#
# Unit tests for the nglsettings module.
# One test executable per module, each registered with ctest.
#
if (NOT BUILD_TESTING)
  return()
endif()

# --- nglsettings: QSettings-backed settings + connection-name mapping.
# --- setPortOffset/setServerHostname have no export macro and the tree builds
# --- with hidden visibility, so those symbols are not exported from
# --- libnglsettings - the module source is compiled directly into the test
# --- (same pattern as the LogView test in TetraIF/unit-test).
if (TARGET nglsettings)
  ADD_EXECUTABLE(nglsettings_unit_test
    nglsettings_unit_test.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/../nglsettings_connections.cpp)
  TARGET_LINK_LIBRARIES(nglsettings_unit_test
    nglsettings
    Qt6::Core
    Qt6::Network
    Qt6::Test
  )
  ADD_TEST(NAME nglsettings_unit_test COMMAND $<TARGET_FILE:nglsettings_unit_test>)
endif()
