source: orange/Orange/OrangeCanvas/gui/tests/test_splashscreen.py @ 11123:6d803a180097

Revision 11123:6d803a180097, 1021 bytes checked in by Ales Erjavec <ales.erjavec@…>, 18 months ago (diff)

Added SplashScreen widget

Line 
1"""
2Test for splashscreen
3"""
4
5from datetime import datetime
6
7import pkg_resources
8
9from PyQt4.QtGui import QPixmap
10from PyQt4.QtCore import Qt, QRect
11
12from ..splashscreen import SplashScreen
13
14from ..test import QAppTestCase
15
16
17class TestSplashScreen(QAppTestCase):
18    def test_splashscreen(self):
19        splash = pkg_resources.resource_filename(
20                     "Orange.OrangeCanvas",
21                     "icons/orange-splash-screen.png"
22                 )
23
24        w = SplashScreen()
25        w.setPixmap(QPixmap(splash))
26        w.setTextRect(QRect(100, 100, 400, 50))
27
28        def advance_time():
29            now = datetime.now()
30            time = now.strftime("%c : %f")
31            w.showMessage(time, alignment=Qt.AlignCenter)
32            i = now.second % 3
33            rect = QRect(100, 100 + i * 20, 400, 50)
34            w.setTextRect(rect)
35            self.assertEqual((w.textRect(), rect))
36
37            self.singleShot(1, advance_time)
38
39        advance_time()
40
41        w.show()
42        self.app.exec_()
Note: See TracBrowser for help on using the repository browser.