From 3b5450676b61efd2ee8eaab09ee95eba34a39870 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 18 Apr 2024 19:53:33 +0100 Subject: Define some initial surface types --- test/test-assetFactory.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') diff --git a/test/test-assetFactory.cpp b/test/test-assetFactory.cpp index 8341fbf..6061723 100644 --- a/test/test-assetFactory.cpp +++ b/test/test-assetFactory.cpp @@ -12,6 +12,7 @@ #include "game/scenary/illuminator.h" #include "game/scenary/light.h" #include "game/scenary/plant.h" +#include "game/surface.h" #include "game/vehicles/railVehicle.h" #include "game/vehicles/railVehicleClass.h" #include "gfx/gl/sceneRenderer.h" @@ -80,6 +81,20 @@ private: BOOST_FIXTURE_TEST_SUITE(m, FactoryFixture); +BOOST_AUTO_TEST_CASE(surfaces, *boost::unit_test::timeout(5)) +{ + auto mf = AssetFactory::loadXML(RESDIR "/surfaces.xml"); + BOOST_REQUIRE(mf); + BOOST_CHECK_EQUAL(4, mf->assets.size()); + auto gravelAsset = mf->assets.at("terrain.surface.gravel"); + BOOST_REQUIRE(gravelAsset); + auto gravel = std::dynamic_pointer_cast(gravelAsset); + BOOST_REQUIRE(gravel); + BOOST_REQUIRE_EQUAL(gravel->name, "Gravel"); + BOOST_REQUIRE_EQUAL(gravel->colorBias, RGB {.9F}); + BOOST_REQUIRE_EQUAL(gravel->quality, 1.F); +} + BOOST_AUTO_TEST_CASE(brush47xml, *boost::unit_test::timeout(5)) { auto mf = AssetFactory::loadXML(RESDIR "/brush47.xml"); -- cgit v1.2.3 From 0d0a9b2f56bedc0b9394b2ad9a1199ef2907f8f2 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 26 Apr 2024 16:34:19 +0100 Subject: Set the face surface type when setting height --- test/test-geoData.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test-geoData.cpp b/test/test-geoData.cpp index fb9aba0..11d634d 100644 --- a/test/test-geoData.cpp +++ b/test/test-geoData.cpp @@ -229,8 +229,10 @@ BOOST_TEST_DECORATOR(*boost::unit_test::timeout(2)); BOOST_DATA_TEST_CASE(deform, loadFixtureJson("geoData/deform/1.json"), points, cams) { + Surface surface; + surface.colorBias = RGB {0, 0, 1}; auto gd = std::make_shared(GeoData::createFlat({0, 0}, {1000000, 1000000}, 100)); - BOOST_CHECK_NO_THROW(gd->setHeights(points)); + BOOST_CHECK_NO_THROW(gd->setHeights(points, surface)); ApplicationBase ab; TestMainWindow tmw; -- cgit v1.2.3 From c1a2a2fdf3c8b16e2235962ffefad010d9c9f8ed Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 27 May 2024 13:43:47 +0100 Subject: Surface asset test doesn't need render dump --- test/test-assetFactory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test-assetFactory.cpp b/test/test-assetFactory.cpp index 6061723..73370c8 100644 --- a/test/test-assetFactory.cpp +++ b/test/test-assetFactory.cpp @@ -79,8 +79,6 @@ private: SceneRenderer sceneRenderer; }; -BOOST_FIXTURE_TEST_SUITE(m, FactoryFixture); - BOOST_AUTO_TEST_CASE(surfaces, *boost::unit_test::timeout(5)) { auto mf = AssetFactory::loadXML(RESDIR "/surfaces.xml"); @@ -95,6 +93,8 @@ BOOST_AUTO_TEST_CASE(surfaces, *boost::unit_test::timeout(5)) BOOST_REQUIRE_EQUAL(gravel->quality, 1.F); } +BOOST_FIXTURE_TEST_SUITE(m, FactoryFixture); + BOOST_AUTO_TEST_CASE(brush47xml, *boost::unit_test::timeout(5)) { auto mf = AssetFactory::loadXML(RESDIR "/brush47.xml"); -- cgit v1.2.3