Author: bugman Date: Wed Sep 19 10:55:30 2012 New Revision: 17499 URL: http://svn.gna.org/viewcvs/relax?rev=17499&view=rev Log: Created the User_functions.test_structure_pdb_read GUI test for checking the sequence editor window. This new user function GUI testing class is to be used for testing out the special GUI elements not invoked within the unit testing. The test_structure_pdb_read() test specifically shows a number of failures of the sequence editor window. Added: trunk/test_suite/gui_tests/test_user_functions.py Modified: trunk/test_suite/gui_tests/__init__.py Modified: trunk/test_suite/gui_tests/__init__.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/gui_tests/__init__.py?rev=17499&r1=17498&r2=17499&view=diff ============================================================================== --- trunk/test_suite/gui_tests/__init__.py (original) +++ trunk/test_suite/gui_tests/__init__.py Wed Sep 19 10:55:30 2012 @@ -44,6 +44,7 @@ from pipes import Pipes from rx import Rx from state import State +from test_suite.gui_tests.test_user_functions import User_functions from test_suite.relax_test_loader import RelaxTestLoader as TestLoader @@ -124,6 +125,7 @@ suite_array.append(TestLoader().loadTestsFromTestCase(Pipes)) suite_array.append(TestLoader().loadTestsFromTestCase(Rx)) suite_array.append(TestLoader().loadTestsFromTestCase(State)) + suite_array.append(TestLoader().loadTestsFromTestCase(User_functions)) # Group all tests together. full_suite = TestSuite(suite_array) Added: trunk/test_suite/gui_tests/test_user_functions.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/gui_tests/test_user_functions.py?rev=17499&view=auto ============================================================================== --- trunk/test_suite/gui_tests/test_user_functions.py (added) +++ trunk/test_suite/gui_tests/test_user_functions.py Wed Sep 19 10:55:30 2012 @@ -1,0 +1,89 @@ +############################################################################### +# # +# Copyright (C) 2012 Edward d'Auvergne # +# # +# This file is part of the program relax (http://www.nmr-relax.com). # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see <http://www.gnu.org/licenses/>. # +# # +############################################################################### + +"""Module for testing the special features of the user function GUI windows.""" + +# Python module imports. +from os import sep + +# relax module imports. +from status import Status; status = Status() +from test_suite.gui_tests.base_classes import GuiTestCase + +# relax GUI imports. +from gui.interpreter import Interpreter; interpreter = Interpreter() +from gui.string_conv import int_to_gui, str_to_gui +from gui.uf_objects import Uf_storage; uf_store = Uf_storage() + + +class User_functions(GuiTestCase): + """Class for testing special features of the user function GUI windows.""" + + def test_structure_pdb_read(self): + """Test the full operation of the structure.read_pdb user function GUI window.""" + + # Open the pipe.create user function window, set the args and execute. + uf = uf_store['pipe.create'] + uf._sync = True + uf.create_wizard(parent=self.app.gui) + uf.page.SetValue('pipe_name', str_to_gui('PDB reading test')) + uf.page.SetValue('pipe_type', str_to_gui('mf')) + uf.wizard._go_next(None) + + # Open the structure.read_pdb user function window. + uf = uf_store['structure.read_pdb'] + uf._sync = True + uf.create_wizard(parent=self.app.gui) + + # The PDB file to operate on. + file = status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'structures' + sep + 'trunc_ubi_pcs.pdb' + uf.page.SetValue('file', str_to_gui(file)) + + # Set the models to read. + uf.page.uf_args['read_model'].selection_win_show() + uf.page.uf_args['read_model'].sel_win.append_row(None) + uf.page.uf_args['read_model'].sel_win.append_row(None) + uf.page.uf_args['read_model'].sel_win.append_row(None) + uf.page.uf_args['read_model'].sel_win.sequence.SetStringItem(index=0, col=0, label=int_to_gui(2)) + uf.page.uf_args['read_model'].sel_win.sequence.SetStringItem(index=1, col=0, label=int_to_gui(4)) + uf.page.uf_args['read_model'].selection_win_data() + + # Renumber the models. + uf.page.uf_args['set_model_num'].selection_win_show() + uf.page.uf_args['set_model_num'].sel_win.append_row(None) + uf.page.uf_args['set_model_num'].sel_win.append_row(None) + uf.page.uf_args['set_model_num'].sel_win.sequence.SetStringItem(index=0, col=0, label=int_to_gui(1)) + uf.page.uf_args['set_model_num'].sel_win.sequence.SetStringItem(index=1, col=0, label=int_to_gui(3)) + uf.page.uf_args['set_model_num'].selection_win_data() + + # GUI data checks. + self.assertEqual(uf.page.uf_args['read_model'].GetValue(), [2, 4]) + self.assertEqual(uf.page.uf_args['set_model_num'].GetValue(), [1, 2]) + + # Execute the user function. + uf.wizard._go_next(None) + + # Check the structural data. + self.assert_(hasattr(cdp, 'structure')) + self.assert_(hasattr(cdp.structure, 'structural_data')) + self.assertEqual(len(cdp.structure.structural_data), 2) + self.assertEqual(cdp.structure.structural_data[0].num, 1) + self.assertEqual(cdp.structure.structural_data[1].num, 3)