Extract canvas toolbar state planning
This commit is contained in:
@@ -50,6 +50,37 @@ void pick_and_touch_lock_toggle_state(pp::tests::Harness& harness)
|
||||
PP_EXPECT(harness, !touch_lock.no_op);
|
||||
}
|
||||
|
||||
void button_state_tracks_active_mode_and_toggles(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto draw = pp::app::plan_canvas_tool_button_state(
|
||||
pp::app::CanvasToolMode::draw,
|
||||
true,
|
||||
true);
|
||||
PP_EXPECT(harness, draw.mode == pp::app::CanvasToolMode::draw);
|
||||
PP_EXPECT(harness, draw.pick_active);
|
||||
PP_EXPECT(harness, draw.touch_lock_active);
|
||||
PP_EXPECT(harness, draw.pen_active);
|
||||
PP_EXPECT(harness, !draw.erase_active);
|
||||
PP_EXPECT(harness, !draw.copy_active);
|
||||
PP_EXPECT(harness, !draw.flood_fill_active);
|
||||
|
||||
const auto copy = pp::app::plan_canvas_tool_button_state(
|
||||
pp::app::CanvasToolMode::copy,
|
||||
true,
|
||||
false);
|
||||
PP_EXPECT(harness, copy.copy_active);
|
||||
PP_EXPECT(harness, !copy.pick_active);
|
||||
PP_EXPECT(harness, !copy.touch_lock_active);
|
||||
PP_EXPECT(harness, !copy.pen_active);
|
||||
|
||||
const auto bucket = pp::app::plan_canvas_tool_button_state(
|
||||
pp::app::CanvasToolMode::flood_fill,
|
||||
false,
|
||||
false);
|
||||
PP_EXPECT(harness, bucket.flood_fill_active);
|
||||
PP_EXPECT(harness, !bucket.mask_line_active);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int main()
|
||||
@@ -58,5 +89,6 @@ int main()
|
||||
harness.run("selection plans canvas modes", selection_plans_canvas_modes);
|
||||
harness.run("transform tools plan copy and cut actions", transform_tools_plan_copy_and_cut_actions);
|
||||
harness.run("pick and touch lock toggle state", pick_and_touch_lock_toggle_state);
|
||||
harness.run("button state tracks active mode and toggles", button_state_tracks_active_mode_and_toggles);
|
||||
return harness.finish();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user