From 63e42acc7c5e10764d653a9aa705af0fd41e98a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Thu, 1 Oct 2026 23:01:53 -0400 Subject: [PATCH] Review fixes in progress, unverified: stopped by the user before the tests ran --- tests/SharpCanvasTests.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/SharpCanvasTests.cpp b/tests/SharpCanvasTests.cpp index 6611d5e..2eca09b 100644 --- a/tests/SharpCanvasTests.cpp +++ b/tests/SharpCanvasTests.cpp @@ -32,6 +32,23 @@ int blurred(double width, const Draw &draw) } return count; } + +// Opaque mid tones of 20 rows of columns, turned 2°. +int turned(const Draw &draw) +{ + QImage surface = BrushRaster::context(120, 30, false); + QPainter painter(&surface); + draw(LayerTransform{.origin = {0, 5}, .size = {100, 20}, .rotation = 2}, painter); + painter.end(); + int count = 0; + for (int y = 0; y < 30; ++y) { + for (int x = 0; x < 100; ++x) { + const QRgb pixel = surface.pixel(x, y); + count += qAlpha(pixel) == 255 && qRed(pixel) > 30 && qRed(pixel) < 225; + } + } + return count; +} } class SharpCanvasTests : public QObject { @@ -74,6 +91,8 @@ void SharpCanvasTests::plainMaskedAndTiledLayersCopyAcross() QCOMPARE(blurred(100.05, draw), 0); // A fifth: filtered as before. QVERIFY(blurred(100.2, draw) > 0); + // Turned, even pixel for pixel: filtered between columns. + QVERIFY(turned(draw) > 100); } }