From 1b190e7ea60e3752066b8a2fb255481651f8856e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 18 Jul 2017 14:22:35 +0200 Subject: tst_QWidget: Fix to pass with High DPI scaling enabled Scale coordinates in a few places, remove pixmap scaling in grabWindow() (Windows). Change-Id: Iba9e5d3ca55422a14eda09c8d04329a455d3acb3 Reviewed-by: Oliver Wolff Reviewed-by: Joerg Bornemann --- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tests/auto/widgets/kernel/qwidget') diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 2b6dc5f7e1..bd5d5fac79 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -4952,8 +4952,7 @@ static QPixmap grabWindow(QWindow *window, int x, int y, int width, int height) { QScreen *screen = window->screen(); Q_ASSERT(screen); - QPixmap result = screen->grabWindow(window->winId(), x, y, width, height); - return result.devicePixelRatio() > 1 ? result.scaled(width, height) : result; + return screen->grabWindow(window->winId(), x, y, width, height); } #define VERIFY_COLOR(child, region, color) verifyColor(child, region, color, __LINE__) @@ -4971,7 +4970,8 @@ bool verifyColor(QWidget &child, const QRegion ®ion, const QColor &color, uns const QPixmap pixmap = grabBackingStore ? child.grab(rect) : grabWindow(window, rect.left(), rect.top(), rect.width(), rect.height()); - if (!QTest::qCompare(pixmap.size(), rect.size(), "pixmap.size()", "rect.size()", __FILE__, callerLine)) + const QSize actualSize = pixmap.size() / pixmap.devicePixelRatioF(); + if (!QTest::qCompare(actualSize, rect.size(), "pixmap.size()", "rect.size()", __FILE__, callerLine)) return false; QPixmap expectedPixmap(pixmap); /* ensure equal formats */ expectedPixmap.detach(); @@ -10339,7 +10339,8 @@ public slots: QPoint point2(15, 20); QPoint point3(20, 20); QWindow *window = modal->windowHandle(); - QWindowSystemInterface::handleEnterEvent(window, point1, window->mapToGlobal(point1)); + const QPoint nativePoint1 = QHighDpi::toNativePixels(point1, window->screen()); + QWindowSystemInterface::handleEnterEvent(window, nativePoint1); QTest::mouseMove(window, point1); QTest::mouseMove(window, point2); QTest::mouseMove(window, point3); -- cgit v1.2.3 From 94cf203f36deb5b46d47197d31b780de5f464937 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 13 Jul 2017 17:19:49 +0200 Subject: Use QSharedPointer::create() more MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is the result of running the (experimental) clang-tidy check qt-modernize-qsharedpointer-create Discarded changes: - tst_qsharedpointer.cpp: not sure we want these replacements there (→ separate change) - tst_collations.cpp: hit in a template specialization that is instantiated with both QSharedPointer and QSharedDataPointer. Change-Id: I203c2646e91d026735d923473af3d151d19e3820 Reviewed-by: Thiago Macieira --- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/auto/widgets/kernel/qwidget') diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index bd5d5fac79..918df275e9 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -5753,14 +5753,14 @@ void tst_QWidget::testWindowIconChangeEventPropagation() QList applicationEventSpies; QList widgetEventSpies; foreach (QWidget *widget, widgets) { - applicationEventSpies.append(EventSpyPtr(new EventSpy(widget, QEvent::ApplicationWindowIconChange))); - widgetEventSpies.append(EventSpyPtr(new EventSpy(widget, QEvent::WindowIconChange))); + applicationEventSpies.append(EventSpyPtr::create(widget, QEvent::ApplicationWindowIconChange)); + widgetEventSpies.append(EventSpyPtr::create(widget, QEvent::WindowIconChange)); } QList appWindowEventSpies; QList windowEventSpies; foreach (QWindow *window, windows) { - appWindowEventSpies.append(WindowEventSpyPtr(new EventSpy(window, QEvent::ApplicationWindowIconChange))); - windowEventSpies.append(WindowEventSpyPtr(new EventSpy(window, QEvent::WindowIconChange))); + appWindowEventSpies.append(WindowEventSpyPtr::create(window, QEvent::ApplicationWindowIconChange)); + windowEventSpies.append(WindowEventSpyPtr::create(window, QEvent::WindowIconChange)); } // QApplication::setWindowIcon -- cgit v1.2.3 From 29f6b507325862fe3dd728913b5911f8edde9d35 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Mon, 21 Nov 2016 19:16:31 +0000 Subject: Windows: Don't raise inactive windows when showing a tooltip The Qt4 Q_WS_WIN ifdef never got ported. Change-Id: Iad1ca1a3e20bd5254895781eee09897520b7d7d1 Task-Id: QTBUG-39147 Reviewed-by: Friedemann Kleint --- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/auto/widgets/kernel/qwidget') diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 918df275e9..63ff8380f8 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -5716,6 +5716,8 @@ void tst_QWidget::setToolTip() QTest::qWait(2200); // delay is 2000 QTest::mouseMove(popupWindow); } + + QTRY_COMPARE(QApplication::topLevelWidgets().size(), 1); } void tst_QWidget::testWindowIconChangeEventPropagation() -- cgit v1.2.3 From f3ca13f3d12f52c60f4cd41d0b336c24a8d3359d Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 2 Aug 2017 14:43:16 +0200 Subject: Ignore failures of showMinimizedKeepsFocus/activateWindow on macOS 10.12 Change-Id: I1b5823b48c5dd5bebb8172fd696fc521b7de75b2 Task-number: QTQAINFRA-1359 Reviewed-by: Frederik Gladhorn --- tests/auto/widgets/kernel/qwidget/BLACKLIST | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/auto/widgets/kernel/qwidget') diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index ab45a342e3..0750526464 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -48,6 +48,7 @@ osx [showMinimizedKeepsFocus] osx-10.10 osx-10.11 ci +osx-10.12 ci [moveWindowInShowEvent:1] osx [moveWindowInShowEvent:2] @@ -75,3 +76,5 @@ osx-10.9 ubuntu-14.04 [moveChild:right] osx +[activateWindow] +osx-10.12 ci -- cgit v1.2.3