mailr15885 - /1.3/test_suite/gui_tests/base_classes.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on May 02, 2012 - 21:26:
Author: bugman
Date: Wed May  2 21:26:54 2012
New Revision: 15885

URL: http://svn.gna.org/viewcvs/relax?rev=15885&view=rev
Log:
Created the GUI test base method execute_uf() for executing a user function.

This is an interface which will massively simplify the creation of GUI tests, 
so that they can be
almost the same as normal relax scripts.  This will allow for the porting of 
most of the system test
scripts into GUI tests.  This however requires the use of the new wizard page 
element_*() methods
to create the GUI elements.


Modified:
    1.3/test_suite/gui_tests/base_classes.py

Modified: 1.3/test_suite/gui_tests/base_classes.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/test_suite/gui_tests/base_classes.py?rev=15885&r1=15884&r2=15885&view=diff
==============================================================================
--- 1.3/test_suite/gui_tests/base_classes.py (original)
+++ 1.3/test_suite/gui_tests/base_classes.py Wed May  2 21:26:54 2012
@@ -37,8 +37,10 @@
 from data import Relax_data_store; ds = Relax_data_store()
 from data.gui import Gui
 from generic_fns.reset import reset
-from prompt.interpreter import Interpreter
 from status import Status; status = Status()
+
+# relax GUI module imports.
+from gui.interpreter import Interpreter; interpreter = Interpreter()
 
 
 class GuiTestCase(TestCase):
@@ -49,11 +51,6 @@
 
         # Execute the TestCase __init__ method.
         super(GuiTestCase, self).__init__(methodName)
-
-        # Load the interpreter.
-        self.interpreter = Interpreter(show_script=False, quit=False, 
raise_relax_error=True)
-        self.interpreter.populate_self()
-        self.interpreter.on(verbose=False)
 
         # Get the wx app, if the test suite is launched from the gui.
         self.app = wx.GetApp()
@@ -78,6 +75,31 @@
         # No exception.
         except Queue.Empty:
             pass
+
+
+    def execute_uf(self, page=None, **kargs):
+        """Execute the given user function.
+
+        @keyword page:  The user function page.
+        @type page:     Wizard page
+        """
+
+        # Create and store a wizard instance to be used in all user function 
pages (if needed).
+        if not hasattr(self, '_wizard'):
+            self._wizard = Wiz_window(self.app.gui)
+
+        # Initialise the page (adding it to the wizard).
+        uf_page = page(self._wizard)
+
+        # Set all the values.
+        for key in kargs:
+            uf_page.SetValue(key=key, value=kargs[key])
+
+        # Execute the user function.
+        uf_page.on_execute()
+
+        # Flush the interpreter to force synchronous user functions 
operation.
+        interpreter.flush()
 
 
     def setUp(self):
@@ -162,5 +184,9 @@
         # Recreate the GUI data object.
         ds.relax_gui = Gui()
 
+        # Delete any wizard objects.
+        if hasattr(self, '_wizard'):
+            del self._wizard
+
         # Flush all wx events to make sure the GUI is ready for the next 
test.
         wx.Yield()




Related Messages


Powered by MHonArc, Updated Wed May 02 21:40:01 2012