summaryrefslogtreecommitdiff
path: root/test/test-geoData.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-02-26 23:47:39 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-02-26 23:47:39 +0000
commitaa07f1bdd607a6dead9cdec59ff950f6e9a5c28c (patch)
treea54ddc944b7f9f93585e05bff17904bf996b26ac /test/test-geoData.cpp
parentAdd helper for loading fixtures for data tests from fixture JSON (diff)
downloadilt-aa07f1bdd607a6dead9cdec59ff950f6e9a5c28c.tar.bz2
ilt-aa07f1bdd607a6dead9cdec59ff950f6e9a5c28c.tar.xz
ilt-aa07f1bdd607a6dead9cdec59ff950f6e9a5c28c.zip
Load terrain deform fixture data from JSON
Diffstat (limited to 'test/test-geoData.cpp')
-rw-r--r--test/test-geoData.cpp34
1 files changed, 5 insertions, 29 deletions
diff --git a/test/test-geoData.cpp b/test/test-geoData.cpp
index e1f8fce..36d008b 100644
--- a/test/test-geoData.cpp
+++ b/test/test-geoData.cpp
@@ -205,34 +205,10 @@ BOOST_DATA_TEST_CASE(findEntries,
BOOST_CHECK_EQUAL(fixedTerrtain.findEntry(from, to).idx(), heh);
}
-using DeformTerrainData
- = std::tuple<std::vector<GlobalPosition3D>, std::vector<std::pair<Ray<GlobalPosition3D>, const char *>>>;
+using DeformTerrainData = std::tuple<std::vector<GlobalPosition3D>,
+ std::vector<std::pair<std::pair<GlobalPosition3D, Direction3D>, std::string>>>;
-template<typename T>
-std::ostream &
-operator<<(std::ostream & s, const Ray<T> & ray)
-{
- return s << "Ray" << std::make_pair(ray.start, ray.direction);
-}
-
-BOOST_DATA_TEST_CASE(setTriangle,
- boost::unit_test::data::make<DeformTerrainData>({
- {{
- {70100, 123000, 6000},
- {50100, 52300, 6000},
- {191000, 283000, 8000},
- {241000, 123330, -2000},
- },
- {
- {{{20000, 20000, 90000}, glm::normalize(Direction3D {1, 1, -1.5F})},
- "/tmp/geoData0.tga"},
- {{{30000, 164000, 90000}, glm::normalize(Direction3D {1, -1, -1.5F})},
- "/tmp/geoData1.tga"},
- {{{288000, 162000, 90000}, glm::normalize(Direction3D {-1, -1, -1.5F})},
- "/tmp/geoData2.tga"},
- }},
- }),
- points, cams)
+BOOST_DATA_TEST_CASE(deform, loadFixtureJson<DeformTerrainData>("geoData/deform/1.json"), points, cams)
{
auto gd = std::make_shared<GeoData>(GeoData::createFlat({0, 0}, {1000000, 1000000}, 100));
BOOST_CHECK_NO_THROW(gd->setHeights(points));
@@ -276,8 +252,8 @@ BOOST_DATA_TEST_CASE(setTriangle,
TestTerrain t {gd};
SceneRenderer ss {tro.size, tro.output};
std::for_each(cams.begin(), cams.end(), [&ss, &t, &tro](const auto & cam) {
- ss.camera.setView(cam.first.start, cam.first.direction);
+ ss.camera.setView(cam.first.first, glm::normalize(cam.first.second));
BOOST_CHECK_NO_THROW(ss.render(t));
- Texture::save(tro.outImage, cam.second);
+ Texture::save(tro.outImage, cam.second.c_str());
});
}