aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2022-01-20 17:32:36 +0100
committerEven Rouault <even.rouault@spatialys.com>2022-01-20 17:32:39 +0100
commit6dca8bdc057a454b599438c6caf92825880f3a87 (patch)
treea2c160f92a73e6e216ef9176a2107e6aedccda26 /test
parent2fc66ca67d4e2264b2e3e19bbef53e7daf19c62c (diff)
downloadPROJ-6dca8bdc057a454b599438c6caf92825880f3a87.tar.gz
PROJ-6dca8bdc057a454b599438c6caf92825880f3a87.zip
lookForGridInfo(): make it work properly when passed the old PROJ name
Fixes https://github.com/qgis/QGIS/issues/45470 That is, if the file for the old PROJ name is not found, but the file for the new PROJ name is found, then use the later for fullFilename and gridAvailable.
Diffstat (limited to 'test')
-rw-r--r--test/unit/test_factory.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/unit/test_factory.cpp b/test/unit/test_factory.cpp
index 9abade09..63931a5d 100644
--- a/test/unit/test_factory.cpp
+++ b/test/unit/test_factory.cpp
@@ -2763,6 +2763,47 @@ TEST_F(FactoryWithTmpDatabase, lookForGridInfo) {
// ---------------------------------------------------------------------------
+TEST_F(FactoryWithTmpDatabase,
+ lookForGridInfo_from_old_name_with_new_grid_available) {
+ createStructure();
+
+ ASSERT_TRUE(execute("INSERT INTO grid_alternatives(original_grid_name,"
+ "proj_grid_name, "
+ "old_proj_grid_name, "
+ "proj_grid_format, "
+ "proj_method, "
+ "inverse_direction, "
+ "package_name, "
+ "url, direct_download, open_license, directory) "
+ "VALUES ("
+ "'NOT-YET-IN-GRID-TRANSFORMATION-original_grid_name', "
+ "'tests/egm96_15_uncompressed_truncated.tif', "
+ "'old_name.gtx', "
+ "'NTv2', "
+ "'hgridshift', "
+ "0, "
+ "NULL, "
+ "'url', 1, 1, NULL);"))
+ << last_error();
+
+ std::string fullFilename;
+ std::string packageName;
+ std::string url;
+ bool directDownload = false;
+ bool openLicense = false;
+ bool gridAvailable = false;
+ EXPECT_TRUE(DatabaseContext::create(m_ctxt)->lookForGridInfo(
+ "old_name.gtx", false, fullFilename, packageName, url, directDownload,
+ openLicense, gridAvailable));
+ EXPECT_TRUE(
+ fullFilename.find("tests/egm96_15_uncompressed_truncated.tif") !=
+ std::string::npos)
+ << fullFilename;
+ EXPECT_EQ(gridAvailable, true);
+}
+
+// ---------------------------------------------------------------------------
+
TEST_F(FactoryWithTmpDatabase, custom_geodetic_crs) {
createStructure();
populateWithFakeEPSG();