Changeset c6fb57c in sasview for src/sas/qtgui/MainWindow/UnitTesting
- Timestamp:
- Nov 22, 2017 7:49:06 AM (7 years ago)
- Branches:
- ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- cb4d219
- Parents:
- 0580c77
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/UnitTesting/DataExplorerTest.py
- Property mode changed from 100755 to 100644
r53c771e rc6fb57c 26 26 import sas.qtgui.Plotting.PlotHelper as PlotHelper 27 27 28 if not QApplication.instance():29 28 #if not QApplication.instance(): 29 app = QApplication(sys.argv) 30 30 31 31 class DataExplorerTest(unittest.TestCase): … … 684 684 self.form.treeView.customContextMenuRequested.emit(rect) 685 685 686 # app.exec_() # debug687 688 686 # See that the menu has been shown 689 687 self.form.context_menu.exec_.assert_called_once() … … 805 803 pass 806 804 805 def notestDeleteItem(self): 806 """ 807 Delete selected item from data explorer 808 """ 809 810 # Mock the confirmation dialog with return=No 811 QMessageBox.question = MagicMock(return_value=QMessageBox.No) 812 813 # Populate the model 814 filename = ["cyl_400_20.txt", "cyl_400_20.txt", "cyl_400_20.txt"] 815 self.form.readData(filename) 816 817 # Assure the model contains three items 818 self.assertEqual(self.form.model.rowCount(), 3) 819 820 # Add an item to first file item 821 item1 = QtGui.QStandardItem("test") 822 item1.setCheckable(True) 823 self.form.model.item(0).appendRow(item1) 824 825 # Check the new item is in 826 827 self.assertTrue(self.form.model.item(0).hasChildren()) 828 829 #select_item = self.form.model.item(0).child(3) 830 select_item = self.form.model.item(0) 831 select_index = self.form.model.indexFromItem(select_item) 832 833 # Open up items 834 self.form.current_view.expandAll() 835 836 # Select the newly created item 837 self.form.current_view.selectionModel().select(select_index, QtCore.QItemSelectionModel.Rows) 838 839 # Attempt at deleting 840 self.form.deleteItem() 841 842 # Test the warning dialog called once 843 self.assertTrue(QMessageBox.question.called) 844 845 # Assure the model still contains the items 846 self.assertEqual(self.form.model.rowCount(), 3) 847 848 # Now, mock the confirmation dialog with return=Yes 849 QMessageBox.question = MagicMock(return_value=QMessageBox.Yes) 850 851 # Select the newly created item 852 self.form.current_view.selectionModel().select(select_index, QtCore.QItemSelectionModel.Rows) 853 # delete it. now for good 854 self.form.deleteItem() 855 856 # Test the warning dialog called once 857 self.assertTrue(QMessageBox.question.called) 858 859 # Assure the model contains no items 860 self.assertEqual(self.form.model.rowCount(), 3) 861 807 862 808 863 if __name__ == "__main__":
Note: See TracChangeset
for help on using the changeset viewer.