@@ -67,6 +67,51 @@ public virtual void BasicThreeColumnsTest() {
6767 ) ) ;
6868 }
6969
70+ [ NUnit . Framework . Test ]
71+ public virtual void BasicTwoColumnsTest ( ) {
72+ String filename = DESTINATION_FOLDER + "basicTwoColumnsTest.pdf" ;
73+ String cmpName = SOURCE_FOLDER + "cmp_basicTwoColumnsTest.pdf" ;
74+ IList < TemplateValue > templateColumns = new List < TemplateValue > ( ) ;
75+ templateColumns . Add ( new PointValue ( 150.0f ) ) ;
76+ templateColumns . Add ( new PointValue ( 150.0f ) ) ;
77+ SolidBorder border = new SolidBorder ( ColorConstants . BLUE , 1 ) ;
78+ using ( Document document = new Document ( new PdfDocument ( new PdfWriter ( filename ) ) ) ) {
79+ GridContainer grid = new GridContainer ( ) ;
80+ grid . SetProperty ( Property . GRID_TEMPLATE_COLUMNS , templateColumns ) ;
81+ grid . Add ( new Paragraph ( "One" ) . SetBorder ( border ) ) ;
82+ grid . Add ( new Paragraph ( "Two" ) . SetBorder ( border ) ) ;
83+ Paragraph paragraph3 = new Paragraph ( "One" ) . SetBorder ( border ) ;
84+ paragraph3 . SetProperty ( Property . GRID_COLUMN_SPAN , 2 ) ;
85+ grid . Add ( paragraph3 ) ;
86+ document . Add ( grid ) ;
87+ }
88+ NUnit . Framework . Assert . IsNull ( new CompareTool ( ) . CompareByContent ( filename , cmpName , DESTINATION_FOLDER , "diff_"
89+ ) ) ;
90+ }
91+
92+ [ NUnit . Framework . Test ]
93+ public virtual void BasicTwoRowsTest ( ) {
94+ String filename = DESTINATION_FOLDER + "basicTwoRowsTest.pdf" ;
95+ String cmpName = SOURCE_FOLDER + "cmp_basicTwoRowsTest.pdf" ;
96+ IList < TemplateValue > templateRows = new List < TemplateValue > ( ) ;
97+ templateRows . Add ( new PointValue ( 150.0f ) ) ;
98+ templateRows . Add ( new PointValue ( 150.0f ) ) ;
99+ SolidBorder border = new SolidBorder ( ColorConstants . BLUE , 1 ) ;
100+ using ( Document document = new Document ( new PdfDocument ( new PdfWriter ( filename ) ) ) ) {
101+ GridContainer grid = new GridContainer ( ) ;
102+ grid . SetProperty ( Property . GRID_TEMPLATE_ROWS , templateRows ) ;
103+ grid . SetProperty ( Property . GRID_FLOW , GridFlow . COLUMN ) ;
104+ grid . Add ( new Paragraph ( "One" ) . SetBorder ( border ) ) ;
105+ grid . Add ( new Paragraph ( "Two" ) . SetBorder ( border ) ) ;
106+ Paragraph paragraph3 = new Paragraph ( "One" ) . SetBorder ( border ) ;
107+ paragraph3 . SetProperty ( Property . GRID_ROW_SPAN , 2 ) ;
108+ grid . Add ( paragraph3 ) ;
109+ document . Add ( grid ) ;
110+ }
111+ NUnit . Framework . Assert . IsNull ( new CompareTool ( ) . CompareByContent ( filename , cmpName , DESTINATION_FOLDER , "diff_"
112+ ) ) ;
113+ }
114+
70115 [ NUnit . Framework . Test ]
71116 public virtual void BasicAutoColumnsTest ( ) {
72117 String filename = DESTINATION_FOLDER + "basicAutoColumnsTest.pdf" ;
@@ -131,6 +176,66 @@ public virtual void BasicThreeColumnsWithCustomColumnIndexesTest() {
131176 ) ) ;
132177 }
133178
179+ [ NUnit . Framework . Test ]
180+ public virtual void BasicThreeColumnsOutOfBoundsWithNoCellsTest ( ) {
181+ String filename = DESTINATION_FOLDER + "basicThreeColumnsOutOfBoundsWithNoCellsTest.pdf" ;
182+ String cmpName = SOURCE_FOLDER + "cmp_basicThreeColumnsOutOfBoundsWithNoCellsTest.pdf" ;
183+ IList < TemplateValue > templateColumns = new List < TemplateValue > ( ) ;
184+ templateColumns . Add ( new PointValue ( 100.0f ) ) ;
185+ templateColumns . Add ( new PointValue ( 100.0f ) ) ;
186+ templateColumns . Add ( new PointValue ( 100.0f ) ) ;
187+ SolidBorder border = new SolidBorder ( ColorConstants . BLUE , 1 ) ;
188+ using ( Document document = new Document ( new PdfDocument ( new PdfWriter ( filename ) ) ) ) {
189+ GridContainer grid = new GridContainer ( ) ;
190+ grid . SetProperty ( Property . GRID_TEMPLATE_COLUMNS , templateColumns ) ;
191+ Paragraph paragraph1 = new Paragraph ( "One" ) . SetBorder ( border ) ;
192+ paragraph1 . SetProperty ( Property . GRID_COLUMN_START , - 2 ) ;
193+ paragraph1 . SetProperty ( Property . GRID_COLUMN_END , - 1 ) ;
194+ grid . Add ( paragraph1 ) ;
195+ grid . Add ( new Paragraph ( "Two" ) . SetBorder ( border ) ) ;
196+ Paragraph paragraph3 = new Paragraph ( "Three" ) . SetBorder ( border ) ;
197+ paragraph3 . SetProperty ( Property . GRID_COLUMN_START , - 4 ) ;
198+ paragraph3 . SetProperty ( Property . GRID_COLUMN_END , 3 ) ;
199+ grid . Add ( paragraph3 ) ;
200+ grid . Add ( new Paragraph ( "Four" ) . SetBorder ( border ) ) ;
201+ document . Add ( grid ) ;
202+ }
203+ NUnit . Framework . Assert . IsNull ( new CompareTool ( ) . CompareByContent ( filename , cmpName , DESTINATION_FOLDER , "diff_"
204+ ) ) ;
205+ }
206+
207+ [ NUnit . Framework . Test ]
208+ public virtual void BasicThreeColumnsWithNegativeCustomColumnIndexesTest ( ) {
209+ String filename = DESTINATION_FOLDER + "basicThreeColumnsWithNegativeCustomColumnIndexesTest.pdf" ;
210+ String cmpName = SOURCE_FOLDER + "cmp_basicThreeColumnsWithNegativeCustomColumnIndexesTest.pdf" ;
211+ IList < TemplateValue > templateColumns = new List < TemplateValue > ( ) ;
212+ templateColumns . Add ( new PointValue ( 100.0f ) ) ;
213+ templateColumns . Add ( new PointValue ( 100.0f ) ) ;
214+ templateColumns . Add ( new PointValue ( 100.0f ) ) ;
215+ SolidBorder border = new SolidBorder ( ColorConstants . BLUE , 1 ) ;
216+ using ( Document document = new Document ( new PdfDocument ( new PdfWriter ( filename ) ) ) ) {
217+ GridContainer grid = new GridContainer ( ) ;
218+ grid . SetProperty ( Property . GRID_TEMPLATE_COLUMNS , templateColumns ) ;
219+ Paragraph paragraph1 = new Paragraph ( "One" ) . SetBorder ( border ) ;
220+ paragraph1 . SetProperty ( Property . GRID_COLUMN_START , - 2 ) ;
221+ paragraph1 . SetProperty ( Property . GRID_COLUMN_END , - 1 ) ;
222+ grid . Add ( paragraph1 ) ;
223+ grid . Add ( new Paragraph ( "Two" ) . SetBorder ( border ) ) ;
224+ Paragraph paragraph3 = new Paragraph ( "Three" ) . SetBorder ( border ) ;
225+ paragraph3 . SetProperty ( Property . GRID_COLUMN_START , - 7 ) ;
226+ paragraph3 . SetProperty ( Property . GRID_COLUMN_END , 3 ) ;
227+ grid . Add ( paragraph3 ) ;
228+ grid . Add ( new Paragraph ( "Four" ) . SetBorder ( border ) ) ;
229+ grid . Add ( new Paragraph ( "Five" ) . SetBorder ( border ) ) ;
230+ grid . Add ( new Paragraph ( "Six" ) . SetBorder ( border ) ) ;
231+ grid . Add ( new Paragraph ( "Seven" ) . SetBorder ( border ) ) ;
232+ grid . Add ( new Paragraph ( "Eight" ) . SetBorder ( border ) ) ;
233+ document . Add ( grid ) ;
234+ }
235+ NUnit . Framework . Assert . IsNull ( new CompareTool ( ) . CompareByContent ( filename , cmpName , DESTINATION_FOLDER , "diff_"
236+ ) ) ;
237+ }
238+
134239 [ NUnit . Framework . Test ]
135240 public virtual void ThreeColumnsWithAdjacentWideCellsTest ( ) {
136241 String filename = DESTINATION_FOLDER + "threeColumnsWithAdjacentWideCellsTest.pdf" ;
0 commit comments