summaryrefslogtreecommitdiff
path: root/tests/pke-test-asset-manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pke-test-asset-manager.cpp')
-rw-r--r--tests/pke-test-asset-manager.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/pke-test-asset-manager.cpp b/tests/pke-test-asset-manager.cpp
new file mode 100644
index 0000000..82e1345
--- /dev/null
+++ b/tests/pke-test-asset-manager.cpp
@@ -0,0 +1,47 @@
+
+#include "./pke-test-asset-manager.h"
+
+#include "asset-manager.hpp"
+#include "ecs.hpp"
+#include "font.hpp"
+#include "thread-pool.hpp"
+
+void pke_test_asset_manager_spinup() {
+ PkeThreads_Init();
+ AM_Init();
+ ECS_Init();
+ FontType_Init();
+};
+
+void pke_test_asset_manager_teardown() {
+ FontType_Teardown();
+ ECS_Teardown();
+ AM_Teardown();
+ PkeThreads_Teardown();
+};
+
+int pke_test_asset_manager_001() {
+ AssetHandle handle = AM_GetHandle(AssetKey { "fnt_mquin_img" });
+ const Asset *a = AM_Get(handle);
+ AM_Release(handle);
+ return int(a != NULL && handle != AssetHandle_MAX);
+}
+
+struct pke_test_group *pke_test_asset_manager_get_group() {
+ static const uint64_t test_count = 1;
+ static struct pke_test tests[test_count] = {
+ {
+ .title = "test 001",
+ .func = pke_test_asset_manager_001,
+ .expected_result = 1,
+ }
+ };
+ static struct pke_test_group group = {};
+ group.title = "asset_manager";
+ group.n_tests = test_count;
+ group.tests = &tests[0];
+ group.test_setup = pke_test_asset_manager_spinup;
+ group.test_teardown = pke_test_asset_manager_teardown;
+
+ return &group;
+}