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 <oliver.wolff@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
216da37cc5
commit
1b190e7ea6
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user