@@ -8,34 +8,36 @@ namespace System.Windows.Forms.Tests;
8
8
// NB: doesn't require thread affinity
9
9
public class PrintPreviewControlTests
10
10
{
11
- private const int EmptyColorArgb = 0 ;
12
- private const int BlueColorArgb = - 16776961 ;
13
- private const int GreenColorArgb = - 16744448 ;
14
- private const int ControlDarkColorArgb = - 6250336 ;
15
- private const int AppWorkSpaceNoHcColorArgb = - 5526613 ;
16
- private const int AppWorkSpaceHcColorArgb = - 1 ;
17
-
18
- [ Theory ]
19
- [ InlineData ( EmptyColorArgb , false , AppWorkSpaceNoHcColorArgb ) ]
20
- [ InlineData ( EmptyColorArgb , true , ControlDarkColorArgb ) ]
21
- [ InlineData ( BlueColorArgb , false , BlueColorArgb ) ]
22
- [ InlineData ( GreenColorArgb , true , GreenColorArgb ) ]
23
- public void ShowPrintPreviewControl_BackColorIsCorrect ( int customBackColorArgb , bool isHighContrast , int expectedBackColorArgb )
11
+ [ Fact ]
12
+ public void ShowPrintPreviewControl_BackColorIsCorrect ( )
24
13
{
25
14
PrintPreviewControl control = new ( ) ;
26
15
27
- if ( customBackColorArgb != EmptyColorArgb )
28
- {
29
- control . BackColor = Color . FromArgb ( customBackColorArgb ) ;
30
- }
16
+ int actualBackColorArgb = control . TestAccessor ( ) . Dynamic . GetBackColor ( false ) . ToArgb ( ) ;
17
+ Assert . Equal ( SystemColors . AppWorkspace . ToArgb ( ) , actualBackColorArgb ) ;
31
18
32
- int actualBackColorArgb = control . TestAccessor ( ) . Dynamic . GetBackColor ( isHighContrast ) . ToArgb ( ) ;
33
- Assert . Equal ( expectedBackColorArgb , actualBackColorArgb ) ;
19
+ control . BackColor = Color . Green ;
34
20
21
+ actualBackColorArgb = control . TestAccessor ( ) . Dynamic . GetBackColor ( false ) . ToArgb ( ) ;
22
+ Assert . Equal ( Color . Green . ToArgb ( ) , actualBackColorArgb ) ;
23
+ }
24
+
25
+ [ Fact ]
26
+ public void ShowPrintPreviewControlHighContrast_BackColorIsCorrect ( )
27
+ {
28
+ PrintPreviewControl control = new ( ) ;
29
+
30
+ int actualBackColorArgb = control . TestAccessor ( ) . Dynamic . GetBackColor ( true ) . ToArgb ( ) ;
31
+
32
+ Assert . Equal ( SystemColors . ControlDarkDark . ToArgb ( ) , actualBackColorArgb ) ;
35
33
// Default AppWorkSpace color in HC theme does not allow to follow HC standards.
36
- if ( isHighContrast )
37
- {
38
- Assert . True ( ! AppWorkSpaceHcColorArgb . Equals ( actualBackColorArgb ) ) ;
39
- }
34
+ Assert . False ( SystemColors . AppWorkspace . ToArgb ( ) . Equals ( actualBackColorArgb ) ) ;
35
+
36
+ control . BackColor = Color . Green ;
37
+
38
+ actualBackColorArgb = control . TestAccessor ( ) . Dynamic . GetBackColor ( true ) . ToArgb ( ) ;
39
+
40
+ Assert . Equal ( Color . Green . ToArgb ( ) , actualBackColorArgb ) ;
41
+ Assert . False ( SystemColors . AppWorkspace . ToArgb ( ) . Equals ( actualBackColorArgb ) ) ;
40
42
}
41
43
}
0 commit comments