Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormike <michael.jmontcalm@gmail.com>2009-10-05 15:42:28 (GMT)
committer mike <michael.jmontcalm@gmail.com>2009-10-05 15:42:28 (GMT)
commite1ed58a1a9b8674559824c158b4ed7375a0f7c18 (patch)
treed8cf73dcbc4db3ee45da14e2e2f0368cb9923922
parentb658de9cf3cb526f8492a54dab19e8238c9edb9b (diff)
LP 439980 : Adding tests for the addon module
-rwxr-xr-xtests/run-tests.py3
-rw-r--r--tutorius/actions.py145
-rw-r--r--tutorius/addon.py1
3 files changed, 2 insertions, 147 deletions
diff --git a/tests/run-tests.py b/tests/run-tests.py
index d41aa0a..793db3a 100755
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -40,6 +40,7 @@ if __name__=='__main__':
import constraintstests
import propertiestests
import serializertests
+ import addontests
suite = unittest.TestSuite()
suite.addTests(unittest.findTestCases(coretests))
suite.addTests(unittest.findTestCases(servicestests))
@@ -70,5 +71,5 @@ if __name__=='__main__':
from propertiestests import *
from actiontests import *
from serializertests import *
-
+ from addontests import *
unittest.main()
diff --git a/tutorius/actions.py b/tutorius/actions.py
index 0db7988..89e71ae 100644
--- a/tutorius/actions.py
+++ b/tutorius/actions.py
@@ -177,148 +177,3 @@ class Action(TPropContainer):
self.position = [int(x), int(y)]
self.__edit_img.destroy()
-##class OnceWrapper(Action):
-## """
-## Wraps a class to perform an action once only
-##
-## This ConcreteActions's do() method will only be called on the first do()
-## and the undo() will be callable after do() has been called
-## """
-##
-## _action = TAddonProperty()
-##
-## def __init__(self, action):
-## Action.__init__(self)
-## self._called = False
-## self._need_undo = False
-## self._action = action
-##
-## def do(self):
-## """
-## Do the action only on the first time
-## """
-## if not self._called:
-## self._called = True
-## self._action.do()
-## self._need_undo = True
-##
-## def undo(self):
-## """
-## Undo the action if it's been done
-## """
-## if self._need_undo:
-## self._action.undo()
-## self._need_undo = False
-##
-##class WidgetIdentifyAction(Action):
-## def __init__(self):
-## Action.__init__(self)
-## self.activity = None
-## self._dialog = None
-
-## def do(self):
-## os = ObjectStore()
-## if os.activity:
-## self.activity = os.activity
-
-## self._dialog = WidgetIdentifier(self.activity)
-## self._dialog.show()
-
-
-## def undo(self):
-## if self._dialog:
-## self._dialog.destroy()
-
-##class ChainAction(Action):
-## """Utility class to allow executing actions in a specific order"""
-## def __init__(self, *actions):
-## """ChainAction(action1, ... ) builds a chain of actions"""
-## Action.__init__(self)
-## self._actions = actions
-##
-## def do(self,**kwargs):
-## """do() each action in the chain"""
-## for act in self._actions:
-## act.do(**kwargs)
-##
-## def undo(self):
-## """undo() each action in the chain, starting with the last"""
-## for act in reversed(self._actions):
-## act.undo()
-
-##class DisableWidgetAction(Action):
-## def __init__(self, target):
-## """Constructor
-## @param target target treeish
-## """
-## Action.__init__(self)
-## self._target = target
-## self._widget = None
-
-## def do(self):
-## """Action do"""
-## os = ObjectStore()
-## if os.activity:
-## self._widget = gtkutils.find_widget(os.activity, self._target)
-## if self._widget:
-## self._widget.set_sensitive(False)
-
-## def undo(self):
-## """Action undo"""
-## if self._widget:
-## self._widget.set_sensitive(True)
-
-
-##class TypeTextAction(Action):
-## """
-## Simulate a user typing text in a widget
-## Work on any widget that implements a insert_text method
-##
-## @param widget The treehish representation of the widget
-## @param text the text that is typed
-## """
-## def __init__(self, widget, text):
-## Action.__init__(self)
-##
-## self._widget = widget
-## self._text = text
-##
-## def do(self, **kwargs):
-## """
-## Type the text
-## """
-## widget = gtkutils.find_widget(ObjectStore().activity, self._widget)
-## if hasattr(widget, "insert_text"):
-## widget.insert_text(self._text, -1)
-##
-## def undo(self):
-## """
-## no undo
-## """
-## pass
-##
-##class ClickAction(Action):
-## """
-## Action that simulate a click on a widget
-## Work on any widget that implements a clicked() method
-##
-## @param widget The threehish representation of the widget
-## """
-## def __init__(self, widget):
-## Action.__init__(self)
-## self._widget = widget
-##
-## def do(self):
-## """
-## click the widget
-## """
-## widget = gtkutils.find_widget(ObjectStore().activity, self._widget)
-## if hasattr(widget, "clicked"):
-## widget.clicked()
-##
-## def undo(self):
-## """
-## No undo
-## """
-## pass
-
diff --git a/tutorius/addon.py b/tutorius/addon.py
index e311a65..15612c8 100644
--- a/tutorius/addon.py
+++ b/tutorius/addon.py
@@ -62,7 +62,6 @@ def create(name, *args, **kwargs):
except:
logging.error("Could not instantiate %s with parameters %s, %s"%(comp_metadata['name'],str(args), str(kwargs)))
return None
- return _cache[name]['class'](*args, **kwargs)
except KeyError:
logging.error("Addon not found for class '%s'", name)
return None