-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preferences being a singleton makes it hard to run hermetic tests #294
Comments
I guess we can extract a DTO from the preferences and then put it into Actually I've already put the flag to use vertical candidate in |
lukhnos
added a commit
that referenced
this issue
Nov 23, 2023
This issue was discovered after #381 if the tests were run locally when `selectCandidateWithNumericKeypad` is set to true. This makes the test reset and restore the setting during testing. Ideally we shouldn't let Preferences affect tests, since they are supposed to be hermetic. We have discussed the issue in #294. Until the code is properly refactored, though, this will make the tests pass locally. Also updated the reset-restore code elsewhere in the tests so that the restore always takes place before the assertions.
lukhnos
added a commit
that referenced
this issue
Nov 23, 2023
This issue was discovered after #381 if the tests were run locally when `selectCandidateWithNumericKeypad` is set to true. This commit makes the test reset and restore the setting during testing. Ideally we shouldn't let Preferences affect tests, since they are supposed to be hermetic. We have discussed the issue in #294. Until the code is properly refactored, though, this will make the tests pass locally. Also updated the reset-restore code elsewhere in the tests so that the restore always takes place before the assertions.
zonble
pushed a commit
to zonble/McBopomofo
that referenced
this issue
Nov 26, 2023
This issue was discovered after openvanilla#381 if the tests were run locally when `selectCandidateWithNumericKeypad` is set to true. This commit makes the test reset and restore the setting during testing. Ideally we shouldn't let Preferences affect tests, since they are supposed to be hermetic. We have discussed the issue in openvanilla#294. Until the code is properly refactored, though, this will make the tests pass locally. Also updated the reset-restore code elsewhere in the tests so that the restore always takes place before the assertions.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I wonder if we should consider making Preferences an instantiable class, and the input method app should instantiate with the user defaults back store, whereas tests can instantiate with an empty dictionary. We now have quite some test code that does this:
PR #293 also needs to do this in Plain BPMF test's setup and teardown due to punctution handling is coupled with keyboard layout. Interestingly,
KeyHandler
by default does not depend on it; it only reads fromPreferences
whenInputMethodController
tells it to sync with the prefs; but punctuaction handllers need to eagerly read the keyboard layout value…The text was updated successfully, but these errors were encountered: