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

# --- SqlBrowser: data model + add-table model.
# --- The module is an executable, so the model sources are compiled directly
# --- into the test (same pattern as the LogView test in TetraIF/unit-test).
if (TARGET sqlbrowser)
  ADD_EXECUTABLE(sqlbrowser_unit_test
    sqlbrowser_unit_test.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/../DataModel.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/../AddModel.cpp)
  TARGET_LINK_LIBRARIES(sqlbrowser_unit_test
    Qt6::Core
    Qt6::Gui
    Qt6::Test
  )
  ADD_TEST(NAME sqlbrowser_unit_test COMMAND $<TARGET_FILE:sqlbrowser_unit_test>)
endif()
