@@ -32,53 +32,78 @@ public void IsSupported_Matches_VisualStyleRenderer_IsSupported() =>
32
32
[ WinFormsFact ]
33
33
public void DrawTabItem_Basic_ChangesTabStateSuccessfully ( )
34
34
{
35
- using Bitmap bmp = new ( 100 , 30 ) ;
36
- using Graphics g = Graphics . FromImage ( bmp ) ;
37
- Rectangle bounds = new ( 0 , 0 , 100 , 30 ) ;
38
- Color before = bmp . GetPixel ( 10 , 10 ) ;
35
+ Color colorBeforeDraw = _bmp . GetPixel ( 10 , 10 ) ;
39
36
40
37
foreach ( TabItemState state in Enum . GetValues < TabItemState > ( ) )
41
38
{
42
- TabRenderer . DrawTabItem ( g , bounds , state ) ;
43
- TabRenderer . DrawTabItem ( g , bounds , focused : true , state ) ;
39
+ TabRenderer . DrawTabItem ( _g , _bounds , state ) ;
40
+ TabRenderer . DrawTabItem ( _g , _bounds , focused : true , state ) ;
44
41
}
45
42
46
- Color after = bmp . GetPixel ( 10 , 10 ) ;
47
- after . Should ( ) . NotBe ( before ) ;
43
+ Color colorAfterDraw = _bmp . GetPixel ( 10 , 10 ) ;
44
+ colorAfterDraw . Should ( ) . NotBe ( colorBeforeDraw ) ;
48
45
}
49
46
50
47
[ WinFormsFact ]
51
48
public void DrawTabItem_WithText_ChangesTabStateSuccessfully ( )
52
49
{
53
50
using Font font = new ( "Arial" , 8 ) ;
54
- Color before = _bmp . GetPixel ( 10 , 10 ) ;
51
+ Color colorBeforeDraw = _bmp . GetPixel ( 10 , 10 ) ;
55
52
56
53
foreach ( TabItemState state in Enum . GetValues < TabItemState > ( ) )
57
54
{
58
55
TabRenderer . DrawTabItem ( _g , _bounds , "TabText" , font , state ) ;
56
+ }
57
+
58
+ Color colorAfterDraw = _bmp . GetPixel ( 10 , 10 ) ;
59
+ colorAfterDraw . Should ( ) . NotBe ( colorBeforeDraw ) ;
60
+ }
61
+
62
+ [ WinFormsFact ]
63
+ public void DrawTabItem_WithText_Focused_ChangesTabStateSuccessfully ( )
64
+ {
65
+ using Font font = new ( "Arial" , 8 ) ;
66
+ Color colorBeforeDraw = _bmp . GetPixel ( 10 , 10 ) ;
67
+
68
+ foreach ( TabItemState state in Enum . GetValues < TabItemState > ( ) )
69
+ {
59
70
TabRenderer . DrawTabItem ( _g , _bounds , "TabText" , font , focused : true , state ) ;
71
+ }
72
+
73
+ Color colorAfterDraw = _bmp . GetPixel ( 10 , 10 ) ;
74
+ colorAfterDraw . Should ( ) . NotBe ( colorBeforeDraw ) ;
75
+ }
76
+
77
+ [ WinFormsFact ]
78
+ public void DrawTabItem_WithText_TextFormatFlags_Focused_ChangesTabStateSuccessfully ( )
79
+ {
80
+ using Font font = new ( "Arial" , 8 ) ;
81
+ Color colorBeforeDraw = _bmp . GetPixel ( 10 , 10 ) ;
82
+
83
+ foreach ( TabItemState state in Enum . GetValues < TabItemState > ( ) )
84
+ {
60
85
TabRenderer . DrawTabItem ( _g , _bounds , "TabText" , font , TextFormatFlags . Default , focused : true , state ) ;
61
86
}
62
87
63
- Color after = _bmp . GetPixel ( 10 , 10 ) ;
64
- after . Should ( ) . NotBe ( before ) ;
88
+ Color colorAfterDraw = _bmp . GetPixel ( 10 , 10 ) ;
89
+ colorAfterDraw . Should ( ) . NotBe ( colorBeforeDraw ) ;
65
90
}
66
91
67
92
[ WinFormsFact ]
68
93
public void DrawTabItem_WithImage_ChangesTabStateSuccessfully ( )
69
94
{
70
95
using Bitmap image = new ( 16 , 16 ) ;
71
96
Rectangle imageRect = new ( 5 , 5 , 16 , 16 ) ;
72
- Color before = _bmp . GetPixel ( 10 , 10 ) ;
97
+ Color colorBeforeDraw = _bmp . GetPixel ( 10 , 10 ) ;
73
98
74
99
foreach ( TabItemState state in Enum . GetValues < TabItemState > ( ) )
75
100
{
76
101
TabRenderer . DrawTabItem ( _g , _bounds , image , imageRect , focused : false , state ) ;
77
102
TabRenderer . DrawTabItem ( _g , _bounds , image , imageRect , focused : true , state ) ;
78
103
}
79
104
80
- Color after = _bmp . GetPixel ( 10 , 10 ) ;
81
- after . Should ( ) . NotBe ( before ) ;
105
+ Color colorAfterDraw = _bmp . GetPixel ( 10 , 10 ) ;
106
+ colorAfterDraw . Should ( ) . NotBe ( colorBeforeDraw ) ;
82
107
}
83
108
84
109
[ WinFormsFact ]
@@ -87,16 +112,16 @@ public void DrawTabItem_WithTextAndImage_ChangesTabStateSuccessfully()
87
112
using Font font = new ( "Arial" , 8 ) ;
88
113
using Bitmap image = new ( 16 , 16 ) ;
89
114
Rectangle imageRect = new ( 5 , 5 , 16 , 16 ) ;
90
- Color before = _bmp . GetPixel ( 10 , 10 ) ;
115
+ Color colorBeforeDraw = _bmp . GetPixel ( 10 , 10 ) ;
91
116
92
117
foreach ( TabItemState state in Enum . GetValues < TabItemState > ( ) )
93
118
{
94
119
TabRenderer . DrawTabItem ( _g , _bounds , "TabText" , font , image , imageRect , focused : false , state ) ;
95
120
TabRenderer . DrawTabItem ( _g , _bounds , "TabText" , font , TextFormatFlags . Default , image , imageRect , focused : true , state ) ;
96
121
}
97
122
98
- Color after = _bmp . GetPixel ( 10 , 10 ) ;
99
- after . Should ( ) . NotBe ( before ) ;
123
+ Color colorAfterDraw = _bmp . GetPixel ( 10 , 10 ) ;
124
+ colorAfterDraw . Should ( ) . NotBe ( colorBeforeDraw ) ;
100
125
}
101
126
102
127
[ WinFormsFact ]
@@ -105,11 +130,11 @@ public void DrawTabPage_ChangesTabPageStateSuccessfully()
105
130
using Bitmap bmp = new ( 100 , 100 ) ;
106
131
using Graphics g = Graphics . FromImage ( bmp ) ;
107
132
Rectangle bounds = new ( 0 , 0 , 100 , 100 ) ;
108
- Color before = bmp . GetPixel ( 10 , 10 ) ;
133
+ Color colorBeforeDraw = bmp . GetPixel ( 10 , 10 ) ;
109
134
110
135
TabRenderer . DrawTabPage ( g , bounds ) ;
111
136
112
- Color after = bmp . GetPixel ( 10 , 10 ) ;
113
- after . Should ( ) . NotBe ( before ) ;
137
+ Color colorAfterDraw = bmp . GetPixel ( 10 , 10 ) ;
138
+ colorAfterDraw . Should ( ) . NotBe ( colorBeforeDraw ) ;
114
139
}
115
140
}
0 commit comments