@@ -414,6 +414,193 @@ public virtual void FloatsOnlyJustificationTest01() {
414
414
, "diff_" ) ) ;
415
415
}
416
416
417
+ [ NUnit . Framework . Test ]
418
+ public virtual void TableWithAlignmentNextToRightFloatTest ( ) {
419
+ //TODO DEVSIX-4021 update cmp file after fix
420
+ String outFileName = destinationFolder + "tableWithAlignmentNextToRightFloat.pdf" ;
421
+ String cmpFileName = sourceFolder + "cmp_tableWithAlignmentNextToRightFloat.pdf" ;
422
+ PdfDocument pdfDocument = new PdfDocument ( new PdfWriter ( outFileName ) ) ;
423
+ Document document = new Document ( pdfDocument ) ;
424
+ Table table1 = CreateTable ( HorizontalAlignment . RIGHT ) ;
425
+ Table table2 = CreateTable ( HorizontalAlignment . LEFT ) ;
426
+ Table table3 = CreateTable ( HorizontalAlignment . CENTER ) ;
427
+ Div div = CreateDiv ( ColorConstants . GREEN , ClearPropertyValue . NONE , FloatPropertyValue . RIGHT , UnitValue . CreatePointValue
428
+ ( 200 ) ) ;
429
+ Div spaceDiv = new Div ( ) ;
430
+ spaceDiv . SetProperty ( Property . CLEAR , ClearPropertyValue . BOTH ) ;
431
+ spaceDiv . Add ( new Paragraph ( "Space Div" ) . SetFontColor ( ColorConstants . BLUE ) ) ;
432
+ document . Add ( div ) ;
433
+ document . Add ( table1 ) ;
434
+ document . Add ( spaceDiv ) ;
435
+ document . Add ( div ) ;
436
+ document . Add ( table2 ) ;
437
+ document . Add ( spaceDiv ) ;
438
+ document . Add ( div ) ;
439
+ document . Add ( table3 ) ;
440
+ document . Close ( ) ;
441
+ NUnit . Framework . Assert . IsNull ( new CompareTool ( ) . CompareByContent ( outFileName , cmpFileName , destinationFolder
442
+ ) ) ;
443
+ }
444
+
445
+ [ NUnit . Framework . Test ]
446
+ public virtual void TableWithAlignmentNextToLeftFloatTest ( ) {
447
+ //TODO DEVSIX-4021 update cmp file after fix
448
+ String outFileName = destinationFolder + "tableWithAlignmentNextToLeftFloat.pdf" ;
449
+ String cmpFileName = sourceFolder + "cmp_tableWithAlignmentNextToLeftFloat.pdf" ;
450
+ PdfDocument pdfDocument = new PdfDocument ( new PdfWriter ( outFileName ) ) ;
451
+ Document document = new Document ( pdfDocument ) ;
452
+ Table table1 = CreateTable ( HorizontalAlignment . RIGHT ) ;
453
+ Table table2 = CreateTable ( HorizontalAlignment . LEFT ) ;
454
+ Table table3 = CreateTable ( HorizontalAlignment . CENTER ) ;
455
+ Div div = CreateDiv ( ColorConstants . GREEN , ClearPropertyValue . NONE , FloatPropertyValue . LEFT , UnitValue . CreatePointValue
456
+ ( 200 ) ) ;
457
+ Div spaceDiv = new Div ( ) ;
458
+ spaceDiv . SetProperty ( Property . CLEAR , ClearPropertyValue . BOTH ) ;
459
+ spaceDiv . Add ( new Paragraph ( "Space Div" ) . SetFontColor ( ColorConstants . BLUE ) ) ;
460
+ document . Add ( div ) ;
461
+ document . Add ( table1 ) ;
462
+ document . Add ( spaceDiv ) ;
463
+ document . Add ( div ) ;
464
+ document . Add ( table2 ) ;
465
+ document . Add ( spaceDiv ) ;
466
+ document . Add ( div ) ;
467
+ document . Add ( table3 ) ;
468
+ document . Close ( ) ;
469
+ NUnit . Framework . Assert . IsNull ( new CompareTool ( ) . CompareByContent ( outFileName , cmpFileName , destinationFolder
470
+ ) ) ;
471
+ }
472
+
473
+ [ NUnit . Framework . Test ]
474
+ public virtual void TableWithAlignmentBetweenFloatsTest ( ) {
475
+ //TODO DEVSIX-4021 update cmp file after fix
476
+ String outFileName = destinationFolder + "tableWithAlignmentBetweenFloats.pdf" ;
477
+ String cmpFileName = sourceFolder + "cmp_tableWithAlignmentBetweenFloats.pdf" ;
478
+ PdfDocument pdfDocument = new PdfDocument ( new PdfWriter ( outFileName ) ) ;
479
+ Document document = new Document ( pdfDocument ) ;
480
+ Table table1 = CreateTable ( HorizontalAlignment . RIGHT ) . SetWidth ( 250 ) ;
481
+ Table table2 = CreateTable ( HorizontalAlignment . LEFT ) . SetWidth ( 250 ) ;
482
+ Table table3 = CreateTable ( HorizontalAlignment . CENTER ) . SetWidth ( 250 ) ;
483
+ Div div1 = CreateDiv ( ColorConstants . GREEN , ClearPropertyValue . NONE , FloatPropertyValue . LEFT , UnitValue . CreatePointValue
484
+ ( 100 ) ) ;
485
+ Div div2 = CreateDiv ( ColorConstants . BLUE , ClearPropertyValue . NONE , FloatPropertyValue . RIGHT , UnitValue . CreatePointValue
486
+ ( 100 ) ) ;
487
+ Div spaceDiv = new Div ( ) ;
488
+ spaceDiv . SetProperty ( Property . CLEAR , ClearPropertyValue . BOTH ) ;
489
+ spaceDiv . Add ( new Paragraph ( "Space Div" ) . SetFontColor ( ColorConstants . BLUE ) ) ;
490
+ document . Add ( div1 ) ;
491
+ document . Add ( div2 ) ;
492
+ document . Add ( table1 ) ;
493
+ document . Add ( spaceDiv ) ;
494
+ document . Add ( div1 ) ;
495
+ document . Add ( div2 ) ;
496
+ document . Add ( table2 ) ;
497
+ document . Add ( spaceDiv ) ;
498
+ document . Add ( div1 ) ;
499
+ document . Add ( div2 ) ;
500
+ document . Add ( table3 ) ;
501
+ document . Close ( ) ;
502
+ NUnit . Framework . Assert . IsNull ( new CompareTool ( ) . CompareByContent ( outFileName , cmpFileName , destinationFolder
503
+ ) ) ;
504
+ }
505
+
506
+ [ NUnit . Framework . Test ]
507
+ public virtual void TableWithBigLeftMarginAfterFloatTest ( ) {
508
+ //TODO DEVSIX-4021 update cmp file after fix
509
+ String outFileName = destinationFolder + "tableWithBigLeftMarginAfterFloat.pdf" ;
510
+ String cmpFileName = sourceFolder + "cmp_tableWithBigLeftMarginAfterFloat.pdf" ;
511
+ PdfDocument pdfDocument = new PdfDocument ( new PdfWriter ( outFileName ) ) ;
512
+ Document document = new Document ( pdfDocument ) ;
513
+ Table table1 = CreateTable ( HorizontalAlignment . RIGHT ) ;
514
+ table1 . SetMarginLeft ( 300 ) ;
515
+ Table table2 = CreateTable ( HorizontalAlignment . LEFT ) ;
516
+ table2 . SetMarginLeft ( 300 ) ;
517
+ Table table3 = CreateTable ( HorizontalAlignment . CENTER ) ;
518
+ table3 . SetMarginLeft ( 300 ) ;
519
+ Div div = CreateDiv ( ColorConstants . GREEN , ClearPropertyValue . NONE , FloatPropertyValue . RIGHT , UnitValue . CreatePointValue
520
+ ( 200 ) ) ;
521
+ Div spaceDiv = new Div ( ) ;
522
+ spaceDiv . SetProperty ( Property . CLEAR , ClearPropertyValue . BOTH ) ;
523
+ spaceDiv . Add ( new Paragraph ( "Space Div" ) . SetFontColor ( ColorConstants . BLUE ) ) ;
524
+ document . Add ( div ) ;
525
+ document . Add ( table1 ) ;
526
+ document . Add ( spaceDiv ) ;
527
+ document . Add ( div ) ;
528
+ document . Add ( table2 ) ;
529
+ document . Add ( spaceDiv ) ;
530
+ document . Add ( div ) ;
531
+ document . Add ( table3 ) ;
532
+ document . Close ( ) ;
533
+ NUnit . Framework . Assert . IsNull ( new CompareTool ( ) . CompareByContent ( outFileName , cmpFileName , destinationFolder
534
+ ) ) ;
535
+ }
536
+
537
+ [ NUnit . Framework . Test ]
538
+ public virtual void TableWithBigRightMarginAfterFloatTest ( ) {
539
+ //TODO DEVSIX-4021 update cmp file after fix
540
+ String outFileName = destinationFolder + "tableWithBigRightMarginAfterFloat.pdf" ;
541
+ String cmpFileName = sourceFolder + "cmp_tableWithBigRightMarginAfterFloat.pdf" ;
542
+ PdfDocument pdfDocument = new PdfDocument ( new PdfWriter ( outFileName ) ) ;
543
+ Document document = new Document ( pdfDocument ) ;
544
+ Table table1 = CreateTable ( HorizontalAlignment . RIGHT ) ;
545
+ table1 . SetMarginRight ( 300 ) ;
546
+ Table table2 = CreateTable ( HorizontalAlignment . LEFT ) ;
547
+ table2 . SetMarginRight ( 300 ) ;
548
+ Table table3 = CreateTable ( HorizontalAlignment . CENTER ) ;
549
+ table3 . SetMarginRight ( 300 ) ;
550
+ Div div = CreateDiv ( ColorConstants . GREEN , ClearPropertyValue . NONE , FloatPropertyValue . LEFT , UnitValue . CreatePointValue
551
+ ( 200 ) ) ;
552
+ Div spaceDiv = new Div ( ) ;
553
+ spaceDiv . SetProperty ( Property . CLEAR , ClearPropertyValue . BOTH ) ;
554
+ spaceDiv . Add ( new Paragraph ( "Space Div" ) . SetFontColor ( ColorConstants . BLUE ) ) ;
555
+ document . Add ( div ) ;
556
+ document . Add ( table1 ) ;
557
+ document . Add ( spaceDiv ) ;
558
+ document . Add ( div ) ;
559
+ document . Add ( table2 ) ;
560
+ document . Add ( spaceDiv ) ;
561
+ document . Add ( div ) ;
562
+ document . Add ( table3 ) ;
563
+ document . Close ( ) ;
564
+ NUnit . Framework . Assert . IsNull ( new CompareTool ( ) . CompareByContent ( outFileName , cmpFileName , destinationFolder
565
+ ) ) ;
566
+ }
567
+
568
+ [ NUnit . Framework . Test ]
569
+ public virtual void TableWithSideMarginsBetweenFloatTest ( ) {
570
+ //TODO DEVSIX-4021 update cmp file after fix
571
+ String outFileName = destinationFolder + "tableWithSideMarginsBetweenFloat.pdf" ;
572
+ String cmpFileName = sourceFolder + "cmp_tableWithSideMarginsBetweenFloat.pdf" ;
573
+ PdfDocument pdfDocument = new PdfDocument ( new PdfWriter ( outFileName ) ) ;
574
+ Document document = new Document ( pdfDocument ) ;
575
+ Table table1 = CreateTable ( HorizontalAlignment . RIGHT ) ;
576
+ table1 . SetMarginRight ( 150 ) . SetMarginLeft ( 150 ) ;
577
+ Table table2 = CreateTable ( HorizontalAlignment . LEFT ) ;
578
+ table2 . SetMarginRight ( 300 ) ;
579
+ Table table3 = CreateTable ( HorizontalAlignment . CENTER ) ;
580
+ table3 . SetMarginLeft ( 300 ) ;
581
+ Div div1 = CreateDiv ( ColorConstants . GREEN , ClearPropertyValue . NONE , FloatPropertyValue . LEFT , UnitValue . CreatePointValue
582
+ ( 100 ) ) ;
583
+ Div div2 = CreateDiv ( ColorConstants . BLUE , ClearPropertyValue . NONE , FloatPropertyValue . RIGHT , UnitValue . CreatePointValue
584
+ ( 100 ) ) ;
585
+ Div spaceDiv = new Div ( ) ;
586
+ spaceDiv . SetProperty ( Property . CLEAR , ClearPropertyValue . BOTH ) ;
587
+ spaceDiv . Add ( new Paragraph ( "Space Div" ) . SetFontColor ( ColorConstants . BLUE ) ) ;
588
+ document . Add ( div1 ) ;
589
+ document . Add ( div2 ) ;
590
+ document . Add ( table1 ) ;
591
+ document . Add ( spaceDiv ) ;
592
+ document . Add ( div1 ) ;
593
+ document . Add ( div2 ) ;
594
+ document . Add ( table2 ) ;
595
+ document . Add ( spaceDiv ) ;
596
+ document . Add ( div1 ) ;
597
+ document . Add ( div2 ) ;
598
+ document . Add ( table3 ) ;
599
+ document . Close ( ) ;
600
+ NUnit . Framework . Assert . IsNull ( new CompareTool ( ) . CompareByContent ( outFileName , cmpFileName , destinationFolder
601
+ ) ) ;
602
+ }
603
+
417
604
private Div CreateParentDiv ( HorizontalAlignment ? horizontalAlignment , ClearPropertyValue ? clearPropertyValue
418
605
, UnitValue width ) {
419
606
Div divParent1 = new Div ( ) . SetBorder ( new SolidBorder ( 5 ) ) . SetWidth ( width ) ;
@@ -431,9 +618,30 @@ private static Div CreateDiv(Color color, HorizontalAlignment? horizontalAlignme
431
618
div . SetHorizontalAlignment ( horizontalAlignment ) ;
432
619
div . SetProperty ( Property . CLEAR , clearPropertyValue ) ;
433
620
div . SetProperty ( Property . FLOAT , floatPropertyValue ) ;
434
- div . Add ( new Paragraph ( "Div with HorizontalAlignment." + horizontalAlignment + ", ClearPropertyValue." + clearPropertyValue
435
- + ", FloatPropertyValue." + floatPropertyValue ) ) ;
621
+ String cont = "Div with HorizontalAlignment." + horizontalAlignment + ", ClearPropertyValue." + clearPropertyValue
622
+ + ", FloatPropertyValue." + floatPropertyValue ;
623
+ div . Add ( new Paragraph ( cont ) ) ;
436
624
return div ;
437
625
}
626
+
627
+ private static Div CreateDiv ( Color color , ClearPropertyValue ? clearPropertyValue , FloatPropertyValue ? floatPropertyValue
628
+ , UnitValue width ) {
629
+ Div div = new Div ( ) . SetBorder ( new SolidBorder ( color , 1 ) ) . SetBackgroundColor ( color , 0.3f ) . SetMargins ( 10 , 10
630
+ , 10 , 10 ) . SetWidth ( width ) ;
631
+ div . SetProperty ( Property . CLEAR , clearPropertyValue ) ;
632
+ div . SetProperty ( Property . FLOAT , floatPropertyValue ) ;
633
+ String cont = "Div with ClearPropertyValue." + clearPropertyValue + ", FloatPropertyValue." + floatPropertyValue ;
634
+ div . Add ( new Paragraph ( cont ) ) ;
635
+ return div ;
636
+ }
637
+
638
+ private static Table CreateTable ( HorizontalAlignment ? horizontalAlignment ) {
639
+ Table table = new Table ( 3 ) ;
640
+ table . AddCell ( "Align" + horizontalAlignment . ToString ( ) ) ;
641
+ table . AddCell ( "Cell number two" ) ;
642
+ table . AddCell ( "Cell number three" ) ;
643
+ table . SetHorizontalAlignment ( horizontalAlignment ) ;
644
+ return table ;
645
+ }
438
646
}
439
647
}
0 commit comments