@@ -37,6 +37,78 @@ public void LengthParseCorrectVwValue()
37
37
Assert . AreEqual ( Length . Unit . Vw , v . Type ) ;
38
38
}
39
39
40
+ [ Test ]
41
+ public void LengthToPixlesCorrectPercentWidth ( )
42
+ {
43
+ var l = new Length ( 50 , Length . Unit . Percent ) ;
44
+ var renderDevice = new DefaultRenderDevice { ViewPortWidth = 500 } ;
45
+ Assert . AreEqual ( 250 , l . ToPixel ( renderDevice , true ) ) ;
46
+ }
47
+
48
+ [ Test ]
49
+ public void LengthToPixlesCorrectPercentHeight ( )
50
+ {
51
+ var l = new Length ( 25 , Length . Unit . Percent ) ;
52
+ var renderDevice = new DefaultRenderDevice { ViewPortHeight = 600 } ;
53
+ Assert . AreEqual ( 150 , l . ToPixel ( renderDevice , false ) ) ;
54
+ }
55
+
56
+ [ Test ]
57
+ public void LengthToPixlesCorrectRem ( )
58
+ {
59
+ var l = new Length ( 25 , Length . Unit . Rem ) ;
60
+ var renderDevice = new DefaultRenderDevice { FontSize = 10 } ;
61
+ Assert . AreEqual ( 250 , l . ToPixel ( renderDevice ) ) ;
62
+ }
63
+
64
+ [ Test ]
65
+ public void LengthToPixlesCorrectEm ( )
66
+ {
67
+ var l = new Length ( 10 , Length . Unit . Em ) ;
68
+ var renderDevice = new DefaultRenderDevice { FontSize = 10 } ;
69
+ Assert . AreEqual ( 100 , l . ToPixel ( renderDevice ) ) ;
70
+ }
71
+
72
+ [ Test ]
73
+ public void LengthToPixlesCorrectVh ( )
74
+ {
75
+ var l = new Length ( 10 , Length . Unit . Vh ) ;
76
+ var renderDevice = new DefaultRenderDevice { ViewPortHeight = 1000 } ;
77
+ Assert . AreEqual ( 100 , l . ToPixel ( renderDevice ) ) ;
78
+ }
79
+
80
+ [ Test ]
81
+ public void LengthToPixlesCorrectVw ( )
82
+ {
83
+ var l = new Length ( 20 , Length . Unit . Vw ) ;
84
+ var renderDevice = new DefaultRenderDevice { ViewPortHeight = 1000 } ;
85
+ Assert . AreEqual ( 200 , l . ToPixel ( renderDevice ) ) ;
86
+ }
87
+
88
+ [ Test ]
89
+ public void LengthToPixlesCorrectVmax ( )
90
+ {
91
+ var l = new Length ( 20 , Length . Unit . Vmax ) ;
92
+ var renderDevice = new DefaultRenderDevice
93
+ {
94
+ ViewPortHeight = 1000 ,
95
+ ViewPortWidth = 500
96
+ } ;
97
+ Assert . AreEqual ( 200 , l . ToPixel ( renderDevice ) ) ;
98
+ }
99
+
100
+ [ Test ]
101
+ public void LengthToPixlesCorrectVmin ( )
102
+ {
103
+ var l = new Length ( 20 , Length . Unit . Vmin ) ;
104
+ var renderDevice = new DefaultRenderDevice
105
+ {
106
+ ViewPortHeight = 1000 ,
107
+ ViewPortWidth = 500
108
+ } ;
109
+ Assert . AreEqual ( 100 , l . ToPixel ( renderDevice ) ) ;
110
+ }
111
+
40
112
[ Test ]
41
113
public void AngleParseCorrectDegValue ( )
42
114
{
0 commit comments