diff options
-rw-r--r-- | tests/auto/integration/qscreencapturebackend/tst_qscreencapturebackend.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/tests/auto/integration/qscreencapturebackend/tst_qscreencapturebackend.cpp b/tests/auto/integration/qscreencapturebackend/tst_qscreencapturebackend.cpp index 8f3eb8e09..5d36ffc2d 100644 --- a/tests/auto/integration/qscreencapturebackend/tst_qscreencapturebackend.cpp +++ b/tests/auto/integration/qscreencapturebackend/tst_qscreencapturebackend.cpp @@ -227,15 +227,13 @@ void tst_QScreenCaptureBackend::capture(QTestWidget &widget, const QPoint &drawi QCOMPARE_LE(framesCount, expectedFramesCount + 2); QCOMPARE_GE(framesCount, expectedFramesCount / 2); - const QSize expectedSizeForComparison(qFloor(expectedSize.width() * pixelRatio), - qFloor(expectedSize.height() * pixelRatio)); - for (const auto &image : sink.images()) { auto pixelColor = [&drawingOffset, pixelRatio, &image](int x, int y) { return image.pixelColor((QPoint(x, y) + drawingOffset) * pixelRatio).toRgb(); }; - - QCOMPARE(image.size(), expectedSizeForComparison); + const int capturedWidth = qRound(image.size().width() / pixelRatio); + const int capturedHeight = qRound(image.size().height() / pixelRatio); + QCOMPARE(QSize(capturedWidth, capturedHeight), expectedSize); QCOMPARE(pixelColor(0, 0), QColor(0xFF, 0, 0)); QCOMPARE(pixelColor(39, 50), QColor(0xFF, 0, 0)); |