Пример #1
0
 def test_materialization(self):
     block = RecBlock(self.layout, False, 0, 0, 8, 8)
     virtual = block._virtualize()
     self.assertEqual(
         set(RecBlock._materialize_virtual_block(0, 0, virtual)),
         {(w, self.layout._get_item_position(w, False))
          for w in self.ws})
Пример #2
0
 def test_displaced_materialization(self):
     block = RecBlock(self.layout, False, 0, 0, 8, 8)
     virtual = block._virtualize()
     offset = (1, 2)
     expected = [(w, self.layout._get_item_position(w, False))
                 for w in self.ws]
     for i in range(0, len(expected)):
         widget, pos = expected[i]
         expected[i] = (widget, (pos[0] + offset[0], pos[1] + offset[1],
                                 pos[2], pos[3]))
     self.assertEqual(
         set(RecBlock._materialize_virtual_block(*offset, virtual)),
         set(expected))