summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2025-07-31 15:15:16 -0400
committerJonathan Bradley <jcb@pikum.xyz>2025-07-31 15:15:16 -0400
commitf7d860cee74ad3b94e0d15ea157783b7760f6d55 (patch)
treec2d37ae18a4ce1a63da4010516ecc588bfb7903a /tests
parent8dbacba532e05d76325392d85a75906f2de12350 (diff)
pke-ui: detect mouse clicks, other small refactors
Diffstat (limited to 'tests')
-rw-r--r--tests/pke-test-dummy.cpp2
-rw-r--r--tests/pke-test-serialization.cpp14
-rw-r--r--tests/pke-test-static-ui.cpp9
3 files changed, 16 insertions, 9 deletions
diff --git a/tests/pke-test-dummy.cpp b/tests/pke-test-dummy.cpp
index 8fdc146..efd1ff7 100644
--- a/tests/pke-test-dummy.cpp
+++ b/tests/pke-test-dummy.cpp
@@ -16,6 +16,7 @@ int pke_test_dummy_001() {
PkeThreads_Init();
AM_Init();
ECS_Init();
+ pke_input_init();
pke_ui_init();
PkeCamera_Init();
FontType_Init();
@@ -32,6 +33,7 @@ int pke_test_dummy_001() {
FontType_Teardown();
PkeCamera_Teardown();
pke_ui_teardown();
+ pke_input_teardown();
ECS_Teardown();
AM_Teardown();
PkeThreads_Teardown();
diff --git a/tests/pke-test-serialization.cpp b/tests/pke-test-serialization.cpp
index ebc7177..bf491f5 100644
--- a/tests/pke-test-serialization.cpp
+++ b/tests/pke-test-serialization.cpp
@@ -49,14 +49,15 @@ void pke_test_serialization_spinup() {
// pk_funcinstr_init();
pkeSettings.isSimulationPaused = true;
pk_ev_init(nullptr);
- Physics_Init();
PkeThreads_Init();
AM_Init();
ECS_Init();
- pke_ui_init();
+ Physics_Init();
PkeCamera_Init();
- FontType_Init();
pke_scene_master_init();
+ pke_input_init();
+ pke_ui_init();
+ FontType_Init();
test_scene = pke_scene_create(test_scene_name);
// FontTypeIndex fti;
// FontType *ft = FontType_GetFonts(fti);
@@ -69,14 +70,15 @@ void pke_test_serialization_teardown() {
// pk_funcinstr_init();
// pke_scene_remove(test_scene->scene_handle); // TODO this doesn't work?
test_scene = nullptr;
- pke_scene_master_teardown();
FontType_Teardown();
- PkeCamera_Teardown();
pke_ui_teardown();
+ pke_input_teardown();
+ pke_scene_master_teardown();
+ PkeCamera_Teardown();
+ Physics_Teardown();
ECS_Teardown();
AM_Teardown();
PkeThreads_Teardown();
- Physics_Teardown();
pk_ev_teardown();
bkt = nullptr;
// pk_funcinstr_teardown();
diff --git a/tests/pke-test-static-ui.cpp b/tests/pke-test-static-ui.cpp
index a826587..2eeed66 100644
--- a/tests/pke-test-static-ui.cpp
+++ b/tests/pke-test-static-ui.cpp
@@ -4,6 +4,7 @@
#include "./pke-test-types.h"
#include "ecs.hpp"
+#include "player-input.hpp"
#include "window.hpp"
#include "vendor-glm-include.hpp"
#include <limits>
@@ -25,6 +26,7 @@ void pke_test_static_ui_setup() {
Extent.height = 1080;
pk_ev_init(nullptr);
ECS_Init();
+ pke_input_init();
pke_ui_init();
}
@@ -32,6 +34,7 @@ void pke_test_static_ui_teardown() {
pke_ui_teardown();
ECS_Teardown();
pk_ev_teardown();
+ pke_input_teardown();
}
// test static
@@ -57,7 +60,7 @@ int pke_test_static_ui_000() {
calculated_offset = ui_box->pos_top_left.x + c_ui_box->pos_top_left.x + built_in_offset;
pke_ui_calc_px(arr, nullptr, ui_box);
- pke_ui_recalc_sizes_recursive(arr, ui_box, 0);
+ pke_ui_recalc_sizes_recursive(arr, ui_box);
PKE_TEST_ASSERT(ui_box->internal.parent == nullptr, err_index);
PKE_TEST_ASSERT(ui_box->internal.h_children == 1, err_index);
@@ -109,7 +112,7 @@ int pke_test_static_ui_100() {
calculated_offset_y = (calculated_offset_y * 0.1) + unit + built_in_offset;
pke_ui_calc_px(arr, nullptr, ui_box);
- pke_ui_recalc_sizes_recursive(arr, ui_box, 0);
+ pke_ui_recalc_sizes_recursive(arr, ui_box);
PKE_TEST_ASSERT(ui_box->internal.parent == nullptr, err_index);
PKE_TEST_ASSERT(ui_box->internal.h_children == 1, err_index);
@@ -167,7 +170,7 @@ int pke_test_static_ui_200() {
calculated_offset_y = unit + 1 + built_in_offset;
pke_ui_calc_px(arr, nullptr, ui_box);
- pke_ui_recalc_sizes_recursive(arr, ui_box, 0);
+ pke_ui_recalc_sizes_recursive(arr, ui_box);
PKE_TEST_ASSERT(ui_box->internal.parent == nullptr, err_index);
PKE_TEST_ASSERT(ui_box->internal.h_children == 1, err_index);