@@ -153,5 +153,80 @@ public virtual void AdjustChildrenYLineImageChildHtmlModeTest() {
153
153
NUnit . Framework . Assert . AreEqual ( 50f , lineRenderer . GetOccupiedAreaBBox ( ) . GetBottom ( ) , EPS ) ;
154
154
NUnit . Framework . Assert . AreEqual ( 150.0 , childImageRenderer . GetOccupiedAreaBBox ( ) . GetBottom ( ) , EPS ) ;
155
155
}
156
+
157
+ [ NUnit . Framework . Test ]
158
+ public virtual void HasChildRendererInHtmlModeTest ( ) {
159
+ LineRenderer lineRenderer = new LineRenderer ( ) ;
160
+ TextRenderer textRenderer1 = new TextRenderer ( new Text ( "text1" ) ) ;
161
+ TextRenderer textRenderer2 = new TextRenderer ( new Text ( "text2" ) ) ;
162
+ textRenderer2 . SetProperty ( Property . RENDERING_MODE , RenderingMode . HTML_MODE ) ;
163
+ lineRenderer . AddChild ( textRenderer1 ) ;
164
+ lineRenderer . AddChild ( textRenderer2 ) ;
165
+ NUnit . Framework . Assert . IsTrue ( lineRenderer . HasChildRendererInHtmlMode ( ) ) ;
166
+ }
167
+
168
+ [ NUnit . Framework . Test ]
169
+ public virtual void ChildRendererInDefaultModeTest ( ) {
170
+ LineRenderer lineRenderer = new LineRenderer ( ) ;
171
+ TextRenderer textRenderer1 = new TextRenderer ( new Text ( "text1" ) ) ;
172
+ TextRenderer textRenderer2 = new TextRenderer ( new Text ( "text2" ) ) ;
173
+ textRenderer2 . SetProperty ( Property . RENDERING_MODE , RenderingMode . DEFAULT_LAYOUT_MODE ) ;
174
+ lineRenderer . AddChild ( textRenderer1 ) ;
175
+ lineRenderer . AddChild ( textRenderer2 ) ;
176
+ NUnit . Framework . Assert . IsFalse ( lineRenderer . HasChildRendererInHtmlMode ( ) ) ;
177
+ }
178
+
179
+ [ NUnit . Framework . Test ]
180
+ public virtual void HasChildRendererInHtmlModeNoChildrenTest ( ) {
181
+ LineRenderer lineRenderer = new LineRenderer ( ) ;
182
+ NUnit . Framework . Assert . IsFalse ( lineRenderer . HasChildRendererInHtmlMode ( ) ) ;
183
+ }
184
+
185
+ [ NUnit . Framework . Test ]
186
+ public virtual void LineRendererLayoutInHtmlModeWithLineHeightAndNoChildrenTest ( ) {
187
+ Document document = CreateDocument ( ) ;
188
+ LineRenderer lineRenderer = new LineRenderer ( ) ;
189
+ lineRenderer . SetParent ( document . GetRenderer ( ) ) ;
190
+ lineRenderer . SetProperty ( Property . RENDERING_MODE , RenderingMode . HTML_MODE ) ;
191
+ lineRenderer . SetProperty ( Property . LINE_HEIGHT , LineHeight . CreateNormalValue ( ) ) ;
192
+ lineRenderer . Layout ( new LayoutContext ( CreateLayoutArea ( 1000 , 1000 ) ) ) ;
193
+ NUnit . Framework . Assert . AreEqual ( 0f , lineRenderer . maxAscent , 0f ) ;
194
+ NUnit . Framework . Assert . AreEqual ( 0f , lineRenderer . maxDescent , 0f ) ;
195
+ }
196
+
197
+ [ NUnit . Framework . Test ]
198
+ public virtual void LineRendererLayoutInHtmlModeWithLineHeightAndChildrenInDefaultModeTest ( ) {
199
+ Document document = CreateDocument ( ) ;
200
+ LineRenderer lineRenderer = new LineRenderer ( ) ;
201
+ lineRenderer . SetParent ( document . GetRenderer ( ) ) ;
202
+ lineRenderer . SetProperty ( Property . RENDERING_MODE , RenderingMode . HTML_MODE ) ;
203
+ lineRenderer . SetProperty ( Property . LINE_HEIGHT , LineHeight . CreateFixedValue ( 50 ) ) ;
204
+ TextRenderer textRenderer1 = new TextRenderer ( new Text ( "text" ) ) ;
205
+ textRenderer1 . SetProperty ( Property . RENDERING_MODE , RenderingMode . DEFAULT_LAYOUT_MODE ) ;
206
+ TextRenderer textRenderer2 = new TextRenderer ( new Text ( "text" ) ) ;
207
+ textRenderer2 . SetProperty ( Property . RENDERING_MODE , RenderingMode . DEFAULT_LAYOUT_MODE ) ;
208
+ lineRenderer . AddChild ( textRenderer1 ) ;
209
+ lineRenderer . AddChild ( textRenderer2 ) ;
210
+ lineRenderer . Layout ( new LayoutContext ( CreateLayoutArea ( 1000 , 1000 ) ) ) ;
211
+ NUnit . Framework . Assert . AreEqual ( 10.3392f , lineRenderer . maxAscent , EPS ) ;
212
+ NUnit . Framework . Assert . AreEqual ( - 2.98079f , lineRenderer . maxDescent , EPS ) ;
213
+ }
214
+
215
+ [ NUnit . Framework . Test ]
216
+ public virtual void LineRendererLayoutInHtmlModeWithLineHeightAndChildInHtmlModeTest ( ) {
217
+ Document document = CreateDocument ( ) ;
218
+ LineRenderer lineRenderer = new LineRenderer ( ) ;
219
+ lineRenderer . SetParent ( document . GetRenderer ( ) ) ;
220
+ lineRenderer . SetProperty ( Property . RENDERING_MODE , RenderingMode . HTML_MODE ) ;
221
+ lineRenderer . SetProperty ( Property . LINE_HEIGHT , LineHeight . CreateFixedValue ( 50 ) ) ;
222
+ TextRenderer textRenderer1 = new TextRenderer ( new Text ( "text" ) ) ;
223
+ textRenderer1 . SetProperty ( Property . RENDERING_MODE , RenderingMode . HTML_MODE ) ;
224
+ TextRenderer textRenderer2 = new TextRenderer ( new Text ( "text" ) ) ;
225
+ lineRenderer . AddChild ( textRenderer1 ) ;
226
+ lineRenderer . AddChild ( textRenderer2 ) ;
227
+ lineRenderer . Layout ( new LayoutContext ( CreateLayoutArea ( 1000 , 1000 ) ) ) ;
228
+ NUnit . Framework . Assert . AreEqual ( 28.67920f , lineRenderer . maxAscent , EPS ) ;
229
+ NUnit . Framework . Assert . AreEqual ( - 21.32080f , lineRenderer . maxDescent , EPS ) ;
230
+ }
156
231
}
157
232
}
0 commit comments