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 16:32:08 +0100
commit4dbb80b693aa547a7e1cca6df470392869ccdfff (patch)
tree826c244aa812bfe820f073f086d70bf27259ac6d /test/unit/test_operation.cpp
parent8a1f24dd37db128417a40de353a682bb825c4442 (diff)
downloadPROJ-4dbb80b693aa547a7e1cca6df470392869ccdfff.tar.gz
PROJ-4dbb80b693aa547a7e1cca6df470392869ccdfff.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 fdf81ebb..53b54808 100644
--- a/test/unit/test_operation.cpp
+++ b/test/unit/test_operation.cpp
@@ -4662,6 +4662,28 @@ TEST(operation, geogCRS_to_geogCRS_context_EPSG_4240_Indian1975_to_EPSG_4326) {
// ---------------------------------------------------------------------------
+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");