Skip to content
Snippets Groups Projects
Commit 19e66138 authored by Thomas Holene Løkkeborg's avatar Thomas Holene Løkkeborg
Browse files

#95 legger til ny modul i oppløsningstest

Oppløsningstest OK på 1920 x 1080 (100% & 125%) og 800 x 600
parent b94f17a5
No related branches found
No related tags found
1 merge request!74#95 Forhåndsavtalte koder
Pipeline #83479 failed
......@@ -19,13 +19,30 @@ from soitool.modules.module_authentication_board import (
AuthenticationBoardModule,
)
from soitool.modules.module_subtractorcodes import SubtractorcodesModule
from soitool.modules.module_predefined_codes import PredefinedCodesModule
from soitool.new_module_dialog import MODULE_CHOICES
from soitool.soi_workspace_widget import DATABASE_MODULES
from soitool.database import Database
# The error being ignored here is pylint telling us that 'test' is a standard
# module, so the import should be placed further up. In our case we have an
# actual custom module called 'test', so pylint is confused.
# pylint: disable=C0411
from test.test_database import TESTDBPATH
if isinstance(QtGui.qApp, type(None)):
app = QApplication([])
else:
app = QtGui.qApp
# Modules with a popup as part of their __init__
POPUP_MODULES = [
AuthenticationBoardModule,
SubtractorcodesModule,
PredefinedCodesModule,
]
def screen_information():
"""Get string with information about the screen.
......@@ -87,20 +104,28 @@ class TestModulesAcrossResolutions(unittest.TestCase):
deleted, or changed. It will fail until it is updated.
"""
expected_result = [
{"x": 0, "y": 0, "page": 1, "name": "AuthenticationBoardModule"},
{"x": 407.5, "y": 0, "page": 1, "name": "SubtractorcodesModule"},
{"x": 602.0, "y": 0, "page": 1, "name": "FreeTextModule"},
{"x": 702.0, "y": 0, "page": 1, "name": "TableModule"},
{"x": 0, "y": 0, "page": 1, "name": "PredefinedCodesModule"},
{"x": 640, "y": 0, "page": 1, "name": "AuthenticationBoardModule"},
{"x": 1047.5, "y": 0, "page": 1, "name": "SubtractorcodesModule"},
{"x": 1273.0, "y": 0, "page": 1, "name": "FreeTextModule"},
{"x": 1373.0, "y": 0, "page": 1, "name": "TableModule"},
]
# For use with modules that require a database
self.database = Database(db_path=TESTDBPATH)
def press_enter():
active_widget = app.activeModalWidget()
# triple click to select existing text for overwrite
QTest.mouseDClick(active_widget.edit_headline, Qt.LeftButton)
QTest.mouseClick(active_widget.edit_headline, Qt.LeftButton)
# need to overwrite text because title otherwise contains
# unpredictable text
QTest.keyClicks(active_widget.edit_headline, "TestTitle")
# AuthenticationBoardModule needs special treatment because the
# title can contain random info
if isinstance(active_widget, AuthenticationBoardModule):
# triple click to select existing text for overwrite
QTest.mouseDClick(active_widget.edit_headline, Qt.LeftButton)
QTest.mouseClick(active_widget.edit_headline, Qt.LeftButton)
# need to overwrite text because title otherwise contains
# unpredictable text
QTest.keyClicks(active_widget.edit_headline, "TestTitle")
QTest.keyClick(active_widget, Qt.Key_Enter)
soi = SOI()
......@@ -108,9 +133,13 @@ class TestModulesAcrossResolutions(unittest.TestCase):
for module in MODULE_CHOICES:
# If we're adding one of the modules with a popup as part of it's
# constructor we need to singleShot pressing enter to close it
if module in (AuthenticationBoardModule, SubtractorcodesModule):
if module in POPUP_MODULES:
QTimer.singleShot(0, press_enter)
soi.add_module(module.__name__, module())
if module in DATABASE_MODULES:
soi.add_module(module.__name__, module(database=self.database))
else:
soi.add_module(module.__name__, module())
soi.reorganize()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment