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

Source Code for Module test_suite.gui_tests.state

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2006-2012 Edward d'Auvergne                                   # 
 4  #                                                                             # 
 5  # This file is part of the program relax.                                     # 
 6  #                                                                             # 
 7  # relax 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 2 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # relax 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 relax; if not, write to the Free Software                        # 
19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
20  #                                                                             # 
21  ############################################################################### 
22   
23  # Python module imports. 
24  from os import F_OK, access, sep 
25  import wx 
26   
27  # relax module imports. 
28  from data import Relax_data_store; ds = Relax_data_store() 
29  from generic_fns.mol_res_spin import spin_loop 
30  from generic_fns.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.string_conv import int_to_gui, str_to_gui 
36  from gui.wizard import Wiz_window 
37   
38   
39 -class State(GuiTestCase):
40 """Class for testing various aspects specific to saved states.""" 41
42 - def test_old_state_loading(self):
43 """Test the loading of an old relax 1.3 save state with GUI information.""" 44 45 # Simulate the 'Open relax state' menu entry. 46 file = status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'saved_states' + sep + 'gui_analyses_1.3.bz2' 47 self.app.gui.state_load(file_name=file)
48 49
50 - def test_load_state_no_gui(self):
51 """Test the loading of a relax save state with no GUI data.""" 52 53 # Simulate the 'Open relax state' menu entry. 54 file = status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'model_free' + sep + 'OMP' + sep + 'final_results_trunc_1.3_v2' 55 self.app.gui.state_load(file_name=file) 56 57 # Show the pipe editor. 58 self.app.gui.show_pipe_editor(None) 59 60 # The menu (this is used to set the selected pipe). 61 self.app.gui.pipe_editor.menu(Fake_grid_cell_right_click()) 62 63 # Associated an auto-analysis with the data pipe. 64 self.app.gui.pipe_editor.associate_auto(None) 65 66 # The index. 67 index = 0 68 69 # Test that the model-free analysis tab is loaded. 70 self.assert_(not self.app.gui.analysis.init_state) 71 self.assertEqual(self.app.gui.analysis._num_analyses, 1) 72 self.assertEqual(len(self.app.gui.analysis._analyses), 1) 73 self.assertEqual(self.app.gui.analysis.notebook.GetPageCount(), 1) 74 self.assert_(self.app.gui.analysis._analyses[index].init_flag) 75 76 # Test the relax data store. 77 self.assert_(hasattr(ds, 'relax_gui')) 78 self.assertEqual(ds.relax_gui.analyses[index].analysis_name, 'Model-free') 79 self.assertEqual(ds.relax_gui.analyses[index].pipe_name, 'a')
80 81 82
83 -class Fake_grid_cell_right_click:
84 """Simulate a grid_cell_right_click event .""" 85
86 - def GetRow(self):
87 """Overwrite the GetRow() method.""" 88 89 # Return the first row. 90 return 0
91