Package test_suite :: Package gui_tests :: Module general
[hide private]
[frames] | no frames]

Source Code for Module test_suite.gui_tests.general

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2014-2015 Edward d'Auvergne                                   # 
  4  #                                                                             # 
  5  # This file is part of the program relax (http://www.nmr-relax.com).          # 
  6  #                                                                             # 
  7  # This program is free software: you can redistribute it and/or modify        # 
  8  # it under the terms of the GNU General Public License as published by        # 
  9  # the Free Software Foundation, either version 3 of the License, or           # 
 10  # (at your option) any later version.                                         # 
 11  #                                                                             # 
 12  # This program is distributed in the hope that it will be useful,             # 
 13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
 14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
 15  # GNU General Public License for more details.                                # 
 16  #                                                                             # 
 17  # You should have received a copy of the GNU General Public License           # 
 18  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
 19  #                                                                             # 
 20  ############################################################################### 
 21   
 22  # Module docstring. 
 23  """Generic GUI tests.""" 
 24   
 25  # Python module imports. 
 26  import wx 
 27   
 28  # relax module imports. 
 29  from pipe_control.pipes import cdp_name 
 30  from status import Status; status = Status() 
 31  from test_suite.gui_tests.base_classes import GuiTestCase 
 32   
 33  # relax GUI imports. 
 34  from gui.interpreter import Interpreter; interpreter = Interpreter() 
 35   
 36   
37 -class General(GuiTestCase):
38 """Class for testing general GUI operations.""" 39
40 - def __init__(self, methodName=None):
41 """Set up the test case class for the system tests.""" 42 43 # Execute the base __init__ methods. 44 super(General, self).__init__(methodName) 45 46 # Tests to skip. 47 blacklist = [ 48 'test_new_analysis_wizard_memory_leak' 49 ] 50 51 # Skip the blacklisted tests. 52 if methodName in blacklist: 53 status.skipped_tests.append([methodName, None, self._skip_type])
54 55
57 """Catch U{bug #20479<https://web.archive.org/web/https://gna.org/bugs/?20479>}, the failure to switch pipes when closing non-last tabs.""" 58 59 # NOE tab: Simulate the new analysis wizard. 60 analysis = self.new_analysis_wizard(analysis_type='noe', analysis_name='NOE test', pipe_name='noe', pipe_bundle='noe bundle') 61 62 # Mf tab: Simulate the new analysis wizard. 63 analysis = self.new_analysis_wizard(analysis_type='mf', analysis_name='Mf test', pipe_name='mf', pipe_bundle='mf bundle') 64 65 # NOE tab: Switch back. 66 self.app.gui.analysis.switch_page(index=0) 67 68 # NOE tab: Closure. 69 self.app.gui.analysis.delete_analysis(0) 70 71 # Check that the Mf data pipe is now the current pipe. 72 self.assertEqual(cdp_name(), 'mf')
73 74
76 """Catch U{bug #23187<https://web.archive.org/web/https://gna.org/bugs/?23187>}, deleting residue in GUI, and then open spin viewer crashes relax.""" 77 78 # Mf tab: Simulate the new analysis wizard. 79 analysis = self.new_analysis_wizard(analysis_type='mf', analysis_name='Mf test', pipe_name='mf', pipe_bundle='mf bundle') 80 81 # Create some residues. 82 self._execute_uf(uf_name='residue.create', res_num=1) 83 self._execute_uf(uf_name='residue.create', res_num=2) 84 interpreter.flush() # Required because of the asynchronous uf call. 85 86 # Launch the spin viewer window. 87 self.app.gui.show_tree() 88 89 # Close the spin viewer window. 90 self.app.gui.spin_viewer.handler_close() 91 92 # Delete residue 2. 93 self._execute_uf(uf_name='residue.delete', res_id=":2") 94 interpreter.flush() # Required because of the asynchronous uf call. 95 96 # Launch the spin viewer window. 97 self.app.gui.show_tree()
98 99
101 """Test for memory leaks in the new analysis wizard.""" 102 103 # A large loop (to try to reach the USER Object limit in MS Windows). 104 for i in range(100): 105 # Printout for debugging. 106 print("Analysis wizard number %i." % (i+1)) 107 108 # Simulate the menu selection, but don't destroy the GUI element. 109 self.app.gui.analysis.menu_new(None, destroy=False) 110 111 # Wizard cleanup. 112 wx.Yield() 113 self.app.gui.analysis.new_wizard.Destroy() 114 del self.app.gui.analysis.new_wizard
115