1 /***************************************************************************
2      testqgsmaptoolellipse.cpp
3      ------------------------
4     Date                 : January 2018
5     Copyright            : (C) 2018 by Paul Blottiere
6                            (C) 2021 by Loïc Bartoletti
7     Email                : paul.blottiere@oslandia.com
8                            loic dot bartoletti @oslandia dot com
9  ***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 
18 #include "qgstest.h"
19 
20 #include "qgisapp.h"
21 #include "qgsgeometry.h"
22 #include "qgsmapcanvas.h"
23 #include "qgssettingsregistrycore.h"
24 #include "qgsvectorlayer.h"
25 #include "qgsmaptooladdfeature.h"
26 
27 #include "testqgsmaptoolutils.h"
28 #include "qgsmaptoolellipsecenterpoint.h"
29 #include "qgsmaptoolellipsecenter2points.h"
30 #include "qgsmaptoolellipseextent.h"
31 #include "qgsmaptoolellipsefoci.h"
32 
33 class TestQgsMapToolEllipse : public QObject
34 {
35     Q_OBJECT
36 
37   public:
38     TestQgsMapToolEllipse();
39 
40   private slots:
41     void initTestCase();
42     void cleanupTestCase();
43 
44     void testEllipse_data();
45     void testEllipse();
46 
47   private:
48     QgisApp *mQgisApp = nullptr;
49     QgsMapToolCapture *mParentTool = nullptr;
50     QgsMapCanvas *mCanvas = nullptr;
51     std::map<QString, std::unique_ptr<QgsVectorLayer>> mVectorLayerMap = {};
52 
53     const QList<QString> mCoordinateList =
54     {
55       "XY", "XYZ", "XYM", "XYZM"
56     };
57     const QList<QString> mDrawingEllipseMethods =
58     {
59       "CenterAndPoint", "CenterAndPointWithDeletedVertex",
60       "CenterAnd2Points", "CenterAnd2PointsWithDeletedVertex",
61       "FromExtent", "FromExtentWithDeletedVertex",
62       "FromFoci", "FromFociWithDeletedVertex",
63     };
64     QMap<QString, QString> mDrawFunctionUserNames = {};
65     QMap<QString, std::function<QgsFeatureId( void )>> mDrawFunctionPtrMap = {};
66     QMap<QString, QString> mExpectedWkts = {};
67 
68     void initAttributs();
69 
70     QgsFeatureId drawEllipseFromCenterAndPoint();
71     QgsFeatureId drawEllipseFromCenterAndPointWithDeletedVertex();
72     QgsFeatureId drawEllipseFromCenterAnd2Points();
73     QgsFeatureId drawEllipseFromCenterAnd2PointsWithDeletedVertex();
74     QgsFeatureId drawEllipseFromExtent();
75     QgsFeatureId drawEllipseFromExtentWithDeletedVertex();
76     QgsFeatureId drawEllipseFromFoci();
77     QgsFeatureId drawEllipseFromFociWithDeletedVertex();
78 
79     const double Z = 444.0;
80     const double M = 222.0;
81     const int WKT_PRECISION = 2;
82 
segments()83     unsigned int segments( ) { return QgsSettingsRegistryCore::settingsDigitizingOffsetQuadSeg.value() * 12; }
84 };
85 
86 TestQgsMapToolEllipse::TestQgsMapToolEllipse() = default;
87 
88 
89 //runs before all tests
initTestCase()90 void TestQgsMapToolEllipse::initTestCase()
91 {
92   QgsApplication::init();
93   QgsApplication::initQgis();
94 
95   mQgisApp = new QgisApp();
96   mCanvas = new QgsMapCanvas();
97   mCanvas->setDestinationCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:27700" ) ) );
98 
99   // make testing layers
100   QList<QgsMapLayer *> layerList;
101 
102   mVectorLayerMap["XY"] = std::make_unique<QgsVectorLayer>( QStringLiteral( "LineString?crs=EPSG:27700" ), QStringLiteral( "layer line " ), QStringLiteral( "memory" ) );
103   QVERIFY( mVectorLayerMap["XY"]->isValid() );
104   layerList << mVectorLayerMap["XY"].get();
105 
106   mVectorLayerMap["XYZ"] = std::make_unique<QgsVectorLayer>( QStringLiteral( "LineStringZ?crs=EPSG:27700" ), QStringLiteral( "layer line Z" ), QStringLiteral( "memory" ) );
107   QVERIFY( mVectorLayerMap["XYZ"]->isValid() );
108   layerList << mVectorLayerMap["XYZ"].get();
109 
110   mVectorLayerMap["XYM"] = std::make_unique<QgsVectorLayer>( QStringLiteral( "LineStringM?crs=EPSG:27700" ), QStringLiteral( "layer line M" ), QStringLiteral( "memory" ) );
111   QVERIFY( mVectorLayerMap["XYM"]->isValid() );
112   layerList << mVectorLayerMap["XYM"].get();
113 
114   mVectorLayerMap["XYZM"] = std::make_unique<QgsVectorLayer>( QStringLiteral( "LineStringZM?crs=EPSG:27700" ), QStringLiteral( "layer line ZM" ), QStringLiteral( "memory" ) );
115   QVERIFY( mVectorLayerMap["XYZM"]->isValid() );
116   layerList << mVectorLayerMap["XYZM"].get();
117 
118   // add and set layers in canvas
119   QgsProject::instance()->addMapLayers( layerList );
120   mCanvas->setLayers( layerList );
121 
122   mParentTool = new QgsMapToolAddFeature( mCanvas, QgsMapToolCapture::CaptureLine );
123 
124   initAttributs();
125 }
126 
initAttributs()127 void TestQgsMapToolEllipse::initAttributs()
128 {
129   mDrawFunctionUserNames["CenterAndPoint"] = "from center and a point";
130   mDrawFunctionUserNames["CenterAndPointWithDeletedVertex"] = "from center and a point with deleted vertex";
131   mDrawFunctionUserNames["CenterAnd2Points"] = "from center and 2 points";
132   mDrawFunctionUserNames["CenterAnd2PointsWithDeletedVertex"] = "from center and 2 points with deleted vertex";
133   mDrawFunctionUserNames["FromExtent"] = "from extent point";
134   mDrawFunctionUserNames["FromExtentWithDeletedVertex"] = "from extent with deleted vertex";
135   mDrawFunctionUserNames["FromFoci"] = "from foci point";
136   mDrawFunctionUserNames["FromFociWithDeletedVertex"] = "from foci with deleted vertex";
137 
138   mDrawFunctionPtrMap["CenterAndPoint"] = std::bind( &TestQgsMapToolEllipse::drawEllipseFromCenterAndPoint, this );
139   mDrawFunctionPtrMap["CenterAndPointWithDeletedVertex"] = std::bind( &TestQgsMapToolEllipse::drawEllipseFromCenterAndPointWithDeletedVertex, this );
140   mDrawFunctionPtrMap["CenterAnd2Points"] = std::bind( &TestQgsMapToolEllipse::drawEllipseFromCenterAnd2Points, this );
141   mDrawFunctionPtrMap["CenterAnd2PointsWithDeletedVertex"] = std::bind( &TestQgsMapToolEllipse::drawEllipseFromCenterAnd2PointsWithDeletedVertex, this );
142   mDrawFunctionPtrMap["FromExtent"] = std::bind( &TestQgsMapToolEllipse::drawEllipseFromExtent, this );
143   mDrawFunctionPtrMap["FromExtentWithDeletedVertex"] = std::bind( &TestQgsMapToolEllipse::drawEllipseFromExtentWithDeletedVertex, this );
144   mDrawFunctionPtrMap["FromFoci"] = std::bind( &TestQgsMapToolEllipse::drawEllipseFromFoci, this );
145   mDrawFunctionPtrMap["FromFociWithDeletedVertex"] = std::bind( &TestQgsMapToolEllipse::drawEllipseFromFociWithDeletedVertex, this );
146 
147   mExpectedWkts[QStringLiteral( "XY" "CenterAndPoint" )] =  QgsEllipse::fromCenterPoint( QgsPoint( 0, 0 ), QgsPoint( 1, -1 ) ).toLineString( segments() )->asWkt( WKT_PRECISION );
148   mExpectedWkts[QStringLiteral( "XY" "CenterAndPointWithDeletedVertex" )] = mExpectedWkts[QStringLiteral( "XY" "CenterAndPoint" )];
149   mExpectedWkts[QStringLiteral( "XY" "CenterAnd2Points" )] = QgsEllipse::fromCenter2Points( QgsPoint( 0, 0 ), QgsPoint( 0, 1 ), QgsPoint( 0, -1 ) ).toLineString( segments() )->asWkt( WKT_PRECISION );
150   mExpectedWkts[QStringLiteral( "XY" "CenterAnd2PointsWithDeletedVertex" )] = mExpectedWkts[QStringLiteral( "XY" "CenterAnd2Points" )];
151   mExpectedWkts[QStringLiteral( "XY" "FromExtent" )] = QgsEllipse::fromExtent( QgsPoint( 0, 0 ), QgsPoint( 2, 2 ) ).toLineString( segments() )->asWkt( WKT_PRECISION );
152   mExpectedWkts[QStringLiteral( "XY" "FromExtentWithDeletedVertex" )] = mExpectedWkts[QStringLiteral( "XY" "FromExtent" )];
153   mExpectedWkts[QStringLiteral( "XY" "FromFoci" )] = QgsEllipse::fromFoci( QgsPoint( 0, 0 ), QgsPoint( 1, -1 ), QgsPoint( 0, -1 ) ).toLineString( segments() )->asWkt( WKT_PRECISION );
154   mExpectedWkts[QStringLiteral( "XY" "FromFociWithDeletedVertex" )] = mExpectedWkts[QStringLiteral( "XY" "FromFoci" )];
155 
156   mExpectedWkts[QStringLiteral( "XYZ" "CenterAndPoint" )] =  QgsEllipse::fromCenterPoint( QgsPoint( 0, 0, Z, M, QgsWkbTypes::PointZ ), QgsPoint( 1, -1, Z, M, QgsWkbTypes::PointZ ) ).toLineString( segments() )->asWkt( WKT_PRECISION );
157   mExpectedWkts[QStringLiteral( "XYZ" "CenterAndPointWithDeletedVertex" )] = mExpectedWkts[QStringLiteral( "XYZ" "CenterAndPoint" )];
158   mExpectedWkts[QStringLiteral( "XYZ" "CenterAnd2Points" )] = QgsEllipse::fromCenter2Points( QgsPoint( 0, 0, Z, M, QgsWkbTypes::PointZ ), QgsPoint( 0, 1, Z, M, QgsWkbTypes::PointZ ), QgsPoint( 0, -1, Z, M, QgsWkbTypes::PointZ ) ).toLineString( segments() )->asWkt( WKT_PRECISION );
159   mExpectedWkts[QStringLiteral( "XYZ" "CenterAnd2PointsWithDeletedVertex" )] = mExpectedWkts[QStringLiteral( "XYZ" "CenterAnd2Points" )];
160   mExpectedWkts[QStringLiteral( "XYZ" "FromExtent" )] = QgsEllipse::fromExtent( QgsPoint( 0, 0, Z, M, QgsWkbTypes::PointZ ), QgsPoint( 2, 2, Z, M, QgsWkbTypes::PointZ ) ).toLineString( segments() )->asWkt( WKT_PRECISION );
161   mExpectedWkts[QStringLiteral( "XYZ" "FromExtentWithDeletedVertex" )] = mExpectedWkts[QStringLiteral( "XYZ" "FromExtent" )];
162   mExpectedWkts[QStringLiteral( "XYZ" "FromFoci" )] = QgsEllipse::fromFoci( QgsPoint( 0, 0, Z, M, QgsWkbTypes::PointZ ), QgsPoint( 1, -1, Z, M, QgsWkbTypes::PointZ ), QgsPoint( 0, -1, Z, M, QgsWkbTypes::PointZ ) ).toLineString( segments() )->asWkt( WKT_PRECISION );
163   mExpectedWkts[QStringLiteral( "XYZ" "FromFociWithDeletedVertex" )] = mExpectedWkts[QStringLiteral( "XYZ" "FromFoci" )];
164 
165   mExpectedWkts[QStringLiteral( "XYM" "CenterAndPoint" )] =  QgsEllipse::fromCenterPoint( QgsPoint( 0, 0, Z, M, QgsWkbTypes::PointM ), QgsPoint( 1, -1, Z, M, QgsWkbTypes::PointM ) ).toLineString( segments() )->asWkt( WKT_PRECISION );
166   mExpectedWkts[QStringLiteral( "XYM" "CenterAndPointWithDeletedVertex" )] = mExpectedWkts[QStringLiteral( "XYM" "CenterAndPoint" )];
167   mExpectedWkts[QStringLiteral( "XYM" "CenterAnd2Points" )] = QgsEllipse::fromCenter2Points( QgsPoint( 0, 0, Z, M, QgsWkbTypes::PointM ), QgsPoint( 0, 1, Z, M, QgsWkbTypes::PointM ), QgsPoint( 0, -1, Z, M, QgsWkbTypes::PointM ) ).toLineString( segments() )->asWkt( WKT_PRECISION );
168   mExpectedWkts[QStringLiteral( "XYM" "CenterAnd2PointsWithDeletedVertex" )] = mExpectedWkts[QStringLiteral( "XYM" "CenterAnd2Points" )];
169   mExpectedWkts[QStringLiteral( "XYM" "FromExtent" )] = QgsEllipse::fromExtent( QgsPoint( 0, 0, Z, M, QgsWkbTypes::PointM ), QgsPoint( 2, 2, Z, M, QgsWkbTypes::PointM ) ).toLineString( segments() )->asWkt( WKT_PRECISION );
170   mExpectedWkts[QStringLiteral( "XYM" "FromExtentWithDeletedVertex" )] = mExpectedWkts[QStringLiteral( "XYM" "FromExtent" )];
171   mExpectedWkts[QStringLiteral( "XYM" "FromFoci" )] = QgsEllipse::fromFoci( QgsPoint( 0, 0, Z, M, QgsWkbTypes::PointM ), QgsPoint( 1, -1, Z, M, QgsWkbTypes::PointM ), QgsPoint( 0, -1, Z, M, QgsWkbTypes::PointM ) ).toLineString( segments() )->asWkt( WKT_PRECISION );
172   mExpectedWkts[QStringLiteral( "XYM" "FromFociWithDeletedVertex" )] = mExpectedWkts[QStringLiteral( "XYM" "FromFoci" )];
173 
174   mExpectedWkts[QStringLiteral( "XYZM" "CenterAndPoint" )] =  QgsEllipse::fromCenterPoint( QgsPoint( 0, 0, Z, M, QgsWkbTypes::PointZM ), QgsPoint( 1, -1, Z, M, QgsWkbTypes::PointZM ) ).toLineString( segments() )->asWkt( WKT_PRECISION );
175   mExpectedWkts[QStringLiteral( "XYZM" "CenterAndPointWithDeletedVertex" )] = mExpectedWkts[QStringLiteral( "XYZM" "CenterAndPoint" )];
176   mExpectedWkts[QStringLiteral( "XYZM" "CenterAnd2Points" )] = QgsEllipse::fromCenter2Points( QgsPoint( 0, 0, Z, M, QgsWkbTypes::PointZM ), QgsPoint( 0, 1, Z, M, QgsWkbTypes::PointZM ), QgsPoint( 0, -1, Z, M, QgsWkbTypes::PointZM ) ).toLineString( segments() )->asWkt( WKT_PRECISION );
177   mExpectedWkts[QStringLiteral( "XYZM" "CenterAnd2PointsWithDeletedVertex" )] = mExpectedWkts[QStringLiteral( "XYZM" "CenterAnd2Points" )];
178   mExpectedWkts[QStringLiteral( "XYZM" "FromExtent" )] = QgsEllipse::fromExtent( QgsPoint( 0, 0, Z, M, QgsWkbTypes::PointZM ), QgsPoint( 2, 2, Z, M, QgsWkbTypes::PointZM ) ).toLineString( segments() )->asWkt( WKT_PRECISION );
179   mExpectedWkts[QStringLiteral( "XYZM" "FromExtentWithDeletedVertex" )] = mExpectedWkts[QStringLiteral( "XYZM" "FromExtent" )];
180   mExpectedWkts[QStringLiteral( "XYZM" "FromFoci" )] = QgsEllipse::fromFoci( QgsPoint( 0, 0, Z, M, QgsWkbTypes::PointZM ), QgsPoint( 1, -1, Z, M, QgsWkbTypes::PointZM ), QgsPoint( 0, -1, Z, M, QgsWkbTypes::PointZM ) ).toLineString( segments() )->asWkt( WKT_PRECISION );
181   mExpectedWkts[QStringLiteral( "XYZM" "FromFociWithDeletedVertex" )] = mExpectedWkts[QStringLiteral( "XYZM" "FromFoci" )];
182 }
183 
cleanupTestCase()184 void TestQgsMapToolEllipse::cleanupTestCase()
185 {
186 
187   for ( QString coordinate : mCoordinateList )
188   {
189     mVectorLayerMap[coordinate].reset();
190   }
191   QgsApplication::exitQgis();
192 }
193 
194 
drawEllipseFromCenterAndPoint()195 QgsFeatureId TestQgsMapToolEllipse::drawEllipseFromCenterAndPoint()
196 {
197   QgsMapToolEllipseCenterPoint mapTool( mParentTool, mCanvas );
198   mCanvas->setMapTool( &mapTool );
199 
200   TestQgsMapToolAdvancedDigitizingUtils utils( &mapTool );
201   utils.mouseClick( 0, 0, Qt::LeftButton );
202   utils.mouseMove( 1, -1 );
203   utils.mouseClick( 1, -1, Qt::RightButton );
204 
205   return utils.newFeatureId();
206 }
207 
drawEllipseFromCenterAndPointWithDeletedVertex()208 QgsFeatureId TestQgsMapToolEllipse::drawEllipseFromCenterAndPointWithDeletedVertex()
209 {
210   QgsMapToolEllipseCenterPoint mapTool( mParentTool, mCanvas );
211   mCanvas->setMapTool( &mapTool );
212 
213   TestQgsMapToolAdvancedDigitizingUtils utils( &mapTool );
214   utils.mouseClick( 4, 1, Qt::LeftButton );
215   utils.keyClick( Qt::Key_Backspace );
216   utils.mouseClick( 0, 0, Qt::LeftButton );
217   utils.mouseMove( 1, -1 );
218   utils.mouseClick( 1, -1, Qt::RightButton );
219 
220   return utils.newFeatureId();
221 }
222 
drawEllipseFromCenterAnd2Points()223 QgsFeatureId TestQgsMapToolEllipse::drawEllipseFromCenterAnd2Points()
224 {
225   QgsMapToolEllipseCenter2Points mapTool( mParentTool, mCanvas );
226   mCanvas->setMapTool( &mapTool );
227 
228   TestQgsMapToolAdvancedDigitizingUtils utils( &mapTool );
229   utils.mouseClick( 0, 0, Qt::LeftButton );
230   utils.mouseClick( 0, 1, Qt::LeftButton );
231   utils.mouseMove( 0, -1 );
232   utils.mouseClick( 0, -1, Qt::RightButton );
233 
234   return utils.newFeatureId();
235 }
236 
drawEllipseFromCenterAnd2PointsWithDeletedVertex()237 QgsFeatureId TestQgsMapToolEllipse::drawEllipseFromCenterAnd2PointsWithDeletedVertex()
238 {
239   QgsMapToolEllipseCenter2Points mapTool( mParentTool, mCanvas );
240   mCanvas->setMapTool( &mapTool );
241 
242   TestQgsMapToolAdvancedDigitizingUtils utils( &mapTool );
243   utils.mouseClick( 0, 0, Qt::LeftButton );
244   utils.mouseClick( 4, 1, Qt::LeftButton );
245   utils.keyClick( Qt::Key_Backspace );
246   utils.mouseClick( 0, 1, Qt::LeftButton );
247   utils.mouseMove( 0, -1 );
248   utils.mouseClick( 0, -1, Qt::RightButton );
249 
250   return utils.newFeatureId();
251 }
252 
drawEllipseFromExtent()253 QgsFeatureId TestQgsMapToolEllipse::drawEllipseFromExtent()
254 {
255   QgsMapToolEllipseExtent mapTool( mParentTool, mCanvas );
256   mCanvas->setMapTool( &mapTool );
257 
258   TestQgsMapToolAdvancedDigitizingUtils utils( &mapTool );
259   utils.mouseClick( 0, 0, Qt::LeftButton );
260   utils.mouseMove( 2, 2 );
261   utils.mouseClick( 2, 2, Qt::RightButton );
262 
263   return utils.newFeatureId();
264 }
265 
drawEllipseFromExtentWithDeletedVertex()266 QgsFeatureId TestQgsMapToolEllipse::drawEllipseFromExtentWithDeletedVertex()
267 {
268   QgsMapToolEllipseExtent mapTool( mParentTool, mCanvas );
269   mCanvas->setMapTool( &mapTool );
270 
271   TestQgsMapToolAdvancedDigitizingUtils utils( &mapTool );
272   utils.mouseClick( 4, 1, Qt::LeftButton );
273   utils.keyClick( Qt::Key_Backspace );
274   utils.mouseClick( 0, 0, Qt::LeftButton );
275   utils.mouseMove( 2, 2 );
276   utils.mouseClick( 2, 2, Qt::RightButton );
277 
278   return utils.newFeatureId();
279 }
280 
drawEllipseFromFoci()281 QgsFeatureId TestQgsMapToolEllipse::drawEllipseFromFoci()
282 {
283   QgsMapToolEllipseFoci mapTool( mParentTool, mCanvas );
284   mCanvas->setMapTool( &mapTool );
285 
286   TestQgsMapToolAdvancedDigitizingUtils utils( &mapTool );
287   utils.mouseClick( 0, 0, Qt::LeftButton );
288   utils.mouseMove( 1, -1 );
289   utils.mouseClick( 1, -1, Qt::LeftButton );
290   utils.mouseMove( 0, -1 );
291   utils.mouseClick( 0, -1, Qt::RightButton );
292 
293   return utils.newFeatureId();
294 }
295 
drawEllipseFromFociWithDeletedVertex()296 QgsFeatureId TestQgsMapToolEllipse::drawEllipseFromFociWithDeletedVertex()
297 {
298   QgsMapToolEllipseFoci mapTool( mParentTool, mCanvas );
299   mCanvas->setMapTool( &mapTool );
300 
301   TestQgsMapToolAdvancedDigitizingUtils utils( &mapTool );
302   utils.mouseClick( 4, 1, Qt::LeftButton );
303   utils.keyClick( Qt::Key_Backspace );
304   utils.mouseClick( 0, 0, Qt::LeftButton );
305   utils.mouseMove( 1, -1 );
306   utils.mouseClick( 1, -1, Qt::LeftButton );
307   utils.mouseMove( 0, -1 );
308   utils.mouseClick( 0, -1, Qt::RightButton );
309 
310   return utils.newFeatureId();
311 }
312 
313 
testEllipse_data()314 void TestQgsMapToolEllipse::testEllipse_data()
315 {
316   QTest::addColumn<QString>( "wktGeometry" );
317   QTest::addColumn<QString>( "wktExpected" );
318   QTest::addColumn<qlonglong>( "featureCount" );
319   QTest::addColumn<long>( "featureCountExpected" );
320 
321   QgsSettingsRegistryCore::settingsDigitizingDefaultZValue.setValue( Z );
322   QgsSettingsRegistryCore::settingsDigitizingDefaultMValue.setValue( M );
323 
324   QgsFeatureId newFid;
325   QgsFeature f;
326   QString wkt;
327   QgsVectorLayer *mLayer;
328 
329   QString rowStringName;
330 
331   for ( QString coordinate : mCoordinateList )
332   {
333     mLayer = mVectorLayerMap[coordinate].get();
334     mCanvas->setCurrentLayer( mLayer );
335 
336     for ( QString drawMethod : mDrawingEllipseMethods )
337     {
338       mLayer->startEditing();
339       mLayer->dataProvider()->truncate();
340 
341       newFid = mDrawFunctionPtrMap[drawMethod]();
342       f = mLayer->getFeature( newFid );
343 
344       wkt = mExpectedWkts[coordinate + drawMethod];
345       rowStringName = coordinate + " " + mDrawFunctionUserNames[drawMethod];
346       QTest::newRow( rowStringName.toStdString().c_str() ) << f.geometry().asWkt( WKT_PRECISION ) << wkt << mLayer->featureCount() << ( long )1;
347 
348       mLayer->rollBack();
349     }
350   }
351 
352   QgsSettingsRegistryCore::settingsDigitizingDefaultZValue.setValue( 0 );
353   QgsSettingsRegistryCore::settingsDigitizingDefaultMValue.setValue( 0 );
354 }
355 
testEllipse()356 void TestQgsMapToolEllipse::testEllipse()
357 {
358   QFETCH( qlonglong, featureCount );
359   QFETCH( long, featureCountExpected );
360   QCOMPARE( featureCount, featureCountExpected );
361 
362   QFETCH( QString, wktGeometry );
363   QFETCH( QString, wktExpected );
364   QCOMPARE( wktGeometry, wktExpected );
365 }
366 
367 
368 QGSTEST_MAIN( TestQgsMapToolEllipse )
369 #include "testqgsmaptoolellipse.moc"
370