@@ -73,6 +73,7 @@ class TestQgsVertexTool : public QObject
73
73
void testAddVertexDoubleClickWithShift ();
74
74
void testAvoidIntersections ();
75
75
void testDeleteVertex ();
76
+ void testConvertVertex ();
76
77
void testMoveMultipleVertices ();
77
78
void testMoveMultipleVertices2 ();
78
79
void testMoveVertexTopo ();
@@ -83,7 +84,6 @@ class TestQgsVertexTool : public QObject
83
84
void testActiveLayerPriority ();
84
85
void testSelectedFeaturesPriority ();
85
86
void testVertexToolCompoundCurve ();
86
- void testConvertVertex ();
87
87
88
88
89
89
private:
@@ -800,6 +800,36 @@ void TestQgsVertexTool::testDeleteVertex()
800
800
QCOMPARE ( mLayerPoint ->undoStack ()->index (), 1 );
801
801
}
802
802
803
+
804
+ void TestQgsVertexTool::testConvertVertex ()
805
+ {
806
+ QCOMPARE ( mLayerCompoundCurve ->undoStack ()->index (), 2 );
807
+
808
+ // convert vertex in compoundCurve while moving vertex
809
+ QCOMPARE ( mLayerCompoundCurve ->getFeature ( mFidCompoundCurveF1 ).geometry (), QgsGeometry::fromWkt ( " CompoundCurve ( CircularString (14 14, 10 10, 17 10))" ) );
810
+ mouseClick ( 10 , 10 , Qt::LeftButton );
811
+ keyClick ( Qt::Key_C );
812
+ mouseClick ( 10 , 10 , Qt::LeftButton );
813
+ QCOMPARE ( mLayerCompoundCurve ->undoStack ()->index (), 4 ); // one undo for move, one undo for convert
814
+ QCOMPARE ( mLayerCompoundCurve ->getFeature ( mFidCompoundCurveF1 ).geometry (), QgsGeometry::fromWkt ( " CompoundCurve ((14 14, 10 10, 17 10))" ) );
815
+ mLayerCompoundCurve ->undoStack ()->undo ();
816
+ mLayerCompoundCurve ->undoStack ()->undo ();
817
+ QCOMPARE ( mLayerCompoundCurve ->undoStack ()->index (), 2 );
818
+ QCOMPARE ( mLayerCompoundCurve ->getFeature ( mFidCompoundCurveF1 ).geometry (), QgsGeometry::fromWkt ( " CompoundCurve ( CircularString (14 14, 10 10, 17 10))" ) );
819
+
820
+ // convert vertex in compoundCurve by selection
821
+ QCOMPARE ( mLayerCompoundCurve ->getFeature ( mFidCompoundCurveF1 ).geometry (), QgsGeometry::fromWkt ( " CompoundCurve ( CircularString (14 14, 10 10, 17 10))" ) );
822
+ mousePress ( 9.5 , 9.5 , Qt::LeftButton );
823
+ mouseMove ( 10.5 , 10.5 );
824
+ mouseRelease ( 10.5 , 10.5 , Qt::LeftButton );
825
+ keyClick ( Qt::Key_C );
826
+ QCOMPARE ( mLayerCompoundCurve ->undoStack ()->index (), 3 );
827
+ QCOMPARE ( mLayerCompoundCurve ->getFeature ( mFidCompoundCurveF1 ).geometry (), QgsGeometry::fromWkt ( " CompoundCurve ((14 14, 10 10, 17 10))" ) );
828
+ mLayerCompoundCurve ->undoStack ()->undo ();
829
+ QCOMPARE ( mLayerCompoundCurve ->undoStack ()->index (), 2 );
830
+ QCOMPARE ( mLayerCompoundCurve ->getFeature ( mFidCompoundCurveF1 ).geometry (), QgsGeometry::fromWkt ( " CompoundCurve ( CircularString (14 14, 10 10, 17 10))" ) );
831
+ }
832
+
803
833
void TestQgsVertexTool::testMoveMultipleVertices ()
804
834
{
805
835
// select two vertices
@@ -1323,25 +1353,6 @@ void TestQgsVertexTool::testSelectVerticesByPolygon()
1323
1353
QCOMPARE ( mLayerMultiPolygon ->getFeature ( mFidMultiPolygonF1 ).geometry (), QgsGeometry::fromWkt ( " MultiPolygon (((1 5, 2 5, 2 6.5, 2 8, 1 8, 1 6.5, 1 5),(1.25 5.5, 1.25 6, 1.75 6, 1.75 5.5, 1.25 5.5),(1.25 7, 1.75 7, 1.75 7.5, 1.25 7.5, 1.25 7)),((3 5, 3 6.5, 3 8, 4 8, 4 6.5, 4 5, 3 5),(3.25 5.5, 3.75 5.5, 3.75 6, 3.25 6, 3.25 5.5),(3.25 7, 3.75 7, 3.75 7.5, 3.25 7.5, 3.25 7)))" ) );
1324
1354
}
1325
1355
1326
- void TestQgsVertexTool::testConvertVertex ()
1327
- {
1328
- // convert vertex in compoundCurve
1329
- QCOMPARE ( mLayerCompoundCurve ->getFeature ( mFidCompoundCurveF1 ).geometry (), QgsGeometry::fromWkt ( " CompoundCurve ( CircularString (14 14, 10 10, 17 10))" ) );
1330
- mouseClick ( 1 , 1 , Qt::LeftButton );
1331
- keyClick ( Qt::Key_C );
1332
- QCOMPARE ( mLayerCompoundCurve ->undoStack ()->index (), 2 );
1333
- QCOMPARE ( mLayerCompoundCurve ->getFeature ( mFidCompoundCurveF1 ).geometry (), QgsGeometry::fromWkt ( " CompoundCurve ((14 14, 10 10, 17 10))" ) );
1334
- mLayerCompoundCurve ->undoStack ()->undo ();
1335
- QCOMPARE ( mLayerCompoundCurve ->undoStack ()->index (), 1 );
1336
-
1337
- // convert vertex in linestring
1338
- QCOMPARE ( mLayerLine ->getFeature ( mFidLineF1 ).geometry (), QgsGeometry::fromWkt ( " LINESTRING(2 1, 0.5 0.5, 1 3)" ) );
1339
- mouseClick ( 1 , 1 , Qt::LeftButton );
1340
- keyClick ( Qt::Key_C ); // DOES NOTHING AS IT'S A LINE LAYER
1341
- QCOMPARE ( mLayerLine ->undoStack ()->index (), 1 );
1342
- QCOMPARE ( mLayerLine ->getFeature ( mFidLineF1 ).geometry (), QgsGeometry::fromWkt ( " LINESTRING(2 1, 0.5 0.5, 1 3)" ) );
1343
-
1344
- }
1345
1356
1346
1357
QGSTEST_MAIN ( TestQgsVertexTool )
1347
1358
#include " testqgsvertextool.moc"
0 commit comments