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. Task-number: QTBUG-115945 Change-Id: I3e95449ada26ff5bb0acc00412f345733603f4c0 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit ae9594ea98e723a99b8ad8c056505f4c7deb77c9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
cd81b9016e
commit
e4d4714aae
@ -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…
x
Reference in New Issue
Block a user