Compare retained image pixels without assuming SIMD color rounding

This commit is contained in:
evgeny committed 2026-10-17 01:30:05 +02:00
1 parent 64bbbdc631
commit 9c7d088f8b
1 file changed
+3 -2
@@ -45,10 +45,11 @@ private slots:
output[0] = image.bits(); output[0] = image.bits();
QCOMPARE(sws_scale(converter, source->data, source->linesize, 0, height, output, strides), height); QCOMPARE(sws_scale(converter, source->data, source->linesize, 0, height, output, strides), height);
for (int y = 0; y < height; y++) QCOMPARE(memcmp(image.constScanLine(y), guarded.data() + y * strides[0], width * 3), 0); for (int y = 0; y < height; y++) QCOMPARE(memcmp(image.constScanLine(y), guarded.data() + y * strides[0], width * 3), 0);
QColor corner = image.pixelColor(width - 1, height - 1), first = image.pixelColor(0, 0);
QImage shared = image; image = {}; QImage shared = image; image = {};
QCOMPARE(shared.pixelColor(width - 1, height - 1), QColor(19, 19, 19)); QCOMPARE(shared.pixelColor(width - 1, height - 1), corner);
QImage detached = shared; detached.fill(Qt::red); QImage detached = shared; detached.fill(Qt::red);
QCOMPARE(shared.pixelColor(0, 0), QColor(19, 19, 19)); QCOMPARE(detached.pixelColor(0, 0), QColor(Qt::red)); QCOMPARE(shared.pixelColor(0, 0), first); QCOMPARE(detached.pixelColor(0, 0), QColor(Qt::red));
} }
}; };