summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-08-31 14:01:12 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-08-31 19:14:55 +0200
commit90358f6042d1fe2db849e17e1b0c875fb0560b20 (patch)
tree493e57226970f613c18871d086ae88031b091fde /tests
parent8028474e62c584ed3d5bb0f662b9690ca029f028 (diff)
Deprecate and remove uses of AA_DisableHighDpiScaling
Change-Id: Ibadce68775858c524b998aacad310905ba2c2e8e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp3
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp11
-rw-r--r--tests/manual/embeddedintoforeignwindow/main.cpp3
-rw-r--r--tests/manual/foreignwindows/main.cpp3
-rw-r--r--tests/manual/highdpi/main.cpp14
-rw-r--r--tests/manual/qcursor/qcursorhighdpi/main.cpp5
6 files changed, 5 insertions, 34 deletions
diff --git a/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp b/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp
index ed89e6fbb4..3e19764618 100644
--- a/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp
+++ b/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp
@@ -223,7 +223,8 @@ void tst_NoQtEventLoop::consumeMouseEvents()
int argc = 1;
char *argv[] = {const_cast<char*>("test")};
// ensure scaling is off since the child window is positioned using QWindow API.
- QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
+ // FIXME: Position by taking the screen DPR into account instead
+ qputenv("QT_ENABLE_HIGHDPI_SCALING", "0");
QGuiApplication app(argc, argv);
QString clsName(QStringLiteral("tst_NoQtEventLoop_WINDOW"));
const HINSTANCE appInstance = (HINSTANCE)GetModuleHandle(0);
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
index b61faf6c2b..a751fae05d 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -72,8 +72,6 @@ class tst_QStyleSheetStyle : public QObject
public:
tst_QStyleSheetStyle();
- static void initMain();
-
private slots:
void init();
void cleanup();
@@ -173,12 +171,6 @@ private:
QSize m_testSize;
};
-// highdpiImages() tests HighDPI scaling; disable initially.
-void tst_QStyleSheetStyle::initMain()
-{
- QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
-}
-
tst_QStyleSheetStyle::tst_QStyleSheetStyle()
{
const int testSize = qMax(200, m_availableGeometry.width() / 10);
@@ -2215,8 +2207,9 @@ void tst_QStyleSheetStyle::highdpiImages()
w.setWindowTitle(QLatin1String(QTest::currentTestFunction()) + QLatin1String("::")
+ QLatin1String(QTest::currentDataTag()));
QScreen *screen = QGuiApplication::primaryScreen();
+ auto inverseDpr = 1 / screen->devicePixelRatio();
w.move(screen->availableGeometry().topLeft());
- QHighDpiScaling::setScreenFactor(screen, screenFactor);
+ QHighDpiScaling::setScreenFactor(screen, inverseDpr * screenFactor);
w.setStyleSheet("QWidget { background-image: url(\":/images/testimage.png\"); }");
w.show();
diff --git a/tests/manual/embeddedintoforeignwindow/main.cpp b/tests/manual/embeddedintoforeignwindow/main.cpp
index 8827b3a0a2..c8e8a4f1b5 100644
--- a/tests/manual/embeddedintoforeignwindow/main.cpp
+++ b/tests/manual/embeddedintoforeignwindow/main.cpp
@@ -207,9 +207,6 @@ static inline bool isOptionSet(int argc, char *argv[], const char *option)
int main(int argc, char *argv[])
{
- // Check for no scaling before QApplication is instantiated.
- if (isOptionSet(argc, argv, "-s"))
- QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
QCoreApplication::setApplicationVersion(QLatin1String(QT_VERSION_STR));
QGuiApplication::setApplicationDisplayName("Foreign Window Embedding Tester");
diff --git a/tests/manual/foreignwindows/main.cpp b/tests/manual/foreignwindows/main.cpp
index cc5b16391c..45c00d9b90 100644
--- a/tests/manual/foreignwindows/main.cpp
+++ b/tests/manual/foreignwindows/main.cpp
@@ -226,9 +226,6 @@ static inline bool isOptionSet(int argc, char *argv[], const char *option)
int main(int argc, char *argv[])
{
- // Check for no scaling before QApplication is instantiated.
- if (isOptionSet(argc, argv, "-s"))
- QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
QCoreApplication::setApplicationVersion(QLatin1String(QT_VERSION_STR));
QGuiApplication::setApplicationDisplayName("Foreign window tester");
diff --git a/tests/manual/highdpi/main.cpp b/tests/manual/highdpi/main.cpp
index 95036d881f..883dd5a226 100644
--- a/tests/manual/highdpi/main.cpp
+++ b/tests/manual/highdpi/main.cpp
@@ -1424,19 +1424,8 @@ void MetricsTest::logScreenChangeSignal(const QObject *o, const char *name, cons
int main(int argc, char **argv)
{
-#define NOSCALINGOPTION "noscaling"
-
qInfo("High DPI tester %s", QT_VERSION_STR);
- int preAppOptionCount = 0;
- for (int a = 1; a < argc; ++a) {
- if (qstrcmp(argv[a], "--" NOSCALINGOPTION) == 0) {
- QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
- preAppOptionCount++;
- qInfo("AA_DisableHighDpiScaling");
- }
- }
-
QApplication app(argc, argv);
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
@@ -1449,7 +1438,6 @@ int main(int argc, char **argv)
parser.addVersionOption();
QCommandLineOption controllerOption("interactive", "Show configuration window.");
parser.addOption(controllerOption);
- parser.addOption(QCommandLineOption(NOSCALINGOPTION, "Set AA_DisableHighDpiScaling"));
DemoContainerList demoList;
demoList << new DemoContainer<PixmapPainter>("pixmap", "Test pixmap painter");
@@ -1478,7 +1466,7 @@ int main(int argc, char **argv)
//controller takes ownership of all demos
DemoController controller(demoList, &parser);
- if (parser.isSet(controllerOption) || (QCoreApplication::arguments().count() - preAppOptionCount) <= 1)
+ if (parser.isSet(controllerOption) || (QCoreApplication::arguments().count()) <= 1)
controller.show();
if (QApplication::topLevelWidgets().isEmpty())
diff --git a/tests/manual/qcursor/qcursorhighdpi/main.cpp b/tests/manual/qcursor/qcursorhighdpi/main.cpp
index 2e920ab231..b7c4b95a77 100644
--- a/tests/manual/qcursor/qcursorhighdpi/main.cpp
+++ b/tests/manual/qcursor/qcursorhighdpi/main.cpp
@@ -338,11 +338,6 @@ int main(int argc, char *argv[])
QStringList arguments;
std::copy(argv + 1, argv + argc, std::back_inserter(arguments));
-#if QT_VERSION > 0x050000
- if (arguments.contains("-n"))
- QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
-#endif // Qt 5
-
QApplication app(argc, argv);
MainWindowPtrList windows;