@@ -38,55 +38,55 @@ public void LengthParseCorrectVwValue()
38
38
}
39
39
40
40
[ Test ]
41
- public void LengthToPixlesCorrectPercentWidth ( )
41
+ public void LengthToPixelsCorrectPercentWidth ( )
42
42
{
43
43
var l = new Length ( 50 , Length . Unit . Percent ) ;
44
- var renderDevice = new DefaultRenderDevice { ViewPortWidth = 500 } ;
44
+ var renderDevice = new DefaultRenderDevice { ViewPortWidth = 500 } ;
45
45
Assert . AreEqual ( 250 , l . ToPixel ( renderDevice , true ) ) ;
46
46
}
47
47
48
48
[ Test ]
49
- public void LengthToPixlesCorrectPercentHeight ( )
49
+ public void LengthToPixelsCorrectPercentHeight ( )
50
50
{
51
51
var l = new Length ( 25 , Length . Unit . Percent ) ;
52
- var renderDevice = new DefaultRenderDevice { ViewPortHeight = 600 } ;
52
+ var renderDevice = new DefaultRenderDevice { ViewPortHeight = 600 } ;
53
53
Assert . AreEqual ( 150 , l . ToPixel ( renderDevice , false ) ) ;
54
54
}
55
55
56
56
[ Test ]
57
- public void LengthToPixlesCorrectRem ( )
57
+ public void LengthToPixelsCorrectRem ( )
58
58
{
59
59
var l = new Length ( 25 , Length . Unit . Rem ) ;
60
- var renderDevice = new DefaultRenderDevice { FontSize = 10 } ;
60
+ var renderDevice = new DefaultRenderDevice { FontSize = 10 } ;
61
61
Assert . AreEqual ( 250 , l . ToPixel ( renderDevice ) ) ;
62
62
}
63
63
64
64
[ Test ]
65
- public void LengthToPixlesCorrectEm ( )
65
+ public void LengthToPixelsCorrectEm ( )
66
66
{
67
67
var l = new Length ( 10 , Length . Unit . Em ) ;
68
- var renderDevice = new DefaultRenderDevice { FontSize = 10 } ;
68
+ var renderDevice = new DefaultRenderDevice { FontSize = 10 } ;
69
69
Assert . AreEqual ( 100 , l . ToPixel ( renderDevice ) ) ;
70
70
}
71
71
72
72
[ Test ]
73
- public void LengthToPixlesCorrectVh ( )
73
+ public void LengthToPixelsCorrectVh ( )
74
74
{
75
75
var l = new Length ( 10 , Length . Unit . Vh ) ;
76
- var renderDevice = new DefaultRenderDevice { ViewPortHeight = 1000 } ;
76
+ var renderDevice = new DefaultRenderDevice { ViewPortHeight = 1000 } ;
77
77
Assert . AreEqual ( 100 , l . ToPixel ( renderDevice ) ) ;
78
78
}
79
79
80
80
[ Test ]
81
- public void LengthToPixlesCorrectVw ( )
81
+ public void LengthToPixelsCorrectVw ( )
82
82
{
83
83
var l = new Length ( 20 , Length . Unit . Vw ) ;
84
- var renderDevice = new DefaultRenderDevice { ViewPortHeight = 1000 } ;
84
+ var renderDevice = new DefaultRenderDevice { ViewPortHeight = 1000 } ;
85
85
Assert . AreEqual ( 200 , l . ToPixel ( renderDevice ) ) ;
86
86
}
87
87
88
88
[ Test ]
89
- public void LengthToPixlesCorrectVmax ( )
89
+ public void LengthToPixelsCorrectVmax ( )
90
90
{
91
91
var l = new Length ( 20 , Length . Unit . Vmax ) ;
92
92
var renderDevice = new DefaultRenderDevice
@@ -98,7 +98,7 @@ public void LengthToPixlesCorrectVmax()
98
98
}
99
99
100
100
[ Test ]
101
- public void LengthToPixlesCorrectVmin ( )
101
+ public void LengthToPixelsCorrectVmin ( )
102
102
{
103
103
var l = new Length ( 20 , Length . Unit . Vmin ) ;
104
104
var renderDevice = new DefaultRenderDevice
@@ -109,6 +109,78 @@ public void LengthToPixlesCorrectVmin()
109
109
Assert . AreEqual ( 100 , l . ToPixel ( renderDevice ) ) ;
110
110
}
111
111
112
+ [ Test ]
113
+ public void LengthToPercentCorrectWidth ( )
114
+ {
115
+ var l = new Length ( 100 , Length . Unit . Px ) ;
116
+ var renderDevice = new DefaultRenderDevice { ViewPortWidth = 500 } ;
117
+ Assert . AreEqual ( 20 , l . To ( Length . Unit . Percent , renderDevice , true ) ) ;
118
+ }
119
+
120
+ [ Test ]
121
+ public void LengthToPercentCorrectHeight ( )
122
+ {
123
+ var l = new Length ( 100 , Length . Unit . Px ) ;
124
+ var renderDevice = new DefaultRenderDevice { ViewPortHeight = 1000 } ;
125
+ Assert . AreEqual ( 10 , l . To ( Length . Unit . Percent , renderDevice , false ) ) ;
126
+ }
127
+
128
+ [ Test ]
129
+ public void LengthToRemCorrectValue ( )
130
+ {
131
+ var l = new Length ( 100 , Length . Unit . Px ) ;
132
+ var renderDevice = new DefaultRenderDevice { FontSize = 16 } ;
133
+ Assert . AreEqual ( 6.25d , l . To ( Length . Unit . Rem , renderDevice ) ) ;
134
+ }
135
+
136
+ [ Test ]
137
+ public void LengthToEmCorrectValue ( )
138
+ {
139
+ var l = new Length ( 1600 , Length . Unit . Px ) ;
140
+ var renderDevice = new DefaultRenderDevice { FontSize = 16 } ;
141
+ Assert . AreEqual ( 100 , l . To ( Length . Unit . Em , renderDevice ) ) ;
142
+ }
143
+
144
+ [ Test ]
145
+ public void LengthToVhCorrectValue ( )
146
+ {
147
+ var l = new Length ( 100 , Length . Unit . Px ) ;
148
+ var renderDevice = new DefaultRenderDevice { ViewPortHeight = 1000 } ;
149
+ Assert . AreEqual ( 10 , l . To ( Length . Unit . Vh , renderDevice ) ) ;
150
+ }
151
+
152
+ [ Test ]
153
+ public void LengthToVwCorrectValue ( )
154
+ {
155
+ var l = new Length ( 50 , Length . Unit . Px ) ;
156
+ var renderDevice = new DefaultRenderDevice { ViewPortWidth = 1000 } ;
157
+ Assert . AreEqual ( 5 , l . To ( Length . Unit . Vw , renderDevice ) ) ;
158
+ }
159
+
160
+ [ Test ]
161
+ public void LengthToVmaxCorrectValue ( )
162
+ {
163
+ var l = new Length ( 50 , Length . Unit . Px ) ;
164
+ var renderDevice = new DefaultRenderDevice
165
+ {
166
+ ViewPortWidth = 1000 ,
167
+ ViewPortHeight = 500
168
+ } ;
169
+ Assert . AreEqual ( 5 , l . To ( Length . Unit . Vmax , renderDevice ) ) ;
170
+ }
171
+
172
+ [ Test ]
173
+ public void LengthToVminCorrectValue ( )
174
+ {
175
+ var l = new Length ( 50 , Length . Unit . Px ) ;
176
+ var renderDevice = new DefaultRenderDevice
177
+ {
178
+ ViewPortWidth = 1000 ,
179
+ ViewPortHeight = 500
180
+ } ;
181
+ Assert . AreEqual ( 10 , l . To ( Length . Unit . Vmin , renderDevice ) ) ;
182
+ }
183
+
112
184
[ Test ]
113
185
public void AngleParseCorrectDegValue ( )
114
186
{
@@ -162,4 +234,4 @@ public void AngleParseIncorrectValue()
162
234
Assert . IsFalse ( r ) ;
163
235
}
164
236
}
165
- }
237
+ }
0 commit comments