summaryrefslogtreecommitdiff
path: root/tests/test_qt_environment.py
blob: e90d527f85b0a74c8dbc739d6eacc77c9c95b7b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import sys
import unittest

import sip
#sip.setapi('QVariant', 2)

from PyQt4 import QtGui


class TestWin(QtGui.QMainWindow):
    """
    a _really_ minimal test window,
    with only one tray icon
    """
    def __init__(self):
        super(TestWin, self).__init__()
        self.trayIcon = QtGui.QSystemTrayIcon(self)


class QtEnvironTest(unittest.TestCase):
    """
    Test we're running a proper qt environment
    """

    def setUp(self):
        self.app = QtGui.QApplication(sys.argv)
        self.win = TestWin()

    def tearDown(self):
        del(self.win)
        del(self.app)

    def test_system_has_systray(self):
        """
        does system have systray available?
        """
        self.assertEqual(
            self.win.trayIcon.isSystemTrayAvailable(),
            True)


if __name__ == "__main__":
    unittest.main()