Beispiel #1
0
 def testCancelPressed(self):
     """Check that the widget is closed"""
     with mock.patch('qgistester.tests.tests', self.tests):
         ts = TestSelector()
         ts.show()
         self.assertTrue(ts.isVisible())
         ts.cancelPressed()
         self.assertFalse(ts.isVisible())
Beispiel #2
0
 def testCancelPressed(self):
     """check the widget is closed."""
     with mock.patch('qgistester.tests.tests', self.tests):
         ts = TestSelector()
         ts.show()  # dlg.resultsTree is a QTreeWidget
         # do test
         self.assertTrue(ts.isVisible())
         ts.cancelPressed()
         self.assertFalse(ts.isVisible())
Beispiel #3
0
 def testOkPressed(self):
     """check the list of checked tests ar added to test suite."""
     with mock.patch('qgistester.tests.tests', self.tests):
         # do test 1: all selected
         ts = TestSelector()
         ts.show()  # dlg.resultsTree is a QTreeWidget
         self.assertTrue(ts.isVisible())
         ts.okPressed()
         self.assertEqual(ts.tests[0], self.tests[0])
         self.assertEqual(ts.tests[1], self.tests[1])
         self.assertEqual(ts.tests[2], self.tests[2])
         self.assertFalse(ts.isVisible())
         # do test 1: uncheck the middle test
         ts = TestSelector()
         ts.show()  # dlg.resultsTree is a QTreeWidget
         self.assertTrue(ts.isVisible())
         ts.testsTree.topLevelItem(0).child(1).setCheckState(0, False)
         ts.okPressed()
         self.assertEqual(ts.tests[0], self.tests[0])
         self.assertEqual(ts.tests[1], self.tests[2])
         self.assertFalse(ts.isVisible())
         # do test 1: uncheck all
         ts = TestSelector()
         ts.show()  # dlg.resultsTree is a QTreeWidget
         self.assertTrue(ts.isVisible())
         ts.testsTree.topLevelItem(0).child(0).setCheckState(0, False)
         ts.testsTree.topLevelItem(0).child(1).setCheckState(0, False)
         ts.testsTree.topLevelItem(0).child(2).setCheckState(0, False)
         ts.okPressed()
         self.assertEqual(len(ts.tests), 0)
         self.assertFalse(ts.isVisible())
Beispiel #4
0
    def testOkPressed(self):
        """Check that selected tests are added to the suite"""
        with mock.patch('qgistester.tests.tests', self.tests):
            ts = TestSelector()
            ts.show()
            self.assertTrue(ts.isVisible())
            ts.okPressed()
            # no tests selected by default
            self.assertEqual(len(ts.tests), 0)
            self.assertFalse(ts.isVisible())

            # select all tests
            ts = TestSelector()
            ts.show()
            self.assertTrue(ts.isVisible())
            ts.checkTests(lambda t: Qt.Checked)
            ts.okPressed()
            self.assertEqual(ts.tests[0], self.tests[0])
            self.assertEqual(ts.tests[1], self.tests[1])
            self.assertEqual(ts.tests[2], self.tests[2])
            self.assertFalse(ts.isVisible())

            # select 2 tests out of 3 available
            ts = TestSelector()
            ts.show()
            self.assertTrue(ts.isVisible())
            ts.checkTests(lambda t: Qt.Checked)
            ts.testsTree.topLevelItem(0).child(1).child(0).child(
                0).setCheckState(0, False)
            ts.okPressed()
            self.assertEqual(ts.tests[0], self.tests[0])
            self.assertEqual(ts.tests[1], self.tests[2])
            self.assertFalse(ts.isVisible())