comparison tests/tools/tileset/main.cpp @ 181:fbfc2555bda5

Common: cleanup
author David Demelier <markand@malikania.fr>
date Fri, 12 Oct 2018 20:24:40 +0200
parents a3af3b793da4
children 3107ce017c3a
comparison
equal deleted inserted replaced
180:23ee2b6091e8 181:fbfc2555bda5
26 #include <malikania/loader.hpp> 26 #include <malikania/loader.hpp>
27 #include <malikania/tileset.hpp> 27 #include <malikania/tileset.hpp>
28 28
29 class test_tileset { 29 class test_tileset {
30 protected: 30 protected:
31 mlk::directory_locator locator_{CMAKE_CURRENT_BINARY_DIR}; 31 mlk::directory_locator locator_{CMAKE_CURRENT_BINARY_DIR};
32 mlk::loader loader_{locator_}; 32 mlk::loader loader_{locator_};
33 }; 33 };
34 34
35 BOOST_FIXTURE_TEST_SUITE(test_tileset_suite, test_tileset) 35 BOOST_FIXTURE_TEST_SUITE(test_tileset_suite, test_tileset)
36 36
37 BOOST_AUTO_TEST_CASE(tileset) 37 BOOST_AUTO_TEST_CASE(tileset)
38 { 38 {
39 const std::vector<std::string> list{ 39 const std::vector<std::string> list{
40 "tileset.json", 40 "tileset.json",
41 "tileset_embedded.json", 41 "tileset_embedded.json",
42 "tileset_external.json" 42 "tileset_external.json"
43 }; 43 };
44 44
45 for (const auto& t : list) { 45 for (const auto& t : list) {
46 auto tileset = loader_.load_tileset(t); 46 auto tileset = loader_.load_tileset(t);
47 47
48 BOOST_REQUIRE_EQUAL("worldmapchip5fo.png", tileset.get_image()); 48 BOOST_REQUIRE_EQUAL("worldmapchip5fo.png", tileset.image);
49 BOOST_REQUIRE_EQUAL(32U, tileset.get_cell().width); 49 BOOST_REQUIRE_EQUAL(32U, tileset.cell.width);
50 BOOST_REQUIRE_EQUAL(32U, tileset.get_cell().height); 50 BOOST_REQUIRE_EQUAL(32U, tileset.cell.height);
51 BOOST_REQUIRE_EQUAL(3U, tileset.get_tile_properties().size()); 51 BOOST_REQUIRE_EQUAL(3U, tileset.tile_properties.size());
52 52
53 auto tp = tileset.get_tile_properties(); 53 // Index 8.
54 BOOST_REQUIRE_EQUAL("value", tileset.tile_properties[8]["test"]);
54 55
55 // Index 8. 56 // TODO: postpone collisions once made.
56 BOOST_REQUIRE_EQUAL("value", tp[8]["test"]); 57 }
57
58 // TODO: postpone collisions once made.
59 }
60 } 58 }
61 59
62 BOOST_AUTO_TEST_SUITE_END() 60 BOOST_AUTO_TEST_SUITE_END()