예제 #1
0
 def test_start_main_window(self):
     self.test_case.create_study()
     self.test_case.add_subjects()
     self.test_case.study.clear_results()
     main_window = MainWindow(self.test_case.analysis_type)
     self.keep_widget_alive(main_window)
     main_window.set_study(self.test_case.study)
     main_window.show()
     model = main_window.study_view.tableview.model()
     subjectnames = [model.data(model.index(i, model.SUBJECTNAME_COL)) \
                     for i in range(model.rowCount())]
     
     main_window.close()
     self.assertEqual(self.test_case.subjectnames, subjectnames)
예제 #2
0
 def test_create_new_study(self):
     main_window = MainWindow(self.test_case.analysis_type)
     self.keep_widget_alive(main_window)
     main_window.show()
     QtTest.QTest.keyClicks(main_window, "n", QtCore.Qt.ControlModifier, 10 )
                                 
     dialog = main_window.findChild(QtGui.QDialog, 'StudyEditorDialog')
     TestStudyGui.action_define_new_study_content(dialog, 
                                                  self.test_case.studyname, 
                                                  self.test_case.output_directory,
                                                  self.test_case.filenames)
     import_dialog = main_window.findChild(QtGui.QDialog, 'ImportSubjectsDialog')
     close_button = import_dialog.ui.close_buttonBox
     while not close_button.isEnabled():
         time.sleep(1)
         QtGui.QApplication.processEvents()
     QtTest.QTest.mouseClick(close_button, QtCore.Qt.LeftButton)
     
     self.assertEqual(main_window.study.name, self.test_case.studyname)
     self.assertEqual(main_window.study.output_directory, self.test_case.output_directory)
     self._assert_subjects_exist(main_window.study)
     main_window.close()