summaryrefslogtreecommitdiffhomepage
path: root/test/json.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/json.cpp')
-rw-r--r--test/json.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/json.cpp b/test/json.cpp
new file mode 100644
index 00000000..51bc6f80
--- /dev/null
+++ b/test/json.cpp
@@ -0,0 +1,29 @@
+#include "app.hpp"
+#include "serialize/tile-atlas.hpp"
+#include "serialize/magnum-vector.hpp"
+#include "serialize/json-helper.hpp"
+#include "compat/assert.hpp"
+#include "tile-atlas.hpp"
+#include "loader.hpp"
+
+namespace Magnum::Examples {
+void app::test_json() // NOLINT(readability-convert-member-functions-to-static)
+{
+ bool ret = true;
+ using nlohmann::to_json;
+ const std::filesystem::path output_dir = "f:/dev/game/build/test/";
+ {
+ nlohmann::json j;
+ auto atlas = loader.tile_atlas("share/game/images/metal1.tga", {2, 2});
+ ret &= json_helper::to_json(atlas, output_dir/"atlas.json");
+ }
+ {
+ Magnum::Math::Vector<2, int> v2i_1{1, 2};
+ Vector2 v2i_2{2, 3};
+ ret &= json_helper::to_json(v2i_1, output_dir/"vec2i_1.json");
+ ret &= json_helper::to_json(v2i_2, output_dir/"vec2i_2.json");
+ }
+ ASSERT(ret);
+}
+
+} // namespace Magnum::Examples