summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2021-02-24 00:06:26 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-03-08 10:47:53 +0000
commit667d0eb3c5e57f9a6d8838910ece8c46b398781f (patch)
tree4776364d03eb70f4f8526e6572869b999336b866 /tests/auto/gui
parent93f46f303e4afd21e013c67d13cbdc0497a8b076 (diff)
High-DPI: Set the minimum scale factor to 1
Avoid painting errors with dpr < 1, also for the PassThrough mode. This limits the minimum high-dpi scale factor to 1, for the code path which determines the scale factor based on screen DPI. Task-number: QTBUG-89948 Change-Id: I14b3f130f0ae141d5f05c87437f926a9f76d1dec Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit ee409e6f0cab4aa051f75f7c7116d4b607d137fc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/kernel/qhighdpi/tst_qhighdpi.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/gui/kernel/qhighdpi/tst_qhighdpi.cpp b/tests/auto/gui/kernel/qhighdpi/tst_qhighdpi.cpp
index 09bf8439c8..512209ab73 100644
--- a/tests/auto/gui/kernel/qhighdpi/tst_qhighdpi.cpp
+++ b/tests/auto/gui/kernel/qhighdpi/tst_qhighdpi.cpp
@@ -49,6 +49,7 @@ private slots:
void initTestCase();
void qhighdpiscaling_data();
void qhighdpiscaling();
+ void minimumDpr();
void noscreens();
void screenDpiAndDpr_data();
void screenDpiAndDpr();
@@ -223,6 +224,20 @@ void tst_QHighDpi::screenDpiAndDpr()
}
}
+void tst_QHighDpi::minimumDpr()
+{
+ QList<qreal> dpiValues { 40, 60, 95 };
+ std::unique_ptr<QGuiApplication> app(createStandardOffscreenApp(dpiValues));
+ for (QScreen *screen : app->screens()) {
+ // Qt does not currently support DPR values < 1. Make sure
+ // the minimum DPR value is 1, also when the screen reports
+ // a low DPI.
+ QCOMPARE(screen->devicePixelRatio(), 1);
+ QWindow window(screen);
+ QCOMPARE(window.devicePixelRatio(), 1);
+ }
+}
+
void tst_QHighDpi::noscreens()
{
// Create application object with a no-screens configuration (should not crash)