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>bb10
parent
5dc068e95a
commit
ae9594ea98
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue