Add live pass sampler dispatch helper coverage

This commit is contained in:
2026-06-13 16:59:26 +02:00
parent f3364a96ae
commit 384db00015
4 changed files with 58 additions and 1 deletions

View File

@@ -287,6 +287,34 @@ void retained_stroke_main_pass_texture_dispatch_helper_builds_expected_callback_
PP_EXPECT(h, events == expected_events);
}
void retained_stroke_live_pass_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_live_pass_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::brush_tip,
4,
dispatch);
pp::panopainter::unbind_legacy_canvas_stroke_sampler_input(
LegacyCanvasStrokeTextureInput::brush_tip,
dispatch);
const std::vector<std::string> expected_events {
"bind:brush_tip:4",
"unbind:brush_tip",
};
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();
@@ -1370,6 +1398,9 @@ int main()
harness.run(
"retained_stroke_main_pass_texture_dispatch_helper_builds_expected_callback_wiring",
retained_stroke_main_pass_texture_dispatch_helper_builds_expected_callback_wiring);
harness.run(
"retained_stroke_live_pass_sampler_dispatch_helper_builds_expected_callback_wiring",
retained_stroke_live_pass_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);