Skip to content

Commit

Permalink
Add some proj6 test branches
Browse files Browse the repository at this point in the history
(cherry picked from commit cdc9a84)
  • Loading branch information
nyalldawson committed Dec 20, 2019
1 parent 394cbb3 commit 1d505d0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/src/core/testqgsdistancearea.cpp
Expand Up @@ -341,7 +341,11 @@ void TestQgsDistanceArea::measureAreaAndUnits()
poly << ring;
polygon = QgsGeometry::fromPolygonXY( poly );

#if PROJ_VERSION_MAJOR>=6
da.setSourceCrs( QgsCoordinateReferenceSystem( QStringLiteral( "ESRI:102635" ) ), QgsProject::instance()->transformContext() );
#else
da.setSourceCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:102635" ) ), QgsProject::instance()->transformContext() );
#endif
da.setEllipsoid( QStringLiteral( "NONE" ) );
// measurement should be in square feet
area = da.measureArea( polygon );
Expand Down
13 changes: 13 additions & 0 deletions tests/src/core/testqgsgdalutils.cpp
Expand Up @@ -105,7 +105,11 @@ void TestQgsGdalUtils::testCreateSingleBandMemoryDataset()
QCOMPARE( GDALGetRasterXSize( ds1.get() ), 40 );
QCOMPARE( GDALGetRasterYSize( ds1.get() ), 20 );

#if PROJ_VERSION_MAJOR>=6
QCOMPARE( GDALGetProjectionRef( ds1.get() ), QStringLiteral( R"""(GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]])""" ) );
#else
QCOMPARE( GDALGetProjectionRef( ds1.get() ), EPSG_4326_WKT );
#endif
double geoTransform[6];
double geoTransformExpected[] = { 1, 0.5, 0, 11, 0, -0.5 };
QCOMPARE( GDALGetGeoTransform( ds1.get(), geoTransform ), CE_None );
Expand All @@ -123,7 +127,11 @@ void TestQgsGdalUtils::testCreateMultiBandMemoryDataset()
QCOMPARE( GDALGetRasterXSize( ds1.get() ), 40 );
QCOMPARE( GDALGetRasterYSize( ds1.get() ), 20 );

#if PROJ_VERSION_MAJOR>=6
QCOMPARE( GDALGetProjectionRef( ds1.get() ), QStringLiteral( R"""(GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]])""" ) );
#else
QCOMPARE( GDALGetProjectionRef( ds1.get() ), EPSG_4326_WKT );
#endif
double geoTransform[6];
double geoTransformExpected[] = { 1, 0.5, 0, 11, 0, -0.5 };
QCOMPARE( GDALGetGeoTransform( ds1.get(), geoTransform ), CE_None );
Expand All @@ -148,7 +156,12 @@ void TestQgsGdalUtils::testCreateSingleBandTiffDataset()
QCOMPARE( GDALGetRasterXSize( ds1.get() ), 40 );
QCOMPARE( GDALGetRasterYSize( ds1.get() ), 20 );

#if PROJ_VERSION_MAJOR>=6
QCOMPARE( GDALGetProjectionRef( ds1.get() ), QStringLiteral( R"""(GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]])""" ) );
#else
QCOMPARE( GDALGetProjectionRef( ds1.get() ), EPSG_4326_WKT );
#endif

double geoTransform[6];
double geoTransformExpected[] = { 1, 0.5, 0, 11, 0, -0.5 };
QCOMPARE( GDALGetGeoTransform( ds1.get(), geoTransform ), CE_None );
Expand Down

0 comments on commit 1d505d0

Please sign in to comment.