コード例 #1
0
ファイル: test_newlayout.py プロジェクト: dimitrs/rctk
class TestFixedComplex1(object):
    """ a random, fixed layout """
    def setup_method(self, method):
        self.layout = GridLayout(rows=5, columns=7)

    def test_blocks(self):
        self.layout.append(dummy, rowspan=3, colspan=3)
        self.layout.append(dummy, rowspan=2, colspan=2)
        self.layout.append(dummy, rowspan=2, colspan=2)
        self.layout.append(dummy, rowspan=3, colspan=2)
        self.layout.append(dummy, rowspan=3, colspan=2)
        self.layout.append(dummy, rowspan=2, colspan=3)
        assert self.layout.find() is None

    def test_cells(self):
        for i in range(0, 5*7):
            self.layout.append(dummy)
        assert self.layout.find() is None

    def test_widecells(self):
        for i in range(0, 5):
            self.layout.append(dummy, colspan=7)
        assert self.layout.find() is None
コード例 #2
0
ファイル: test_newlayout.py プロジェクト: dimitrs/rctk
 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)
コード例 #3
0
ファイル: test_newlayout.py プロジェクト: dimitrs/rctk
 def test_largegap(self):
     layout = GridLayout(columns=2)
     layout.allocate(5, 1)
     assert layout.find() == (0, 0)
コード例 #4
0
ファイル: test_newlayout.py プロジェクト: dimitrs/rctk
 def test_largegap(self):
     layout = GridLayout(rows=2)
     layout.allocate(1, 5)
     assert layout.find() == (0, 0)
コード例 #5
0
ファイル: test_newlayout.py プロジェクト: dimitrs/rctk
 def test_gap(self):
     layout = GridLayout(columns=1)
     layout.allocate(1, 0)
     assert layout.find() == (0, 0)
コード例 #6
0
ファイル: test_newlayout.py プロジェクト: dimitrs/rctk
 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)
コード例 #7
0
ファイル: test_newlayout.py プロジェクト: dimitrs/rctk
 def test_gap(self):
     layout = GridLayout(rows=1)
     layout.allocate(0, 1)
     assert layout.find() == (0, 0)
コード例 #8
0
ファイル: test_newlayout.py プロジェクト: dimitrs/rctk
 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
コード例 #9
0
ファイル: test_newlayout.py プロジェクト: dimitrs/rctk
 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
コード例 #10
0
ファイル: test_newlayout.py プロジェクト: dimitrs/rctk
 def test_fit(self):
     layout = GridLayout(rows=2, columns=2)
     res = layout.find(rowspan=2, colspan=2)
     assert res == (0, 0)
コード例 #11
0
ファイル: test_newlayout.py プロジェクト: dimitrs/rctk
 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)
コード例 #12
0
ファイル: test_newlayout.py プロジェクト: dimitrs/rctk
 def test_allocate_colfixed(self):
     layout = GridLayout(columns=1)
     layout.allocate(0, 0)
     py.test.raises(LayoutException, layout.allocate, 0, 0)
コード例 #13
0
ファイル: test_newlayout.py プロジェクト: dimitrs/rctk
 def test_allocate_rowfixed(self):
     layout = GridLayout(rows=1)
     layout.allocate(0, 0)
     py.test.raises(LayoutException, layout.allocate, 0, 0)
コード例 #14
0
ファイル: test_newlayout.py プロジェクト: dimitrs/rctk
 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)
コード例 #15
0
ファイル: test_newlayout.py プロジェクト: dimitrs/rctk
class TestComplex1(object):
    """ Same as TestComplex but only columns fixed, rows grow """
    def setup_method(self, method):
        self.layout = GridLayout(columns=7)

    def test_blocks(self):
        self.layout.append(dummy, rowspan=3, colspan=3)
        self.layout.append(dummy, rowspan=2, colspan=2)
        self.layout.append(dummy, rowspan=2, colspan=2)
        self.layout.append(dummy, rowspan=3, colspan=2)
        self.layout.append(dummy, rowspan=3, colspan=2)
        self.layout.append(dummy, rowspan=2, colspan=3)
        assert self.layout.find() == (5, 0)

    def test_cells(self):
        for i in range(0, 5*7):
            self.layout.append(dummy)
        assert self.layout.find() == (5, 0)

    def test_widecells(self):
        for i in range(0, 5):
            self.layout.append(dummy, colspan=7)
        assert self.layout.find() == (5, 0)
コード例 #16
0
ファイル: test_newlayout.py プロジェクト: dimitrs/rctk
 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)
コード例 #17
0
ファイル: test_newlayout.py プロジェクト: dimitrs/rctk
 def setup_method(self, method):
     self.layout = GridLayout(columns=7)
コード例 #18
0
ファイル: test_newlayout.py プロジェクト: dimitrs/rctk
 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