@@ -74,15 +74,24 @@ class TestQgsNodeTool : public QObject
74
74
mNodeTool ->cadCanvasMoveEvent ( &e );
75
75
}
76
76
77
- void mouseClick ( double mapX, double mapY, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = Qt::KeyboardModifiers() )
77
+ void mousePress ( double mapX, double mapY, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = Qt::KeyboardModifiers() )
78
78
{
79
79
QgsMapMouseEvent e1 ( mCanvas , QEvent::MouseButtonPress, mapToScreen ( mapX, mapY ), button, button, stateKey );
80
80
mNodeTool ->cadCanvasPressEvent ( &e1 );
81
+ }
81
82
83
+ void mouseRelease ( double mapX, double mapY, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = Qt::KeyboardModifiers() )
84
+ {
82
85
QgsMapMouseEvent e2 ( mCanvas , QEvent::MouseButtonRelease, mapToScreen ( mapX, mapY ), button, Qt::MouseButton (), stateKey );
83
86
mNodeTool ->cadCanvasReleaseEvent ( &e2 );
84
87
}
85
88
89
+ void mouseClick ( double mapX, double mapY, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = Qt::KeyboardModifiers() )
90
+ {
91
+ mousePress ( mapX, mapY, button, stateKey );
92
+ mouseRelease ( mapX, mapY, button, stateKey );
93
+ }
94
+
86
95
void keyClick ( int key )
87
96
{
88
97
QKeyEvent e1 ( QEvent::KeyPress, key, Qt::KeyboardModifiers () );
@@ -421,6 +430,21 @@ void TestQgsNodeTool::testDeleteVertex()
421
430
422
431
QCOMPARE ( mLayerPoint ->getFeature ( mFidPointF1 ).geometry (), QgsGeometry::fromWkt ( " POINT(2 3)" ) );
423
432
433
+ // delete a vertex by dragging a selection rect
434
+
435
+ mousePress ( 0.5 , 2.5 , Qt::LeftButton );
436
+ mouseMove ( 1.5 , 3.5 );
437
+ mouseRelease ( 1.5 , 3.5 , Qt::LeftButton );
438
+ keyClick ( Qt::Key_Delete );
439
+
440
+ QCOMPARE ( mLayerLine ->undoStack ()->index (), 2 );
441
+ QCOMPARE ( mLayerLine ->getFeature ( mFidLineF1 ).geometry (), QgsGeometry::fromWkt ( " LINESTRING(2 1, 1 1)" ) );
442
+
443
+ mLayerLine ->undoStack ()->undo ();
444
+ QCOMPARE ( mLayerLine ->undoStack ()->index (), 1 );
445
+
446
+ QCOMPARE ( mLayerLine ->getFeature ( mFidLineF1 ).geometry (), QgsGeometry::fromWkt ( " LINESTRING(2 1, 1 1, 1 3)" ) );
447
+
424
448
// no other unexpected changes happened
425
449
QCOMPARE ( mLayerLine ->undoStack ()->index (), 1 );
426
450
QCOMPARE ( mLayerPolygon ->undoStack ()->index (), 1 );
0 commit comments