Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
[TouchRunner] Fix colors for iOS 13 dark mode (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentDondain authored and spouliot committed Sep 13, 2019
1 parent de42aa3 commit d22825a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions NUnitLite/TouchRunner/TestCaseElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public override void Update ()
{
if (Result.IsIgnored ()) {
Value = Result.GetMessage ();
DetailColor = UIColor.Orange;
DetailColor = Orange;
} else if (Result.IsSuccess () || Result.IsInconclusive ()) {
int counter = Result.AssertCount;
Value = String.Format ("{0} {1} ms for {2} assertion{3}",
Expand All @@ -94,7 +94,7 @@ public override void Update ()
DetailColor = DarkGreen;
} else if (Result.IsFailure ()) {
Value = Result.GetMessage ();
DetailColor = UIColor.Red;
DetailColor = Red;
} else {
// Assert.Ignore falls into this
Value = Result.GetMessage ();
Expand Down
9 changes: 7 additions & 2 deletions NUnitLite/TouchRunner/TestElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ namespace MonoTouch.NUnit.UI {

abstract class TestElement : StyledMultilineElement {

static internal UIColor DarkGreen = UIColor.FromRGB (0x00, 0x77, 0x00);
static internal UIColor DarkGreen = UIDevice.CurrentDevice.CheckSystemVersion (13, 0) ? UIColor.SystemGreenColor : UIColor.FromRGB (0x00, 0x77, 0x00);
static internal UIColor Orange = UIDevice.CurrentDevice.CheckSystemVersion (13, 0) ? UIColor.SystemOrangeColor : UIColor.Orange;
static internal UIColor Red = UIDevice.CurrentDevice.CheckSystemVersion (13, 0) ? UIColor.SystemRedColor : UIColor.Red;

private TestResult result;

Expand All @@ -46,7 +48,10 @@ public TestElement (ITest test, TouchRunner runner)
throw new ArgumentNullException ("test");
if (runner == null)
throw new ArgumentNullException ("runner");


if (UIDevice.CurrentDevice.CheckSystemVersion (13, 0)) {
TextColor = UIColor.LabelColor;
}
Test = test;
Runner = runner;
}
Expand Down
4 changes: 2 additions & 2 deletions NUnitLite/TouchRunner/TestSuiteElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public TestSuiteElement (TestSuite test, TouchRunner runner)
runner.Show (Suite);
};
} else {
DetailColor = UIColor.Orange;
DetailColor = Orange;
Value = "No test was found inside this suite";
}
}
Expand All @@ -75,7 +75,7 @@ public override void Update ()
if (positive > 1)
sb.Append ('s');
} else {
DetailColor = UIColor.Red;
DetailColor = Red;
if (positive > 0)
sb.Append (positive).Append (" success");
if (sb.Length > 0)
Expand Down

0 comments on commit d22825a

Please sign in to comment.