[graphics/krita/krita/6.0] libs/flake/tests: Add subpath removal unit test
Dmitry Kazakov <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit effa40c4a3f06e366cd904400dbcb750941ab1e4 by Dmitry Kazakov, on behalf of Luna Lovecraft.
Committed on 27/07/2026 at 16:18.
Pushed by dkazakov into branch 'krita/6.0'.
Add subpath removal unit test
This new test is for the changes in 329d8714c652
M +29 -0 libs/flake/tests/TestPointRemoveCommand.cpp
M +1 -0 libs/flake/tests/TestPointRemoveCommand.h
https://invent.kde.org/graphics/krita/-/commit/effa40c4a3f06e366cd904400dbcb750941ab1e4
diff --git a/libs/flake/tests/TestPointRemoveCommand.cpp b/libs/flake/tests/TestPointRemoveCommand.cpp
index a65cea5351e..9c5a8ea20fe 100644
--- a/libs/flake/tests/TestPointRemoveCommand.cpp
+++ b/libs/flake/tests/TestPointRemoveCommand.cpp
@@ -134,6 +134,35 @@ void TestPointRemoveCommand::redoUndoSubpathRemove()
delete cmd1;
}
+void TestPointRemoveCommand::subpathRemoval()
+{
+ KoPathShape path;
+
+ path.moveTo(QPointF(-1,-1));
+
+ auto p0 = path.moveTo(QPointF(0,0));
+ auto p1 = path.lineTo(QPointF(1,0));
+
+ auto p2 = path.moveTo(QPointF(0,1));
+ auto p3 = path.lineTo(QPointF(1,1));
+
+ QList<KoPathPointData> pd;
+ pd
+ << KoPathPointData(&path, path.pathPointIndex(p0))
+ << KoPathPointData(&path, path.pathPointIndex(p1))
+ << KoPathPointData(&path, path.pathPointIndex(p2))
+ << KoPathPointData(&path, path.pathPointIndex(p3));
+
+ MockShapeController mockController;
+ KoShapeController shapeController(0, &mockController);
+
+ KUndo2Command *cmd = KoPathPointRemoveCommand::createCommand(pd, &shapeController);
+ cmd->redo();
+
+ //Have to have one subpath left, so that it doesn't delete the whole shape
+ QCOMPARE(path.subpathCount(), 1);
+}
+
void TestPointRemoveCommand::redoUndoShapeRemove()
{
KoPathShape *path1 = new KoPathShape();
diff --git a/libs/flake/tests/TestPointRemoveCommand.h b/libs/flake/tests/TestPointRemoveCommand.h
index 5d1c6a7b4e5..72de8213eb5 100644
--- a/libs/flake/tests/TestPointRemoveCommand.h
+++ b/libs/flake/tests/TestPointRemoveCommand.h
@@ -16,6 +16,7 @@ private Q_SLOTS:
void redoUndoSubpathRemove();
void redoUndoShapeRemove();
void redoUndo();
+ void subpathRemoval();
};
#endif // TESTPOINTREMOVECOMMAND_H