From 781410537a1c7ddac340efabeedd4c9309e5cf39 Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Fri, 30 May 2025 14:41:54 -0400 Subject: pke: asset: BucketContainer>pk_bkt_arr_t & cleanup --- tests/pke-test-asset-manager.cpp | 47 ++++++++++++++++++++++++++++++++++++++++ tests/pke-test-asset-manager.h | 16 ++++++++++++++ tests/pke-test.cpp | 4 +++- 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 tests/pke-test-asset-manager.cpp create mode 100644 tests/pke-test-asset-manager.h (limited to 'tests') 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; +} diff --git a/tests/pke-test-asset-manager.h b/tests/pke-test-asset-manager.h new file mode 100644 index 0000000..802b67f --- /dev/null +++ b/tests/pke-test-asset-manager.h @@ -0,0 +1,16 @@ +#ifndef PKE_PKE_TEST_ASSET_MANAGER_H +#define PKE_PKE_TEST_ASSET_MANAGER_H + +#include "pke-test-types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct pke_test_group *pke_test_asset_manager_get_group(); + +#ifdef __cplusplus +} +#endif + +#endif /* PKE_PKE_TEST_ASSET_MANAGER_H */ diff --git a/tests/pke-test.cpp b/tests/pke-test.cpp index 78ad662..2e9eb9d 100644 --- a/tests/pke-test.cpp +++ b/tests/pke-test.cpp @@ -1,9 +1,10 @@ #include "./pke-test-types.h" +#include "./pke-test-asset-manager.h" #include "./pke-test-dummy.h" -#include "./pke-test-static-ui.h" #include "./pke-test-serialization.h" +#include "./pke-test-static-ui.h" #include "pk.h" #include "unistd.h" @@ -38,6 +39,7 @@ int main(int argc, char *argv[]) pke_test_dummy_get_group, pke_test_static_ui_get_group, pke_test_serialization_get_group, + pke_test_asset_manager_get_group, NULL, }; -- cgit v1.2.3