Review fixes in progress, unverified: stopped by the user before the tests ran

This commit is contained in:
ZacharyZhang-NY committed 2026-10-01 23:01:53 -04:00
1 parent 81894f744a
commit 70318de2e8
14 files changed
+232 -101

No files matched your search

+27
View File
@@ -41,6 +41,8 @@ private slots:
void aTurnedLayerDoesntSnap();
void eachEdgeSnapsOnItsOwn();
void theDraggedSideAloneSnaps();
void aLongDragSnapsTheEdgeItCarries();
void aTieTakesTheLowEdge();
void snappingOffOrAnotherDragLeavesThePoint();
};
@@ -141,6 +143,31 @@ void ResizeSnapTests::theDraggedSideAloneSnaps()
QCOMPARE(resized.session.snapGuides, (SnapGuides{{}, {150}}));
}
// Dragged past the anchor, the moved edge is the box's left.
void ResizeSnapTests::aLongDragSnapsTheEdgeItCarries()
{
Resized resized;
const LayerTransform flipped = resized.resize(3, QPointF(110, 60), QPointF(-3, 60), false);
QCOMPARE(flipped.origin.x(), 0.0);
QCOMPARE(flipped.size.width(), 10.0);
QVERIFY(flipped.flipX);
QCOMPARE(resized.session.snapGuides, (SnapGuides{{0}, {}}));
}
// Half a pixel from the anchor: a one-pixel box, the pointer mid-way.
void ResizeSnapTests::aTieTakesTheLowEdge()
{
Resized resized;
resized.place(QPointF(13, 150), QSizeF(20, 20));
resized.session.selectLayer(resized.layer);
const TransformDrag drag{layerWith(resized.session, resized.layer).transform, QPointF(110, 60), {TransformDrag::Kind::resize, 3}, std::nullopt};
QCOMPARE(drag.updated(QPointF(10.5, 60), false, false).size.width(), 1.0);
// The anchor's edge, which no step moves: the pointer stays.
QCOMPARE(resized.session.snappedResizePoint(QPointF(10.5, 60), drag, false, {resized.layer}, 5, [&](QPointF to) { return drag.updated(to, false, false); }),
QPointF(10.5, 60));
QCOMPARE(resized.session.snapGuides, (SnapGuides{{13}, {}}));
}
void ResizeSnapTests::snappingOffOrAnotherDragLeavesThePoint()
{
Resized resized;