diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-03-16 17:56:42 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-16 17:56:42 +0100 |
| commit | 1707090212c4a784e15b67f3e396640da840ad18 (patch) | |
| tree | 7509a1282eea3bd939b42fbb7610aadedbb28e85 /test/unit/test_c_api.cpp | |
| parent | 175cbad0a7ca202cefff33f240100b01752f8f73 (diff) | |
| parent | 6cfc2521d687e3de57fa13b0f80ef05073362571 (diff) | |
| download | PROJ-1707090212c4a784e15b67f3e396640da840ad18.tar.gz PROJ-1707090212c4a784e15b67f3e396640da840ad18.zip | |
Merge pull request #2068 from rouault/add_proj_get_suggested_operation
Add proj_get_suggested_operation()
Diffstat (limited to 'test/unit/test_c_api.cpp')
| -rw-r--r-- | test/unit/test_c_api.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp index bcd14c0f..c984e84e 100644 --- a/test/unit/test_c_api.cpp +++ b/test/unit/test_c_api.cpp @@ -1348,12 +1348,36 @@ TEST_F(CApi, proj_create_operations) { EXPECT_EQ(proj_list_get(m_ctxt, res, -1), nullptr); EXPECT_EQ(proj_list_get(m_ctxt, res, proj_list_get_count(res)), nullptr); - auto op = proj_list_get(m_ctxt, res, 0); - ASSERT_NE(op, nullptr); - ObjectKeeper keeper_op(op); - EXPECT_FALSE(proj_coordoperation_has_ballpark_transformation(m_ctxt, op)); + { + auto op = proj_list_get(m_ctxt, res, 0); + ASSERT_NE(op, nullptr); + ObjectKeeper keeper_op(op); + EXPECT_FALSE( + proj_coordoperation_has_ballpark_transformation(m_ctxt, op)); + EXPECT_EQ(proj_get_name(op), std::string("NAD27 to NAD83 (3)")); + } + + { + PJ_COORD coord; + coord.xy.x = 40; + coord.xy.y = -100; + int idx = proj_get_suggested_operation(m_ctxt, res, PJ_FWD, coord); + ASSERT_GE(idx, 0); + ASSERT_LT(idx, proj_list_get_count(res)); + auto op = proj_list_get(m_ctxt, res, idx); + ASSERT_NE(op, nullptr); + ObjectKeeper keeper_op(op); + // Transformation for USA + EXPECT_EQ(proj_get_name(op), std::string("NAD27 to NAD83 (1)")); + } - EXPECT_EQ(proj_get_name(op), std::string("NAD27 to NAD83 (3)")); + { + PJ_COORD coord; + coord.xy.x = 40; + coord.xy.y = 10; + int idx = proj_get_suggested_operation(m_ctxt, res, PJ_FWD, coord); + EXPECT_GE(idx, -1); + } } // --------------------------------------------------------------------------- |
