@@ -231,37 +231,34 @@ public virtual void WordSplitAcrossMultipleRenderersOverflowXVisible() {
231231 }
232232
233233 [ NUnit . Framework . Test ]
234- public virtual void WordSplitAcrossMutipleTextRenderersWithinFloatingContainer ( ) {
235- String outFileName = destinationFolder + "wordSplitAcrossMutipleTextRenderersWithinFloatingContainer .pdf" ;
236- String cmpFileName = sourceFolder + "cmp_wordSplitAcrossMutipleTextRenderersWithinFloatingContainer .pdf" ;
234+ public virtual void WordSplitRenderersWithFittingFloatingElementInBetween ( ) {
235+ String outFileName = destinationFolder + "wordSplitRenderersWithFittingFloatingElementInBetween .pdf" ;
236+ String cmpFileName = sourceFolder + "cmp_wordSplitRenderersWithFittingFloatingElementInBetween .pdf" ;
237237 PdfDocument pdfDocument = new PdfDocument ( new PdfWriter ( outFileName ) ) ;
238238 Document doc = new Document ( pdfDocument ) ;
239239 doc . SetFontSize ( 20 ) ;
240- Text oooooooooover = new Text ( "oooooooooover" ) . SetFontColor ( ColorConstants . LIGHT_GRAY ) ;
241- Text flooooo = new Text ( "flooooo" ) . SetFontColor ( ColorConstants . GRAY ) ;
242- Text ooooowNextWords = new Text ( "ooooow next words" ) . SetFontColor ( ColorConstants . DARK_GRAY ) ;
243- Paragraph floatingParagraph = new Paragraph ( ) . Add ( oooooooooover ) . Add ( flooooo ) . Add ( ooooowNextWords ) . SetBackgroundColor
244- ( ColorConstants . CYAN ) . SetWidth ( 150 ) . SetBorder ( new SolidBorder ( 1 ) ) ;
245- // TODO DEVSIX-1438 bring reviewer's attention: if overflow is set on the div, then forced split occurs.
246- // is it expected?
247- floatingParagraph . SetProperty ( Property . OVERFLOW_X , OverflowPropertyValue . VISIBLE ) ;
248- floatingParagraph . SetProperty ( Property . FLOAT , FloatPropertyValue . RIGHT ) ;
249- Text regularText = new Text ( "regular words regular words regular words regular words regular words regular "
250- + "words regular words regular words regular words" ) ;
251- Paragraph regularParagraph = new Paragraph ( regularText ) . SetBackgroundColor ( ColorConstants . MAGENTA ) ;
252- Div div = new Div ( ) . Add ( floatingParagraph ) . Add ( regularParagraph ) . SetMaxWidth ( 300 ) . SetHeight ( 300 ) . SetBackgroundColor
253- ( ColorConstants . YELLOW ) ;
254- div . SetProperty ( Property . RENDERING_MODE , RenderingMode . HTML_MODE ) ;
255- doc . Add ( div ) ;
240+ Text reg = new Text ( "reg" ) . SetFontColor ( ColorConstants . LIGHT_GRAY ) ;
241+ Text ul = new Text ( "ul" ) . SetFontColor ( ColorConstants . DARK_GRAY ) ;
242+ Text aaaaaaaaaaaaaaaaaaaaaaati = new Text ( "aaaaaaaaaaaaaaaaaaaaaaati" ) . SetFontColor ( ColorConstants . GRAY ) ;
243+ Text ngAndRestOfText = new Text ( "ng overflow text renderers with floating elements between them" ) . SetFontColor
244+ ( ColorConstants . RED ) ;
245+ Div floatDiv = new Div ( ) . SetWidth ( 20 ) . SetHeight ( 60 ) . SetBackgroundColor ( ColorConstants . LIGHT_GRAY ) . SetBorder
246+ ( new SolidBorder ( 2 ) ) ;
247+ floatDiv . SetProperty ( Property . FLOAT , FloatPropertyValue . RIGHT ) ;
248+ Paragraph p = new Paragraph ( ) . Add ( reg ) . Add ( ul ) . Add ( floatDiv ) . Add ( aaaaaaaaaaaaaaaaaaaaaaati ) . Add ( ngAndRestOfText
249+ ) . SetBackgroundColor ( ColorConstants . CYAN ) . SetWidth ( 150 ) . SetBorder ( new SolidBorder ( 1 ) ) ;
250+ p . SetProperty ( Property . OVERFLOW_X , OverflowPropertyValue . VISIBLE ) ;
251+ doc . SetProperty ( Property . RENDERING_MODE , RenderingMode . HTML_MODE ) ;
252+ doc . Add ( p ) ;
256253 doc . Close ( ) ;
257254 NUnit . Framework . Assert . IsNull ( new CompareTool ( ) . CompareByContent ( outFileName , cmpFileName , destinationFolder
258255 ) ) ;
259256 }
260257
261258 [ NUnit . Framework . Test ]
262- public virtual void WordSplitRenderersWithFloatingElementInsertedInBetween ( ) {
263- String outFileName = destinationFolder + "wordSplitRenderersWithFloatingElementInsertedInBetween .pdf" ;
264- String cmpFileName = sourceFolder + "cmp_wordSplitRenderersWithFloatingElementInsertedInBetween .pdf" ;
259+ public virtual void WordSplitRenderersWithNotFittingFloatingElementInBetween ( ) {
260+ String outFileName = destinationFolder + "wordSplitRenderersWithNotFittingFloatingElementInBetween .pdf" ;
261+ String cmpFileName = sourceFolder + "cmp_wordSplitRenderersWithNotFittingFloatingElementInBetween .pdf" ;
265262 PdfDocument pdfDocument = new PdfDocument ( new PdfWriter ( outFileName ) ) ;
266263 Document doc = new Document ( pdfDocument ) ;
267264 doc . SetFontSize ( 20 ) ;
@@ -271,7 +268,6 @@ public virtual void WordSplitRenderersWithFloatingElementInsertedInBetween() {
271268 floating . SetProperty ( Property . FLOAT , FloatPropertyValue . RIGHT ) ;
272269 Paragraph paragraph = new Paragraph ( ) . Add ( loooooooooooo ) . Add ( floating ) . Add ( oooongWords ) . SetBackgroundColor
273270 ( ColorConstants . YELLOW ) . SetWidth ( 150 ) . SetBorder ( new SolidBorder ( 1 ) ) ;
274- // todo mention that it's crucial to set both overflow and rendering_mode!!!
275271 paragraph . SetProperty ( Property . OVERFLOW_X , OverflowPropertyValue . VISIBLE ) ;
276272 paragraph . SetProperty ( Property . RENDERING_MODE , RenderingMode . HTML_MODE ) ;
277273 doc . Add ( paragraph ) ;
@@ -280,6 +276,84 @@ public virtual void WordSplitRenderersWithFloatingElementInsertedInBetween() {
280276 ) ) ;
281277 }
282278
279+ [ NUnit . Framework . Test ]
280+ public virtual void WordSplitRenderersWithFittingFloatingInBetweenInSecondWord ( ) {
281+ String outFileName = destinationFolder + "wordSplitRenderersWithFittingFloatingInBetweenInSecondWord.pdf" ;
282+ String cmpFileName = sourceFolder + "cmp_wordSplitRenderersWithFittingFloatingInBetweenInSecondWord.pdf" ;
283+ PdfDocument pdfDocument = new PdfDocument ( new PdfWriter ( outFileName ) ) ;
284+ Document doc = new Document ( pdfDocument ) ;
285+ doc . SetFontSize ( 20 ) ;
286+ Text itsAndSpace = new Text ( "It's " ) ;
287+ Text reg = new Text ( "reg" ) . SetFontColor ( ColorConstants . LIGHT_GRAY ) ;
288+ Text ul = new Text ( "ul" ) . SetFontColor ( ColorConstants . DARK_GRAY ) ;
289+ Text aaaaaaaaaaaaaaaaaaaaaaati = new Text ( "aaaaaaaaaaaaaaaaaaaaaaati" ) . SetFontColor ( ColorConstants . GRAY ) ;
290+ Text ngAndRestOfText = new Text ( "ng overflow text renderers with floating elements between them" ) . SetFontColor
291+ ( ColorConstants . RED ) ;
292+ Div floatDiv = new Div ( ) . SetWidth ( 20 ) . SetHeight ( 60 ) . SetBackgroundColor ( ColorConstants . LIGHT_GRAY ) . SetBorder
293+ ( new SolidBorder ( 2 ) ) ;
294+ floatDiv . SetProperty ( Property . FLOAT , FloatPropertyValue . RIGHT ) ;
295+ Paragraph p = new Paragraph ( ) . Add ( itsAndSpace ) . Add ( reg ) . Add ( ul ) . Add ( floatDiv ) . Add ( aaaaaaaaaaaaaaaaaaaaaaati
296+ ) . Add ( ngAndRestOfText ) . SetBackgroundColor ( ColorConstants . CYAN ) . SetWidth ( 150 ) . SetBorder ( new SolidBorder
297+ ( 1 ) ) ;
298+ p . SetProperty ( Property . OVERFLOW_X , OverflowPropertyValue . VISIBLE ) ;
299+ doc . SetProperty ( Property . RENDERING_MODE , RenderingMode . HTML_MODE ) ;
300+ doc . Add ( p ) ;
301+ doc . Close ( ) ;
302+ NUnit . Framework . Assert . IsNull ( new CompareTool ( ) . CompareByContent ( outFileName , cmpFileName , destinationFolder
303+ ) ) ;
304+ }
305+
306+ [ NUnit . Framework . Test ]
307+ public virtual void WordSplitRenderersWithOverflowedFloatingElementInBetween ( ) {
308+ String outFileName = destinationFolder + "wordSplitRenderersWithOverflowedFloatingElementInBetween.pdf" ;
309+ String cmpFileName = sourceFolder + "cmp_wordSplitRenderersWithOverflowedFloatingElementInBetween.pdf" ;
310+ PdfDocument pdfDocument = new PdfDocument ( new PdfWriter ( outFileName ) ) ;
311+ Document doc = new Document ( pdfDocument ) ;
312+ doc . SetFontSize ( 20 ) ;
313+ Text reg = new Text ( "reg" ) . SetFontColor ( ColorConstants . LIGHT_GRAY ) ;
314+ Text ul = new Text ( "ul" ) . SetFontColor ( ColorConstants . DARK_GRAY ) ;
315+ Text aaaaaaaaaaaaaaaaaaaaaaati = new Text ( "aaaaaaaaaaaaaaaaaaaaaaati" ) . SetFontColor ( ColorConstants . GRAY ) ;
316+ Text ngAndRestOfText = new Text ( "ng overflow text renderers with floating elements between them" ) . SetFontColor
317+ ( ColorConstants . RED ) ;
318+ Div floatDiv = new Div ( ) . SetWidth ( 20 ) . SetHeight ( 60 ) . SetBackgroundColor ( ColorConstants . LIGHT_GRAY ) . SetBorder
319+ ( new SolidBorder ( 2 ) ) ;
320+ floatDiv . SetProperty ( Property . FLOAT , FloatPropertyValue . RIGHT ) ;
321+ Paragraph p = new Paragraph ( ) . Add ( reg ) . Add ( ul ) . Add ( aaaaaaaaaaaaaaaaaaaaaaati ) . Add ( floatDiv ) . Add ( ngAndRestOfText
322+ ) . SetBackgroundColor ( ColorConstants . CYAN ) . SetWidth ( 150 ) . SetBorder ( new SolidBorder ( 1 ) ) ;
323+ p . SetProperty ( Property . OVERFLOW_X , OverflowPropertyValue . VISIBLE ) ;
324+ doc . SetProperty ( Property . RENDERING_MODE , RenderingMode . HTML_MODE ) ;
325+ doc . Add ( p ) ;
326+ doc . Close ( ) ;
327+ NUnit . Framework . Assert . IsNull ( new CompareTool ( ) . CompareByContent ( outFileName , cmpFileName , destinationFolder
328+ ) ) ;
329+ }
330+
331+ [ NUnit . Framework . Test ]
332+ public virtual void WordSplitAcrossMutipleTextRenderersWithinFloatingContainer ( ) {
333+ String outFileName = destinationFolder + "wordSplitAcrossMutipleTextRenderersWithinFloatingContainer.pdf" ;
334+ String cmpFileName = sourceFolder + "cmp_wordSplitAcrossMutipleTextRenderersWithinFloatingContainer.pdf" ;
335+ PdfDocument pdfDocument = new PdfDocument ( new PdfWriter ( outFileName ) ) ;
336+ Document doc = new Document ( pdfDocument ) ;
337+ doc . SetFontSize ( 20 ) ;
338+ Text oooooooooover = new Text ( "oooooooooover" ) . SetFontColor ( ColorConstants . LIGHT_GRAY ) ;
339+ Text flooooo = new Text ( "flooooo" ) . SetFontColor ( ColorConstants . GRAY ) ;
340+ Text ooooowNextWords = new Text ( "ooooow next words" ) . SetFontColor ( ColorConstants . DARK_GRAY ) ;
341+ Paragraph floatingParagraph = new Paragraph ( ) . Add ( oooooooooover ) . Add ( flooooo ) . Add ( ooooowNextWords ) . SetBackgroundColor
342+ ( ColorConstants . CYAN ) . SetWidth ( 150 ) . SetBorder ( new SolidBorder ( 1 ) ) ;
343+ floatingParagraph . SetProperty ( Property . OVERFLOW_X , OverflowPropertyValue . VISIBLE ) ;
344+ floatingParagraph . SetProperty ( Property . FLOAT , FloatPropertyValue . RIGHT ) ;
345+ Text regularText = new Text ( "regular words regular words regular words regular words regular words regular "
346+ + "words regular words regular words regular words" ) ;
347+ Paragraph regularParagraph = new Paragraph ( regularText ) . SetBackgroundColor ( ColorConstants . MAGENTA ) ;
348+ Div div = new Div ( ) . Add ( floatingParagraph ) . Add ( regularParagraph ) . SetMaxWidth ( 300 ) . SetHeight ( 300 ) . SetBackgroundColor
349+ ( ColorConstants . YELLOW ) ;
350+ div . SetProperty ( Property . RENDERING_MODE , RenderingMode . HTML_MODE ) ;
351+ doc . Add ( div ) ;
352+ doc . Close ( ) ;
353+ NUnit . Framework . Assert . IsNull ( new CompareTool ( ) . CompareByContent ( outFileName , cmpFileName , destinationFolder
354+ ) ) ;
355+ }
356+
283357 [ NUnit . Framework . Test ]
284358 public virtual void WordSplitAcrossRenderersWithPrecedingImageRenderer ( ) {
285359 String outFileName = destinationFolder + "wordSplitAcrossRenderersWithPrecedingImageRenderer.pdf" ;
0 commit comments