summaryrefslogtreecommitdiff
path: root/tests/test_qt_environment.py
blob: 08fccf4b943825a6568c9fc2f45158851ba0585c (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
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)