Commit a731ca41 authored by Brad King's avatar Brad King

Teach Examples to use ExternalData

Teach vtk_add_test_cxx and vtk_test_cxx_executable to work in
Examples/*/Cxx directories when variable "vtk-example" is set and
"vtk-module" is not set.  Convert Examples/*/Cxx/CMakeLists.txt to use
these functions.  Populate Examples/*/Cxx/Baseline/ directories with
ExternalData content links for example baseline images.

Change-Id: Ic7d847a4561f5ed882b35e80c3ce98aa578ef7d3
parent d0550e61
......@@ -84,6 +84,16 @@ function(vtk_add_test_cxx)
set(_T -T ${VTK_TEST_OUTPUT_DIR})
endif()
if(vtk-module)
set(prefix ${vtk-module})
set(base_dir ${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline)
elseif(vtk-example)
set(prefix ${vtk-example})
set(base_dir ${CMAKE_CURRENT_SOURCE_DIR}/Baseline)
else()
message(FATAL_ERROR "Neither vtk-module nor vtk-example is set!")
endif()
foreach(name ${names})
set(_V "")
set(_E "")
......@@ -98,11 +108,11 @@ function(vtk_add_test_cxx)
endif()
endforeach()
if(data_dir AND NOT tmp_no_valid)
set(_V -V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/${name}.png,:}")
set(_V -V "DATA{${base_dir}/${name}.png,:}")
endif()
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-${name}
COMMAND ${vtk-module}CxxTests ${name} ${${name}_ARGS}
NAME ${prefix}Cxx-${name}
COMMAND ${prefix}CxxTests ${name} ${${name}_ARGS}
${_D} ${_T} ${_V} ${_E})
set_property(DIRECTORY APPEND PROPERTY VTK_TEST_CXX_SOURCES ${name}.cxx)
endforeach()
......@@ -125,7 +135,14 @@ macro(vtk_test_cxx_executable exe_name)
get_property(vtk_test_cxx_sources DIRECTORY PROPERTY VTK_TEST_CXX_SOURCES)
create_test_sourcelist(Tests ${exe_name}.cxx ${vtk_test_cxx_sources}
EXTRA_INCLUDE ${test_driver})
vtk_module_test_executable(${exe_name} ${Tests} ${test_extra})
if(vtk-module)
vtk_module_test_executable(${exe_name} ${Tests} ${test_extra})
elseif(vtk-example)
add_executable(${exe_name} ${Tests} ${test_extra})
target_link_libraries(${exe_name} ${VTK_LIBRARIES})
else()
message(FATAL_ERROR "Neither vtk-module nor vtk-example is set!")
endif()
endmacro()
# -----------------------------------------------------------------------------
......
......@@ -21,21 +21,16 @@ target_link_libraries(ParticleReader ${VTK_LIBRARIES})
if(vtkTestingRendering_SOURCE_DIR)
######## Regression Testing ########
SET(KIT IOExamples)
SET(MyTests TestDumpXMLFile.cxx TestParticleReader.cxx)
include(vtkTestingObjectFactory)
add_executable(${KIT}CxxTests ${KIT}CxxTests.cxx ${MyTests})
target_link_libraries(${KIT}CxxTests ${VTK_LIBRARIES})
set(vtk-example IOExamples)
if (VTK_DATA_ROOT)
add_test(NAME ${KIT}-ParticleReader COMMAND ${KIT}CxxTests
TestParticleReader
${VTK_DATA_ROOT}/Data/golf.csv
${VTK_TEST_OUTPUT_DIR}/TestParticleReader.vtp)
add_test(NAME ${KIT}-DumpXMLFile COMMAND ${KIT}CxxTests
TestDumpXMLFile
${VTK_DATA_ROOT}/Data/cow.vtp)
set(TestDumpXMLFile_ARGS ${VTK_DATA_ROOT}/Data/cow.vtp)
set(TestParticleReader_ARGS
${VTK_DATA_ROOT}/Data/golf.csv
${VTK_TEST_OUTPUT_DIR}/TestParticleReader.vtp)
vtk_add_test_cxx(NO_DATA NO_VALID NO_OUTPUT
TestParticleReader.cxx
TestDumpXMLFile.cxx
)
endif()
vtk_test_cxx_executable(${vtk-example}CxxTests RENDERING_FACTORY)
endif()
......@@ -22,15 +22,10 @@ target_link_libraries(ImageSlicing ${VTK_LIBRARIES})
if(vtkTestingRendering_SOURCE_DIR)
######## Regression Testing ########
set(KIT ImageProcessingExamples)
set(MyTests TestImageSlicing.cxx)
include(vtkTestingObjectFactory)
add_executable(${KIT}CxxTests ${KIT}CxxTests.cxx ${MyTests})
target_link_libraries(${KIT}CxxTests ${VTK_LIBRARIES})
if (VTK_DATA_ROOT)
add_test(NAME ${KIT}-ImageSlicing COMMAND ${KIT}CxxTests
TestImageSlicing ${VTK_DATA_ROOT}/Data/headsq/quarter)
endif()
set(vtk-example ImageProcessingExamples)
set(TestImageSlicing_ARGS ${VTK_DATA_ROOT}/Data/headsq/quarter)
vtk_add_test_cxx(
TestImageSlicing.cxx
)
vtk_test_cxx_executable(${vtk-example}CxxTests RENDERING_FACTORY)
endif()
......@@ -41,22 +41,16 @@ target_link_libraries(GenerateCubesFromLabels ${VTK_LIBRARIES})
if(vtkTestingRendering_SOURCE_DIR)
######## Regression Testing ########
set(KIT MedicalExamples)
set(MyTests TestMedical1.cxx TestMedical2.cxx TestMedical3.cxx TestMedical4.cxx)
include(vtkTestingObjectFactory)
add_executable(${KIT}CxxTests ${KIT}CxxTests.cxx ${MyTests})
target_link_libraries(${KIT}CxxTests ${VTK_LIBRARIES})
if (VTK_DATA_ROOT)
add_test(NAME ${KIT}-Medical1 COMMAND ${KIT}CxxTests
TestMedical1 ${VTK_DATA_ROOT}/Data/headsq/quarter)
add_test(NAME ${KIT}-Medical2 COMMAND ${KIT}CxxTests
TestMedical2 ${VTK_DATA_ROOT}/Data/headsq/quarter)
add_test(NAME ${KIT}-Medical3 COMMAND ${KIT}CxxTests
TestMedical3 ${VTK_DATA_ROOT}/Data/headsq/quarter)
add_test(NAME ${KIT}-Medical4 COMMAND ${KIT}CxxTests
TestMedical4 ${VTK_DATA_ROOT}/Data/headsq/quarter)
endif()
set(vtk-example MedicalExamples)
set(TestMedical1_ARGS ${VTK_DATA_ROOT}/Data/headsq/quarter)
set(TestMedical2_ARGS ${VTK_DATA_ROOT}/Data/headsq/quarter)
set(TestMedical3_ARGS ${VTK_DATA_ROOT}/Data/headsq/quarter)
set(TestMedical4_ARGS ${VTK_DATA_ROOT}/Data/headsq/quarter)
vtk_add_test_cxx(
TestMedical1.cxx
TestMedical2.cxx
TestMedical3.cxx
TestMedical4.cxx
)
vtk_test_cxx_executable(${vtk-example}CxxTests RENDERING_FACTORY)
endif()
......@@ -28,24 +28,22 @@ target_link_libraries(Delaunay3DAlpha ${VTK_LIBRARIES})
if(vtkTestingRendering_SOURCE_DIR)
######## Regression Testing ########
set(KIT ModellingExamples)
set(MyTests TestFinance.cxx TestDelaunay3D.cxx TestDelaunay3DAlpha.cxx)
include(vtkTestingObjectFactory)
add_executable(${KIT}CxxTests ${KIT}CxxTests.cxx ${MyTests})
target_link_LIBRARIES(${KIT}CxxTests ${VTK_LIBRARIES})
if (VTK_DATA_ROOT)
add_test(NAME ${KIT}-Finance COMMAND ${KIT}CxxTests
TestFinance ${VTK_DATA_ROOT}/Data/financial.txt)
add_test(NAME ${KIT}-Delaunay3D COMMAND ${KIT}CxxTests
TestDelaunay3D
${VTK_DATA_ROOT}/Data/cow.vtp
${VTK_TEST_OUTPUT_DIR}/Delaunay3D.vtu)
add_test(NAME ${KIT}-Delaunay3DAlpa COMMAND ${KIT}CxxTests
TestDelaunay3DAlpha
.5 ${VTK_DATA_ROOT}/Data/cow.vtp
${VTK_TEST_OUTPUT_DIR}/Delaunay3DAlpha.vtu)
endif()
set(vtk-example ModellingExamples)
set(TestFinance_ARGS ${VTK_DATA_ROOT}/Data/financial.txt)
set(TestDelaunay3D_ARGS
${VTK_DATA_ROOT}/Data/cow.vtp
${VTK_TEST_OUTPUT_DIR}/Delaunay3D.vtu
)
set(TestDelaunay3DAlpha_ARGS
.5 ${VTK_DATA_ROOT}/Data/cow.vtp
${VTK_TEST_OUTPUT_DIR}/Delaunay3DAlpha.vtu
)
vtk_add_test_cxx(
TestFinance.cxx
)
vtk_add_test_cxx(NO_DATA NO_VALID NO_OUTPUT
TestDelaunay3D.cxx
TestDelaunay3DAlpha.cxx
)
vtk_test_cxx_executable(${vtk-example}CxxTests RENDERING_FACTORY)
endif()
......@@ -26,29 +26,13 @@ target_link_libraries(BandedContours ${VTK_LIBRARIES})
if(vtkTestingRendering_SOURCE_DIR)
######## Regression Testing ########
set(KIT VisualizationAlgorithmsExamples)
set(MyTests
set(vtk-example VisualizationAlgorithmsExamples)
set(TestFilledContours_ARGS ${VTK_DATA_ROOT}/Data/filledContours.vtp 10)
set(TestBandedContours_ARGS ${VTK_DATA_ROOT}/Data/filledContours.vtp 10)
vtk_add_test_cxx(
TestTubesWithVaryingRadiusAndColors.cxx
TestFilledContours.cxx
TestBandedContours.cxx
TestTubesWithVaryingRadiusAndColors.cxx
)
include(vtkTestingObjectFactory)
add_executable(${KIT}CxxTests ${KIT}CxxTests.cxx ${MyTests})
target_link_libraries(${KIT}CxxTests ${VTK_LIBRARIES})
add_test(NAME ${KIT}-TubesWithVaryingRadiusAndColors
COMMAND ${KIT}CxxTests
TestTubesWithVaryingRadiusAndColors)
if (VTK_DATA_ROOT)
add_test(NAME ${KIT}-FilledContours
COMMAND ${KIT}CxxTests
TestFilledContours
${VTK_DATA_ROOT}/Data/filledContours.vtp 10)
add_test(NAME ${KIT}-BandedContours
COMMAND ${KIT}CxxTests
TestBandedContours
${VTK_DATA_ROOT}/Data/filledContours.vtp 10)
endif()
)
vtk_test_cxx_executable(${vtk-example}CxxTests RENDERING_FACTORY)
endif()
......@@ -28,15 +28,11 @@ target_link_libraries(BalloonWidget ${VTK_LIBRARIES})
if(vtkTestingRendering_SOURCE_DIR)
######## Regression Testing ########
set(KIT WidgetsExamples)
set(MyTests TestSlider.cxx TestSlider2D.cxx TestBalloonWidget.cxx)
include(vtkTestingObjectFactory)
add_executable(${KIT}CxxTests ${KIT}CxxTests.cxx ${MyTests})
target_link_libraries(${KIT}CxxTests ${VTK_LIBRARIES})
add_test(NAME ${KIT}-Slider COMMAND ${KIT}CxxTests TestSlider)
add_test(NAME ${KIT}-Slider2D COMMAND ${KIT}CxxTests TestSlider2D)
add_test(NAME ${KIT}-BalloonWidget COMMAND ${KIT}CxxTests TestBalloonWidget)
set(vtk-example WidgetsExamples)
vtk_add_test_cxx(
TestSlider.cxx
TestSlider2D.cxx
TestBalloonWidget.cxx
)
vtk_test_cxx_executable(${vtk-example}CxxTests RENDERING_FACTORY)
endif()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment