Internal
Public Access
Add RdpSessionBackend test coverage (#1)
RdpSessionBackend can't reasonably get the same fixture-driven state-machine tests SshSessionBackend got: it's driven by FreeRDP's own event loop and a raw worker thread against a real freerdp_connect(), not a QProcess we can point at a stand-in binary. What it does have is a large amount of pure, regression-prone logic -- exactly the kind that already caused a real historical bug here (the X11-keycode/PC-AT-scancode mixup fixed in Milestone 7) -- so that's what gets covered instead. Twelve functions promoted from free functions / private members to public statics purely so tests can call them without a live connection: security-mode/performance-profile normalization, the HiDPI scale-value mapping, desktop-size clamping, both scancode-mapping functions, and the five FreeRDP error-code interpretation functions. UINT32 is surfaced as quint32 in the public signatures to keep FreeRDP/WinPR types out of the header, matching how rdp_freerdp* is already only forward-declared there. 27 test cases, including a couple of direct regression guards: verifying scancodeFromNativeScanCode() is a faithful passthrough to FreeRDP's X11 table (not a reimplementation), and that it does NOT reproduce the old "X11 keycode treated as PC/AT scancode" bug for a documented example key. This closes out #1's originally scoped work (CTest wiring, ProfileRepository, SshSessionBackend, RdpSessionBackend coverage). Deeper state-machine coverage for the two session backends remains future work if ever needed, but isn't blocking here. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,3 +17,26 @@ target_compile_definitions(test_ssh_session_backend PRIVATE
|
||||
ORBITHUB_TEST_FIXTURES_DIR="${CMAKE_CURRENT_SOURCE_DIR}/fixtures"
|
||||
)
|
||||
add_test(NAME test_ssh_session_backend COMMAND test_ssh_session_backend)
|
||||
|
||||
if(TARGET freerdp AND TARGET winpr)
|
||||
add_executable(test_rdp_session_backend
|
||||
test_rdp_session_backend.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/rdp_session_backend.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/session_backend.h
|
||||
)
|
||||
target_include_directories(test_rdp_session_backend PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/third_party/FreeRDP/include
|
||||
${CMAKE_SOURCE_DIR}/third_party/FreeRDP/winpr/include
|
||||
${CMAKE_BINARY_DIR}/third_party/FreeRDP/include
|
||||
${CMAKE_BINARY_DIR}/third_party/FreeRDP/winpr/include
|
||||
)
|
||||
target_compile_definitions(test_rdp_session_backend PRIVATE ORBITHUB_HAS_FREERDP)
|
||||
target_link_libraries(test_rdp_session_backend PRIVATE Qt6::Core Qt6::Gui Qt6::Test freerdp winpr)
|
||||
if(TARGET freerdp-client)
|
||||
target_link_libraries(test_rdp_session_backend PRIVATE freerdp-client)
|
||||
endif()
|
||||
add_test(NAME test_rdp_session_backend COMMAND test_rdp_session_backend)
|
||||
else()
|
||||
message(STATUS "FreeRDP targets not available -- skipping test_rdp_session_backend")
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user