From 882d84b086010e2a5088be11362db16217beab99 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Mon, 28 Dec 2020 17:07:44 +0100 Subject: C API: add proj_crs_is_derived() --- test/unit/test_c_api.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test/unit/test_c_api.cpp') diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp index d43d68ce..60ad8f61 100644 --- a/test/unit/test_c_api.cpp +++ b/test/unit/test_c_api.cpp @@ -5183,4 +5183,30 @@ TEST_F(CApi, datum_ensemble) { } } +// --------------------------------------------------------------------------- + +TEST_F(CApi, proj_crs_is_derived) { + { + auto wkt = + createProjectedCRS()->exportToWKT(WKTFormatter::create().get()); + auto obj = proj_create_from_wkt(m_ctxt, wkt.c_str(), nullptr, nullptr, + nullptr); + ObjectKeeper keeper(obj); + ASSERT_NE(obj, nullptr) << wkt; + + EXPECT_TRUE(proj_crs_is_derived(m_ctxt, obj)); + } + + { + auto wkt = createProjectedCRS()->baseCRS()->exportToWKT( + WKTFormatter::create().get()); + auto obj = proj_create_from_wkt(m_ctxt, wkt.c_str(), nullptr, nullptr, + nullptr); + ObjectKeeper keeper(obj); + ASSERT_NE(obj, nullptr) << wkt; + + EXPECT_FALSE(proj_crs_is_derived(m_ctxt, obj)); + } +} + } // namespace -- cgit v1.2.3