Add stroke sampler dispatch helper coverage
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user