Ejemplo n.º 1
0
 def test_blocks(self):
     layout = GridLayout(rows=4, columns=4)
     layout.allocate(0, 0, colspan=2, rowspan=2)
     res = layout.find(rowspan=2, colspan=2)
     assert res == (0, 2)
     layout.allocate(0, 2, colspan=2, rowspan=2)
     res = layout.find(rowspan=2, colspan=2)
     assert res == (2, 0)
     layout.allocate(2, 0, colspan=2, rowspan=2)
     res = layout.find(rowspan=2, colspan=2)
     assert res == (2, 2)
     layout.allocate(2, 2, colspan=2, rowspan=2)
     res = layout.find(rowspan=2, colspan=2)
     assert res == None
Ejemplo n.º 2
0
 def test_largegap(self):
     layout = GridLayout(columns=2)
     layout.allocate(5, 1)
     assert layout.find() == (0, 0)
Ejemplo n.º 3
0
 def test_grow(self):
     layout = GridLayout(columns=2)
     layout.allocate(0, 0)
     assert layout.find() == (0, 1)
     layout.allocate(0, 1)
     assert layout.find() == (1, 0)
Ejemplo n.º 4
0
 def test_gap(self):
     layout = GridLayout(columns=1)
     layout.allocate(1, 0)
     assert layout.find() == (0, 0)
Ejemplo n.º 5
0
 def test_largegap(self):
     layout = GridLayout(rows=2)
     layout.allocate(1, 5)
     assert layout.find() == (0, 0)
Ejemplo n.º 6
0
 def test_gap(self):
     layout = GridLayout(rows=1)
     layout.allocate(0, 1)
     assert layout.find() == (0, 0)
Ejemplo n.º 7
0
 def test_allocate_refused_col(self):
     layout = GridLayout(rows=4, columns=4)
     layout.allocate(1, 0)
     # so far so good. Try to allocate something with a colspan of 2
     # at 0,0
     py.test.raises(LayoutException, layout.allocate, 0, 0, 2, 1)
Ejemplo n.º 8
0
 def test_available(self):
     layout = GridLayout(rows=3, columns=3)
     layout.allocate(0,0)
     res = layout.find(rowspan=2, colspan=3)
     assert res == (1, 0)
Ejemplo n.º 9
0
 def test_notavailable(self):
     layout = GridLayout(rows=3, columns=3)
     layout.allocate(1,1)
     res = layout.find(rowspan=2, colspan=3)
     assert res is None
Ejemplo n.º 10
0
 def test_allocate_colfixed(self):
     layout = GridLayout(columns=1)
     layout.allocate(0, 0)
     py.test.raises(LayoutException, layout.allocate, 0, 0)
Ejemplo n.º 11
0
 def test_allocate_rowfixed(self):
     layout = GridLayout(rows=1)
     layout.allocate(0, 0)
     py.test.raises(LayoutException, layout.allocate, 0, 0)
Ejemplo n.º 12
0
 def test_available_colfixed(self):
     layout = GridLayout(columns=1)
     assert layout.available_positions() is not None
     layout.allocate(0, 0)
     assert layout.available_positions() is not None
     assert layout.available_positions() == (1, 0)
Ejemplo n.º 13
0
 def test_available_rowfixed(self):
     layout = GridLayout(rows=1)
     assert layout.available_positions() is not None
     layout.allocate(0, 0)
     assert layout.available_positions() is not None
     assert layout.available_positions() == (0, 1)
Ejemplo n.º 14
0
 def test_available_fixed(self):
     layout = GridLayout(rows=1, columns=1)
     assert layout.available_positions() is not None
     layout.allocate(0, 0)
     assert layout.available_positions() is None