Skip to content

Port to latest orion-ui and expand test coverage - #43

Merged
corepunch merged 6 commits into
mainfrom
copilot/analyze-test-coverage-and-improve
May 1, 2026
Merged

Port to latest orion-ui and expand test coverage#43
corepunch merged 6 commits into
mainfrom
copilot/analyze-test-coverage-and-improve

Conversation

Copilot AI commented May 1, 2026

Copy link
Copy Markdown
Contributor

Advances the ui submodule to the latest orion-ui main and fixes the resulting API breakage. Adds five new test suites covering previously untested core modules.

orion-ui API migration (0dd5b62b570da0)

Draw functions moved from pointer to pass-by-value rect_t params:

// Before
void fill_rect(uint32_t color, rect_t const *r);
void draw_rect(int tex, rect_t const *r);
void draw_button(rect_t const *r, int dx, int dy, bool pressed);

// After
void fill_rect(uint32_t color, rect_t r);
void draw_rect(int tex, rect_t r);
void draw_button(rect_t r, int dx, int dy, bool pressed);
  • Updated declarations in mapview/map.h
  • Fixed &r / &win->frame call sites in editor/windows/sprite.c and things.c
  • Removed window_title_bar_y declaration from map.h (function deleted upstream)
  • Replaced removed axPollEvent with get_message in mapview/wi_stuff.c
  • Changed orion-ui submodule build to make library (avoids compiling example apps with upstream bugs)

New tests (85 total, all passing)

Suite File Count Covers
Collision tests/collision_test.c 20 dist_sq, closest_point_on_line, calc_slide, can_enter_sector
WAD tests/wad_test.c 16 is_map_block_valid, lump lookup, struct binary layout
BSP tests/bsp_test.c 5 R_PointOnSide, BSP traversal (existed but was never wired into make test)
Wall normals tests/walls_test.c 10 compute_normal_packed: axis directions, diagonal, degenerate, 3-4-5, scale independence
Player physics tests/player_test.c 18 Angle wrapping, pitch clamping, velocity clamping, friction deceleration

Makefile test target and clean target updated accordingly. New test binaries added to .gitignore.

Copilot AI and others added 2 commits May 1, 2026 06:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Ports DOOM-ED to the latest orion-ui submodule API by updating drawing call sites/prototypes, and expands the repo’s standalone C test suites while wiring them into make test.

Changes:

  • Updated fill_rect / draw_rect / draw_rect_ex declarations and relevant call sites to use pass-by-value rect_t.
  • Added new standalone test executables (collision_test, wad_test) and wired them (plus existing bsp_test) into the test and clean Makefile targets.
  • Updated .gitignore to ignore the new test binaries.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/wad_test.c Adds a standalone test binary for WAD parsing helpers and struct layout.
tests/collision_test.c Adds a standalone test binary for collision geometry helper functions.
mapview/map.h Updates draw function prototypes for new orion-ui API; removes window_title_bar_y (and currently also removes get_window_item).
editor/windows/things.c Updates draw_rect call site to pass rect_t by value.
editor/windows/sprite.c Updates draw_button/draw_rect call sites to pass rect_t by value.
Makefile Adds new test targets and runs them under make test; updates clean accordingly.
.gitignore Ignores the newly added test binaries.

Comment thread mapview/map.h
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@corepunch
corepunch marked this pull request as ready for review May 1, 2026 06:22
@corepunch

Copy link
Copy Markdown
Owner

@copilot Building liborion via ui/Makefile...
mkdir -p build/lib
Building platform library...
/Applications/Xcode_16.4.app/Contents/Developer/usr/bin/make -C platform OUTDIR=/Users/runner/work/doom-ed/doom-ed/ui/build/lib
( find macos -name ".m"; find unix -name ".c"; ) | sed 's|.|#include "&"|' | clang -Wall -Wextra -fPIC -I. -DGL_SILENCE_DEPRECATION -Wno-deprecated-declarations -DHAVE_WINDOWING -x objective-c - -dynamiclib -framework AppKit -framework Cocoa -framework OpenGL -framework IOSurface -framework Security -framework CoreFoundation -install_name @rpath/libplatform.dylib -o /Users/runner/work/doom-ed/doom-ed/ui/build/lib/libplatform.dylib
Creating static library: build/lib/liborion.a
find user kernel commctl -name "
.c" | sort | sed 's/./#include "&"/' |
gcc -Wall -Wextra -std=c11 -I. -DGL_SILENCE_DEPRECATION -D_DEFAULT_SOURCE -Wno-unused-parameter -I/opt/homebrew/include -I/usr/local/include -DHAVE_LUA -I/opt/homebrew/include/lua -x c -c -o build/liborion_unity.o - &&
ar rcs build/lib/liborion.a build/liborion_unity.o &&
rm -f build/liborion_unity.o
In file included from :26:
./kernel/renderer.c:630:39: warning: incompatible pointer types passing 'float[16]' to parameter of type 'const vec4 ' (aka 'const float ()[4]') [-Wincompatible-pointer-types]
630 | update_sprite_projection_uniforms(prev_proj);
| ^~~~~~~~~
./kernel/renderer.c:164:58: note: passing argument to parameter 'projection' here
164 | static void update_sprite_projection_uniforms(const mat4 projection) {
| ^
./kernel/renderer.c:646:37: warning: incompatible pointer types passing 'float[16]' to parameter of type 'const vec4 ' (aka 'const float ()[4]') [-Wincompatible-pointer-types]
646 | update_sprite_projection_uniforms(prev_proj);
| ^~~~~~~~~
./kernel/renderer.c:164:58: note: passing argument to parameter 'projection' here
164 | static void update_sprite_projection_uniforms(const mat4 projection) {
| ^
2 warnings generated.
Creating shared library: build/lib/liborion.dylib
find user kernel commctl -name "
.c" | sort | sed 's/.*/#include "&"/' |
gcc -Wall -Wextra -std=c11 -I. -DGL_SILENCE_DEPRECATION -D_DEFAULT_SOURCE -Wno-unused-parameter -I/opt/homebrew/include -I/usr/local/include -DHAVE_LUA -I/opt/homebrew/include/lua -dynamiclib -x c -o build/lib/liborion.dylib - -L/opt/homebrew/lib -L/usr/local/lib -L/opt/homebrew/lib -Lbuild/lib -lplatform -Wl,-rpath,/Users/runner/work/doom-ed/doom-ed/ui/build/lib -lm -framework OpenGL -llua
In file included from :26:
./kernel/renderer.c:630:39: warning: incompatible pointer types passing 'float[16]' to parameter of type 'const vec4 ' (aka 'const float ()[4]') [-Wincompatible-pointer-types]
630 | update_sprite_projection_uniforms(prev_proj);
| ^~~~~~~~~
./kernel/renderer.c:164:58: note: passing argument to parameter 'projection' here
164 | static void update_sprite_projection_uniforms(const mat4 projection) {
| ^
./kernel/renderer.c:646:37: warning: incompatible pointer types passing 'float[16]' to parameter of type 'const vec4 ' (aka 'const float ()[4]') [-Wincompatible-pointer-types]
646 | update_sprite_projection_uniforms(prev_proj);
| ^~~~~~~~~
./kernel/renderer.c:164:58: note: passing argument to parameter 'projection' here
164 | static void update_sprite_projection_uniforms(const mat4 projection) {
| ^
2 warnings generated.
mkdir -p build/share
Copying VGA font sheet: build/share/orion/vga-rom-font-8x16.png
cp share/vga-rom-font-8x16.png build/share/orion/vga-rom-font-8x16.png
mkdir -p build/bin
Building example: build/bin/filemanager
Building example: build/bin/formeditor
Building example: build/bin/gitclient
Building example: build/bin/helloworld
Building example: build/bin/imageeditor
In file included from :13:
./examples/imageeditor/win_filtergallery.c:60:29: error: call to undeclared function 'icon_grid_layout'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
60 | icon_grid_layout_t grid = icon_grid_layout(view_w, g_app->filter_count);
| ^
./examples/imageeditor/win_filtergallery.c:60:22: error: initializing 'icon_grid_layout_t' with an expression of incompatible type 'int'
60 | icon_grid_layout_t grid = icon_grid_layout(view_w, g_app->filter_count);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./examples/imageeditor/win_filtergallery.c:61:10: error: call to undeclared function 'icon_grid_hit_test'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
61 | return icon_grid_hit_test(&grid,
| ^
./examples/imageeditor/win_filtergallery.c:75:27: error: static declaration of 'icon_grid_layout' follows non-static declaration
75 | static icon_grid_layout_t icon_grid_layout(int view_w, int item_count) {
| ^
./examples/imageeditor/win_filtergallery.c:60:29: note: previous implicit declaration is here
60 | icon_grid_layout_t grid = icon_grid_layout(view_w, g_app->filter_count);
| ^
./examples/imageeditor/win_filtergallery.c:98:12: error: static declaration of 'icon_grid_hit_test' follows non-static declaration
98 | static int icon_grid_hit_test(const icon_grid_layout_t *g, int x, int y,
| ^
./examples/imageeditor/win_filtergallery.c:61:10: note: previous implicit declaration is here
61 | return icon_grid_hit_test(&grid,
| ^
./examples/imageeditor/win_filtergallery.c:334:22: error: call to undeclared function 'MAKEWPARAM'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
334 | MAKEWPARAM(FG_BTN_OK, btnClicked), win);
| ^
6 errors generated.
make[1]: *** [build/bin/imageeditor] Error 1
make: *** [ui/build/lib/liborion.dylib] Error 2

Copilot AI commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Building liborion via ui/Makefile...
mkdir -p build/lib
Building platform library...
...

The CI failure was caused by bugs in the latest orion-ui main commit's examples/imageeditor/win_filtergallery.c (missing forward declarations + undefined MAKEWPARAM). Since doom-ed only needs the orion-ui library (not its example apps), the fix is to call make library instead of make all when building the submodule. This avoids compiling any example code. Fixed in 81429ef.

Copilot AI requested a review from corepunch May 1, 2026 06:28
@corepunch

Copy link
Copy Markdown
Owner

@copilot Building liborion via ui/Makefile...
mkdir -p build/lib
Building platform library...
/Applications/Xcode_16.4.app/Contents/Developer/usr/bin/make -C platform OUTDIR=/Users/runner/work/doom-ed/doom-ed/ui/build/lib
( find macos -name ".m"; find unix -name ".c"; ) | sed 's|.|#include "&"|' | clang -Wall -Wextra -fPIC -I. -DGL_SILENCE_DEPRECATION -Wno-deprecated-declarations -DHAVE_WINDOWING -x objective-c - -dynamiclib -framework AppKit -framework Cocoa -framework OpenGL -framework IOSurface -framework Security -framework CoreFoundation -install_name @rpath/libplatform.dylib -o /Users/runner/work/doom-ed/doom-ed/ui/build/lib/libplatform.dylib
Creating static library: build/lib/liborion.a
find user kernel commctl -name "
.c" | sort | sed 's/./#include "&"/' |
gcc -Wall -Wextra -std=c11 -I. -DGL_SILENCE_DEPRECATION -D_DEFAULT_SOURCE -Wno-unused-parameter -I/opt/homebrew/include -I/usr/local/include -DHAVE_LUA -I/opt/homebrew/include/lua -x c -c -o build/liborion_unity.o - &&
ar rcs build/lib/liborion.a build/liborion_unity.o &&
rm -f build/liborion_unity.o
In file included from :26:
./kernel/renderer.c:630:39: warning: incompatible pointer types passing 'float[16]' to parameter of type 'const vec4 ' (aka 'const float ()[4]') [-Wincompatible-pointer-types]
630 | update_sprite_projection_uniforms(prev_proj);
| ^~~~~~~~~
./kernel/renderer.c:164:58: note: passing argument to parameter 'projection' here
164 | static void update_sprite_projection_uniforms(const mat4 projection) {
| ^
./kernel/renderer.c:646:37: warning: incompatible pointer types passing 'float[16]' to parameter of type 'const vec4 ' (aka 'const float ()[4]') [-Wincompatible-pointer-types]
646 | update_sprite_projection_uniforms(prev_proj);
| ^~~~~~~~~
./kernel/renderer.c:164:58: note: passing argument to parameter 'projection' here
164 | static void update_sprite_projection_uniforms(const mat4 projection) {
| ^
2 warnings generated.
Creating shared library: build/lib/liborion.dylib
find user kernel commctl -name "
.c" | sort | sed 's/.*/#include "&"/' |
gcc -Wall -Wextra -std=c11 -I. -DGL_SILENCE_DEPRECATION -D_DEFAULT_SOURCE -Wno-unused-parameter -I/opt/homebrew/include -I/usr/local/include -DHAVE_LUA -I/opt/homebrew/include/lua -dynamiclib -x c -o build/lib/liborion.dylib - -L/opt/homebrew/lib -L/usr/local/lib -L/opt/homebrew/lib -Lbuild/lib -lplatform -Wl,-rpath,/Users/runner/work/doom-ed/doom-ed/ui/build/lib -lm -framework OpenGL -llua
In file included from :26:
./kernel/renderer.c:630:39: warning: incompatible pointer types passing 'float[16]' to parameter of type 'const vec4 ' (aka 'const float ()[4]') [-Wincompatible-pointer-types]
630 | update_sprite_projection_uniforms(prev_proj);
| ^~~~~~~~~
./kernel/renderer.c:164:58: note: passing argument to parameter 'projection' here
164 | static void update_sprite_projection_uniforms(const mat4 projection) {
| ^
./kernel/renderer.c:646:37: warning: incompatible pointer types passing 'float[16]' to parameter of type 'const vec4 ' (aka 'const float ()[4]') [-Wincompatible-pointer-types]
646 | update_sprite_projection_uniforms(prev_proj);
| ^~~~~~~~~
./kernel/renderer.c:164:58: note: passing argument to parameter 'projection' here
164 | static void update_sprite_projection_uniforms(const mat4 projection) {
| ^
2 warnings generated.
gcc -Wall -std=gnu17 -DGL_SILENCE_DEPRECATION -I/opt/homebrew/include -I/usr/local/include -I/usr/local/opt/cglm/include -I. -c mapview/bsp.c -o build/mapview/bsp.o
gcc -Wall -std=gnu17 -DGL_SILENCE_DEPRECATION -I/opt/homebrew/include -I/usr/local/include -I/usr/local/opt/cglm/include -I. -c mapview/collision.c -o build/mapview/collision.o
gcc -Wall -std=gnu17 -DGL_SILENCE_DEPRECATION -I/opt/homebrew/include -I/usr/local/include -I/usr/local/opt/cglm/include -I. -c mapview/floor.c -o build/mapview/floor.o
gcc -Wall -std=gnu17 -DGL_SILENCE_DEPRECATION -I/opt/homebrew/include -I/usr/local/include -I/usr/local/opt/cglm/include -I. -c mapview/gamefont.c -o build/mapview/gamefont.o
gcc -Wall -std=gnu17 -DGL_SILENCE_DEPRECATION -I/opt/homebrew/include -I/usr/local/include -I/usr/local/opt/cglm/include -I. -c mapview/input.c -o build/mapview/input.o
mapview/input.c:23:16: warning: unused variable 'sector' [-Wunused-variable]
23 | mapsector_t *sector = &map->sectors[sector_index];
| ^~~~~~
1 warning generated.
gcc -Wall -std=gnu17 -DGL_SILENCE_DEPRECATION -I/opt/homebrew/include -I/usr/local/include -I/usr/local/opt/cglm/include -I. -c mapview/main.c -o build/mapview/main.o
gcc -Wall -std=gnu17 -DGL_SILENCE_DEPRECATION -I/opt/homebrew/include -I/usr/local/include -I/usr/local/opt/cglm/include -I. -c mapview/renderer.c -o build/mapview/renderer.o
gcc -Wall -std=gnu17 -DGL_SILENCE_DEPRECATION -I/opt/homebrew/include -I/usr/local/include -I/usr/local/opt/cglm/include -I. -c mapview/sky.c -o build/mapview/sky.o
gcc -Wall -std=gnu17 -DGL_SILENCE_DEPRECATION -I/opt/homebrew/include -I/usr/local/include -I/usr/local/opt/cglm/include -I. -c mapview/sprites.c -o build/mapview/sprites.o
gcc -Wall -std=gnu17 -DGL_SILENCE_DEPRECATION -I/opt/homebrew/include -I/usr/local/include -I/usr/local/opt/cglm/include -I. -c mapview/texture.c -o build/mapview/texture.o
gcc -Wall -std=gnu17 -DGL_SILENCE_DEPRECATION -I/opt/homebrew/include -I/usr/local/include -I/usr/local/opt/cglm/include -I. -c mapview/things.c -o build/mapview/things.o
mapview/things.c:295:18: warning: passing 'const mat4' (aka 'const float[4][4]') to parameter of type 'vec4 ' (aka 'float ()[4]') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
295 | glm_mat4_mul(viewdef->mvp, model, mv);
| ^~~~~~~~~~~~
/opt/homebrew/include/cglm/mat4.h:316:19: note: passing argument to parameter 'm1' here
316 | glm_mat4_mul(mat4 m1, mat4 m2, mat4 dest) {
| ^
1 warning generated.
gcc -Wall -std=gnu17 -DGL_SILENCE_DEPRECATION -I/opt/homebrew/include -I/usr/local/include -I/usr/local/opt/cglm/include -I. -c mapview/triangulate.c -o build/mapview/triangulate.o
gcc -Wall -std=gnu17 -DGL_SILENCE_DEPRECATION -I/opt/homebrew/include -I/usr/local/include -I/usr/local/opt/cglm/include -I. -c mapview/wad.c -o build/mapview/wad.o
gcc -Wall -std=gnu17 -DGL_SILENCE_DEPRECATION -I/opt/homebrew/include -I/usr/local/include -I/usr/local/opt/cglm/include -I. -c mapview/walls.c -o build/mapview/walls.o
gcc -Wall -std=gnu17 -DGL_SILENCE_DEPRECATION -I/opt/homebrew/include -I/usr/local/include -I/usr/local/opt/cglm/include -I. -c mapview/wi_stuff.c -o build/mapview/wi_stuff.o
mapview/wi_stuff.c:97:10: error: call to undeclared function 'axPollEvent'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
97 | while (axPollEvent(&event)) {
| ^
1 error generated.
make: *** [build/mapview/wi_stuff.o] Error 1

make sure build succeeds before finishing work

Copilot AI commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Building liborion via ui/Makefile...
mkdir -p build/lib
Building platform library...
...

The make library fix uncovered a second issue: axPollEvent in mapview/wi_stuff.c is an old API that was replaced by get_message in orion-ui (already declared in map.h). Replaced in 98e87ce.

@corepunch

Copy link
Copy Markdown
Owner

@copilot Read through code and add more unit tests and integration tests

Copilot AI commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Read through code and add more unit tests and integration tests

Added two new test suites in ab073b3, bringing the total from 52 to 85 passing tests:

tests/walls_test.c (10 tests) — covers compute_normal_packed() from walls.c: all four axis-aligned wall directions, 45° diagonal, degenerate zero-length input, 3-4-5 reference triangle, scale independence, z-channel always-zero invariant, and direction-reversal negates normal.

tests/player_test.c (18 tests) — covers the player physics math from input.c in isolation: angle wrap at boundaries (−10→350, 360→0, 370→10), pitch clamp at ±89, velocity magnitude cap with direction preservation (including zero vector), and friction deceleration including the edge case where a large Δt brings speed exactly to zero rather than negative.

Both are wired into make test and make clean, and the binaries are listed in .gitignore.

@corepunch
corepunch merged commit f4662e1 into main May 1, 2026
2 checks passed
@corepunch
corepunch deleted the copilot/analyze-test-coverage-and-improve branch May 1, 2026 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants