summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-08-14 15:55:31 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-08-23 08:39:16 +0200
commita4a11987089b1558b5b50a0d38c3263bb25818d7 (patch)
tree5683bc43cb276432ef1482483b056906708dd30c /tests/auto/widgets
parent3f603906b425152fe41e3b16d91fb25d0b0f0823 (diff)
Windows: Fix some widget tests to pass on High DPI screens
For tst_QFrame and tst_QOpenGLWidget, force scaling off since they do screen captures which would fail with scaling activated due to different device pixel ratios. For tst_QGraphicsItem and tst_QHeaderView, force scaling on for Windows since some tests otherwise fail due to violation of the minimum size constraints of framed windows on Windows. The tests will then pass regardless of any environment setting of the scaling variables on a developer machine. Change-Id: Iefa4e84b433f7e51dce4e416546a9eda8ee6d0f1 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp11
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp9
-rw-r--r--tests/auto/widgets/widgets/qframe/tst_qframe.cpp4
-rw-r--r--tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp3
4 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 7b914512ab..72ea2ae31a 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -272,6 +272,9 @@ class tst_QGraphicsItem : public QObject
{
Q_OBJECT
+public:
+ static void initMain();
+
private slots:
void construction();
void constructionWithParent();
@@ -474,6 +477,14 @@ private:
QTouchDevice *m_touchDevice = nullptr;
};
+void tst_QGraphicsItem::initMain()
+{
+#ifdef Q_OS_WIN
+ // Ensure minimum size constraints of framed windows on High DPI screens
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+#endif
+}
+
void tst_QGraphicsItem::construction()
{
for (int i = 0; i < 7; ++i) {
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
index f247889d55..df02815eb2 100644
--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
@@ -106,6 +106,7 @@ class tst_QHeaderView : public QObject
public:
tst_QHeaderView();
+ static void initMain();
private slots:
void initTestCase();
@@ -265,6 +266,14 @@ protected:
QElapsedTimer timer;
};
+void tst_QHeaderView::initMain()
+{
+#ifdef Q_OS_WIN
+ // Ensure minimum size constraints of framed windows on High DPI screens
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+#endif
+}
+
class QtTestModel: public QAbstractTableModel
{
diff --git a/tests/auto/widgets/widgets/qframe/tst_qframe.cpp b/tests/auto/widgets/widgets/qframe/tst_qframe.cpp
index 432f4474c5..05f9cd2e4a 100644
--- a/tests/auto/widgets/widgets/qframe/tst_qframe.cpp
+++ b/tests/auto/widgets/widgets/qframe/tst_qframe.cpp
@@ -37,6 +37,10 @@
class tst_QFrame : public QObject
{
Q_OBJECT
+
+public:
+ static void initMain() { QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling); }
+
private slots:
void testDefaults();
void testInitStyleOption_data();
diff --git a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
index 21c9f41646..76f8ebc804 100644
--- a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
+++ b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
@@ -49,6 +49,9 @@ class tst_QOpenGLWidget : public QObject
{
Q_OBJECT
+public:
+ static void initMain() { QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling); }
+
private slots:
void initTestCase();
void create();