From ed7c2a6a73f24f97a0f04c2e6be6862ffe54b585 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 21 Feb 2023 01:25:34 +0000 Subject: Support for loading objects, uses and model factories from an XML resource --- test/test-modelFactory.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test/test-modelFactory.cpp') diff --git a/test/test-modelFactory.cpp b/test/test-modelFactory.cpp index 39362f5..8f2d56c 100644 --- a/test/test-modelFactory.cpp +++ b/test/test-modelFactory.cpp @@ -147,4 +147,27 @@ BOOST_AUTO_TEST_CASE(brush47) render(20); } +BOOST_AUTO_TEST_CASE(brush47xml) +{ + auto mf = ModelFactory::loadXML(RESDIR "/brush47.xml"); + BOOST_REQUIRE(mf); + BOOST_REQUIRE_EQUAL(6, mf->shapes.size()); + BOOST_CHECK(mf->shapes.at("plane")); + BOOST_CHECK(mf->shapes.at("cylinder")); + BOOST_CHECK(mf->shapes.at("cuboid")); + BOOST_CHECK(mf->shapes.at("wheel")); + BOOST_CHECK(mf->shapes.at("axel")); + auto bogey = mf->shapes.at("bogey"); + BOOST_REQUIRE(bogey); + auto bogeyObj = std::dynamic_pointer_cast(bogey); + BOOST_CHECK_EQUAL(3, bogeyObj->uses.size()); + + FactoryMesh::Collection factoryMeshes; + std::transform(factoryMeshes.begin(), factoryMeshes.end(), std::back_inserter(meshes.objects), + [](const FactoryMesh::CPtr & factoryMesh) -> Mesh::Ptr { + return factoryMesh->createMesh(); + }); + + render(20); +} BOOST_AUTO_TEST_SUITE_END(); -- cgit v1.2.3