Skip to content

Commit

Permalink
[TouchRunner] TestFinished may be called on a background thread, so m…
Browse files Browse the repository at this point in the history
…ake sure to execute any UI logic on the main thread. (#60)
  • Loading branch information
rolfbjarne authored May 14, 2020
1 parent ba1196f commit d5b1caa
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions NUnitLite/TouchRunner/TouchRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -653,17 +653,19 @@ public override void TestFinished (ITestResult r)
{
base.TestFinished (r);

TestResult result = r as TestResult;
TestSuite ts = result.Test as TestSuite;
if (ts != null) {
TestSuiteElement tse;
if (suite_elements.TryGetValue (ts, out tse))
tse.Update (result);
} else {
TestMethod tc = result.Test as TestMethod;
if (tc != null)
case_elements [tc].Update (result);
}
ExecuteOnMainThread (() => {
TestResult result = r as TestResult;
TestSuite ts = result.Test as TestSuite;
if (ts != null) {
TestSuiteElement tse;
if (suite_elements.TryGetValue (ts, out tse))
tse.Update (result);
} else {
TestMethod tc = result.Test as TestMethod;
if (tc != null)
case_elements [tc].Update (result);
}
});
}

protected override void WriteDeviceInformation (TextWriter writer)
Expand Down

0 comments on commit d5b1caa

Please sign in to comment.