Author: bugman Date: Tue Jul 10 08:11:40 2012 New Revision: 17214 URL: http://svn.gna.org/viewcvs/relax?rev=17214&view=rev Log: Redesign of the setUp() and tearDown() methods of the GUI tests. This is needed as the current design does not work under MS Windows! Instead of created a new wx app for each test (this dies in Windows as it looks like only a limited number of toolbars can be created), only one app is created and is recycled. This design better mimics GUI usage anyway. This change uncovers a few GUI bugs not caught by the previous design. Modified: trunk/test_suite/gui_tests/base_classes.py Modified: trunk/test_suite/gui_tests/base_classes.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/gui_tests/base_classes.py?rev=17214&r1=17213&r2=17214&view=diff ============================================================================== --- trunk/test_suite/gui_tests/base_classes.py (original) +++ trunk/test_suite/gui_tests/base_classes.py Tue Jul 10 08:11:40 2012 @@ -63,14 +63,6 @@ # A string used for classifying skipped tests. self._skip_type = 'gui' - # Get the wx app, if the test suite is launched from the gui. - self.app = wx.GetApp() - - # Flag for the GUI. - self._gui_launch = False - if self.app != None: - self._gui_launch = True - def _execute_uf(self, *args, **kargs): """Execute the given user function. @@ -193,8 +185,12 @@ # Create a temporary directory for the results. ds.tmpdir = mkdtemp() - # Start the GUI if not launched from the GUI. - if not self._gui_launch: + # Get the wx app, if it exists. + self.app = wx.GetApp() + + # Create the app if needed. + if self.app == None: + # Initialise. self.app = wx.App(redirect=False) # relax GUI imports (here to prevent a circular import from the test suite in the GUI). @@ -249,24 +245,15 @@ # Reset relax. reset() - # Reset the observers. - status._setup_observers() - - # Destroy some GUI windows, if open. + # Close some GUI windows, if open. windows = ['pipe_editor', 'relax_prompt', 'results_viewer', 'spin_viewer'] for window in windows: if hasattr(self.app.gui, window): # Get the object. win_obj = getattr(self.app.gui, window) - # Destroy the wxWidget part. - win_obj.Destroy() - - # Destroy the Python object part. - delattr(self.app.gui, window) - - # Delete the app. - del self.app + # Close the window. + win_obj.Close() # Flush all wx events to make sure the GUI is ready for the next test. wx.Yield()