Extract canvas toolbar state planning
This commit is contained in:
@@ -886,6 +886,24 @@ if(TARGET pano_cli)
|
||||
LABELS "app;ui;integration;desktop-fast;fuzz"
|
||||
WILL_FAIL TRUE)
|
||||
|
||||
add_test(NAME pano_cli_plan_canvas_tool_state_draw_smoke
|
||||
COMMAND pano_cli plan-canvas-tool-state --mode draw --picking --touch-lock)
|
||||
set_tests_properties(pano_cli_plan_canvas_tool_state_draw_smoke PROPERTIES
|
||||
LABELS "app;ui;integration;desktop-fast"
|
||||
PASS_REGULAR_EXPRESSION "\"command\":\"plan-canvas-tool-state\".*\"mode\":\"draw\".*\"pickActive\":true.*\"touchLockActive\":true.*\"penActive\":true")
|
||||
|
||||
add_test(NAME pano_cli_plan_canvas_tool_state_copy_smoke
|
||||
COMMAND pano_cli plan-canvas-tool-state --mode copy --picking)
|
||||
set_tests_properties(pano_cli_plan_canvas_tool_state_copy_smoke PROPERTIES
|
||||
LABELS "app;ui;integration;desktop-fast;fuzz"
|
||||
PASS_REGULAR_EXPRESSION "\"command\":\"plan-canvas-tool-state\".*\"mode\":\"copy\".*\"pickActive\":false.*\"penActive\":false.*\"copyActive\":true")
|
||||
|
||||
add_test(NAME pano_cli_plan_canvas_tool_state_rejects_unknown
|
||||
COMMAND pano_cli plan-canvas-tool-state --mode warp)
|
||||
set_tests_properties(pano_cli_plan_canvas_tool_state_rejects_unknown PROPERTIES
|
||||
LABELS "app;ui;integration;desktop-fast;fuzz"
|
||||
WILL_FAIL TRUE)
|
||||
|
||||
add_test(NAME pano_cli_plan_grid_operation_pick_smoke
|
||||
COMMAND pano_cli plan-grid-operation --kind pick)
|
||||
set_tests_properties(pano_cli_plan_grid_operation_pick_smoke PROPERTIES
|
||||
|
||||
@@ -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