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