diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-05-13 09:33:38 -0500 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2019-05-13 09:42:38 -0500 |
| commit | 97d6060e596d1b044f84e7d140b26200ef56f65e (patch) | |
| tree | bc959ee31e7f73e9ccbd5004340b3ee0548df7e5 /test/unit/test_c_api.cpp | |
| parent | 32703ddba9081682b4c39ae7bcedeabeb8c6143d (diff) | |
| download | PROJ-97d6060e596d1b044f84e7d140b26200ef56f65e.tar.gz PROJ-97d6060e596d1b044f84e7d140b26200ef56f65e.zip | |
identify(): take into account the authority passed in (fixes #1465)
When identifying an object that has already a code with authority A
but the authority of interest passed was B, then it was not checking
that A != B, and did not try to search in the objects of B.
Diffstat (limited to 'test/unit/test_c_api.cpp')
| -rw-r--r-- | test/unit/test_c_api.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp index bea3eaa1..b9ea0bd5 100644 --- a/test/unit/test_c_api.cpp +++ b/test/unit/test_c_api.cpp @@ -1650,6 +1650,38 @@ TEST_F(CApi, proj_identify) { ObjListKeeper keeper_res(res); EXPECT_EQ(res, nullptr); } + { + auto obj2 = proj_create( + m_ctxt, "+proj=longlat +datum=WGS84 +no_defs +type=crs"); + ObjectKeeper keeper2(obj2); + ASSERT_NE(obj2, nullptr); + int *confidence = nullptr; + auto res = proj_identify(m_ctxt, obj2, nullptr, nullptr, &confidence); + ObjListKeeper keeper_res(res); + EXPECT_EQ(proj_list_get_count(res), 4); + proj_int_list_destroy(confidence); + } + { + auto obj2 = proj_create_from_database(m_ctxt, "IGNF", "ETRS89UTM28", + PJ_CATEGORY_CRS, false, nullptr); + ObjectKeeper keeper2(obj2); + ASSERT_NE(obj2, nullptr); + int *confidence = nullptr; + auto res = proj_identify(m_ctxt, obj2, "EPSG", nullptr, &confidence); + ObjListKeeper keeper_res(res); + EXPECT_EQ(proj_list_get_count(res), 1); + auto gotCRS = proj_list_get(m_ctxt, res, 0); + ASSERT_NE(gotCRS, nullptr); + ObjectKeeper keeper_gotCRS(gotCRS); + auto auth = proj_get_id_auth_name(gotCRS, 0); + ASSERT_TRUE(auth != nullptr); + EXPECT_EQ(auth, std::string("EPSG")); + auto code = proj_get_id_code(gotCRS, 0); + ASSERT_TRUE(code != nullptr); + EXPECT_EQ(code, std::string("25828")); + EXPECT_EQ(confidence[0], 70); + proj_int_list_destroy(confidence); + } } // --------------------------------------------------------------------------- |
