Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Nov 3, 2019
1 parent c796b2d commit 0f0714e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
32 changes: 16 additions & 16 deletions tests/src/core/testqgscoordinatereferencesystem.cpp
Expand Up @@ -137,7 +137,7 @@ void TestQgsCoordinateReferenceSystem::initTestCase()

QgsDebugMsg( QStringLiteral( "Custom srs database: %1" ).arg( QgsApplication::qgisUserDatabaseFilePath() ) );

qDebug() << "GEOPROJ4 constant: " << GEOPROJ4;
qDebug() << "geoProj4() constant: " << geoProj4();
qDebug() << "GDAL version (build): " << GDAL_RELEASE_NAME;
qDebug() << "GDAL version (runtime): " << GDALVersionInfo( "RELEASE_NAME" );
#if PROJ_VERSION_MAJOR > 4
Expand All @@ -163,7 +163,7 @@ void TestQgsCoordinateReferenceSystem::cleanupTestCase()

void TestQgsCoordinateReferenceSystem::wktCtor()
{
QString myWkt = GEOWKT;
QString myWkt = geoWkt();
QgsCoordinateReferenceSystem myCrs( myWkt );
debugPrint( myCrs );
QVERIFY( myCrs.isValid() );
Expand Down Expand Up @@ -336,15 +336,15 @@ void TestQgsCoordinateReferenceSystem::sridCache()
void TestQgsCoordinateReferenceSystem::createFromWkt()
{
QgsCoordinateReferenceSystem myCrs;
myCrs.createFromWkt( GEOWKT );
myCrs.createFromWkt( geoWkt() );
debugPrint( myCrs );
QVERIFY( myCrs.isValid() );
QCOMPARE( myCrs.srsid(), GEOCRS_ID );
}

void TestQgsCoordinateReferenceSystem::fromWkt()
{
QgsCoordinateReferenceSystem myCrs = QgsCoordinateReferenceSystem::fromWkt( GEOWKT );
QgsCoordinateReferenceSystem myCrs = QgsCoordinateReferenceSystem::fromWkt( geoWkt() );
QVERIFY( myCrs.isValid() );
QCOMPARE( myCrs.srsid(), GEOCRS_ID );
myCrs = QgsCoordinateReferenceSystem::fromWkt( QStringLiteral( "not wkt" ) );
Expand All @@ -355,13 +355,13 @@ void TestQgsCoordinateReferenceSystem::wktCache()
{
// test that crs can be retrieved correctly from cache
QgsCoordinateReferenceSystem crs;
crs.createFromWkt( GEOWKT );
crs.createFromWkt( geoWkt() );
QVERIFY( crs.isValid() );
QCOMPARE( crs.srsid(), GEOCRS_ID );
QVERIFY( QgsCoordinateReferenceSystem::sWktCache.contains( GEOWKT ) );
QVERIFY( QgsCoordinateReferenceSystem::sWktCache.contains( geoWkt() ) );
// a second time, so crs is fetched from cache
QgsCoordinateReferenceSystem crs2;
crs2.createFromWkt( GEOWKT );
crs2.createFromWkt( geoWkt() );
QVERIFY( crs2.isValid() );
QCOMPARE( crs2.srsid(), GEOCRS_ID );

Expand All @@ -376,7 +376,7 @@ void TestQgsCoordinateReferenceSystem::wktCache()
QVERIFY( !crs4.isValid() );

QgsCoordinateReferenceSystem::invalidateCache();
QVERIFY( !QgsCoordinateReferenceSystem::sWktCache.contains( GEOWKT ) );
QVERIFY( !QgsCoordinateReferenceSystem::sWktCache.contains( geoWkt() ) );
}

QString TestQgsCoordinateReferenceSystem::testESRIWkt( int i, QgsCoordinateReferenceSystem &myCrs )
Expand Down Expand Up @@ -544,15 +544,15 @@ void TestQgsCoordinateReferenceSystem::createFromProj4()
QVERIFY( !myCrs.createFromProj4( QString() ) );
QVERIFY( !myCrs.isValid() );

QVERIFY( myCrs.createFromProj4( GEOPROJ4 ) );
QVERIFY( myCrs.createFromProj4( geoProj4() ) );
debugPrint( myCrs );
QVERIFY( myCrs.isValid() );
QCOMPARE( myCrs.srsid(), GEOCRS_ID );
}

void TestQgsCoordinateReferenceSystem::fromProj4()
{
QgsCoordinateReferenceSystem myCrs = QgsCoordinateReferenceSystem::fromProj4( GEOPROJ4 );
QgsCoordinateReferenceSystem myCrs = QgsCoordinateReferenceSystem::fromProj4( geoProj4() );
debugPrint( myCrs );
QVERIFY( myCrs.isValid() );
QCOMPARE( myCrs.srsid(), GEOCRS_ID );
Expand All @@ -568,13 +568,13 @@ void TestQgsCoordinateReferenceSystem::proj4Cache()
{
// test that crs can be retrieved correctly from cache
QgsCoordinateReferenceSystem crs;
crs.createFromProj4( GEOPROJ4 );
crs.createFromProj4( geoProj4() );
QVERIFY( crs.isValid() );
QCOMPARE( crs.srsid(), GEOCRS_ID );
QVERIFY( QgsCoordinateReferenceSystem::sProj4Cache.contains( GEOPROJ4 ) );
QVERIFY( QgsCoordinateReferenceSystem::sProj4Cache.contains( geoProj4() ) );
// a second time, so crs is fetched from cache
QgsCoordinateReferenceSystem crs2;
crs2.createFromProj4( GEOPROJ4 );
crs2.createFromProj4( geoProj4() );
QVERIFY( crs2.isValid() );
QCOMPARE( crs2.srsid(), GEOCRS_ID );

Expand All @@ -589,7 +589,7 @@ void TestQgsCoordinateReferenceSystem::proj4Cache()
QVERIFY( !crs4.isValid() );

QgsCoordinateReferenceSystem::invalidateCache();
QVERIFY( !QgsCoordinateReferenceSystem::sProj4Cache.contains( GEOPROJ4 ) );
QVERIFY( !QgsCoordinateReferenceSystem::sProj4Cache.contains( geoProj4() ) );
}

void TestQgsCoordinateReferenceSystem::fromString()
Expand Down Expand Up @@ -792,7 +792,7 @@ void TestQgsCoordinateReferenceSystem::toWkt()
myCrs.createFromSrid( GEOSRID );
QString myWkt = myCrs.toWkt();
debugPrint( myCrs );
//Note: this is not the same as GEOWKT as OGR strips off the TOWGS clause...
//Note: this is not the same as geoWkt() as OGR strips off the TOWGS clause...
QString myStrippedWkt( "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID"
"[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],"
"AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY"
Expand All @@ -809,7 +809,7 @@ void TestQgsCoordinateReferenceSystem::toProj4()
debugPrint( myCrs );
//first proj string produced by gdal 1.8-1.9
//second by gdal 1.7
QCOMPARE( myCrs.toProj4(), GEOPROJ4 );
QCOMPARE( myCrs.toProj4(), geoProj4() );
}
void TestQgsCoordinateReferenceSystem::isGeographic()
{
Expand Down
10 changes: 5 additions & 5 deletions tests/src/core/testqgsdistancearea.cpp
Expand Up @@ -72,7 +72,7 @@ void TestQgsDistanceArea::basic()
QgsDistanceArea daA;
double resultA, resultB, resultC;

daA.setEllipsoid( GEO_NONE );
daA.setEllipsoid( geoNone() );
resultA = daA.measureLine( p1, p2 );
QCOMPARE( resultA, 5.0 );

Expand Down Expand Up @@ -107,9 +107,9 @@ void TestQgsDistanceArea::basic()
void TestQgsDistanceArea::noEllipsoid()
{
QgsDistanceArea da;
da.setEllipsoid( GEO_NONE );
da.setEllipsoid( geoNone() );
QVERIFY( !da.willUseEllipsoid() );
QCOMPARE( da.ellipsoid(), GEO_NONE );
QCOMPARE( da.ellipsoid(), geoNone() );
}

void TestQgsDistanceArea::cache()
Expand Down Expand Up @@ -167,13 +167,13 @@ void TestQgsDistanceArea::cache()
QgsDistanceArea da5;
QVERIFY( !da5.setEllipsoid( QStringLiteral( "MyFirstEllipsoid" ) ) );
QVERIFY( !da5.willUseEllipsoid() );
QCOMPARE( da5.ellipsoid(), GEO_NONE );
QCOMPARE( da5.ellipsoid(), geoNone() );

// invalid again, should be cached
QgsDistanceArea da6;
QVERIFY( !da6.setEllipsoid( QStringLiteral( "MyFirstEllipsoid" ) ) );
QVERIFY( !da6.willUseEllipsoid() );
QCOMPARE( da6.ellipsoid(), GEO_NONE );
QCOMPARE( da6.ellipsoid(), geoNone() );
}

void TestQgsDistanceArea::test_distances()
Expand Down
2 changes: 1 addition & 1 deletion tests/src/core/testqgsmaprendererjob.cpp
Expand Up @@ -112,7 +112,7 @@ void TestQgsMapRendererJob::initTestCase()
mEncoding = QStringLiteral( "UTF-8" );
QgsField myField1( QStringLiteral( "Value" ), QVariant::Int, QStringLiteral( "int" ), 10, 0, QStringLiteral( "Value on lon" ) );
mFields.append( myField1 );
mCRS = QgsCoordinateReferenceSystem( GEOWKT );
mCRS = QgsCoordinateReferenceSystem( geoWkt() );
//
// Create the test dataset if it doesn't exist
//
Expand Down
4 changes: 2 additions & 2 deletions tests/src/core/testqgsvectorfilewriter.cpp
Expand Up @@ -136,7 +136,7 @@ void TestQgsVectorFileWriter::initTestCase()
mEncoding = QStringLiteral( "UTF-8" );
QgsField myField1( QStringLiteral( "Field1" ), QVariant::String, QStringLiteral( "String" ), 10, 0, QStringLiteral( "Field 1 comment" ) );
mFields.append( myField1 );
mCRS = QgsCoordinateReferenceSystem( GEOWKT );
mCRS = QgsCoordinateReferenceSystem( geoWkt() );
mPoint1 = QgsPointXY( 10.0, 10.0 );
mPoint2 = QgsPointXY( 15.0, 10.0 );
mPoint3 = QgsPointXY( 15.0, 12.0 );
Expand Down Expand Up @@ -434,7 +434,7 @@ void TestQgsVectorFileWriter::regression1141()
QgsFields fields;
fields.append( myField );
QgsCoordinateReferenceSystem crs;
crs = QgsCoordinateReferenceSystem( GEOWKT );
crs = QgsCoordinateReferenceSystem( geoWkt() );
QString tmpDir = QDir::tempPath() + '/';
QString fileName = tmpDir + "ąęćń.shp";

Expand Down

0 comments on commit 0f0714e

Please sign in to comment.