1 #include "AssetTest.hpp"
3 #include "app/Assets.hpp"
4 #include "app/init.hpp"
5 #include "world/Simulation.hpp"
7 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(blobs::app::test::AssetTest, "headed");
14 void AssetTest::setUp() {
17 void AssetTest::tearDown() {
21 void AssetTest::testLoadBasic() {
25 CPPUNIT_ASSERT_MESSAGE(
26 "no resources loaded",
27 assets.data.resources.Size() > 0
29 CPPUNIT_ASSERT_MESSAGE(
30 "no tile types loaded",
31 assets.data.resources.Size() > 0
34 CPPUNIT_ASSERT_MESSAGE(
35 "tile texture has no width",
36 assets.textures.tiles.Width() > 0
38 CPPUNIT_ASSERT_MESSAGE(
39 "tile texture has no height",
40 assets.textures.tiles.Height() > 0
42 CPPUNIT_ASSERT_MESSAGE(
43 "tile texture has no depth",
44 assets.textures.tiles.Depth() > 0
47 CPPUNIT_ASSERT_MESSAGE(
48 "skin texture has no width",
49 assets.textures.skins.Width() > 0
51 CPPUNIT_ASSERT_MESSAGE(
52 "skin texture has no height",
53 assets.textures.skins.Height() > 0
55 CPPUNIT_ASSERT_MESSAGE(
56 "skin texture has no depth",
57 assets.textures.skins.Depth() > 0
60 CPPUNIT_ASSERT_EQUAL_MESSAGE(
61 "large font has wrong family",
62 std::string("DejaVu Sans"), std::string(assets.fonts.large.FamilyName())
64 CPPUNIT_ASSERT_EQUAL_MESSAGE(
65 "medium font has wrong family",
66 std::string("DejaVu Sans"), std::string(assets.fonts.medium.FamilyName())
68 CPPUNIT_ASSERT_EQUAL_MESSAGE(
69 "small font has wrong family",
70 std::string("DejaVu Sans"), std::string(assets.fonts.small.FamilyName())
74 void AssetTest::testLoadUniverse() {
78 world::Simulation sim(assets);
79 assets.LoadUniverse("universe", sim);
81 CPPUNIT_ASSERT_EQUAL_MESSAGE(
82 "wrong number of suns in default universe",
83 std::set<world::Sun *>::size_type(1), sim.Suns().size()
85 CPPUNIT_ASSERT_EQUAL_MESSAGE(
86 "wrong number of planets in default universe",
87 std::set<world::Planet *>::size_type(3), sim.Planets().size()
89 CPPUNIT_ASSERT_NO_THROW_MESSAGE(
90 "spawn planet does not exist",
91 sim.PlanetByName("Planet")