Commit adb2479
refactor: backend extension traits, test coverage, JS events, ASAN fix (#54)
* test: add demux error path, streaming throttle, seek interpolation tests
Add 49 new pure-logic tests across two crates (PR 6 from refactor plan):
demux_lite.rs (21 new tests):
- Truncated/empty box headers, invalid box sizes, extended size errors
- Zero-size box (extends to EOF), oversized box skipping
- Missing moov/empty moov, parse_moov_tracks edge cases
- Empty stts/stsc/stsz/stco tables, sample offset/PTS edge cases
- AVCC→Annex B: empty data, NAL exceeds bounds, invalid NAL length size
- read_desc_len: single/multi/empty, ctts negative offset clamping
- find_keyframe_before/find_sample_at with empty tables
tv_controller.rs (28 new tests):
- should_throttle: extract pure function, test all 12 boundary cases
(decoder=0 ± moov ± buf threshold, decoder>0 ± lookahead boundary)
- linear_seek_interpolation: extract pure function, test 8 cases
(zero/half/full/beyond duration, zero/negative duration, small/large files)
- parse_moov_duration: v0, zero timescale, missing mvhd, too short
- maybe_evict: 5 tests (small buffer, large buffer, disabled, cursor at
start, preserves data near cursor)
Also refactors inline seek interpolation formulas to use the extracted
linear_seek_interpolation() helper for consistency and testability.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add input mapping + color conversion unit tests across backends
Add ~85 pure-logic unit tests covering:
SDL backend (lib.rs): key_up edge cases (Backspace/F11 not mapped),
F-key coverage, letter-key selectivity, wheel delta sign inversion,
mouse coordinate truncation, frect/fpoint conversion helpers.
WASM backend (input.rs): Extract scale_point_math() pure function from
scale_point() for testable letterbox coordinate scaling. 19 tests cover
identity, 2x scaling, horizontal/vertical letterboxing, clamping,
aspect ratio variations, zero-size elements, fractional coords, DPI.
PSP backend (input.rs): Extract analog_to_cursor_delta(), clamp_cursor(),
apply_deadzone() helpers. 15 tests for deadzone threshold, cursor speed,
boundary clamping, button/trigger map completeness, constant values.
PSP backend (lib.rs): Add from_abgr() decode function and 20 tests for
RGBA-to-ABGR encode, decode, and round-trip for all primary colors,
transparent, arbitrary values, min/max channels.
UE5 backend (input.rs): 8 additional tests for coordinate passthrough,
boundary values, multiple poll drain cycles, all-button round-trip.
UE5 backend (renderer.rs): 28 tests for lerp_u8 endpoints/midpoint/
zero-denominator, lerp_color, intersect_clip, RGBA buffer layout for
all primary colors, alpha blending, transparency, out-of-bounds pixel
safety, and RGBA encode/decode round-trip.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: backend extension traits, 200+ tests, JS event dispatch, ASAN fix
Backend trait surface area:
- Split SdiBackend (48 methods) into 8 focused extension traits
(SdiShapes, SdiGradients, SdiAlpha, SdiText, SdiTextures,
SdiClipTransform, SdiVector, SdiBatch) with blanket impls
- Remove dead code: draw_text_weighted (never overridden)
- Existing SdiBackend kept intact for backwards compat (Phase 1)
Test coverage (~200 new tests):
- Input mapping: SDL (13), WASM (19), PSP (15), UE5 (8) tests
- Color/pixel conversion: PSP ABGR (20), UE5 RGBA/lerp/clip (28) tests
- Video demux: 21 error path tests (truncated headers, missing atoms,
empty sample tables, AVCC edge cases)
- Streaming: 28 tests (throttle logic, seek interpolation, moov
parsing, buffer eviction) with extracted pure helper functions
Browser JS runtime:
- Retain JsEngine beyond page load (stored in BrowserWidget)
- Event bubbling via __oasis_dispatch_with_bubbling (target→root)
- stopPropagation, preventDefault, target/currentTarget support
- Hit-test clicks through layout tree to dispatch to JS listeners
- 8 new JS event dispatch tests
CI fixes:
- Fix ASAN "incompatible runtimes" by removing CFLAGS=-fsanitize=address
(SDL3 C code conflicted with Rust's ASan runtime)
- Expand memory-ci PR trigger paths (oasis-app, backend-sdl, backend-ue5,
oasis-types, Cargo.toml/lock)
- Add advisory nightly clippy step to PR validation pipeline
- Fix unused_comparisons warning in oasis-vector anim.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update backend method counts (30→39), JS runtime, plan status
- CLAUDE.md: SdiBackend 39 methods + 8 extension traits, JS event dispatch
- design.md: update method counts in 2 locations
- ADR 003: update method counts, document extension traits
- AGENTS.md: update method count
- Plan doc: mark Phase 1 as implemented
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* ci: disable benchmarks in PR validation pipeline
Benchmarks add significant time to PR validation without blocking value.
They can be run manually or in main-ci instead.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* ci: use if conditional for benchmarks instead of comment block
Benchmarks now only run on workflow_dispatch, skipped for PRs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: SdiVector defaults use triangle fan + line segments, not bounding boxes
Change SdiVector supertrait from SdiCore to SdiShapes so defaults can
use ext_fill_triangle (triangle fan decomposition) for polygons/arcs
and ext_draw_line for stroke outlines instead of crude fill_rect
bounding boxes.
Addresses Gemini review feedback on PR #54.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address AI review feedback (iteration 2)
Automated fix by Claude in response to Gemini/Codex review.
Iteration: 2/5
Co-Authored-By: AI Review Agent <noreply@anthropic.com>
* fix: auto-format + update pre-commit to run cargo fmt on commit
- Fix formatting in SdiVector extension trait defaults
- Update pre-commit config: cargo fmt auto-fixes on commit (local,
not Docker), clippy runs on pre-push only (too slow per commit)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: AI Agent Bot <ai-agent@localhost>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: AI Review Agent <ai-review-agent@localhost>1 parent 227b6db commit adb2479
File tree
23 files changed
+3420
-182
lines changed- .github/workflows
- crates
- oasis-app/src
- oasis-backend-psp/src
- oasis-backend-sdl/src
- oasis-backend-ue5/src
- oasis-backend-wasm/src
- oasis-browser/src
- layout
- oasis-types/src
- oasis-vector/src
- oasis-video/src
- docs
- adr
23 files changed
+3420
-182
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
11 | 17 | | |
12 | 18 | | |
13 | 19 | | |
| |||
54 | 60 | | |
55 | 61 | | |
56 | 62 | | |
57 | | - | |
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
75 | 83 | | |
76 | 84 | | |
77 | 85 | | |
| |||
128 | 136 | | |
129 | 137 | | |
130 | 138 | | |
131 | | - | |
| 139 | + | |
132 | 140 | | |
| 141 | + | |
133 | 142 | | |
134 | 143 | | |
135 | 144 | | |
| |||
139 | 148 | | |
140 | 149 | | |
141 | 150 | | |
142 | | - | |
| 151 | + | |
143 | 152 | | |
144 | 153 | | |
145 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | 43 | | |
45 | 44 | | |
46 | | - | |
| 45 | + | |
47 | 46 | | |
48 | | - | |
| 47 | + | |
49 | 48 | | |
50 | 49 | | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
| 57 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| |||
0 commit comments