-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_welcomeScreen.py
62 lines (42 loc) · 1.5 KB
/
test_welcomeScreen.py
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import unittest
import sys
from PyQt5.QtWidgets import QApplication
from PyQt5 import uic, Qt
from PyQt5.QtWidgets import QDialog
from PyQt5.QtTest import QTest
from PyQt5.QtCore import Qt
class WelcomeScreen(QDialog):
"""
This is a demo class for the first welcome screen.
This class loads the ui file in order to generate the interface for the first welcome
screen. It determines what screen to show next when the enter button is clicked based
on whether there's a new user or returning user.
"""
def __init__(self):
"""
The constructor for welcomeScreen class.
"""
super(WelcomeScreen, self).__init__()
uic.loadUi("welcomescreen.ui", self)
self.login.clicked.connect(self.goToNextPage)
self.show()
def goToNextPage(self):
"""
The function to go to the next page based on the conditions met.
"""
print("Next page is opened.")
class TestGUI(unittest.TestCase):
"""
This is a class for testing the widgets of the welcome screen interface.
This class loads the ui file in order to generate the interface and tests the different features
the user may use on this interface.
"""
def testWidgets(self):
"""
The function to test the functionality of the enter button.
"""
app = QApplication(sys.argv)
testObject = WelcomeScreen()
QTest.mouseClick(testObject.login, Qt.LeftButton)
if __name__ == "__main__":
unittest.main()