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_crs.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_crs.cpp')
| -rw-r--r-- | test/unit/test_crs.cpp | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/test/unit/test_crs.cpp b/test/unit/test_crs.cpp index fbbd4f64..0f0304b1 100644 --- a/test/unit/test_crs.cpp +++ b/test/unit/test_crs.cpp @@ -1984,13 +1984,35 @@ TEST(crs, projectedCRS_identify_no_db) { TEST(crs, projectedCRS_identify_db) { auto dbContext = DatabaseContext::create(); auto factoryEPSG = AuthorityFactory::create(dbContext, "EPSG"); + auto factoryIGNF = AuthorityFactory::create(dbContext, "IGNF"); + auto factoryAnonymous = AuthorityFactory::create(dbContext, std::string()); { // Identify by existing code - auto res = - factoryEPSG->createProjectedCRS("2172")->identify(factoryEPSG); - ASSERT_EQ(res.size(), 1U); - EXPECT_EQ(res.front().first->getEPSGCode(), 2172); - EXPECT_EQ(res.front().second, 100); + auto crs = factoryEPSG->createProjectedCRS("2172"); + { + auto res = crs->identify(factoryEPSG); + ASSERT_EQ(res.size(), 1U); + EXPECT_EQ(res.front().first->getEPSGCode(), 2172); + EXPECT_EQ(res.front().second, 100); + } + { + auto res = crs->identify(factoryAnonymous); + ASSERT_EQ(res.size(), 1U); + } + { + auto res = crs->identify(factoryIGNF); + ASSERT_EQ(res.size(), 0U); + } + } + { + // Identify by existing code + auto crs = factoryIGNF->createProjectedCRS("ETRS89UTM28"); + { + auto res = crs->identify(factoryEPSG); + ASSERT_EQ(res.size(), 1U); + EXPECT_EQ(res.front().first->getEPSGCode(), 25828); + EXPECT_EQ(res.front().second, 70); + } } { // Non-existing code |
