2020-12-07 16:48:46 +01:00
|
|
|
from src.python.ui.mainwindow_ui import Ui_MainWindow
|
2020-12-21 19:08:28 +01:00
|
|
|
from src.python.classes.mainwindow import MainWindow
|
2020-12-07 16:48:46 +01:00
|
|
|
import unittest
|
2020-12-21 19:08:28 +01:00
|
|
|
from PyQt5.QtWidgets import QApplication, QDialog, QLabel
|
|
|
|
import sys
|
2020-12-07 16:48:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Test_Ui_MainWindow(unittest.TestCase):
|
2020-12-21 19:08:28 +01:00
|
|
|
app = QApplication(sys.argv)
|
2020-12-07 16:48:46 +01:00
|
|
|
|
|
|
|
def setUp(self) -> None:
|
|
|
|
pass
|
|
|
|
|
|
|
|
def tearDown(self) -> None:
|
|
|
|
pass
|
|
|
|
|
2020-12-21 19:08:28 +01:00
|
|
|
def test_create_mainwindow(self):
|
2020-12-07 16:48:46 +01:00
|
|
|
ui_mainwindow = Ui_MainWindow()
|
|
|
|
self.assertIsInstance(ui_mainwindow, Ui_MainWindow)
|
|
|
|
|
2020-12-21 19:08:28 +01:00
|
|
|
def test_create_dialog(self):
|
|
|
|
mainwindow = MainWindow()
|
|
|
|
title = "test create dialog"
|
|
|
|
msg = "test msg"
|
|
|
|
dialog: QDialog = mainwindow.create_custom_dialog(title=title, msg=msg)
|
|
|
|
self.assertIsInstance(dialog, QDialog)
|
|
|
|
self.assertEqual(dialog.windowTitle(), title)
|
|
|
|
self.assertEqual(dialog.findChild(QLabel, name='message_box').text(), msg)
|
|
|
|
|
2020-12-07 16:48:46 +01:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|