@@ -18,25 +18,42 @@ public void WithAlpha()
1818 Assert . Equal ( expected , ( Rgba32 ) c2 ) ;
1919 }
2020
21- [ Fact ]
22- public void Equality_WhenTrue ( )
21+ [ Theory ]
22+ [ InlineData ( false ) ]
23+ [ InlineData ( true ) ]
24+ public void Equality_WhenTrue ( bool highPrecision )
2325 {
2426 Color c1 = new Rgba64 ( 100 , 2000 , 3000 , 40000 ) ;
2527 Color c2 = new Rgba64 ( 100 , 2000 , 3000 , 40000 ) ;
2628
29+ if ( highPrecision )
30+ {
31+ c1 = Color . FromPixel ( c1 . ToPixel < RgbaVector > ( ) ) ;
32+ c2 = Color . FromPixel ( c2 . ToPixel < RgbaVector > ( ) ) ;
33+ }
34+
2735 Assert . True ( c1 . Equals ( c2 ) ) ;
2836 Assert . True ( c1 == c2 ) ;
2937 Assert . False ( c1 != c2 ) ;
3038 Assert . True ( c1 . GetHashCode ( ) == c2 . GetHashCode ( ) ) ;
3139 }
3240
33- [ Fact ]
34- public void Equality_WhenFalse ( )
41+ [ Theory ]
42+ [ InlineData ( false ) ]
43+ [ InlineData ( true ) ]
44+ public void Equality_WhenFalse ( bool highPrecision )
3545 {
3646 Color c1 = new Rgba64 ( 100 , 2000 , 3000 , 40000 ) ;
3747 Color c2 = new Rgba64 ( 101 , 2000 , 3000 , 40000 ) ;
3848 Color c3 = new Rgba64 ( 100 , 2000 , 3000 , 40001 ) ;
3949
50+ if ( highPrecision )
51+ {
52+ c1 = Color . FromPixel ( c1 . ToPixel < RgbaVector > ( ) ) ;
53+ c2 = Color . FromPixel ( c2 . ToPixel < RgbaVector > ( ) ) ;
54+ c3 = Color . FromPixel ( c3 . ToPixel < RgbaVector > ( ) ) ;
55+ }
56+
4057 Assert . False ( c1 . Equals ( c2 ) ) ;
4158 Assert . False ( c2 . Equals ( c3 ) ) ;
4259 Assert . False ( c3 . Equals ( c1 ) ) ;
@@ -47,13 +64,20 @@ public void Equality_WhenFalse()
4764 Assert . False ( c1 . Equals ( null ) ) ;
4865 }
4966
50- [ Fact ]
51- public void ToHex ( )
67+ [ Theory ]
68+ [ InlineData ( false ) ]
69+ [ InlineData ( true ) ]
70+ public void ToHex ( bool highPrecision )
5271 {
5372 string expected = "ABCD1234" ;
54- var color = Color . ParseHex ( expected ) ;
55- string actual = color . ToHex ( ) ;
73+ Color color = Color . ParseHex ( expected ) ;
5674
75+ if ( highPrecision )
76+ {
77+ color = Color . FromPixel ( color . ToPixel < RgbaVector > ( ) ) ;
78+ }
79+
80+ string actual = color . ToHex ( ) ;
5781 Assert . Equal ( expected , actual ) ;
5882 }
5983
0 commit comments