Example #1
0
 def test_no_suitable_block(self):
     layout = QTilingLayout(max_span=3)
     widgets = [Widget(0), Widget(1), Widget(2), Widget(3), Widget(4)]
     layout.addWidget(widgets[0], 0, 0, 2, 1)
     layout.addWidget(widgets[1], 0, 1, 1, 2)
     layout.addWidget(widgets[2], 1, 2, 2, 1)
     layout.addWidget(widgets[3], 2, 0, 1, 1)
     layout.addWidget(widgets[4], 2, 1, 1, 1)
     with self.assertRaises(ImpossibleToBuildBlockException):
         layout._fill_spaces(RecBlock(layout, False, 0, 0, 3, 3))
Example #2
0
 def test_right_block(self):
     layout = QTilingLayout(max_span=3)
     widgets = [Widget(0), Widget(1), Widget(2)]
     layout.addWidget(widgets[0], 0, 0, 2, 1)
     layout.addWidget(widgets[1], 0, 1, 1, 2)
     layout.addWidget(widgets[2], 1, 2, 1, 1)
     layout._fill_spaces(RecBlock(layout, False, 0, 0, 3, 3))
     self.assertEqual(layout._get_item_position(widgets[0], False),
                      (0, 0, 3, 1))
     self.assertEqual(layout._get_item_position(widgets[1], False),
                      (0, 1, 2, 2))
     self.assertEqual(layout._get_item_position(widgets[2], False),
                      (2, 1, 1, 2))