[QGIS Commit] r8181 - trunk/qgis/tests/src/core
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Tue Feb 26 05:20:23 EST 2008
Author: timlinux
Date: 2008-02-26 05:20:23 -0500 (Tue, 26 Feb 2008)
New Revision: 8181
Modified:
trunk/qgis/tests/src/core/testqgsgeometry.cpp
Log:
Union test
Modified: trunk/qgis/tests/src/core/testqgsgeometry.cpp
===================================================================
--- trunk/qgis/tests/src/core/testqgsgeometry.cpp 2008-02-26 02:52:00 UTC (rev 8180)
+++ trunk/qgis/tests/src/core/testqgsgeometry.cpp 2008-02-26 10:20:23 UTC (rev 8181)
@@ -26,6 +26,7 @@
//qgis includes...
#include <qgsapplication.h>
#include <qgsgeometry.h>
+#include <qgspoint.h>
/** \ingroup UnitTests
* This is a unit test for the different geometry operations on vector features.
@@ -41,6 +42,7 @@
void cleanup();// will be called after every testfunction.
void intersectionCheck();
+ void unionCheck();
private:
QgsPoint mPoint1; /* +1 +A */
QgsPoint mPoint2; /* / \ / \ */
@@ -143,7 +145,25 @@
QVERIFY ( !mpPolygonGeometryA->intersects(mpPolygonGeometryC));
}
+void TestQgsGeometry::unionCheck()
+{
+ // should be no union as A does not intersect C
+ QgsGeometry * mypUnionGeometry = mpPolygonGeometryA->Union(mpPolygonGeometryC);
+ QgsPolyline myPolyline = mypUnionGeometry->asPolyline();
+ QVERIFY (myPolyline.size() == 0); //check that the union failed properly
+ // should be a union as A intersect B
+ mypUnionGeometry = mpPolygonGeometryA->Union(mpPolygonGeometryB);
+ myPolyline = mypUnionGeometry->asPolyline();
+ QVERIFY (myPolyline.size() > 0); //check that the union created a feature
+ for (int i = 0; i < myPolyline.size(); i++)
+ {
+ QgsPoint myPoint = myPolyline.at(i);
+ qDebug(myPoint.stringRep());
+ }
+ delete mypUnionGeometry;
+}
+
QTEST_MAIN(TestQgsGeometry)
#include "moc_testqgsgeometry.cxx"
More information about the QGIS-commit
mailing list