diff options
author | Simon Poirier <simpoir@gmail.com> | 2009-07-02 05:27:27 (GMT) |
---|---|---|
committer | Simon Poirier <simpoir@gmail.com> | 2009-07-02 05:27:27 (GMT) |
commit | 9fafb49af210e956d43d6a00106558d1a00d13df (patch) | |
tree | 5732d7950fab9915705685e0612ef4186111ef4a /src/sugar/tutorius/tests/actiontests.py | |
parent | 651700dfb6f42c61b8791b75f78cc60f7234ec92 (diff) |
* Modularized actions and event filters through add-on components
* Working serialization
* Working editor with addons
* began refactoring actions and events
** fixed some tests to work with addons
** filters and actions tests won't pass until refactoring is done
Diffstat (limited to 'src/sugar/tutorius/tests/actiontests.py')
-rw-r--r-- | src/sugar/tutorius/tests/actiontests.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/sugar/tutorius/tests/actiontests.py b/src/sugar/tutorius/tests/actiontests.py index d244547..4e126b3 100644 --- a/src/sugar/tutorius/tests/actiontests.py +++ b/src/sugar/tutorius/tests/actiontests.py @@ -24,17 +24,18 @@ The behavior of the actions must be tested here. import unittest import gtk +from sugar.tutorius import addon from sugar.tutorius.actions import * from sugar.tutorius.services import ObjectStore test_props = {"prop_a":8, "prop_b":3, "prop_c":"Hi"} class PropertyAction(Action): + prop_a = TIntProperty(test_props["prop_a"]) + prop_b = TIntProperty(test_props["prop_b"]) + prop_c = TStringProperty(test_props["prop_c"]) def __init__(self, na): Action.__init__(self) - self.prop_a = TIntProperty(test_props["prop_a"]) - self.prop_b = TIntProperty(test_props["prop_b"]) - self.prop_c = TStringProperty(test_props["prop_c"]) def has_function(obj, function_name): """ @@ -51,20 +52,20 @@ class PropsTest(unittest.TestCase): assert act.get_properties() == test_props.keys(), "Action does not contain property 'a'" for prop_name in act.get_properties(): - assert act.properties[prop_name].value == test_props[prop_name], "Wrong initial value for property %s : %s"%(prop_name,str(act.properties[prop_name])) + assert getattr(act, prop_name) == test_props[prop_name], "Wrong initial value for property %s : %s"%(prop_name,str(getattr(act, prop_name))) class DialogMessageTest(unittest.TestCase): def setUp(self): - self.dial = DialogMessage("Message text", [200, 300]) + self.dial = addon.create('DialogMessage', "Message text", [200, 300]) def test_properties(self): - assert self.dial.message.value == "Message text", "Wrong start value for the message" + assert self.dial.message == "Message text", "Wrong start value for the message" - assert self.dial.position.value == [200, 300], "Wrong start value for the position" + assert self.dial.position == [200, 300], "Wrong start value for the position" class BubbleMessageTest(unittest.TestCase): def setUp(self): - self.bubble = BubbleMessage(message="Message text", pos=[200, 300], tailpos=[-15, -25]) + self.bubble = addon.create('BubbleMessage', message="Message text", pos=[200, 300], tailpos=[-15, -25]) def test_properties(self): props = self.bubble.get_properties() @@ -81,6 +82,7 @@ class CountAction(Action): This action counts how many times it's do and undo methods get called """ def __init__(self): + Action.__init__(self) self.do_count = 0 self.undo_count = 0 @@ -136,6 +138,7 @@ class OnceWrapperTests(unittest.TestCase): class ChainTester(Action): def __init__(self, witness): + Action.__init__(self) self._witness = witness def do(self, **kwargs): |