Merge 13.17 and 13.18: a dragged curve point stays on its neighbour, bands match one band, SheetTeardownTests on 13.4a's sheet; AGENTS and TASKS

This commit is contained in:
ZacharyZhang-NY committed 2026-10-01 18:18:42 -04:00
1 parent a004db172b
commit 72230b09b8
7 files changed
+43 -16

No files matched your search

+11 -8
View File
@@ -179,19 +179,22 @@ void CameraRawCurveGraphTests::aPointIsPickedByDistanceAndKept()
QVERIFY(std::abs(graph.curve().rgb[2].y - 0.6) < 0.01 && graph.curve().rgb[1] == (CurvePoint{0.3, 0.3}));
// Kept as it passes x 0.99, held before the end.
graph.move(graph.at(1.2, 0.2));
QVERIFY(std::abs(graph.curve().rgb[2].x - 0.99) < 1e-9 && graph.curve().rgb[1] == (CurvePoint{0.3, 0.3}));
// Onto its neighbour: a hundredth past, then repaired away.
QVERIFY(std::abs(graph.curve().rgb[2].x - 0.99) < 1e-6 && graph.curve().rgb[1] == (CurvePoint{0.3, 0.3}));
// Fix beyond Swift: onto its neighbour it stays, still dragged.
graph.move(graph.at(0.1, 0.2));
QCOMPARE(graph.curve().rgb.size(), size_t(3));
QVERIFY(graph.curve().rgb[1] == (CurvePoint{0.3, 0.3}));
graph.release(graph.at(0.1, 0.2));
// Onto the next point: a hundredth short; that one goes.
QCOMPARE(graph.curve().rgb.size(), size_t(4));
QVERIFY(std::abs(graph.curve().rgb[2].x - 0.31) < 1e-6 && graph.curve().rgb[1] == (CurvePoint{0.3, 0.3}));
graph.move(graph.at(0.6, 0.7));
QCOMPARE(graph.curve().rgb.size(), size_t(4));
QVERIFY(std::abs(graph.curve().rgb[2].x - 0.6) < 0.003 && graph.curve().rgb[3] == (CurvePoint{1, 1}));
graph.release(graph.at(0.6, 0.7));
// Onto the next point: a hundredth short; both stay.
graph.set([](CameraRawCurveSettings &curve) { curve.rgb = {{0, 0}, {0.3, 0.3}, {0.5, 0.5}, {1, 1}}; });
graph.press(graph.at(0.3, 0.3));
graph.move(graph.at(0.8, 0.3));
graph.release(graph.at(0.8, 0.3));
QCOMPARE(graph.curve().rgb.size(), size_t(3));
QVERIFY(std::abs(graph.curve().rgb[1].x - 0.49) < 1e-9);
QCOMPARE(graph.curve().rgb.size(), size_t(4));
QVERIFY(std::abs(graph.curve().rgb[1].x - 0.49) < 1e-6 && graph.curve().rgb[2] == (CurvePoint{0.5, 0.5}));
// 0.05 away takes the point; 0.06 away adds one.
graph.set([](CameraRawCurveSettings &curve) { curve.rgb = {{0, 0}, {0.5, 0.5}, {1, 1}}; });
graph.press(graph.at(0.53, 0.54));
+3 -2
View File
@@ -133,13 +133,14 @@ void CameraRawGroupDrawTests::endPointsStayAndARealDoubleClickRemoves()
QTest::mouseRelease(&graph, Qt::LeftButton, {}, QPoint(40, 40));
QCOMPARE(group.raw().curve.rgb.size(), size_t(2));
QVERIFY(group.raw().curve.rgb[0].x == 0 && std::abs(group.raw().curve.rgb[0].y - (1 - 40.0 / h)) < 1e-9 && group.raw().curve.rgb[1] == (CurvePoint{1, 1}));
// Past the start: a hundredth in, then repaired away.
// Past the start it stays a hundredth in.
group.set([](CameraRawSettings &settings) { settings.curve.rgb = {{0, 0}, {0.5, 0.5}, {1, 1}}; });
QTest::mousePress(&graph, Qt::LeftButton, {}, QPoint(w / 2, h / 2));
QMouseEvent far(QEvent::MouseMove, QPointF(-50, h / 2), graph.mapToGlobal(QPointF(-50, h / 2)), Qt::NoButton, Qt::LeftButton, Qt::NoModifier);
QApplication::sendEvent(&graph, &far);
QTest::mouseRelease(&graph, Qt::LeftButton, {}, QPoint(-50, h / 2));
QVERIFY(group.raw().curve.rgb == CameraRawCurveSettings::linear());
QCOMPARE(group.raw().curve.rgb.size(), size_t(3));
QVERIFY(std::abs(group.raw().curve.rgb[1].x - 0.01) < 1e-6);
// A real double click: press, release, double click, release.
group.set([](CameraRawSettings &settings) { settings.curve.rgb = {{0, 0}, {0.5, 0.5}, {1, 1}}; });
doubleClick(graph, QPoint(w / 2, h / 2));
+16
View File
@@ -111,6 +111,7 @@ private slots:
void theScreenIsTheDarkColourOrBlack();
void clearPixelsStayClear();
void everyBandOfATallImageIsDrawn();
void bandsDrawAsOneBandDoes();
void theGlowIsTheBlurredLightAtItsAmount();
void theGlowNeverPassesAlpha();
void theSheetShowsScanlinesRows();
@@ -282,6 +283,21 @@ void ScanlinesTests::everyBandOfATallImageIsDrawn()
QCOMPARE(tall, repeated({0, 255, 255, 255, 255, 255, 255, 0}, 70));
}
void ScanlinesTests::bandsDrawAsOneBandDoes()
{
// One band of 62 rows, 32 of 300: tops agree.
QImage noise = BrushRaster::context(7, 300, false);
for (int y = 0; y < 300; ++y)
for (int x = 0; x < 7; ++x)
noise.setPixelColor(x, y, QColor((x * 37 + y * 11) % 256, (x * 91 + y * 53) % 256, (y * 29) % 256, 128 + (x + y) % 128));
DitherSettings settings = scanlines(2);
settings.colors = DitherColors::original;
settings.dots = 50;
settings.wobble = 5;
const QImage whole = settings.apply(noise), one = settings.apply(noise.copy(0, 0, 7, 62));
QCOMPARE(whole.copy(0, 0, 7, 62), one);
}
void ScanlinesTests::theGlowIsTheBlurredLightAtItsAmount()
{
QImage image = filled(64, 160, Qt::black);
+2 -2
View File
@@ -102,8 +102,8 @@ void SheetTeardownTests::theDocumentSheetsGoQuietly()
{
const CanvasDocument canvas{120, 80};
typeThenDestroy(std::make_unique<ImageSizeSheet>(canvas, [](std::optional<ImageSizeOptions>) {}), QStringLiteral("60"));
typeThenDestroy(std::make_unique<CanvasSizeSheet>(canvas, PaletteColor::black(), PaletteColor::white(), [](std::optional<CanvasSizeOptions>) {}),
QStringLiteral("60"));
EditorSession session;
typeThenDestroy(std::make_unique<CanvasSizeSheet>(canvas, session, [](std::optional<CanvasSizeOptions>) {}), QStringLiteral("60"));
}
void SheetTeardownTests::aCameraRawRowGoesQuietly()