Skip to content

Added qml tests for the vertex editor geometry tool#7579

Open
kaustuvpokharel wants to merge 5 commits into
masterfrom
vertex-pr
Open

Added qml tests for the vertex editor geometry tool#7579
kaustuvpokharel wants to merge 5 commits into
masterfrom
vertex-pr

Conversation

@kaustuvpokharel

Copy link
Copy Markdown
Collaborator

This pr adds a qml test file for the vertex editor tool. The vertex model itself is already covered in test_vertexmodel.cpp, so this does not retest that. It focuses on the tool layer around it: init wiring, applyChanges and the autoSave branch, cancel, remove, and undo.

The tool reads a few objects from its parent scope in the app (qfieldSettings, coordinateLocator, etc). I provide them in the test the same way tst_featureForm.qml does, as plain in-scope items. mapSettings is a real MapSettings set to the Fields layer CRS so the vertex model transform is a no-op. Tests run against the existing Fields (polygon) and Tracks (line) features in test_bees.qgz, and never commit, the edits go to the layer edit buffer and are rolled back after each test so the shared data stays clean.

canvasClicked is left out on purpose. It turns a screen point into a map coordinate through mapSettings.screenToCoordinate, which only means something with a real rendered canvas. Without one the screen to map math is meaningless, so a click test there would just assert made up numbers. That path fits an integration (spix) test better, is what I thought, if we need it.
I did not test the remove-down-to-minimum case. The polygon has 12 real vertices so it would take about 8 removals to trip canRemoveVertex false, which could endup fragile. Instead canRemoveVertex is checked from both sides: true on a removable vertex in edit mode, false outside edit mode. That covers the guard without exhausting the ring. I also left out the save-failure toast branch. Forcing featureModel.save() to return false means making the layer non-editable mid-operation, which is fragile and risks leaving the shared layer dirty. It is a thin error branch and not worth the check, let me know if you think otherwise @nirvn . All tests pass es locally.

@qfield-fairy

qfield-fairy commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

🍎 MacOS DMG universal builds

Download a MacOS DMG universal build of this PR for testing.
(Built from commit e08efc1)

🪟 Windows builds

Download a Windows build of this PR for testing and for arm64.

(Built from commit e08efc1)

🐧 Linux AppImage builds

Download a Linux AppImage build of this PR for testing.
(Built from commit e08efc1)

📱 Android builds

Download an Android arm64 build of this PR for testing.
(Built from commit e08efc1)

Other Android architectures

@kaustuvpokharel kaustuvpokharel self-assigned this Jun 17, 2026
Comment thread test/qml/tst_geometryeditor_vertex.qml Outdated
Comment thread test/qml/tst_geometryeditor_vertex.qml Outdated
Comment thread test/qml/tst_geometryeditor_vertex.qml Outdated
@kaustuvpokharel kaustuvpokharel requested a review from nirvn June 21, 2026 20:57
Comment thread test/qml/tst_geometryeditor_vertex.qml
Comment thread test/qml/tst_geometryeditor_vertex.qml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants