Skip to content

Commit

Permalink
1 remaining test fails in CRS tests
Browse files Browse the repository at this point in the history
  • Loading branch information
timlinux committed Apr 7, 2012
1 parent 26322b6 commit 1f43afd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/core/qgscoordinatereferencesystem.cpp
Expand Up @@ -1014,6 +1014,16 @@ bool QgsCoordinateReferenceSystem::operator==( const QgsCoordinateReferenceSyste
{
QString myWkt = toWkt();
QString theirWkt = theSrs.toWkt();
// if there is a 0,0,0 based Bursa-Wolf conversion, we will test the
// wkt with the TOWGS84 string removed as OSRImportFromProj4
// (which is often used in the class to contruct an SRS)
// does not create the empty TOWGS84 string
// TODO check 3 parameter form too?
// see http://www.gdal.org/ogr/classOGRSpatialReference.html
// TODO this is probably an ugly hack, find a nicer approach TS
QString myToWGSString( ",TOWGS84[0,0,0,0,0,0,0]" );
myWkt.replace( myToWGSString, "" );
theirWkt.replace( myToWGSString, "" );
return mIsValidFlag && theSrs.mIsValidFlag && myWkt == theirWkt;
}

Expand Down
5 changes: 4 additions & 1 deletion tests/src/core/testqgscoordinatereferencesystem.cpp
Expand Up @@ -180,7 +180,10 @@ void TestQgsCoordinateReferenceSystem::equals()
QgsCoordinateReferenceSystem myCrs;
myCrs.createFromSrid( GEOSRID );
debugPrint( myCrs );
QVERIFY( myCrs.equals( GEOPROJ4 ) );
//Note: OSRImportFromProj4 (used internally by equals)
//drops the TOWGS from the WKT which causes this test to fail
QString myProj4( GEOPROJ4 );
QVERIFY( myCrs.equals( myProj4 ) );
}
void TestQgsCoordinateReferenceSystem::readXML()
{
Expand Down

0 comments on commit 1f43afd

Please sign in to comment.