diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-04-03 19:41:23 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-04-03 19:50:48 +0200 |
| commit | bb770de3b7cb04aad8116ed84a5815b7f6f7a82c (patch) | |
| tree | 4f0ecbe08d2ab975966d65f85e4485e4f4050324 /test/unit/test_io.cpp | |
| parent | 1a8933942cf92d0724cc168d04302d8b78c3814f (diff) | |
| download | PROJ-bb770de3b7cb04aad8116ed84a5815b7f6f7a82c.tar.gz PROJ-bb770de3b7cb04aad8116ed84a5815b7f6f7a82c.zip | |
createFromUserInput(): allow compound CRS with the 2 parts given by names, e.g. 'WGS 84 + EGM96 height'
Diffstat (limited to 'test/unit/test_io.cpp')
| -rw-r--r-- | test/unit/test_io.cpp | 30 |
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); } // --------------------------------------------------------------------------- |
