From ded5316f4a4d7098a07f397640020fe5cb6150ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Fri, 3 Feb 2012 11:54:49 +0000 Subject: [PATCH] Enabled new smoother test. refs #394 git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@13664 383ad7c9-94d9-4d36-a494-682f7c89f535 --- Plugin-Smoother/tests/CMakeLists.txt | 49 +++---------------- .../tests/smoother_c0_normal_10.ofs | 17 +++++++ .../tests/smoother_test_script.ofs | 11 ----- 3 files changed, 23 insertions(+), 54 deletions(-) create mode 100644 Plugin-Smoother/tests/smoother_c0_normal_10.ofs delete mode 100644 Plugin-Smoother/tests/smoother_test_script.ofs diff --git a/Plugin-Smoother/tests/CMakeLists.txt b/Plugin-Smoother/tests/CMakeLists.txt index ad739b7dc..e7a499823 100644 --- a/Plugin-Smoother/tests/CMakeLists.txt +++ b/Plugin-Smoother/tests/CMakeLists.txt @@ -2,57 +2,20 @@ # Include Testing package if(BUILD_TESTING) - # ======================================================================== - # Copy required files - # ======================================================================== - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/smoother_test_script.ofs - ${CMAKE_BINARY_DIR}/tests/Plugin-Smoother/smoother_test_script.ofs @ONLY ) - # ======================================================================== # ======================================================================== # Tests # ======================================================================== # ======================================================================== + include( ${CMAKE_SOURCE_DIR}/tests/testGenerators.cmake ) + # ======================================================================== - # Start OpenFlipper Headless in batch mode, to see if all plugins - # that pretend to be scriptable without ui are correct and the core - # can start # ======================================================================== - ADD_TEST(PLUGIN-SMOOTHER-NOGUI_Start_OpenFlipper_in_batch_mode ${OPENFLIPPER_EXECUTABLE} -b ) - - # Timeout after 60 seconds if we havean endless loop - # Should be run serial to avoid collisons with other instances - # Only one processor required - set_tests_properties ( - PLUGIN-SMOOTHER-NOGUI_Start_OpenFlipper_in_batch_mode PROPERTIES - TIMEOUT 60 - RUN_SERIAL TRUE - PROCESSORS 1 - ) - - set( test_cmd ${OPENFLIPPER_EXECUTABLE} ) - set( args "-c -b smoother_test_script.ofs" ) - add_test( PLUGIN-SMOOTHER-NOGUI_Cube_10_Iterations_tangential_C1 - ${CMAKE_COMMAND} - -D test_cmd=${test_cmd} - -D test_args:string=${args} - -D md5=23699491b2e4a2517d41ec91acca13db - -D output_test=${OPENFLIPPER_TEST_RESULTS}/smoother_test_result.obj - -P ${CMAKE_SOURCE_DIR}/tests/run_test_md5.cmake - ) - - # Timeout after 2 minutes if we have an endless loop - # Should be run serial to avoid collisons with other instances - # Only one processor required - set_tests_properties ( - PLUGIN-SMOOTHER-NOGUI_Cube_10_Iterations_tangential_C1 PROPERTIES - TIMEOUT 120 - RUN_SERIAL TRUE - PROCESSORS 1 - ) - - + # Tests + # ======================================================================== + # ======================================================================== + run_algorithm_test( "smoother_c0_normal_10.ofs" "cube_sharp.off" "result_cube_sharp_smooth_normal_c0_10.off" ) diff --git a/Plugin-Smoother/tests/smoother_c0_normal_10.ofs b/Plugin-Smoother/tests/smoother_c0_normal_10.ofs new file mode 100644 index 000000000..9aa7e5800 --- /dev/null +++ b/Plugin-Smoother/tests/smoother_c0_normal_10.ofs @@ -0,0 +1,17 @@ + + +var input = core.loadObject("@OPENFLIPPER_TEST_INPUT_FILE@"); +var reference = core.loadObject("@OPENFLIPPER_TEST_REFERENCE_FILE@"); + +smoother.smooth(input,10,"normal","C0"); + +meshcompare.compare(reference,input); + +printToFile("@OUTPUT_TEST_DATA_FILE@","TEST=@TESTNAME@"); +printToFile("@OUTPUT_TEST_DATA_FILE@","LOADEDFILE=@OPENFLIPPER_TEST_INPUT_FILE@"); +printToFile("@OUTPUT_TEST_DATA_FILE@","MAXIMALDISTANCE_DOUBLE=",meshcompare.lastMaximalDistance()); +printToFile("@OUTPUT_TEST_DATA_FILE@","MAXIMALNORMALDEVIATION_DOUBLE=",meshcompare.lastMaximalNormalDeviation()); +printToFile("@OUTPUT_TEST_DATA_FILE@","MAXIMALMEANCURVATUREDEVIATION_DOUBLE=",meshcompare.lastMaximalMeanCurvatureDeviation()); +printToFile("@OUTPUT_TEST_DATA_FILE@","MAXIMALGAUSSCURVATUREDEVIATION_DOUBLE=",meshcompare.lastMaximalGaussCurvatureDeviation()); + +core.exitApplication(); diff --git a/Plugin-Smoother/tests/smoother_test_script.ofs b/Plugin-Smoother/tests/smoother_test_script.ofs deleted file mode 100644 index 758aa7ed7..000000000 --- a/Plugin-Smoother/tests/smoother_test_script.ofs +++ /dev/null @@ -1,11 +0,0 @@ -var cube = fileobj.loadObject("@OPENFLIPPER_TEST_FILES@/cube1.obj"); - -print("Loaded file") -smoother.smooth(cube,10,"tangential","C1"); - -print("Smoothed") -fileobj.saveObject(cube,"@OPENFLIPPER_TEST_RESULTS@/smoother_test_result.obj"); - - -print("Written") -core.exitApplication(); -- GitLab