From 2f8d7643d03f39fa848576692264d0fe3a37ed91 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 6 Nov 2023 20:48:33 +0000 Subject: Reformat with new clang-format --- test/test-assetFactory.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/test-assetFactory.cpp') diff --git a/test/test-assetFactory.cpp b/test/test-assetFactory.cpp index 18dc778..145481e 100644 --- a/test/test-assetFactory.cpp +++ b/test/test-assetFactory.cpp @@ -24,44 +24,52 @@ BOOST_GLOBAL_FIXTURE(ApplicationBase); BOOST_GLOBAL_FIXTURE(TestMainWindow); const std::filesystem::path TMP {"/tmp"}; + class FactoryFixture : public TestRenderOutputSize, public SceneProvider { public: FactoryFixture() : sceneRenderer {size, output} { } + ~FactoryFixture() { auto outpath = (TMP / boost::unit_test::framework::current_test_case().full_name()).replace_extension(".tga"); std::filesystem::create_directories(outpath.parent_path()); Texture::save(outImage, outpath.c_str()); } + void content(const SceneShader & shader) const override { shader.basic.use(Location {{0, 0, 0}, {0, 0, 0}}); objects.apply(&Renderable::render, shader); } + void lights(const SceneShader & shader) const override { shader.pointLight.add({-3, 1, 5}, {1, 1, 1}, .1F); } + void environment(const SceneShader &, const SceneRenderer & sceneRenderer) const override { sceneRenderer.setAmbientLight({.4, .4, .4}); sceneRenderer.setDirectionalLight({.6, .6, .6}, east + south + south + down, *this); } + void shadows(const ShadowMapper & mapper) const override { mapper.dynamicPoint.use(Location {{0, 0, 0}, {0, 0, 0}}); objects.apply(&Renderable::shadows, mapper); } + void render(float dist = 10.f) { sceneRenderer.camera.setView({-dist, dist * 1.2f, dist * 1.2f}, south + east + down); sceneRenderer.render(*this); } + Collection objects; private: @@ -69,6 +77,7 @@ private: }; BOOST_FIXTURE_TEST_SUITE(m, FactoryFixture); + BOOST_AUTO_TEST_CASE(brush47xml, *boost::unit_test::timeout(5)) { auto mf = AssetFactory::loadXML(RESDIR "/brush47.xml"); @@ -115,6 +124,7 @@ BOOST_AUTO_TEST_CASE(foliage, *boost::unit_test::timeout(5)) render(5); } + BOOST_AUTO_TEST_SUITE_END(); BOOST_AUTO_TEST_CASE(loadall) @@ -125,6 +135,7 @@ BOOST_AUTO_TEST_CASE(loadall) } template using InOut = std::tuple; + BOOST_DATA_TEST_CASE(normalizeColourName, boost::unit_test::data::make>({ {"", ""}, -- cgit v1.2.3