source: orange/Orange/OrangeCanvas/canvas/items/tests/__init__.py @ 11102:1ae099099c23

Revision 11102:1ae099099c23, 1.2 KB checked in by Ales Erjavec <ales.erjavec@…>, 19 months ago (diff)

Added GraphicsItems representing the items in the workflow scheme.

Line 
1"""
2Tests for items
3"""
4import sys
5import traceback
6import unittest
7
8
9class TestItems(unittest.TestCase):
10    def setUp(self):
11        import logging
12
13        from PyQt4.QtGui import QApplication, QGraphicsScene, QGraphicsView, \
14                                QPainter
15
16        from PyQt4.QtCore import QTimer
17
18        logging.basicConfig()
19
20        self.app = QApplication([])
21        self.scene = QGraphicsScene()
22        self.view = QGraphicsView(self.scene)
23        self.view.setRenderHints(
24            QPainter.Antialiasing | \
25            QPainter.SmoothPixmapTransform | \
26            QPainter.TextAntialiasing
27            )
28        self.view.resize(500, 300)
29        self.view.show()
30        QTimer.singleShot(10000, self.app.exit)
31
32        def my_excepthook(*args):
33            sys.setrecursionlimit(1010)
34            traceback.print_exc(limit=4)
35
36        self._orig_excepthook = sys.excepthook
37        sys.excepthook = my_excepthook
38        self.singleShot = QTimer.singleShot
39
40    def tearDown(self):
41        self.scene.clear()
42        self.scene.deleteLater()
43        self.view.deleteLater()
44        del self.scene
45        del self.view
46        self.app.processEvents()
47        del self.app
48        sys.excepthook = self._orig_excepthook
Note: See TracBrowser for help on using the repository browser.