From 91be9d1dce85361cdbb6ae5269bf323b1ac96a97 Mon Sep 17 00:00:00 2001 From: thomahl <thomahl@stud.ntnu.no> Date: Wed, 22 Apr 2020 11:33:21 +0200 Subject: [PATCH] =?UTF-8?q?#125=20la=20til=20debug=20output=20om=20skjerm?= =?UTF-8?q?=20i=20oppl=C3=B8sningstest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/test_resolution_smoke_test.py | 44 +++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/test/test_resolution_smoke_test.py b/test/test_resolution_smoke_test.py index d091612..03f108b 100644 --- a/test/test_resolution_smoke_test.py +++ b/test/test_resolution_smoke_test.py @@ -13,6 +13,7 @@ from PySide2.QtWidgets import QApplication from PySide2 import QtGui from PySide2.QtCore import QTimer, Qt from PySide2.QtTest import QTest +from PySide2.QtGui import QGuiApplication from soitool.soi import SOI from soitool.modules.module_authentication_board import ( AuthenticationBoardModule, @@ -26,6 +27,43 @@ else: app = QtGui.qApp +def screen_information(): + """Get string with information about the screen. + + Returns + ------- + str + String with screen information. + """ + screen_string = "" + screen = QGuiApplication.primaryScreen() + screen_string += "screen.size() -> " + str(screen.size()) + "\n" + screen_string += ( + "screen.physicalDotsPerInchX() -> " + + str(screen.physicalDotsPerInchX()) + + "\n" + ) + screen_string += ( + "screen.physicalDotsPerInchY() -> " + + str(screen.physicalDotsPerInchY()) + + "\n" + ) + screen_string += ( + "screen.logicalDotsPerInchX() -> " + + str(screen.logicalDotsPerInchX()) + + "\n" + ) + screen_string += ( + "screen.logicalDotsPerInchY() -> " + + str(screen.logicalDotsPerInchY()) + + "\n" + ) + screen_string += ( + "screen.devicePixelRatio() -> " + str(screen.devicePixelRatio()) + "\n" + ) + return screen_string + + class TestModulesAcrossResolutions(unittest.TestCase): """TestCase for modules across resolutions.""" @@ -62,5 +100,9 @@ class TestModulesAcrossResolutions(unittest.TestCase): soi.reorganize() self.assertEqual( - expected_result, [module["meta"] for module in soi.modules], + expected_result, + [module["meta"] for module in soi.modules], + "All modules added to SOI and calling reorganize should result in " + "expected 'meta' information. Screen is: \n" + + screen_information(), ) -- GitLab