Files
dusk/test/ui/test_uitab.c
T
YourWishes 8f8fa8f8d1 Scene.set() JS lifecycle, UI sprite caching, emulator test scripts
- Add Scene.set(module) so JerryScript can switch scenes via
  require()'d {init, update, dispose} modules; wire it into
  engineUpdate() and rework overworldscene.js/init.js to the new shape.
- Fix scriptManagerExecFile() never pushing its own file's directory
  onto the require() dir stack, breaking relative require() calls from
  a top-level entry script (e.g. init.js -> ./overworldscene.js).
- Cache sprite geometry across frames for uislider/uitab/uiframe
  (dialogs/textbox/settings) and give uitextbox a per-page glyph cache
  instead of one spriteBatchBuffer call per visible character. uiconsole
  drops its alloc/free vertex buffer for a fixed-size one. uifps skips
  rebuilding its label when the text hasn't changed.
- Add PSP_OPTIMIZATION_PLAN.md and a handful of UI/spritebatch unit
  tests covering the new caching logic.
- Add Dolphin/PPSSPP emulator smoke-test scripts (+ Docker variants and
  CI jobs) for GameCube/Wii/PSP.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-31 13:21:57 -05:00

37 lines
1.2 KiB
C

/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "dusktest.h"
#include "ui/widget/uitab.h"
#include "util/memory.h"
// uiTabInit requires a real font (FONT_DEFAULT) to build the label's
// glyph cache, which needs a live GL context this test binary doesn't
// have. uiTabRebuildBackground only reads the label's already-measured
// width/height, so it's safe to set those directly and exercise it here.
static void test_uiTabRebuildBackground_matchesLabelSize(void **state) {
uitab_t tab;
memoryZero(&tab, sizeof(uitab_t));
tab.label.width = 42;
tab.label.height = 12;
uiTabRebuildBackground(&tab);
assert_float_equal(tab.cachedBackground.min[0], 0.0f, 0.0001f);
assert_float_equal(tab.cachedBackground.min[1], 0.0f, 0.0001f);
assert_float_equal(tab.cachedBackground.max[0], 42.0f, 0.0001f);
assert_float_equal(tab.cachedBackground.max[1], 12.0f, 0.0001f);
}
int main(int argc, char **argv) {
const struct CMUnitTest tests[] = {
cmocka_unit_test(test_uiTabRebuildBackground_matchesLabelSize),
};
return cmocka_run_group_tests(tests, NULL, NULL);
}