aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-04-04 01:28:11 +0200
committerGitHub <noreply@github.com>2020-04-04 01:28:11 +0200
commit670eab68f2345b2a77bfac8a109588770bceb740 (patch)
tree4f0ecbe08d2ab975966d65f85e4485e4f4050324 /test
parent1a8933942cf92d0724cc168d04302d8b78c3814f (diff)
parentbb770de3b7cb04aad8116ed84a5815b7f6f7a82c (diff)
downloadPROJ-670eab68f2345b2a77bfac8a109588770bceb740.tar.gz
PROJ-670eab68f2345b2a77bfac8a109588770bceb740.zip
Merge pull request #2126 from rouault/createFromUserInput_compoundCRS_from_names
createFromUserInput(): allow compound CRS with the 2 parts given by names, e.g. 'WGS 84 + EGM96 height'
Diffstat (limited to 'test')
-rw-r--r--test/unit/test_io.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp
index 9d6c2c43..6cdd3014 100644
--- a/test/unit/test_io.cpp
+++ b/test/unit/test_io.cpp
@@ -9548,6 +9548,36 @@ TEST(io, createFromUserInput) {
ParsingException);
EXPECT_NO_THROW(createFromUserInput("WGS84 UTM zone 31N", dbContext));
EXPECT_NO_THROW(createFromUserInput("ID74", dbContext));
+
+ {
+ // Exact match on each piece of the compound CRS
+ auto obj = createFromUserInput("WGS 84 + EGM96 height", dbContext);
+ auto crs = nn_dynamic_pointer_cast<CompoundCRS>(obj);
+ ASSERT_TRUE(crs != nullptr);
+ EXPECT_EQ(crs->nameStr(), "WGS 84 + EGM96 height");
+ }
+
+ {
+ // Aproximate match on each piece of the compound CRS
+ auto obj = createFromUserInput("WGS84 + EGM96", dbContext);
+ auto crs = nn_dynamic_pointer_cast<CompoundCRS>(obj);
+ ASSERT_TRUE(crs != nullptr);
+ EXPECT_EQ(crs->nameStr(), "WGS 84 + EGM96 height");
+ }
+
+ {
+ // Exact match of a CompoundCRS object
+ auto obj = createFromUserInput(
+ "WGS 84 / World Mercator + EGM2008 height", dbContext);
+ auto crs = nn_dynamic_pointer_cast<CompoundCRS>(obj);
+ ASSERT_TRUE(crs != nullptr);
+ EXPECT_EQ(crs->identifiers().size(), 1U);
+ }
+
+ EXPECT_THROW(createFromUserInput("WGS 84 + foobar", dbContext),
+ ParsingException);
+ EXPECT_THROW(createFromUserInput("foobar + EGM96 height", dbContext),
+ ParsingException);
}
// ---------------------------------------------------------------------------