From 1bbbdfe0d9e9e7a4e42241a2eb596b46ac02c65b Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 18 Aug 2024 16:05:05 +0100 Subject: Populate GameState::assets in appropriate tests --- test/test-assetFactory.cpp | 3 +++ test/testRenderOutput.h | 2 ++ 2 files changed, 5 insertions(+) (limited to 'test') diff --git a/test/test-assetFactory.cpp b/test/test-assetFactory.cpp index 1c2c417..0b5b278 100644 --- a/test/test-assetFactory.cpp +++ b/test/test-assetFactory.cpp @@ -97,6 +97,7 @@ BOOST_AUTO_TEST_CASE(brush47xml, *boost::unit_test::timeout(5)) { auto mf = AssetFactory::loadXML(RESDIR "/brush47.xml"); BOOST_REQUIRE(mf); + gameState.assets = mf->assets; BOOST_REQUIRE_GE(mf->shapes.size(), 6); BOOST_CHECK(mf->shapes.at("plane")); BOOST_CHECK(mf->shapes.at("cylinder")); @@ -126,6 +127,7 @@ BOOST_AUTO_TEST_CASE(foliage, *boost::unit_test::timeout(5)) { auto mf = AssetFactory::loadXML(RESDIR "/foliage.xml"); BOOST_REQUIRE(mf); + gameState.assets = mf->assets; auto tree_01_1 = mf->assets.at("Tree-01-1"); BOOST_REQUIRE(tree_01_1); auto tree_01_1_f = std::dynamic_pointer_cast(tree_01_1); @@ -144,6 +146,7 @@ BOOST_AUTO_TEST_CASE(lights, *boost::unit_test::timeout(5)) { auto mf = AssetFactory::loadXML(RESDIR "/lights.xml"); BOOST_REQUIRE(mf); + gameState.assets = mf->assets; auto rlight = mf->assets.at("r-light"); BOOST_REQUIRE(rlight); auto oldlamp = mf->assets.at("old-lamp"); diff --git a/test/testRenderOutput.h b/test/testRenderOutput.h index 056d029..79908b1 100644 --- a/test/testRenderOutput.h +++ b/test/testRenderOutput.h @@ -1,6 +1,7 @@ #pragma once #include "config/types.h" +#include "game/gamestate.h" #include "glArrays.h" #include #include @@ -17,6 +18,7 @@ public: glFrameBuffer output; glRenderBuffer depth; glTexture outImage; + GameState gameState; }; template class TestRenderOutputSize : public TestRenderOutput { -- cgit v1.2.3 From f03e11fb38701f278f3c0f465958932044227830 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 26 Aug 2024 13:34:06 +0100 Subject: test-render loads all assets into gameState --- test/test-render.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/test-render.cpp b/test/test-render.cpp index b9a809e..bb5a137 100644 --- a/test/test-render.cpp +++ b/test/test-render.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -25,10 +26,8 @@ #include class TestScene : public SceneProvider { - const RailVehicleClassPtr brush47rvc = std::dynamic_pointer_cast( - AssetFactory::loadXML(RESDIR "/brush47.xml")->assets.at("brush-47")); - const std::shared_ptr tree021f - = std::dynamic_pointer_cast(AssetFactory::loadXML(RESDIR "/foliage.xml")->assets.at("Tree-02-1")); + RailVehicleClassPtr brush47rvc; + std::shared_ptr tree021f; std::shared_ptr train1, train2; std::shared_ptr plant1; RailLinks rail; @@ -40,6 +39,9 @@ class TestScene : public SceneProvider { public: TestScene() { + gameState->assets = AssetFactory::loadAll(RESDIR); + brush47rvc = std::dynamic_pointer_cast(gameState->assets.at("brush-47")); + tree021f = std::dynamic_pointer_cast(gameState->assets.at("Tree-02-1")); train1 = std::make_shared(brush47rvc); train1->location.setPosition({52000, 50000, 2000}); train1->bogies.front().setPosition(train1->bogies.front().position() + train1->location.position()); -- cgit v1.2.3