Internal
Public Access
Parses mRemoteNG's confCons.xml export format directly -- schema verified against mRemoteNG's own XmlConnectionsDeserializer.cs source and a real exported sample, not guessed at. Maps nested <Node Type="Container"> folders and <Node Type="Connection"> entries onto OrbitHub profiles: RDP stays RDP, SSH1/SSH2 collapse to OrbitHub's single SSH protocol, anything else (VNC, Telnet, HTTP, PowerShell, ...) is skipped and listed in the import summary rather than silently dropped. Passwords are never read, not even for the common case where they're technically readable without a master password (mRemoteNG only encrypts the Password attribute itself, everything else -- Hostname, Username, Domain, Protocol -- is plaintext). A FullFileEncryption="true" export encrypts the whole node tree instead and genuinely can't be read without the user's master password; that case is detected and refused with a clear message rather than failing confusingly. The parser (src/mremoteng_importer.h/.cpp) is a pure function decoupled from any file/UI I/O, matching this session's established pattern of keeping business logic separately testable from the Qt Widgets shell that calls it (ProfilesWindow::importFromMRemoteNG() is the thin wrapper: QFileDialog, call the parser, write results via ProfileRepository, show a summary). 11 test cases against realistic sample XML. Hit a real moc gotcha along the way: a literal "//" inside a raw string literal (the xmlns URL) makes moc's lexer think a line comment started there, silently desyncing its parse so it never finds the QObject-derived test class at all (no error, just a missing vtable at link time). Fixed by moving the XML fixtures into a plain non-QObject header moc never scans, split across two adjacent literals as a second safeguard. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
51 lines
2.3 KiB
CMake
51 lines
2.3 KiB
CMake
add_executable(test_profile_repository
|
|
test_profile_repository.cpp
|
|
${CMAKE_SOURCE_DIR}/src/profile_repository.cpp
|
|
)
|
|
target_include_directories(test_profile_repository PRIVATE ${CMAKE_SOURCE_DIR}/src)
|
|
target_link_libraries(test_profile_repository PRIVATE Qt6::Core Qt6::Sql Qt6::Test)
|
|
add_test(NAME test_profile_repository COMMAND test_profile_repository)
|
|
|
|
add_executable(test_mremoteng_importer
|
|
test_mremoteng_importer.cpp
|
|
${CMAKE_SOURCE_DIR}/src/mremoteng_importer.cpp
|
|
)
|
|
target_include_directories(test_mremoteng_importer PRIVATE ${CMAKE_SOURCE_DIR}/src)
|
|
target_link_libraries(test_mremoteng_importer PRIVATE Qt6::Core Qt6::Test)
|
|
add_test(NAME test_mremoteng_importer COMMAND test_mremoteng_importer)
|
|
|
|
add_executable(test_ssh_session_backend
|
|
test_ssh_session_backend.cpp
|
|
${CMAKE_SOURCE_DIR}/src/ssh_session_backend.cpp
|
|
${CMAKE_SOURCE_DIR}/src/session_backend.h
|
|
)
|
|
target_include_directories(test_ssh_session_backend PRIVATE ${CMAKE_SOURCE_DIR}/src)
|
|
target_link_libraries(test_ssh_session_backend PRIVATE Qt6::Core Qt6::Gui Qt6::Test)
|
|
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()
|