Example #1
0
 def test_removes_2_by_3_square_from_top_left(self):
     g = span_top_left(grid(5, 5), 2, 3)
     self.assertEqual(g['rows'][0], [spanning_cell(2, 3), cell(), cell()])
     self.assertEqual(g['rows'][1], [cell(), cell()])
     self.assertEqual(
         g['rows'][2],
         [cell(), cell(), cell(), cell(),
          cell()])
     self.assertEqual(
         g['rows'][3],
         [cell(), cell(), cell(), cell(),
          cell()])
     self.assertEqual(
         g['rows'][3],
         [cell(), cell(), cell(), cell(),
          cell()])
Example #2
0
 def test_removing_huge_square_spans_the_whole_grid(self):
     g = span_top_left(grid(2, 2), 222, 222)
     self.assertEqual(g['rows'][0], [spanning_cell(2, 2)])
     self.assertEqual(g['rows'][1], [])
Example #3
0
 def test_spanning_to_2_rows_removes_1_cell_from_2nd_row(self):
     g = span_top_left(grid(3, 2), 2, 1)
     self.assertEqual(g['rows'][0], [spanning_cell(2, 1), cell()])
     self.assertEqual(g['rows'][1], [cell()])
     self.assertEqual(g['rows'][2], [cell(), cell()])
Example #4
0
 def test_spanning_to_too_many_columns_results_in_1_cell_with_max_colspan(
         self):
     g = span_top_left(grid(2, 3), 1, 200)
     self.assertEqual(g['rows'][0], [spanning_cell(1, 3)])
Example #5
0
 def test_spanning_to_2_columns_removes_1_cell_from_top_row(self):
     g = span_top_left(grid(2, 3), 1, 2)
     self.assertEqual(g['rows'][0], [spanning_cell(1, 2), cell()])
     self.assertEqual(g['rows'][1], [cell(), cell(), cell()])
Example #6
0
 def test_assigns_the_colspan_rowspan_keeping_the_color_white(self):
     c = spanning_cell(4, 5)
     self.assertEqual(c['rowspan'], 4)
     self.assertEqual(c['colspan'], 5)
     self.assertEqual(c['color'], 'white')