# add_qml_test macro
include(QmlTest)

add_subdirectory(Components)

set(qmltest_DEFAULT_IMPORT_PATHS
  ${CMAKE_BINARY_DIR}/plugins
  ${CMAKE_BINARY_DIR}/tests/utils/modules
  ${CMAKE_BINARY_DIR}/tests/mocks
)

set(qmltest_DEFAULT_TARGETS qmlunittests)
set(qmltest_DEFAULT_NO_ADD_TEST FALSE)
set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal")
add_qml_test(utils/Unity/Test UnityTest)
add_qml_test(Components PhysicalKeysMapper)

set(qmltest_DEFAULT_TARGETS qmluitests)
set(qmltest_DEFAULT_NO_ADD_TEST TRUE)
set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/liblightdm:${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")

add_qml_test(. Shell)
add_qml_test(. ShellWithPin)
add_qml_test(Components Background)
add_qml_test(Components Carousel)
add_qml_test(Components Dialogs)
add_qml_test(Components DraggingArea)
add_qml_test(Components LazyImage)
add_qml_test(Components Lockscreen)
add_qml_test(Components Rating)
add_qml_test(Components ResponsiveGridView)
add_qml_test(Components ResponsiveVerticalJournal IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins)
add_qml_test(Components Showable)
add_qml_test(Components ZoomableImage)
add_qml_test(Dash Dash)
add_qml_test(Dash DashContent)
add_qml_test(Dash Card)
add_qml_benchmark(Dash CardBenchmark 1000)
add_qml_test(Dash CardTool)
add_qml_test(Dash GenericScopeView)
add_qml_test(Dash PageHeader)
add_qml_test(Dash PreviewListView)
add_qml_test(Dash/Previews Preview)
add_qml_test(Dash/Previews PreviewActions)
add_qml_test(Dash/Previews PreviewAudioPlayback)
add_qml_test(Dash/Previews PreviewExpandable)
add_qml_test(Dash/Previews PreviewHeader)
add_qml_test(Dash/Previews PreviewImageGallery)
add_qml_test(Dash/Previews PreviewPayments)
add_qml_test(Dash/Previews PreviewProgress)
add_qml_test(Dash/Previews PreviewRatingDisplay)
add_qml_test(Dash/Previews PreviewRatingInput)
add_qml_test(Dash/Previews PreviewTable)
add_qml_test(Dash/Previews PreviewTextSummary)
add_qml_test(Dash/Previews PreviewVideoPlayback)
add_qml_test(Dash/Previews PreviewWidgetFactory)
add_qml_test(Dash/Previews PreviewZoomableImage)
add_qml_test(Dash/ScopeSettings ScopeSettingBoolean)
add_qml_test(Dash/ScopeSettings ScopeSettingList)
add_qml_test(Dash/ScopeSettings ScopeSettingNumber)
add_qml_test(Dash/ScopeSettings ScopeSettingString)
add_qml_test(Dash/ScopeSettings ScopeSettingsWidgetFactory)
add_qml_test(Greeter Clock)
add_qml_test(Greeter Greeter)
add_qml_test(Greeter Infographics)
add_qml_test(Greeter NarrowView)
add_qml_test(Greeter WideView)
add_qml_test(Launcher Launcher)
add_qml_test(Notifications Notifications)
add_qml_test(Notifications VisualSnapDecisionsQueue)
add_qml_test(Notifications OptionToggle)
add_qml_test(Notifications SwipeToAct)
add_qml_test(Panel ActiveCallHint)
add_qml_test(Panel IndicatorItem)
add_qml_test(Panel IndicatorItemRow)
add_qml_test(Panel IndicatorPage)
add_qml_test(Panel IndicatorsBar)
add_qml_test(Panel IndicatorsMenu)
add_qml_test(Panel MenuContent)
add_qml_test(Panel Panel)
add_qml_test(Panel/Indicators IndicatorsLight ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
# These MenuItemFactory tests need the test/mocks/ to come before plugins/
add_qml_test(Panel/Indicators MenuItemFactory IMPORT_PATHS ${CMAKE_BINARY_DIR}/tests/mocks ${qmltest_DEFAULT_IMPORT_PATHS})
add_qml_test(Panel/Indicators MessageMenuItemFactory IMPORT_PATHS ${CMAKE_BINARY_DIR}/tests/mocks ${qmltest_DEFAULT_IMPORT_PATHS})
add_qml_test(Stages ApplicationWindow)
add_qml_test(Stages DesktopStage)
add_qml_test(Stages PhoneStage ENVIRONMENT)
add_qml_test(Stages SpreadDelegate ENVIRONMENT)
add_qml_test(Stages SurfaceContainer ENVIRONMENT)
add_qml_test(Stages SessionContainer ENVIRONMENT)
add_qml_test(Stages TabletStage)
add_qml_test(Stages WindowMoveResizeArea)
add_qml_test(Stages Splash)
add_qml_test(Tutorial Tutorial)
add_qml_test(Wizard Wizard)
