Author: bugman Date: Wed May 28 20:25:54 2014 New Revision: 23571 URL: http://svn.gna.org/viewcvs/relax?rev=23571&view=rev Log: Created the User_functions.test_spectrum_read_intensities GUI test to catch bug #22105. This is reported at https://gna.org/bugs/?22105. The problem is that a single file name is split up into many files when the file selection button is clicked, one for each character of the file name. Modified: trunk/test_suite/gui_tests/test_user_functions.py Modified: 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=23571&r1=23570&r2=23571&view=diff ============================================================================== --- trunk/test_suite/gui_tests/test_user_functions.py (original) +++ trunk/test_suite/gui_tests/test_user_functions.py Wed May 28 20:25:54 2014 @@ -142,6 +142,53 @@ self.assertEqual(points[0][0], 1.0) self.assertEqual(points[0][1], None) self.assertEqual(points[0][2], None) + + + def test_spectrum_read_intensities(self): + """Test the operation of the spectrum.read_intensities user function GUI window.""" + + # Open the spectrum.read_intensities user function window. + uf = uf_store['spectrum.read_intensities'] + uf._sync = True + uf.create_wizard(parent=self.app.gui) + + # Set the y-value of a single pos, and check. + uf.page.uf_args['file'].selection_win_show() + uf.page.uf_args['file'].sel_win.SetValue('test_file') + uf.page.uf_args['file'].selection_win_data() + file = uf.page.uf_args['file'].GetValue() + print("File names: %s" % file) + self.assert_(isinstance(file, str)) + self.assertEqual(file, 'test_file') + + # Set the file to nothing in the wizard, open the Sequence window, close the window, and check that None comes back. + uf.page.uf_args['file'].SetValue(str_to_gui('')) + uf.page.uf_args['file'].selection_win_show() + uf.page.uf_args['file'].selection_win_data() + file = uf.page.uf_args['file'].GetValue() + print("File names: %s" % file) + self.assertEqual(file, None) + + # Set a valid file list in the wizard, open and close the Sequence window (twice), and check that the file comes back. + uf.page.uf_args['file'].SetValue(str_to_gui("['test1', 'test2']")) + uf.page.uf_args['file'].selection_win_show() + uf.page.uf_args['file'].selection_win_data() + uf.page.uf_args['file'].selection_win_show() + uf.page.uf_args['file'].selection_win_data() + file = uf.page.uf_args['file'].GetValue() + print("File names: %s" % file) + self.assertEqual(len(file), 2) + self.assertEqual(file[0], 'test1') + self.assertEqual(file[1], 'test2') + + # Set the file to a number of invalid values, checking that they are ignored. + for val in ["['1', '2', '3'", "['1'", "[['1'], ['2'], ['1', '2', '3']]"]: + uf.page.uf_args['file'].SetValue(str_to_gui(val)) + uf.page.uf_args['file'].selection_win_show() + uf.page.uf_args['file'].selection_win_data() + file = uf.page.uf_args['file'].GetValue() + print("Invalid file: %s\nFile names: %s" % (val, file)) + self.assertEqual(file, None) def test_structure_add_atom(self):