# This is a list of test XML files.
# When you add an entry **be sure to describe the actions a user
# must perform to reproduce the test** as it can be painful to
# read the XML when a test needs to be re-recorded.
# **It is also useful to tersely describe what functionality is
# being tested if not clear from the procedural description and
# test name.**
set(xml_tests_with_baselines
  # Just open an SMTK file and ensure it renders properly.
  # Also tests default color-by mode in theory.
  OpenModelFile
  # Open 2 model files; set 1 to color-by-entity, 1 to color-by-volume.
  # Zoom to second model so colors can be discerned.
  PerResourceColorByMode
  # Open an SMTK model, block select some entities, then change the selection filters
  # so only the edges remain selected.
  SelectionFilterJustEdges
  # Open an SMTK model then select 1 model face in the tree view.
  SelectModelEntityInTree
  # Open an SMTK model then select 1 model face in the rendered view via block-selection.
  SelectModelEntityInRendering
  # Open an SMTK model. Then change the filename and ensure the newly-
  # specified model is loaded. Select a face in the tree view to ensure
  # that both the render and tree views are updated.
  SwitchModelFiles
)

set(test_images ${cmb_SOURCE_DIR}/data/baselines/modelbuilder)
if (cmb_data_dir)
  foreach(test ${xml_tests_with_baselines})
    #get_image_threshold_arg(THRESHOLD_CMD ${test})
    set(tname "${test}")
    add_test(
      NAME ${tname}
      COMMAND modelbuilder
        -dr
        --test-script=${CMAKE_CURRENT_SOURCE_DIR}/${test}.xml
        --test-directory=${cmb_test_dir}
        --test-baseline=${test_images}/${test}.png
        --test-plugin-path=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
        --exit
    )
    set(tlabels cmb modelbuilder ${${test}-labels})
    set_tests_properties(${tname}
      PROPERTIES LABELS "${tlabels}"
    )
  endforeach()
endif()
