Extract stroke destination dispatch helper

This commit is contained in:
2026-06-13 17:42:40 +02:00
parent 38a73fc6f0
commit 6bb1268edb
4 changed files with 51 additions and 11 deletions

View File

@@ -361,6 +361,28 @@ void retained_stroke_pad_destination_texture_dispatch_helper_builds_expected_cal
PP_EXPECT(h, events == expected_events);
}
void retained_stroke_destination_texture_dispatch_helper_builds_expected_callback_wiring(pp::tests::Harness& h)
{
std::vector<std::string> events;
const auto dispatch = pp::panopainter::make_legacy_canvas_stroke_destination_texture_dispatch(
[&](int slot) { events.emplace_back("activate:" + std::to_string(slot)); },
[&] { events.emplace_back("bind:destination"); },
[&] { events.emplace_back("unbind:destination"); });
pp::panopainter::bind_legacy_canvas_stroke_texture_input(
LegacyCanvasStrokeTextureInput::stroke_destination,
dispatch);
pp::panopainter::unbind_legacy_canvas_stroke_texture_input(
LegacyCanvasStrokeTextureInput::stroke_destination,
dispatch);
const std::vector<std::string> expected_events {
"bind:destination",
"unbind:destination",
};
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();
@@ -1450,6 +1472,9 @@ int main()
harness.run(
"retained_stroke_brush_tip_texture_dispatch_helper_builds_expected_callback_wiring",
retained_stroke_brush_tip_texture_dispatch_helper_builds_expected_callback_wiring);
harness.run(
"retained_stroke_destination_texture_dispatch_helper_builds_expected_callback_wiring",
retained_stroke_destination_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);