Ignore:
Timestamp:
Jun 21, 2016 8:07:33 AM (8 years ago)
Author:
Piotr Rozyczko <piotr.rozyczko@…>
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:
f82ab8c
Parents:
1042dba
Message:

More main window items, system close, update checker, doc viewer etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/UnitTesting/DataExplorerTest.py

    r1042dba r9e426c1  
    7272        loadButton = self.form.cmdLoad 
    7373 
    74         # Mock the system file open method 
    75         QtGui.QFileDialog.getOpenFileName = MagicMock(return_value=None) 
     74        filename = "cyl_400_20.txt" 
     75        # Initialize signal spy instances 
     76        spy_file_read = QtSignalSpy(self.form, self.form.communicate.fileReadSignal) 
     77 
     78        # Return no files. 
     79        QtGui.QFileDialog.getOpenFileNames = MagicMock(return_value=None) 
    7680 
    7781        # Click on the Load button 
     
    7983 
    8084        # Test the getOpenFileName() dialog called once 
    81         self.assertTrue(QtGui.QFileDialog.getOpenFileName.called) 
    82         QtGui.QFileDialog.getOpenFileName.assert_called_once() 
     85        self.assertTrue(QtGui.QFileDialog.getOpenFileNames.called) 
     86        QtGui.QFileDialog.getOpenFileNames.assert_called_once() 
     87 
     88        # Make sure the signal has not been emitted 
     89        self.assertEqual(spy_file_read.count(), 0) 
     90 
     91        # Now, return a single file 
     92        QtGui.QFileDialog.getOpenFileNames = MagicMock(return_value=filename) 
     93         
     94        # Click on the Load button 
     95        QTest.mouseClick(loadButton, Qt.LeftButton) 
     96 
     97        # Test the getOpenFileName() dialog called once 
     98        self.assertTrue(QtGui.QFileDialog.getOpenFileNames.called) 
     99        QtGui.QFileDialog.getOpenFileNames.assert_called_once() 
     100 
     101        # Expected one spy instance 
     102        self.assertEqual(spy_file_read.count(), 1) 
     103        self.assertIn(filename, str(spy_file_read.called()[0]['args'][0])) 
    83104 
    84105    def testDeleteButton(self): 
     
    131152        QTest.mouseClick(deleteButton, Qt.LeftButton) 
    132153 
    133  
    134154    def testSendToButton(self): 
    135155        """ 
     
    166186        # Assure the message box popped up 
    167187        QtGui.QMessageBox.assert_called_once() 
    168  
    169188 
    170189    def testDataSelection(self): 
     
    272291        Test the callback method updating the data object 
    273292        """ 
    274  
    275293        message="Loading Data Complete" 
    276294        data_dict = {"a1":Data1D()} 
Note: See TracChangeset for help on using the changeset viewer.