summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/kernel/qhighdpi/tst_qhighdpi.cpp
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2020-06-11 14:51:58 +0200
committerMorten Johan Sørvig <morten.sorvig@qt.io>2020-10-20 07:27:04 +0200
commit3df2448f6322bd6ecc8c11aa05e935223ef96dd3 (patch)
treed7af3953931cf2e723ac4d68151f244d45fc798e /tests/auto/gui/kernel/qhighdpi/tst_qhighdpi.cpp
parentd023da86399b99d365f1e745fb0d9424afc8194b (diff)
Merge existing tst_qhighdpiscaling into tst_qhgihdpi
Move the factor() test, drop scale() which should be covered already. Change-Id: Id2079536a91c7e9f7199960bdf6b33489d0a6670 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'tests/auto/gui/kernel/qhighdpi/tst_qhighdpi.cpp')
-rw-r--r--tests/auto/gui/kernel/qhighdpi/tst_qhighdpi.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/gui/kernel/qhighdpi/tst_qhighdpi.cpp b/tests/auto/gui/kernel/qhighdpi/tst_qhighdpi.cpp
index a7b18167ba..d771da7320 100644
--- a/tests/auto/gui/kernel/qhighdpi/tst_qhighdpi.cpp
+++ b/tests/auto/gui/kernel/qhighdpi/tst_qhighdpi.cpp
@@ -163,6 +163,29 @@ void tst_QHighDpi::initTestCase()
#endif
}
+void tst_QHighDpi::qhighdpiscaling_data()
+{
+ standardScreenDpiTestData();
+}
+
+// Tests the QHighDpiScaling API directly
+void tst_QHighDpi::qhighdpiscaling()
+{
+ QFETCH(QList<qreal>, dpiValues);
+ std::unique_ptr<QGuiApplication> app(createStandardOffscreenApp(dpiValues));
+
+ QHighDpiScaling::setGlobalFactor(2);
+
+ // Verfy that QHighDpiScaling::factor() does not crash on nullptr contexts.
+ QScreen *screenContext = nullptr;
+ QVERIFY(QHighDpiScaling::factor(screenContext) >= 0);
+ QPlatformScreen *platformScreenContext = nullptr;
+ QVERIFY(QHighDpiScaling::factor(platformScreenContext) >= 0);
+ QWindow *windowContext = nullptr;
+ QVERIFY(QHighDpiScaling::factor(windowContext) >= 0);
+ QHighDpiScaling::setGlobalFactor(1);
+}
+
void tst_QHighDpi::screenDpiAndDpr_data()
{
standardScreenDpiTestData();