Skip to content
Permalink
Browse files
adapt some tests to 'better' wkt (followup b1efd47)
  • Loading branch information
jef-n committed Jul 18, 2013
1 parent 8fc14f8 commit ba35b23fd596034ad416b08ed3ac9afd7ab21e6d
@@ -211,7 +211,7 @@ double QgsRasterChecker::tolerance( double val, int places )
QString QgsRasterChecker::compareHead()
{
QString html;
html += QString( "<tr><th style='%1'>Param name</th><th style='%1'>Verified value</th><th style='%1'>Eexpected value</th><th style='%1'>Difference</th><th style='%1'>Tolerance</th></tr>" ).arg( mCellStyle );
html += QString( "<tr><th style='%1'>Param name</th><th style='%1'>Verified value</th><th style='%1'>Expected value</th><th style='%1'>Difference</th><th style='%1'>Tolerance</th></tr>" ).arg( mCellStyle );
return html;
}

@@ -80,14 +80,14 @@ void TestQgsOgcUtils::testGeometryToGML()
QVERIFY( !elemPoint.isNull() );

doc.appendChild( elemPoint );
QCOMPARE( doc.toString( -1 ), QString( "<gml:Point><gml:coordinates cs=\",\" ts=\" \">111.0,222.0</gml:coordinates></gml:Point>" ) );
QCOMPARE( doc.toString( -1 ), QString( "<gml:Point><gml:coordinates cs=\",\" ts=\" \">111,222</gml:coordinates></gml:Point>" ) );
doc.removeChild( elemPoint );

QDomElement elemLine = QgsOgcUtils::geometryToGML( geomLine, doc );
QVERIFY( !elemLine.isNull() );

doc.appendChild( elemLine );
QCOMPARE( doc.toString( -1 ), QString( "<gml:LineString><gml:coordinates cs=\",\" ts=\" \">111.0,222.0 222.0,222.0</gml:coordinates></gml:LineString>" ) );
QCOMPARE( doc.toString( -1 ), QString( "<gml:LineString><gml:coordinates cs=\",\" ts=\" \">111,222 222,222</gml:coordinates></gml:LineString>" ) );
doc.removeChild( elemLine );

// Test GML3
@@ -98,14 +98,14 @@ void TestQgsOgcUtils::testGeometryToGML()
QVERIFY( !elemPoint.isNull() );

doc.appendChild( elemPoint );
QCOMPARE( doc.toString( -1 ), QString( "<gml:Point><gml:pos srsDimension=\"2\">111.0 222.0</gml:pos></gml:Point>" ) );
QCOMPARE( doc.toString( -1 ), QString( "<gml:Point><gml:pos srsDimension=\"2\">111 222</gml:pos></gml:Point>" ) );
doc.removeChild( elemPoint );

elemLine = QgsOgcUtils::geometryToGML( geomLine, doc, "GML3" );
QVERIFY( !elemLine.isNull() );

doc.appendChild( elemLine );
QCOMPARE( doc.toString( -1 ), QString( "<gml:LineString><gml:posList srsDimension=\"2\">111.0 222.0 222.0 222.0</gml:posList></gml:LineString>" ) );
QCOMPARE( doc.toString( -1 ), QString( "<gml:LineString><gml:posList srsDimension=\"2\">111 222 222 222</gml:posList></gml:LineString>" ) );
doc.removeChild( elemLine );

delete geomPoint;
@@ -315,15 +315,15 @@ void TestQgsOgcUtils::testExpressionToOgcFilter_data()
"<ogc:Filter>"
"<ogc:Intersects>"
"<ogc:PropertyName>geometry</ogc:PropertyName>"
"<gml:Point><gml:coordinates cs=\",\" ts=\" \">5.0,6.0</gml:coordinates></gml:Point>"
"<gml:Point><gml:coordinates cs=\",\" ts=\" \">5,6</gml:coordinates></gml:Point>"
"</ogc:Intersects>"
"</ogc:Filter>" );

QTest::newRow( "contains + gml" ) << QString( "contains($geometry, geomFromGML('<Point><coordinates cs=\",\" ts=\" \">5.0,6.0</coordinates></Point>'))" ) << QString(
QTest::newRow( "contains + gml" ) << QString( "contains($geometry, geomFromGML('<Point><coordinates cs=\",\" ts=\" \">5,6</coordinates></Point>'))" ) << QString(
"<ogc:Filter>"
"<ogc:Contains>"
"<ogc:PropertyName>geometry</ogc:PropertyName>"
"<Point><coordinates cs=\",\" ts=\" \">5.0,6.0</coordinates></Point>"
"<Point><coordinates cs=\",\" ts=\" \">5,6</coordinates></Point>"
"</ogc:Contains>"
"</ogc:Filter>" );

@@ -321,7 +321,7 @@ def testClipping(self):
#print 'Difference: %s' % myDifferenceGeometry.exportToWkt()
print 'Symmetrical: %s' % mySymmetricalGeometry.exportToWkt()

myExpectedWkt = 'LINESTRING(20.0 20.0, 30.0 30.0)'
myExpectedWkt = 'LINESTRING(20 20, 30 30)'
# There should only be one feature that intersects this clip
# poly so this assertion should work.
self.assertEqual(myExpectedWkt,
@@ -179,8 +179,8 @@ def testUnion(self):
def testAsWktCoordinates(self):
"""Test that we can get a proper wkt representation fo the rect"""
rect1 = QgsRectangle( 0.0, 0.0, 5.0, 5.0)
myExpectedWkt = ('0.0 0.0, '
'5.0 5.0')
myExpectedWkt = ('0 0, '
'5 5')
myWkt = rect1.asWktCoordinates()
myMessage = ('Expected: %s\nGot: %s\n' %
(myExpectedWkt, myWkt))
@@ -189,11 +189,11 @@ def testAsWktCoordinates(self):
def testAsWktPolygon(self):
"""Test that we can get a proper rect wkt polygon representation for rect"""
rect1 = QgsRectangle( 0.0, 0.0, 5.0, 5.0)
myExpectedWkt = ('POLYGON((0.0 0.0, '
'5.0 0.0, '
'5.0 5.0, '
'0.0 5.0, '
'0.0 0.0))')
myExpectedWkt = ('POLYGON((0 0, '
'5 0, '
'5 5, '
'0 5, '
'0 0))')
myWkt = rect1.asWktPolygon()
myMessage = ('Expected: %s\nGot: %s\n' %
(myExpectedWkt, myWkt))

0 comments on commit ba35b23

Please sign in to comment.