source: orange/Orange/OrangeCanvas/gui/test.py @ 11100:cf6f6744dd9b

Revision 11100:cf6f6744dd9b, 1008 bytes checked in by Ales Erjavec <ales.erjavec@…>, 19 months ago (diff)

Added gui widget toolkit.

Line 
1"""
2Basic Qt testing framework
3==========================
4"""
5
6try:
7    import unittest2 as unittest
8except ImportError:
9    import unittest
10
11import gc
12
13from PyQt4.QtGui import QApplication
14from PyQt4.QtCore import QCoreApplication, QTimer
15
16
17class QAppTestCase(unittest.TestCase):
18    def setUp(self):
19        self.app = QApplication([])
20        QTimer.singleShot(20000, self.app.exit)
21
22    def tearDown(self):
23        if hasattr(self, "scene"):
24            self.scene.clear()
25            self.scene.deleteLater()
26            self.app.processEvents()
27            del self.scene
28        self.app.processEvents()
29        del self.app
30        gc.collect()
31
32    def singleShot(self, *args):
33        QTimer.singleShot(*args)
34
35
36class QCoreAppTestCase(unittest.TestCase):
37    def setUp(self):
38        self.app = QCoreApplication([])
39        QTimer.singleShot(20000, self.app.exit)
40
41    def tearDown(self):
42        del self.app
43        gc.collect()
44
45    def singleShot(self, *args):
46        QTimer.singleShot(*args)
Note: See TracBrowser for help on using the repository browser.