MagicPodcast/tests/gui_tests/test_mainwindow_ui.py

33 lines
944 B
Python

from src.python.ui.mainwindow_ui import Ui_MainWindow
from src.python.classes.mainwindow import MainWindow
import unittest
from PyQt5.QtWidgets import QApplication, QDialog, QLabel
import sys
class Test_Ui_MainWindow(unittest.TestCase):
app = QApplication(sys.argv)
def setUp(self) -> None:
pass
def tearDown(self) -> None:
pass
def test_create_mainwindow(self):
ui_mainwindow = Ui_MainWindow()
self.assertIsInstance(ui_mainwindow, Ui_MainWindow)
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)
if __name__ == '__main__':
unittest.main()