Route animation timeline scrubbing through app core
This commit is contained in:
@@ -466,6 +466,42 @@ void onion_frame_ranges_reject_invalid_inputs(pp::tests::Harness& harness)
|
||||
PP_EXPECT(harness, !pp::app::plan_animation_onion_frame_range(3, 1, -1));
|
||||
}
|
||||
|
||||
void timeline_scrub_clamps_cursor_to_document_frame(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto left = pp::app::plan_animation_timeline_scrub(5, -0.01F);
|
||||
PP_REQUIRE(harness, left);
|
||||
PP_EXPECT(harness, left.value().target_frame == 0);
|
||||
|
||||
const auto first = pp::app::plan_animation_timeline_scrub(5, 0.0F);
|
||||
PP_REQUIRE(harness, first);
|
||||
PP_EXPECT(harness, first.value().target_frame == 0);
|
||||
|
||||
const auto second = pp::app::plan_animation_timeline_scrub(5, 35.0F);
|
||||
PP_REQUIRE(harness, second);
|
||||
PP_EXPECT(harness, second.value().target_frame == 1);
|
||||
|
||||
const auto inside_last = pp::app::plan_animation_timeline_scrub(5, 174.99F);
|
||||
PP_REQUIRE(harness, inside_last);
|
||||
PP_EXPECT(harness, inside_last.value().target_frame == 4);
|
||||
|
||||
const auto far_right = pp::app::plan_animation_timeline_scrub(5, 10000.0F);
|
||||
PP_REQUIRE(harness, far_right);
|
||||
PP_EXPECT(harness, far_right.value().target_frame == 4);
|
||||
|
||||
const auto custom_width = pp::app::plan_animation_timeline_scrub(4, 21.0F, 10.0F);
|
||||
PP_REQUIRE(harness, custom_width);
|
||||
PP_EXPECT(harness, custom_width.value().target_frame == 2);
|
||||
}
|
||||
|
||||
void timeline_scrub_rejects_invalid_inputs(pp::tests::Harness& harness)
|
||||
{
|
||||
PP_EXPECT(harness, !pp::app::plan_animation_timeline_scrub(0, 0.0F));
|
||||
PP_EXPECT(harness, !pp::app::plan_animation_timeline_scrub(3, std::numeric_limits<float>::infinity()));
|
||||
PP_EXPECT(harness, !pp::app::plan_animation_timeline_scrub(3, 0.0F, 0.0F));
|
||||
PP_EXPECT(harness, !pp::app::plan_animation_timeline_scrub(3, 0.0F, -1.0F));
|
||||
PP_EXPECT(harness, !pp::app::plan_animation_timeline_scrub(3, 0.0F, std::numeric_limits<float>::infinity()));
|
||||
}
|
||||
|
||||
void executor_dispatches_mutating_frame_operations(pp::tests::Harness& harness)
|
||||
{
|
||||
FakeDocumentAnimationServices services;
|
||||
@@ -632,6 +668,8 @@ int main()
|
||||
harness.run("onion size updates canvas without document mutation", onion_size_updates_canvas_without_document_mutation);
|
||||
harness.run("onion frame ranges clamp edges and alpha", onion_frame_ranges_clamp_edges_and_alpha);
|
||||
harness.run("onion frame ranges reject invalid inputs", onion_frame_ranges_reject_invalid_inputs);
|
||||
harness.run("timeline scrub clamps cursor to document frame", timeline_scrub_clamps_cursor_to_document_frame);
|
||||
harness.run("timeline scrub rejects invalid inputs", timeline_scrub_rejects_invalid_inputs);
|
||||
harness.run("executor dispatches mutating frame operations", executor_dispatches_mutating_frame_operations);
|
||||
harness.run("executor dispatches timeline and parameter operations", executor_dispatches_timeline_and_parameter_operations);
|
||||
harness.run("executor rejects malformed animation plans", executor_rejects_malformed_animation_plans);
|
||||
|
||||
Reference in New Issue
Block a user