Extract stroke mix request wiring
This commit is contained in:
@@ -1807,6 +1807,84 @@ void retained_stroke_mix_pass_rejects_incomplete_requests(pp::tests::Harness& h)
|
||||
PP_EXPECT(h, events.empty());
|
||||
}
|
||||
|
||||
void retained_stroke_mix_pass_request_builder_preserves_callback_wiring(pp::tests::Harness& h)
|
||||
{
|
||||
const std::array<LegacyCanvasStrokeMixPassPlane, 1> planes {
|
||||
LegacyCanvasStrokeMixPassPlane { .index = 3, .visible = true, .has_target = true, .opacity = 0.75F },
|
||||
};
|
||||
|
||||
std::vector<std::string> events;
|
||||
const auto request = pp::panopainter::make_legacy_canvas_stroke_mix_pass_request(
|
||||
"mix-test",
|
||||
glm::vec2(128.0F, 64.0F),
|
||||
planes,
|
||||
[&] { events.emplace_back("bind-samplers"); },
|
||||
[&] { events.emplace_back("unbind-samplers"); },
|
||||
[&](int plane_index, const glm::mat4&) {
|
||||
events.emplace_back("setup:" + std::to_string(plane_index));
|
||||
},
|
||||
[&](int plane_index) {
|
||||
events.emplace_back("bind-layer:" + std::to_string(plane_index));
|
||||
},
|
||||
[&](int plane_index) {
|
||||
events.emplace_back("bind-stroke:" + std::to_string(plane_index));
|
||||
},
|
||||
[&](int plane_index) {
|
||||
events.emplace_back("bind-mask:" + std::to_string(plane_index));
|
||||
},
|
||||
[&] { events.emplace_back("draw"); },
|
||||
[&](int plane_index) {
|
||||
events.emplace_back("unbind-mask:" + std::to_string(plane_index));
|
||||
},
|
||||
[&](int plane_index) {
|
||||
events.emplace_back("unbind-stroke:" + std::to_string(plane_index));
|
||||
},
|
||||
[&](int plane_index) {
|
||||
events.emplace_back("unbind-layer:" + std::to_string(plane_index));
|
||||
});
|
||||
|
||||
PP_EXPECT(h, request.context == "mix-test");
|
||||
PP_EXPECT(h, request.resolution.x == 128.0F);
|
||||
PP_EXPECT(h, request.resolution.y == 64.0F);
|
||||
PP_EXPECT(h, request.planes.size() == 1U);
|
||||
PP_EXPECT(h, request.planes.front().index == 3);
|
||||
PP_EXPECT(h, request.bind_mix_samplers);
|
||||
PP_EXPECT(h, request.unbind_mix_samplers);
|
||||
PP_EXPECT(h, request.setup_plane_shader);
|
||||
PP_EXPECT(h, request.bind_layer_texture);
|
||||
PP_EXPECT(h, request.bind_stroke_texture);
|
||||
PP_EXPECT(h, request.bind_mask_texture);
|
||||
PP_EXPECT(h, request.draw_plane);
|
||||
PP_EXPECT(h, request.unbind_mask_texture);
|
||||
PP_EXPECT(h, request.unbind_stroke_texture);
|
||||
PP_EXPECT(h, request.unbind_layer_texture);
|
||||
|
||||
request.bind_mix_samplers();
|
||||
request.setup_plane_shader(3, glm::mat4(1.0F));
|
||||
request.bind_layer_texture(3);
|
||||
request.bind_stroke_texture(3);
|
||||
request.bind_mask_texture(3);
|
||||
request.draw_plane();
|
||||
request.unbind_mask_texture(3);
|
||||
request.unbind_stroke_texture(3);
|
||||
request.unbind_layer_texture(3);
|
||||
request.unbind_mix_samplers();
|
||||
|
||||
const std::vector<std::string> expected_events {
|
||||
"bind-samplers",
|
||||
"setup:3",
|
||||
"bind-layer:3",
|
||||
"bind-stroke:3",
|
||||
"bind-mask:3",
|
||||
"draw",
|
||||
"unbind-mask:3",
|
||||
"unbind-stroke:3",
|
||||
"unbind-layer:3",
|
||||
"unbind-samplers",
|
||||
};
|
||||
PP_EXPECT(h, events == expected_events);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int main()
|
||||
@@ -1911,5 +1989,8 @@ int main()
|
||||
harness.run(
|
||||
"retained_stroke_mix_pass_rejects_incomplete_requests",
|
||||
retained_stroke_mix_pass_rejects_incomplete_requests);
|
||||
harness.run(
|
||||
"retained_stroke_mix_pass_request_builder_preserves_callback_wiring",
|
||||
retained_stroke_mix_pass_request_builder_preserves_callback_wiring);
|
||||
return harness.finish();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user