diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-02-21 01:25:34 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-02-21 01:25:34 +0000 |
commit | ed7c2a6a73f24f97a0f04c2e6be6862ffe54b585 (patch) | |
tree | 810350a653292d54621b7c4e72275bcd48dc6785 /test | |
parent | Add missing override (diff) | |
download | ilt-ed7c2a6a73f24f97a0f04c2e6be6862ffe54b585.tar.bz2 ilt-ed7c2a6a73f24f97a0f04c2e6be6862ffe54b585.tar.xz ilt-ed7c2a6a73f24f97a0f04c2e6be6862ffe54b585.zip |
Support for loading objects, uses and model factories from an XML resource
Diffstat (limited to 'test')
-rw-r--r-- | test/Jamfile.jam | 2 | ||||
-rw-r--r-- | test/test-modelFactory.cpp | 23 |
2 files changed, 24 insertions, 1 deletions
diff --git a/test/Jamfile.jam b/test/Jamfile.jam index d802975..027b880 100644 --- a/test/Jamfile.jam +++ b/test/Jamfile.jam @@ -52,6 +52,6 @@ run test-text.cpp ; run test-enumDetails.cpp ; run test-render.cpp : : : <library>test ; run test-glContextBhvr.cpp ; -run test-modelFactory.cpp : : : <library>test ; +run test-modelFactory.cpp : -- : ../res/brush47.xml : <library>test ; compile test-static-enumDetails.cpp ; compile test-static-stream_support.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<const Object>(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(); |