Author: bugman Date: Mon Feb 24 09:51:06 2014 New Revision: 22258 URL: http://svn.gna.org/viewcvs/relax?rev=22258&view=rev Log: Created the General.test_bug_21720_pipe_switching_with_tab_closure GUI test. This is to catch bug #21720 (https://gna.org/bugs/?21720), the failure to set the current data pipe in the GUI when the current and non-last analysis tab is closed. The test replicates the steps as outlined in the bug report. Added: trunk/test_suite/gui_tests/general.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=22258&r1=22257&r2=22258&view=diff ============================================================================== --- trunk/test_suite/gui_tests/__init__.py (original) +++ trunk/test_suite/gui_tests/__init__.py Mon Feb 24 09:51:06 2014 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2006-2013 Edward d'Auvergne # +# Copyright (C) 2006-2014 Edward d'Auvergne # # # # This file is part of the program relax (http://www.nmr-relax.com). # # # @@ -36,6 +36,7 @@ from test_suite.gui_tests.consistency_tests import Ct from test_suite.gui_tests.dead_uf_pages import Dead_uf_pages from test_suite.gui_tests.frame_order import Frame_order +from test_suite.gui_tests.general import General from test_suite.gui_tests.interatomic import Interatomic from test_suite.gui_tests.jw_mapping import Jw_mapping from test_suite.gui_tests.model_free import Mf @@ -51,6 +52,7 @@ __all__ = ['bmrb', 'consistency_tests', + 'gui', 'interatomic', 'jw_mapping', 'model_free', @@ -118,6 +120,7 @@ suite_array.append(TestLoader().loadTestsFromTestCase(Ct)) suite_array.append(TestLoader().loadTestsFromTestCase(Dead_uf_pages)) suite_array.append(TestLoader().loadTestsFromTestCase(Frame_order)) + suite_array.append(TestLoader().loadTestsFromTestCase(General)) suite_array.append(TestLoader().loadTestsFromTestCase(Interatomic)) suite_array.append(TestLoader().loadTestsFromTestCase(Jw_mapping)) suite_array.append(TestLoader().loadTestsFromTestCase(Mf)) Added: trunk/test_suite/gui_tests/general.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/gui_tests/general.py?rev=22258&view=auto ============================================================================== --- trunk/test_suite/gui_tests/general.py (added) +++ trunk/test_suite/gui_tests/general.py Mon Feb 24 09:51:06 2014 @@ -1,0 +1,81 @@ +############################################################################### +# # +# Copyright (C) 2014 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 docstring. +"""Generic GUI tests.""" + +# relax module imports. +from pipe_control.pipes import cdp_name +from status import Status; status = Status() +from test_suite.gui_tests.base_classes import GuiTestCase + +# relax GUI imports. +from gui.string_conv import str_to_gui + + +class General(GuiTestCase): + """Class for testing general GUI operations.""" + + def test_bug_21720_pipe_switching_with_tab_closure(self): + """Catch U{bug #20479<https://gna.org/bugs/?20479>}, the failure to switch pipes when closing non-last tabs.""" + + # NOE tab: Simulate the new analysis wizard. + self.app.gui.analysis.menu_new(None) + page = self.app.gui.analysis.new_wizard.wizard.get_page(0) + page.select_noe(None) + page.analysis_name.SetValue(str_to_gui("NOE test")) + self.app.gui.analysis.new_wizard.wizard._go_next(None) + page = self.app.gui.analysis.new_wizard.wizard.get_page(1) + page.pipe_name.SetValue(str_to_gui('noe')) + page.pipe_bundle.SetValue(str_to_gui('noe bundle')) + self.app.gui.analysis.new_wizard.wizard._go_next(None) + + # NOE tab: Get the data. + analysis_type, analysis_name, pipe_name, pipe_bundle, uf_exec = self.app.gui.analysis.new_wizard.get_data() + + # NOE tab: Set up the analysis. + self.app.gui.analysis.new_analysis(analysis_type=analysis_type, analysis_name=analysis_name, pipe_name=pipe_name, pipe_bundle=pipe_bundle) + + # R1 tab: Simulate the new analysis wizard. + self.app.gui.analysis.menu_new(None) + page = self.app.gui.analysis.new_wizard.wizard.get_page(0) + page.select_r1(None) + page.analysis_name.SetValue(str_to_gui("R1 test")) + self.app.gui.analysis.new_wizard.wizard._go_next(None) + page = self.app.gui.analysis.new_wizard.wizard.get_page(1) + page.pipe_name.SetValue(str_to_gui('r1')) + page.pipe_bundle.SetValue(str_to_gui('r1 bundle')) + self.app.gui.analysis.new_wizard.wizard._go_next(None) + + # R1 tab: Get the data. + analysis_type, analysis_name, pipe_name, pipe_bundle, uf_exec = self.app.gui.analysis.new_wizard.get_data() + + # R1 tab: Set up the analysis. + self.app.gui.analysis.new_analysis(analysis_type=analysis_type, analysis_name=analysis_name, pipe_name=pipe_name, pipe_bundle=pipe_bundle) + + # NOE tab: Switch back. + self.app.gui.analysis.switch_page(index=0) + + # NOE tab: Closure. + self.app.gui.analysis.delete_analysis(0) + + # Check that the R1 data pipe is now the current pipe. + self.assertEqual(cdp_name(), 'r1')