Skip to content

Commit 1f43afd

Browse files
committed
1 remaining test fails in CRS tests
1 parent 26322b6 commit 1f43afd

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/core/qgscoordinatereferencesystem.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,16 @@ bool QgsCoordinateReferenceSystem::operator==( const QgsCoordinateReferenceSyste
10141014
{
10151015
QString myWkt = toWkt();
10161016
QString theirWkt = theSrs.toWkt();
1017+
// if there is a 0,0,0 based Bursa-Wolf conversion, we will test the
1018+
// wkt with the TOWGS84 string removed as OSRImportFromProj4
1019+
// (which is often used in the class to contruct an SRS)
1020+
// does not create the empty TOWGS84 string
1021+
// TODO check 3 parameter form too?
1022+
// see http://www.gdal.org/ogr/classOGRSpatialReference.html
1023+
// TODO this is probably an ugly hack, find a nicer approach TS
1024+
QString myToWGSString( ",TOWGS84[0,0,0,0,0,0,0]" );
1025+
myWkt.replace( myToWGSString, "" );
1026+
theirWkt.replace( myToWGSString, "" );
10171027
return mIsValidFlag && theSrs.mIsValidFlag && myWkt == theirWkt;
10181028
}
10191029

tests/src/core/testqgscoordinatereferencesystem.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,10 @@ void TestQgsCoordinateReferenceSystem::equals()
180180
QgsCoordinateReferenceSystem myCrs;
181181
myCrs.createFromSrid( GEOSRID );
182182
debugPrint( myCrs );
183-
QVERIFY( myCrs.equals( GEOPROJ4 ) );
183+
//Note: OSRImportFromProj4 (used internally by equals)
184+
//drops the TOWGS from the WKT which causes this test to fail
185+
QString myProj4( GEOPROJ4 );
186+
QVERIFY( myCrs.equals( myProj4 ) );
184187
}
185188
void TestQgsCoordinateReferenceSystem::readXML()
186189
{

0 commit comments

Comments
 (0)