From ddffb9aeabb67e94766985a0e9d682565c9c56b5 Mon Sep 17 00:00:00 2001 From: program-- Date: Mon, 10 Jul 2023 09:32:45 -0700 Subject: [PATCH] rev: add test for geopackage subsetting on read changes per https://github.com/NOAA-OWP/ngen/pull/522#discussion_r1256341575 --- test/geopackage/GeoPackage_Test.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/geopackage/GeoPackage_Test.cpp b/test/geopackage/GeoPackage_Test.cpp index 48516a02cb..391e3cd150 100644 --- a/test/geopackage/GeoPackage_Test.cpp +++ b/test/geopackage/GeoPackage_Test.cpp @@ -60,6 +60,21 @@ TEST_F(GeoPackage_Test, geopackage_read_test) ASSERT_TRUE(third == nullptr); } +TEST_F(GeoPackage_Test, geopackage_idsubset_test) +{ + const auto gpkg = geopackage::read(this->path, "test", { "First" }); + EXPECT_NE(gpkg->find("First"), -1); + EXPECT_EQ(gpkg->find("Second"), -1); + + const auto& first = gpkg->get_feature(0); + EXPECT_EQ(first->get_id(), "First"); + const auto& point = boost::get(first->geometry()); + EXPECT_EQ(point.get<0>(), 102.0); + EXPECT_EQ(point.get<1>(), 0.5); + + ASSERT_TRUE(gpkg->get_feature(1) == nullptr); +} + // this test is essentially the same as the above, however, the coordinates // are stored in EPSG:3857. When read in, they should convert to EPSG:4326. TEST_F(GeoPackage_Test, geopackage_projection_test) @@ -84,4 +99,4 @@ TEST_F(GeoPackage_Test, geopackage_projection_test) EXPECT_NEAR(point.get<1>(), 0.5, 0.0001); ASSERT_TRUE(third == nullptr); -} \ No newline at end of file +}