diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2023-08-11 13:05:10 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2023-08-17 22:35:34 +0200 |
commit | ae9594ea98e723a99b8ad8c056505f4c7deb77c9 (patch) | |
tree | b02d3d0845f462f56b2d27c933360b6bc0ab1edd /tests/auto/gui/painting | |
parent | 5dc068e95a212d0b9e55c6e0091b372507b0c80f (diff) |
Increase setup precision and reduce test precision
Reduce test precision to account for rounding errors, and at the same
time increase the setup precession by premultiplying in rgba64 instead
of argb32, which makes the test randomness trigger more regularly.
Pick-to: 6.6
Task-number: QTBUG-115945
Change-Id: I3e95449ada26ff5bb0acc00412f345733603f4c0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'tests/auto/gui/painting')
-rw-r--r-- | tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp b/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp index 08f45a2552..12178119e1 100644 --- a/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp +++ b/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp @@ -349,8 +349,10 @@ void tst_QColorSpace::imageConversion64PM() for (int j = 0; j < 16; ++j) { int a = j * 15; - for (int i = 0; i < 256; ++i) - testImage.setPixel(i, j, qPremultiply(qRgba(i, i, i, a))); + for (int i = 0; i < 256; ++i) { + QRgba64 color = QRgba64::fromRgba(i, i, i, a); + testImage.setPixelColor(i, j, QColor::fromRgba64(color)); + } } testImage.setColorSpace(fromColorSpace); @@ -389,8 +391,8 @@ void tst_QColorSpace::imageConversion64PM() for (int i = 0; i < 256; ++i) { QRgb expected = qPremultiply(qRgba(i, i, i, expectedAlpha)); QRgb p = testImage.pixel(i, j); - QCOMPARE(qRed(p), qGreen(p)); - QCOMPARE(qRed(p), qBlue(p)); + QVERIFY(qAbs(qRed(p) - qGreen(p)) <= 1); + QVERIFY(qAbs(qRed(p) - qBlue(p)) <= 1); QCOMPARE(qAlpha(p), expectedAlpha); QVERIFY((lastRed - qRed(p)) <= 0); QVERIFY((lastGreen - qGreen(p)) <= 0); |