-
Notifications
You must be signed in to change notification settings - Fork 635
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
fix tests #15159
fix tests #15159
Conversation
UI Smoke TestsTest: success. 2 passed, 0 failed. |
@@ -84,6 +89,11 @@ public virtual void Start() | |||
View.Show(); | |||
|
|||
SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will the current thread be typically in which this test fixture is set up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We run all our tests in a single thread (UI thread).
We set the current syncContext the same way WPF would set when running the application normally (DispatcherSynchronizationContext)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's surprising to me that if the tests are running in the UI thread, we have to do this explicitly. Perhaps this is a subtle difference between a main WPF app and a WPF test.
var automation = this.ViewModel.Automation; | ||
if (automation != null) | ||
{ | ||
automation.PlaybackStateChanged -= OnAutomationPlaybackStateChanged; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be clearer if you refactored this into a corresponding UnregisterCommandCallback
method to match with the RegisterCommandCallback
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments, then LGTM!
Harmony fails on all builds. |
Refactor tests to use the test infrastructure properly (Setup and CLeanup)
Force Dispatcher to run all tasks before test ends (for most cases)
Refactor some SyncContext defaults to use the current one