Skip to content

Commit 117505a

Browse files
committed
feat: update test cases to reflect coordinates in project CRS
1 parent 721386c commit 117505a

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

tests/test_gui.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def test_without_live_preview(self):
6969
self.assertTrue(dlg.isVisible())
7070

7171
# Check first item of list widget
72-
self.assertEqual(dlg.routing_fromline_list.item(0).text(), "Point 0: -0.187575, 56.516620")
72+
self.assertEqual(dlg.routing_fromline_list.item(0).text(), "Point 0: -20880.750000, 7661955.000000")
7373

7474
# Check rubber band has only 2 vertices
7575
self.assertEqual(dlg.routing_fromline_list.count(), 2)
@@ -114,7 +114,7 @@ def test_with_live_preview(self):
114114
dlg.line_tool.canvasReleaseEvent(self.map_release(10, 0, Qt.MouseButton.LeftButton))
115115

116116
self.assertEqual(
117-
dlg.routing_fromline_list.item(0).text(), "Point 0: -123.384059, 48.448463"
117+
dlg.routing_fromline_list.item(0).text(), "Point 0: -13735050.625000, 6181790.000000"
118118
)
119119

120120
# Check that the live preview rubber band has more than two vertices
@@ -210,7 +210,7 @@ def test_drag_drop_with_live_preview(self):
210210
dlg.line_tool.canvasReleaseEvent(self.map_release(10, 5, Qt.MouseButton.LeftButton))
211211
self.assertEqual(dlg.routing_fromline_list.count(), 4)
212212
self.assertEqual(
213-
dlg.routing_fromline_list.item(3).text(), "Point 3: -123.375767, 48.445713"
213+
dlg.routing_fromline_list.item(3).text(), "Point 3: -13734127.517857, 6181328.446429"
214214
)
215215

216216
# Press at previous position
@@ -219,6 +219,21 @@ def test_drag_drop_with_live_preview(self):
219219
# Release somewhere else
220220
dlg.line_tool.canvasReleaseEvent(self.map_release(50, 10, Qt.MouseButton.LeftButton))
221221
self.assertEqual(dlg.routing_fromline_list.count(), 4)
222+
223+
self.assertEqual(
224+
dlg.routing_fromline_list.count(), 4
225+
)
226+
227+
# Set project CRS to EPSG:4326 to force coordinate transformation
228+
project_crs = QgsCoordinateReferenceSystem.fromEpsgId(4326)
229+
self.assertEqual(dlg.last_crs.authid(), "EPSG:3857")
230+
CANVAS.setDestinationCrs(project_crs)
231+
self.assertEqual(dlg.canvas.mapSettings().destinationCrs().authid(), "EPSG:4326")
232+
233+
self.assertEqual(
234+
dlg.routing_fromline_list.count(), 4
235+
)
236+
222237
# Check that the coordinates of the point at the same position in the list has changed
223238
self.assertEqual(
224239
dlg.routing_fromline_list.item(3).text(), "Point 3: -123.342597, 48.442962"

0 commit comments

Comments
 (0)