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

Commit d22825a

Browse files
VincentDondainspouliot
authored andcommitted
[TouchRunner] Fix colors for iOS 13 dark mode (#53)
1 parent de42aa3 commit d22825a

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

NUnitLite/TouchRunner/TestCaseElement.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public override void Update ()
8484
{
8585
if (Result.IsIgnored ()) {
8686
Value = Result.GetMessage ();
87-
DetailColor = UIColor.Orange;
87+
DetailColor = Orange;
8888
} else if (Result.IsSuccess () || Result.IsInconclusive ()) {
8989
int counter = Result.AssertCount;
9090
Value = String.Format ("{0} {1} ms for {2} assertion{3}",
@@ -94,7 +94,7 @@ public override void Update ()
9494
DetailColor = DarkGreen;
9595
} else if (Result.IsFailure ()) {
9696
Value = Result.GetMessage ();
97-
DetailColor = UIColor.Red;
97+
DetailColor = Red;
9898
} else {
9999
// Assert.Ignore falls into this
100100
Value = Result.GetMessage ();

NUnitLite/TouchRunner/TestElement.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ namespace MonoTouch.NUnit.UI {
3535

3636
abstract class TestElement : StyledMultilineElement {
3737

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

4042
private TestResult result;
4143

@@ -46,7 +48,10 @@ public TestElement (ITest test, TouchRunner runner)
4648
throw new ArgumentNullException ("test");
4749
if (runner == null)
4850
throw new ArgumentNullException ("runner");
49-
51+
52+
if (UIDevice.CurrentDevice.CheckSystemVersion (13, 0)) {
53+
TextColor = UIColor.LabelColor;
54+
}
5055
Test = test;
5156
Runner = runner;
5257
}

NUnitLite/TouchRunner/TestSuiteElement.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public TestSuiteElement (TestSuite test, TouchRunner runner)
4848
runner.Show (Suite);
4949
};
5050
} else {
51-
DetailColor = UIColor.Orange;
51+
DetailColor = Orange;
5252
Value = "No test was found inside this suite";
5353
}
5454
}
@@ -75,7 +75,7 @@ public override void Update ()
7575
if (positive > 1)
7676
sb.Append ('s');
7777
} else {
78-
DetailColor = UIColor.Red;
78+
DetailColor = Red;
7979
if (positive > 0)
8080
sb.Append (positive).Append (" success");
8181
if (sb.Length > 0)

0 commit comments

Comments
 (0)