diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-11-07 20:15:56 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-11-07 20:15:56 +0100 |
commit | 10a72bb7d695fd36675198fd52b467fc66fcea17 (patch) | |
tree | 6f241461e7c6fc1b2439e855b0d24f99e27a186b /test | |
parent | 24c7e1915bf16b4141d0502af040791fed65aa06 (diff) |
a
Diffstat (limited to 'test')
-rw-r--r-- | test/app.hpp | 1 | ||||
-rw-r--r-- | test/dijkstra.cpp | 2 | ||||
-rw-r--r-- | test/json/wall-atlas-02_groups.json | 2 | ||||
-rw-r--r-- | test/main.cpp | 1 | ||||
-rw-r--r-- | test/scenery.cpp | 24 | ||||
-rw-r--r-- | test/wall-atlas.cpp | 18 |
6 files changed, 38 insertions, 10 deletions
diff --git a/test/app.hpp b/test/app.hpp index b3ea87fe..b0b7f30f 100644 --- a/test/app.hpp +++ b/test/app.hpp @@ -34,6 +34,7 @@ struct test_app final : private FM_APPLICATION static void test_path_search(); static void test_dijkstra(); static void test_hash(); + static void test_scenery(); static void test_path_search_node_pool(); static void test_wall_atlas(); static void zzz_test_misc(); diff --git a/test/dijkstra.cpp b/test/dijkstra.cpp index 28f59d4f..ad8a09e4 100644 --- a/test/dijkstra.cpp +++ b/test/dijkstra.cpp @@ -7,7 +7,7 @@ namespace floormat { void test_app::test_dijkstra() { - constexpr bool debug = true; + constexpr bool debug = false; auto A = astar{}; auto w = world(); diff --git a/test/json/wall-atlas-02_groups.json b/test/json/wall-atlas-02_groups.json index 1a6ea806..fe565acc 100644 --- a/test/json/wall-atlas-02_groups.json +++ b/test/json/wall-atlas-02_groups.json @@ -17,7 +17,7 @@ }, "overlay": { "pixel-size": "42 x 192", - "tint-mult": [ 0.1, 0.2, 0.3, 0.4 ], + "tint-mult": [ 0.125, 0.25, 0.5, 1 ], "tint-add": [ 1, 2, 3 ], "default-tint": false, "mirrored": true diff --git a/test/main.cpp b/test/main.cpp index 569d5130..2bd038ce 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -34,6 +34,7 @@ int test_app::exec() test_hash(); test_wall_atlas(); + test_scenery(); test_path_search_node_pool(); test_path_search(); test_dijkstra(); diff --git a/test/scenery.cpp b/test/scenery.cpp new file mode 100644 index 00000000..40669ec9 --- /dev/null +++ b/test/scenery.cpp @@ -0,0 +1,24 @@ +#include "app.hpp" +#include "loader/loader.hpp" +#include "loader/scenery.hpp" + +namespace floormat { + +namespace { + +void test_loading() +{ + fm_assert(!loader.sceneries().empty()); + + for (const auto& [name, descr, proto] : loader.sceneries()) + fm_assert(proto.sc_type != scenery_type::none); +} + +} // namespace + +void test_app::test_scenery() +{ + test_loading(); +} + +} // namespace floormat diff --git a/test/wall-atlas.cpp b/test/wall-atlas.cpp index 699043a3..92439800 100644 --- a/test/wall-atlas.cpp +++ b/test/wall-atlas.cpp @@ -64,14 +64,16 @@ void test_read_groups(StringView filename) fm_assert(read_direction_metadata(jroot, Direction_::S).is_empty()); const auto dir = read_direction_metadata(jroot, Direction_::W); - - fm_assert(dir.wall.pixel_size == Vector2ui{}); - fm_assert(!dir.wall.default_tint); - - fm_assert(dir.side.pixel_size == Vector2ui{42, 192}); - fm_assert(dir.side.default_tint); - - fm_assert(dir.top.default_tint == group_defaults.default_tint); + fm_assert(dir.wall.pixel_size == Vector2ui{} ); + fm_assert(dir.wall.default_tint == false ); + fm_assert(dir.wall.mirrored == group_defaults.mirrored ); + fm_assert(dir.wall.from_rotation == (uint8_t)-1 ); + fm_assert(dir.side.pixel_size == Vector2ui{42, 192} ); + fm_assert(dir.side.default_tint == true ); + fm_assert(dir.top.default_tint == group_defaults.default_tint ); + fm_assert(dir.overlay.tint_mult == Vector4{0.125f, 0.25f, 0.5f, 1.f } ); + fm_assert(dir.overlay.tint_add == Vector3{1, 2, 3} ); + fm_assert(dir.overlay.mirrored == true ); } } // namespace |