mirror of
https://github.com/ha7ilm/openwebrx.git
synced 2026-04-04 14:07:32 +00:00
add stack event handling
This commit is contained in:
parent
c83d8580ba
commit
d5c2f8414e
2 changed files with 38 additions and 4 deletions
|
|
@ -41,3 +41,27 @@ class PropertyStackTest(TestCase):
|
|||
self.assertEqual(om["testkey"], "high value")
|
||||
om.removeLayer(high_pm)
|
||||
self.assertEqual(om["testkey"], "low value")
|
||||
|
||||
def testPropertyChange(self):
|
||||
layer = PropertyLayer()
|
||||
stack = PropertyStack()
|
||||
stack.addLayer(0, layer)
|
||||
mock = Mock()
|
||||
stack.wire(mock.method)
|
||||
layer["testkey"] = "testvalue"
|
||||
mock.method.assert_called_once_with("testkey", "testvalue")
|
||||
|
||||
def testPropertyChangeEventPriority(self):
|
||||
low_layer = PropertyLayer()
|
||||
high_layer = PropertyLayer()
|
||||
low_layer["testkey"] = "initial low value"
|
||||
high_layer["testkey"] = "initial high value"
|
||||
stack = PropertyStack()
|
||||
stack.addLayer(1, low_layer)
|
||||
stack.addLayer(0, high_layer)
|
||||
mock = Mock()
|
||||
stack.wire(mock.method)
|
||||
low_layer["testkey"] = "modified low value"
|
||||
mock.method.assert_not_called()
|
||||
high_layer["testkey"] = "modified high value"
|
||||
mock.method.assert_called_once_with("testkey", "modified high value")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue