summaryrefslogtreecommitdiff
path: root/tests/pke-test-serialization.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pke-test-serialization.cpp')
-rw-r--r--tests/pke-test-serialization.cpp24
1 files changed, 6 insertions, 18 deletions
diff --git a/tests/pke-test-serialization.cpp b/tests/pke-test-serialization.cpp
index 021b659..0a77a56 100644
--- a/tests/pke-test-serialization.cpp
+++ b/tests/pke-test-serialization.cpp
@@ -10,7 +10,6 @@
#include "physics.hpp"
#include "pk.h"
#include "pke-test-stubs.h"
-#include "pke-test-types.h"
#include "scene.hpp"
#include "serialization-component.hpp"
#include "serialization.hpp"
@@ -455,7 +454,6 @@ int pke_test_serialization_003() {
try {
h = pke_serialize_init(bkt);
- uint64_t idx_unused;
FontRenderSettings frs;
frs.char_scale = 1.0;
frs.char_spacing_scale = 1.0;
@@ -464,7 +462,7 @@ int pke_test_serialization_003() {
frs.surface_area_pos = glm::ivec2(0, 0);
frs.surface_area_type_flags = FONT_RENDER_SURFACE_AREA_TYPE_FLAGS_CENTER_BOTH;
frs.flags = FONT_RENDER_FLAG_NONE;
- FontTypeRender fr_handle = FontType_AddStringRender(FontType_GetFonts(idx_unused)[0].index_ft, std::move(cstring_to_pk_cstr("asdf")), &frs, nullptr, uuid_n[1]);
+ FontTypeRender fr_handle = FontType_AddStringRender({0,0}, std::move(cstring_to_pk_cstr("asdf")), &frs, nullptr, uuid_n[1]);
pke_ui_box *ui_box = pke_ui_box_new_root(PKE_UI_BOX_TYPE_TEXT, uuid_n[2]);
ui_box->flags |= PKE_UI_BOX_FLAG_POSITION_TYPE_DYNAMIC;
@@ -553,12 +551,8 @@ int pke_test_deserialization_103() {
pke_deserialize_scene(h);
- uint64_t idx_unused;
- FontType *fonts = FontType_GetFonts(idx_unused);
- PK_TEST_ASSERT_NEQ_RET(nullptr, fonts);
- PK_TEST_ASSERT_NEQ_RET(0xFFFFFFFFFFFFFFFF, idx_unused);
- // PK_TEST_ASSERT_LTE_RET(0, fonts->renders.head_r.i); // always true, unsigned
- FontRender *fr = &fonts[0].renders[{0,0}];
+ pk_bkt_arr_t<FontType> ft_bkt = *static_cast<pk_bkt_arr_t<FontType>*>(FontType_GetFonts());
+ FontRender *fr = &ft_bkt[{0,0}].renders[{0,0}];
PK_TEST_ASSERT_EQ_RET(1.f, fr->settings.char_scale);
PK_TEST_ASSERT_EQ_RET(1.f, fr->settings.line_height_scale);
@@ -800,7 +794,6 @@ TextBegin::
:PKFE:)VOGON";
int pke_test_serialization_005() {
- int64_t err_index = 0;
uint32_t i, k;
srlztn_serialize_helper *h = nullptr;
pke_kve *kve = nullptr;
@@ -808,7 +801,6 @@ int pke_test_serialization_005() {
try {
h = pke_serialize_init(bkt);
- uint64_t idx_unused;
FontRenderSettings frs;
frs.char_scale = 1.0;
frs.char_spacing_scale = 1.0;
@@ -817,7 +809,7 @@ int pke_test_serialization_005() {
frs.surface_area_pos = glm::ivec2(0, 0);
frs.surface_area_type_flags = FONT_RENDER_SURFACE_AREA_TYPE_FLAGS_CENTER_BOTH;
frs.flags = FONT_RENDER_FLAG_NONE;
- FontType_AddStringRender(FontType_GetFonts(idx_unused)[0].index_ft, cstring_to_pk_cstr(""), &frs, nullptr, uuid_n[1]);
+ FontType_AddStringRender({0,0}, cstring_to_pk_cstr(""), &frs, nullptr, uuid_n[1]);
pke_serialize_scene(h);
pke_serialize_scene_to_stream(ss, h);
@@ -883,12 +875,8 @@ int pke_test_deserialization_105() {
pke_deserialize_scene(h);
- uint64_t idx_unused;
- FontType *fonts = FontType_GetFonts(idx_unused);
- PK_TEST_ASSERT_NEQ_RET(nullptr, fonts);
- PK_TEST_ASSERT_NEQ_RET(0xFFFFFFFFFFFFFFFF, idx_unused);
- // PK_TEST_ASSERT_LTE_RET(fonts->renders.head_r.i > 0u, err_index); // always true, unsigned
- FontRender *fr = &fonts[0].renders[{0,0}];
+ pk_bkt_arr_t<FontType> ft_bkt = *static_cast<pk_bkt_arr_t<FontType>*>(FontType_GetFonts());
+ FontRender *fr = &ft_bkt[{0,0}].renders[{0,0}];
PK_TEST_ASSERT_EQ_RET(1.f, fr->settings.char_scale);
PK_TEST_ASSERT_EQ_RET(1.f, fr->settings.line_height_scale);