Ejemplo n.º 1
0
 def test_base_binding_force(self):
     t = TestTarget()
     c = ObservableCollection(1,2,3,4,5,6,7,8,9,10)
     t << c
     c._Internal_Collection = ['a','b','c']
     c.update_bindings()
     assert t.Values == ('a','b','c')
Ejemplo n.º 2
0
 def test_base_binding_force(self):
     t = TestTarget()
     c = ObservableCollection(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
     t << c
     c._Internal_Collection = ['a', 'b', 'c']
     c.update_bindings()
     assert t.Values == ('a', 'b', 'c')
Ejemplo n.º 3
0
 def test_ItemAdded(self):
     c = ObservableCollection(1, 2, 3, 4)
     t = self.Tester()
     c.ItemAdded += t.handle_event
     c.add(1)
     assert t.Kwargs['collection'] == c
     assert t.Args == (1, 4)
Ejemplo n.º 4
0
 def test_base_binding_force(self):
     t = TestTarget()
     c = ObservableCollection(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
     t < bind() < c
     c._internal_collection = ['a', 'b', 'c']  # don't do this in practice!
     c.update_bindings()
     assert t.values == ('a', 'b', 'c')
Ejemplo n.º 5
0
 def test_ItemAdded(self):
     c = ObservableCollection(1,2,3,4)
     t = self.Tester()
     c.ItemAdded += t.handle_event
     c.add(1)
     assert t.Kwargs['collection'] == c
     assert t.Args == (1,4)
Ejemplo n.º 6
0
 def test_base_binding_sort(self):
     t = TestTarget()
     c = ObservableCollection(1,2,3,4,5,6,7,8,9,10)
     t << c
     c.update_bindings()
     assert t.Values == (1,2,3,4,5,6,7,8,9,10)
     c.sort(reverse=True)
     assert t.Values == (10,9,8,7,6,5,4,3,2,1)
Ejemplo n.º 7
0
 def test_base_binding_clear(self):
     t = TestTarget()
     c = ObservableCollection(1,2,3,4,5,6,7,8,9,10)
     t << c
     c.update_bindings()
     assert t.Values == (1,2,3,4,5,6,7,8,9,10)
     c.clear()
     assert t.Values == ()
Ejemplo n.º 8
0
 def test_base_binding_sort(self):
     t = TestTarget()
     c = ObservableCollection(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
     t << c
     c.update_bindings()
     assert t.Values == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
     c.sort(reverse=True)
     assert t.Values == (10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
Ejemplo n.º 9
0
 def test_base_binding_clear(self):
     t = TestTarget()
     c = ObservableCollection(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
     t << c
     c.update_bindings()
     assert t.Values == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
     c.clear()
     assert t.Values == ()
Ejemplo n.º 10
0
 def test_base_binding_auto_update_remove(self):
     t = TestTarget()
     c = ObservableCollection(1,2,3,4,5,6,7,8,9,10)
     t << c
     c.remove(5)
     assert t.Values == (1,2,3,4,6,7,8,9,10)
Ejemplo n.º 11
0
 def test_Reordered(self):
     c = ObservableCollection(5,8,2)
     t = self.Tester()
     c.Reordered += t.handle_event
     c.sort(reverse=True)
     assert t.Kwargs['collection'] == c
Ejemplo n.º 12
0
 def test_base_binding_auto_update_add(self):
     t = TestTarget()
     c = ObservableCollection(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
     t < bind() < c
     c.add(11)
     assert t.values == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
Ejemplo n.º 13
0
 def test_iter(self):
     c = ObservableCollection(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
     result = []
     for item in c:
         result.append(item)
     assert result == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Ejemplo n.º 14
0
 def test_base_binding_auto_update_remove(self):
     t = TestTarget()
     c = ObservableCollection(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
     t << c
     c.remove(5)
     assert t.Values == (1, 2, 3, 4, 6, 7, 8, 9, 10)
Ejemplo n.º 15
0
 def test_Reordered(self):
     c = ObservableCollection(5, 8, 2)
     t = self.Tester()
     c.Reordered += t.handle_event
     c.sort(reverse=True)
     assert t.Kwargs['collection'] == c
Ejemplo n.º 16
0
 def test_CollectionChanged_remove(self):
     c = ObservableCollection(1,2,3,4,5,6,7,8,9,10)
     t = self.Tester()
     c.CollectionChanged += t.handle_event
     c.remove(1)
     assert t.Kwargs['collection'] == c
Ejemplo n.º 17
0
 def test_CollectionChanged_remove(self):
     c = ObservableCollection(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
     t = self.Tester()
     c.CollectionChanged += t.handle_event
     c.remove(1)
     assert t.Kwargs['collection'] == c
Ejemplo n.º 18
0
 def test_base_binding(self):
     t = TestTarget()
     c = ObservableCollection(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
     t < bind() < c
     t.update_bindings()
     assert t.values == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)