Example #1
0
 def test_bug_10(self):
     """Adding nodes when the correct root dimensions are still unknown
     should not raise an error.
     """
     layout = Plasma()
     layout.add(object())
     layout.add(object())
 def test_access(self, root):
     layout = Plasma()
     layout.root = root
     layout.add('a')
     now = datetime.now()
     assert layout.root.find_payload('a').last_accessed < now
     layout.focus('a')
     assert layout.root.find_payload('a').last_accessed > now
 def test_focus(self, root):
     layout = Plasma()
     layout.root = root
     a, b, c, d = 'abcd'
     layout.add(a)
     layout.add(b)
     layout.add(c)
     layout.add(d)
     assert layout.focus_first() == 'a'
     assert layout.focus_last() == 'd'
     assert layout.focus_next('b') == 'c'
     assert layout.focus_previous('c') == 'b'
     layout.focus('c')
     assert layout.focused is c