Ensure Plain BPMF tests run with Standard layout
This exposes an issue that our Preferences is a global singleton that uses the user defaults store and is therefore not hermetic.
This commit is contained in:
parent
fda39761ec
commit
5d53b4a93c
|
@ -25,15 +25,22 @@ import XCTest
|
|||
@testable import McBopomofo
|
||||
|
||||
class KeyHandlerPlainBopomofoTests: XCTestCase {
|
||||
var savedKeyboardLayout: Int = 0
|
||||
var handler = KeyHandler()
|
||||
|
||||
override func setUpWithError() throws {
|
||||
LanguageModelManager.loadDataModels()
|
||||
handler = KeyHandler()
|
||||
handler.inputMode = .plainBopomofo
|
||||
|
||||
savedKeyboardLayout = Preferences.keyboardLayout
|
||||
|
||||
// Punctuation-related tests only work when the layout is Standard.
|
||||
Preferences.keyboardLayout = KeyboardLayout.standard.rawValue
|
||||
}
|
||||
|
||||
override func tearDownWithError() throws {
|
||||
Preferences.keyboardLayout = savedKeyboardLayout
|
||||
}
|
||||
|
||||
func testPunctuationTable() {
|
||||
|
|
Loading…
Reference in New Issue