Add stroke sampler dispatch helper coverage

This commit is contained in:
2026-06-13 16:54:27 +02:00
parent f0cc49396e
commit 818f2b10ad
2 changed files with 36 additions and 0 deletions

View File

@@ -509,6 +509,11 @@ Done Checks:
Progress Notes:
- 2026-06-13: `pp_paint_renderer_stroke_execution_tests` now covers the new
retained sampler dispatch helper builder and its pattern bind/unbind wiring.
Next slice should target another narrow `stroke_draw()` seam or another
helper-builder regression without reopening landed texture or dual-pass
helpers.
- 2026-06-13: `Canvas::stroke_draw()` live-pass sampler dispatch now reuses a
retained helper builder for brush-tip, destination, pattern, and mixer
sampler callbacks; the live adapter still owns the concrete sampler objects.

View File

@@ -232,6 +232,34 @@ void retained_stroke_sampler_dispatch_routes_bind_and_unbind_per_input(pp::tests
PP_EXPECT(h, events == expected_events);
}
void retained_stroke_sampler_dispatch_helper_builds_expected_callback_wiring(pp::tests::Harness& h)
{
std::vector<std::string> events;
const auto dispatch = pp::panopainter::make_legacy_canvas_stroke_sampler_dispatch(
[&](int slot) { events.emplace_back("bind:brush_tip:" + std::to_string(slot)); },
[&] { events.emplace_back("unbind:brush_tip"); },
[&](int slot) { events.emplace_back("bind:destination:" + std::to_string(slot)); },
[&] { events.emplace_back("unbind:destination"); },
[&](int slot) { events.emplace_back("bind:pattern:" + std::to_string(slot)); },
[&] { events.emplace_back("unbind:pattern"); },
[&](int slot) { events.emplace_back("bind:mixer:" + std::to_string(slot)); },
[&] { events.emplace_back("unbind:mixer"); });
pp::panopainter::bind_legacy_canvas_stroke_sampler_input(
LegacyCanvasStrokeTextureInput::pattern,
6,
dispatch);
pp::panopainter::unbind_legacy_canvas_stroke_sampler_input(
LegacyCanvasStrokeTextureInput::pattern,
dispatch);
const std::vector<std::string> expected_events {
"bind:pattern:6",
"unbind:pattern",
};
PP_EXPECT(h, events == expected_events);
}
void retained_stroke_sample_executor_copies_destination_and_expands_quads(pp::tests::Harness& h)
{
const auto vertices = make_quad_vertices();
@@ -1309,6 +1337,9 @@ int main()
harness.run(
"retained_stroke_sampler_dispatch_routes_bind_and_unbind_per_input",
retained_stroke_sampler_dispatch_routes_bind_and_unbind_per_input);
harness.run(
"retained_stroke_sampler_dispatch_helper_builds_expected_callback_wiring",
retained_stroke_sampler_dispatch_helper_builds_expected_callback_wiring);
harness.run(
"retained_stroke_sample_executor_unbinds_and_skips_draw_when_bounds_are_empty",
retained_stroke_sample_executor_unbinds_and_skips_draw_when_bounds_are_empty);