Route canvas camera reset through app core

This commit is contained in:
2026-06-05 01:46:41 +02:00
parent f42a6540be
commit 9373e07d3e
9 changed files with 143 additions and 6 deletions

View File

@@ -355,6 +355,16 @@ add_test(NAME pp_app_core_canvas_hotkey_tests COMMAND pp_app_core_canvas_hotkey_
set_tests_properties(pp_app_core_canvas_hotkey_tests PROPERTIES
LABELS "app;ui;document;paint;desktop-fast;fuzz")
add_executable(pp_app_core_canvas_view_tests
app_core/canvas_view_tests.cpp)
target_link_libraries(pp_app_core_canvas_view_tests PRIVATE
pp_app_core
pp_test_harness)
add_test(NAME pp_app_core_canvas_view_tests COMMAND pp_app_core_canvas_view_tests)
set_tests_properties(pp_app_core_canvas_view_tests PROPERTIES
LABELS "app;ui;desktop-fast")
add_executable(pp_app_core_grid_ui_tests
app_core/grid_ui_tests.cpp)
target_link_libraries(pp_app_core_grid_ui_tests PRIVATE
@@ -1628,6 +1638,18 @@ if(TARGET pano_cli)
LABELS "app;ui;integration;desktop-fast;fuzz"
WILL_FAIL TRUE)
add_test(NAME pano_cli_plan_canvas_camera_reset_smoke
COMMAND pano_cli plan-canvas-camera-reset)
set_tests_properties(pano_cli_plan_canvas_camera_reset_smoke PROPERTIES
LABELS "app;ui;integration;desktop-fast"
PASS_REGULAR_EXPRESSION "\"command\":\"plan-canvas-camera-reset\".*\"rotation\":\\[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1\\].*\"position\":\\[0,0,0\\].*\"fieldOfViewDegrees\":85.*\"pan\":\\[0,0\\]")
add_test(NAME pano_cli_plan_canvas_camera_reset_rejects_options
COMMAND pano_cli plan-canvas-camera-reset --unexpected)
set_tests_properties(pano_cli_plan_canvas_camera_reset_rejects_options PROPERTIES
LABELS "app;ui;integration;desktop-fast;fuzz"
WILL_FAIL TRUE)
add_test(NAME pano_cli_plan_canvas_cursor_small_brush_smoke
COMMAND pano_cli plan-canvas-cursor --mode draw --visibility small-brush --brush-size 9.5)
set_tests_properties(pano_cli_plan_canvas_cursor_small_brush_smoke PROPERTIES

View File

@@ -0,0 +1,32 @@
#include "app_core/canvas_view.h"
#include "test_harness.h"
#include <cstddef>
namespace {
void camera_reset_projects_legacy_defaults(pp::tests::Harness& harness)
{
const auto state = pp::app::plan_canvas_camera_reset();
for (std::size_t index = 0; index < state.rotation.size(); ++index) {
const bool diagonal = index == 0 || index == 5 || index == 10 || index == 15;
PP_EXPECT(harness, state.rotation[index] == (diagonal ? 1.0F : 0.0F));
}
PP_EXPECT(harness, state.position[0] == 0.0F);
PP_EXPECT(harness, state.position[1] == 0.0F);
PP_EXPECT(harness, state.position[2] == 0.0F);
PP_EXPECT(harness, state.field_of_view_degrees == 85.0F);
PP_EXPECT(harness, state.pan[0] == 0.0F);
PP_EXPECT(harness, state.pan[1] == 0.0F);
}
} // namespace
int main()
{
pp::tests::Harness harness;
harness.run("camera reset projects legacy defaults", camera_reset_projects_legacy_defaults);
return harness.finish();
}