diff options
Diffstat (limited to 'tests/pke-test-font.cpp')
| -rw-r--r-- | tests/pke-test-font.cpp | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/tests/pke-test-font.cpp b/tests/pke-test-font.cpp index 620715d..3f299e4 100644 --- a/tests/pke-test-font.cpp +++ b/tests/pke-test-font.cpp @@ -6,7 +6,6 @@ #include "font.hpp" #include "pk.h" #include "pke-test-stubs.h" -#include "pke-test-types.h" #include "thread-pool.hpp" static pk_membucket *bkt; @@ -37,35 +36,32 @@ void pke_test_font_teardown() { /* Ensure the font exists */ int pke_test_font_001() { - int err_index = 0; - - FontType *ft = FontType_Get(FontTypeIndex{0}); - PKE_TEST_ASSERT(ft != nullptr, err_index); - PKE_TEST_ASSERT(ft->index_ft == FontTypeIndex{0}, err_index); - + FontType *ft = FontType_Get({0,0}); + PK_TEST_ASSERT_NEQ_RET(nullptr, ft); return 0; } /* Ensure we can have more than one FontRender */ int pke_test_font_002() { - int err_index = 0; - FontTypeIndex fti{0}; + FontTypeHandle fti{}; FontTypeRender handle_001{}; FontTypeRender handle_002{}; FontRenderSettings frs{}; handle_001 = FontType_AddStringRender(fti, std::move(cstring_to_pk_cstr("string one")), &frs); - PKE_TEST_ASSERT(handle_001.index_ft == FontTypeIndex{0}, err_index); - PKE_TEST_ASSERT(handle_001.handle_fr.b == 0u, err_index); - PKE_TEST_ASSERT(handle_001.handle_fr.i == 0u, err_index); + PK_TEST_ASSERT_EQ_RET(0u, handle_001.font_type_handle.b); + PK_TEST_ASSERT_EQ_RET(0u, handle_001.font_type_handle.i); + PK_TEST_ASSERT_EQ_RET(0u, handle_001.font_render_handle.b); + PK_TEST_ASSERT_EQ_RET(0u, handle_001.font_render_handle.i); handle_002 = FontType_AddStringRender(fti, std::move(cstring_to_pk_cstr("string two")), &frs); - PKE_TEST_ASSERT(handle_002.index_ft == FontTypeIndex{0}, err_index); - PKE_TEST_ASSERT(handle_002.handle_fr.b == 0u, err_index); - PKE_TEST_ASSERT(handle_002.handle_fr.i == 1u, err_index); + PK_TEST_ASSERT_EQ_RET(0u, handle_002.font_type_handle.b); + PK_TEST_ASSERT_EQ_RET(0u, handle_002.font_type_handle.i); + PK_TEST_ASSERT_EQ_RET(0u, handle_002.font_render_handle.b); + PK_TEST_ASSERT_EQ_RET(1u, handle_002.font_render_handle.i); return 0; } @@ -75,22 +71,23 @@ int pke_test_font_002() { int pke_test_font_003() { unsigned short u; const unsigned short count = 96; - FontTypeIndex fti{0}; + FontTypeHandle fti{0,0}; FontTypeRender handles[count]; FontRenderSettings frs{}; for (u = 0; u < count; ++u) { - handles[u].index_ft = FontTypeIndex{0}; - handles[u].handle_fr = {0,0}; + handles[u].font_type_handle = {0,0}; + handles[u].font_render_handle = {0,0}; } for (u = 0; u < count; ++u) { char *s = (char*)malloc(64); snprintf(s, 1024, "%s - %u", "test", u); handles[u] = FontType_AddStringRender(fti, std::move(cstring_to_pk_cstr(s)), &frs); - PK_TEST_ASSERT_EQ_RET((FontTypeIndex_T)FontTypeIndex{0}, (FontTypeIndex_T)handles[u].index_ft); - PK_TEST_ASSERT_EQ_RET(floor(u / (float)PK_BKT_ARR_HANDLE_I_MAX), handles[u].handle_fr.b); - PK_TEST_ASSERT_EQ_RET(u % PK_BKT_ARR_HANDLE_I_MAX, handles[u].handle_fr.i); + PK_TEST_ASSERT_EQ_RET(0u, handles[u].font_type_handle.b); + PK_TEST_ASSERT_EQ_RET(0u, handles[u].font_type_handle.i); + PK_TEST_ASSERT_EQ_RET(floor(u / (float)PK_BKT_ARR_HANDLE_I_MAX), handles[u].font_render_handle.b); + PK_TEST_ASSERT_EQ_RET(u % PK_BKT_ARR_HANDLE_I_MAX, handles[u].font_render_handle.i); } return 0; |
