aboutsummaryrefslogtreecommitdiff
path: root/test/unit/test_operation.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-02-25 15:31:41 +0100
committerEven Rouault <even.rouault@spatialys.com>2020-02-25 15:32:28 +0100
commit5c79670110c114c720a9a9bad516f78eee59ea49 (patch)
tree9de48999cc66e130c1266bee4a559d5422cfc88d /test/unit/test_operation.cpp
parent1ce2cc80a4a0ff248cda778ae16de51946fa61b7 (diff)
downloadPROJ-5c79670110c114c720a9a9bad516f78eee59ea49.tar.gz
PROJ-5c79670110c114c720a9a9bad516f78eee59ea49.zip
createOperations(): be robust to a GeographicCRS having a wrong ID attached to it (fixes #1982)
Diffstat (limited to 'test/unit/test_operation.cpp')
-rw-r--r--test/unit/test_operation.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp
index 1af41fde..8a87f3e5 100644
--- a/test/unit/test_operation.cpp
+++ b/test/unit/test_operation.cpp
@@ -4761,6 +4761,28 @@ TEST(operation, geogCRS_to_geogCRS_context_helmert_geog3D_to_geocentirc) {
// ---------------------------------------------------------------------------
+TEST(operation, geogCRS_to_geogCRS_context_invalid_EPSG_ID) {
+ auto authFactory =
+ AuthorityFactory::create(DatabaseContext::create(), "EPSG");
+ auto ctxt = CoordinateOperationContext::create(authFactory, nullptr, 0);
+ // EPSG:4656 is incorrect. Should be EPSG:8997
+ auto obj = WKTParser().createFromWKT(
+ "GEOGCS[\"ITRF2000\","
+ "DATUM[\"International_Terrestrial_Reference_Frame_2000\","
+ "SPHEROID[\"GRS 1980\",6378137,298.257222101,"
+ "AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6656\"]],"
+ "PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.0174532925199433],"
+ "AUTHORITY[\"EPSG\",\"4656\"]]");
+ auto crs = nn_dynamic_pointer_cast<GeographicCRS>(obj);
+ ASSERT_TRUE(crs != nullptr);
+
+ auto list = CoordinateOperationFactory::create()->createOperations(
+ NN_NO_CHECK(crs), GeographicCRS::EPSG_4326, ctxt);
+ ASSERT_EQ(list.size(), 1U);
+}
+
+// ---------------------------------------------------------------------------
+
TEST(operation, vertCRS_to_geogCRS_context) {
auto authFactory =
AuthorityFactory::create(DatabaseContext::create(), "EPSG");