-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f6d08b8
commit 566fe54
Showing
8 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// EditorKeyTests.swift | ||
// ProtonTests | ||
// | ||
// Created by Hon Thi on 8/10/2023. | ||
// Copyright © 2023 Rajdeep Kwatra. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
@testable import Proton | ||
|
||
final class EditorKeyTests: XCTestCase { | ||
func test_ReturnsTab() { | ||
XCTAssertEqual(EditorKey("\t"), EditorKey.tab) | ||
} | ||
|
||
func test_ReturnsEnter() { | ||
XCTAssertEqual(EditorKey("\r"), EditorKey.enter) | ||
XCTAssertEqual(EditorKey("\n"), EditorKey.enter) | ||
} | ||
|
||
func test_ReturnsUp() { | ||
XCTAssertEqual(EditorKey(UIKeyCommand.inputUpArrow), EditorKey.up) | ||
} | ||
|
||
func test_ReturnsDown() { | ||
XCTAssertEqual(EditorKey(UIKeyCommand.inputDownArrow), EditorKey.down) | ||
} | ||
|
||
func test_ReturnsLeft() { | ||
XCTAssertEqual(EditorKey(UIKeyCommand.inputLeftArrow), EditorKey.left) | ||
} | ||
|
||
func test_ReturnsRight() { | ||
XCTAssertEqual(EditorKey(UIKeyCommand.inputRightArrow), EditorKey.right) | ||
} | ||
|
||
func testReturnsNil() { | ||
XCTAssertNil(EditorKey("any")) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// MockKeyboardPress.swift | ||
// ProtonTests | ||
// | ||
// Created by Hon Thi on 6/10/2023. | ||
// Copyright © 2023 Rajdeep Kwatra. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
@available(iOS 13.4, *) | ||
class MockUIPress: UIPress { | ||
var _characters: String | ||
override var key: UIKey? { | ||
MockUIKey(characters: _characters) | ||
} | ||
|
||
init(characters: String) { | ||
self._characters = characters | ||
} | ||
} | ||
|
||
@available(iOS 13.4, *) | ||
class MockUIKey: UIKey { | ||
var _characters: String | ||
override var charactersIgnoringModifiers: String { _characters } | ||
|
||
init(characters: String) { | ||
self._characters = characters | ||
super.init() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters