@@ -192,14 +192,17 @@ test_that("show on complex gridifyLayout returns information to the console", {
192192
193193test_that(" test span row for output height row = c(x:y)" , {
194194 test_layout <- gridifyLayout(
195- nrow = 6L ,
195+ nrow = 3L ,
196196 ncol = 1L ,
197- heights = grid :: unit(c(0.05 , 0.05 , 0.05 , 0. 7 , 0.05 , 0.1 ), " npc" ),
197+ heights = grid :: unit(c(0.15 , 0.7 , 0.15 ), " npc" ),
198198 widths = grid :: unit(1 , " npc" ),
199199 margin = grid :: unit(c(t = 0.1 , r = 0.1 , b = 0.1 , l = 0.1 ), units = " npc" ),
200200 global_gpar = grid :: gpar(),
201- object = gridifyObject(row = c(1 : 3 ), col = 1 ),
202- cells = gridifyCells(title = gridifyCell(row = 1 , col = 1 ), footer = gridifyCell(row = 3 , col = 1 ))
201+ object = gridifyObject(row = 2 , col = 1 ),
202+ cells = gridifyCells(
203+ title = gridifyCell(row = 1 , col = 1 ),
204+ footer = gridifyCell(row = 3 , col = 1 )
205+ )
203206 )
204207 expect_s4_class(test_layout , " gridifyLayout" )
205208
@@ -209,31 +212,34 @@ test_that("test span row for output height row = c(x:y)", {
209212
210213 expect_equal(output , c(
211214 " gridifyLayout object" , " ---------------------" , " Layout dimensions:" ,
212- " Number of rows: 6" , " Number of columns: 1" , " " , " Heights of rows:" ,
213- " Row 1: 0.05 npc" , " Row 2: 0.05 npc" , " Row 3: 0.05 npc" ,
214- " Row 4: 0.7 npc" , " Row 5: 0.05 npc" , " Row 6: 0.1 npc" ,
215+ " Number of rows: 3" , " Number of columns: 1" , " " , " Heights of rows:" ,
216+ " Row 1: 0.15 npc" , " Row 2: 0.7 npc" , " Row 3: 0.15 npc" ,
215217 " " , " Widths of columns:" , " Column 1: 1 npc" , " " , " Object Position:" ,
216- " Row: 1-3" , " Col: 1" , " Width: 1" , " Height: 1" , " " , " Object Row Heights:" ,
217- " Row 1: 0.05 npc" , " Row 2: 0.05 npc" , " Row 3: 0.05 npc" ,
218- " " , " Margin:" , " Top: 0.1 npc" , " Right: 0.1 npc" , " Bottom: 0.1 npc" ,
219- " Left: 0.1 npc" , " " , " Global graphical parameters:" , " Are not set" , " " ,
220- " Default Cell Info:" , " title:" ,
218+ " Row: 2" , " Col: 1" , " Width: 1" , " Height: 1" , " " , " Object Row Heights:" ,
219+ " Row 2: 0.7 npc" , " " , " Margin:" , " Top: 0.1 npc" , " Right: 0.1 npc" ,
220+ " Bottom: 0.1 npc" , " Left: 0.1 npc" , " " , " Global graphical parameters:" ,
221+ " Are not set" , " " , " Default Cell Info:" , " title:" ,
221222 " row:1, col:1, text:NULL, mch:Inf, x:0.5, y:0.5, hjust:0.5, vjust:0.5, rot:0, " ,
222- " footer:" ,
223- " row:3, col:1, text:NULL, mch:Inf, x:0.5, y:0.5, hjust:0.5, vjust:0.5, rot:0, " , " "
223+ " footer:" , " row:3, col:1, text:NULL, mch:Inf, x:0.5, y:0.5, hjust:0.5, vjust:0.5, rot:0, " ,
224+ " "
224225 ))
225226})
226227
227228test_that(" test span row for output height row = c(x, y)" , {
228229 test_layout <- gridifyLayout(
229- nrow = 6L ,
230+ nrow = 3L ,
230231 ncol = 1L ,
231- heights = grid :: unit(c(0.05 , 0.05 , 0.05 , 0. 7 , 0.05 , 0.1 ), " npc" ),
232+ heights = grid :: unit(c(0.15 , 0.7 , 0.15 ), " npc" ),
232233 widths = grid :: unit(1 , " npc" ),
233234 margin = grid :: unit(c(t = 0.1 , r = 0.1 , b = 0.1 , l = 0.1 ), units = " npc" ),
234235 global_gpar = grid :: gpar(),
235- object = gridifyObject(row = c(1 , 4 ), col = 1 ),
236- cells = gridifyCells(title = gridifyCell(row = 1 , col = 1 ), footer = gridifyCell(row = 3 , col = 1 ))
236+ object = gridifyObject(row = 2 , col = 1 ),
237+ cells = gridifyCells(
238+ title = gridifyCell(
239+ row = 1 , col = 1 , text = " Longer Default Title" , gpar = grid :: gpar(col = " black" )
240+ ),
241+ footer = gridifyCell(row = 3 , col = 1 )
242+ )
237243 )
238244 expect_s4_class(test_layout , " gridifyLayout" )
239245
@@ -243,17 +249,16 @@ test_that("test span row for output height row = c(x, y)", {
243249
244250 expect_equal(output , c(
245251 " gridifyLayout object" , " ---------------------" , " Layout dimensions:" ,
246- " Number of rows: 6" , " Number of columns: 1" , " " , " Heights of rows:" ,
247- " Row 1: 0.05 npc" , " Row 2: 0.05 npc" , " Row 3: 0.05 npc" ,
248- " Row 4: 0.7 npc" , " Row 5: 0.05 npc" , " Row 6: 0.1 npc" ,
252+ " Number of rows: 3" , " Number of columns: 1" , " " , " Heights of rows:" ,
253+ " Row 1: 0.15 npc" , " Row 2: 0.7 npc" , " Row 3: 0.15 npc" ,
249254 " " , " Widths of columns:" , " Column 1: 1 npc" , " " , " Object Position:" ,
250- " Row: 1-4" , " Col: 1" , " Width: 1" , " Height: 1" , " " , " Object Row Heights:" ,
251- " Row 1: 0.05 npc" , " Row 2: 0.05 npc" , " Row 3: 0.05 npc" ,
252- " Row 4: 0.7 npc" , " " , " Margin:" , " Top: 0.1 npc" , " Right: 0.1 npc" ,
255+ " Row: 2" , " Col: 1" , " Width: 1" , " Height: 1" , " " , " Object Row Heights:" ,
256+ " Row 2: 0.7 npc" , " " , " Margin:" , " Top: 0.1 npc" , " Right: 0.1 npc" ,
253257 " Bottom: 0.1 npc" , " Left: 0.1 npc" , " " , " Global graphical parameters:" ,
254258 " Are not set" , " " , " Default Cell Info:" , " title:" ,
255- " row:1, col:1, text:NULL, mch:Inf, x:0.5, y:0.5, hjust:0.5, vjust:0.5, rot:0, " ,
256- " footer:" ,
257- " row:3, col:1, text:NULL, mch:Inf, x:0.5, y:0.5, hjust:0.5, vjust:0.5, rot:0, " , " "
259+ " row:1, col:1, text:Longer Def..., mch:Inf, x:0.5, y:0.5, hjust:0.5, vjust:0.5, rot:0, " ,
260+ " gpar - col:black, " , " footer:" ,
261+ " row:3, col:1, text:NULL, mch:Inf, x:0.5, y:0.5, hjust:0.5, vjust:0.5, rot:0, " ,
262+ " "
258263 ))
259264})
0 commit comments