]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Ability to switch test coverage test ON/OFF added (OFF by default)
authorSergey BELASH <belash.sergey@opencascade.com>
Thu, 17 Jul 2014 15:16:51 +0000 (19:16 +0400)
committerSergey BELASH <belash.sergey@opencascade.com>
Thu, 17 Jul 2014 15:16:51 +0000 (19:16 +0400)
CMakeLists.txt
eclipse.sh
src/ConstructionPlugin/CMakeLists.txt
src/ConstructionPlugin/Test/CMakeLists.txt
src/ModelAPI/CMakeLists.txt
src/ModelAPI/Test/CMakeLists.txt [new file with mode: 0644]
src/ModelAPI/Test/test_undo.py [new file with mode: 0644]

index 6cfd58728f49cf36fb252188f1613f58cb53ffe2..496b3f5f14400b263cf20ce3399ecff26e0b3652 100644 (file)
@@ -19,7 +19,7 @@ IF(UNIX)
     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
     
     #Supporting test coverage checks (gcov) in the DEBUG mode
-    IF(CMAKE_BUILD_TYPE MATCHES Debug)
+    IF(USE_TEST_COVERAGE)
       INCLUDE(CodeCoverage)
       MESSAGE(STATUS "Setting flags for gcov support the the gcc...")
       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
@@ -29,7 +29,7 @@ IF(UNIX)
       SETUP_TARGET_FOR_COVERAGE(test_coverage  # Name for custom target.
                                                ctest          # Name of the test driver executable that runs the tests.
                                                coverage)      # Name of output directory.
-    ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
+    ENDIF(USE_TEST_COVERAGE)
     
     #SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -E")
     MESSAGE(STATUS "gcc flags are: " ${CMAKE_CXX_FLAGS})
index 0dddf7dec27da0033b1bdac91dc7539df5bbdd9e..27f21f7db6d69767520f33267681e120a6061279 100755 (executable)
@@ -14,6 +14,7 @@ CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Debug"
 CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT=ON"
 CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=${ROOT_DIR}/install"
 CMAKE_ARGS="${CMAKE_ARGS} -DPYTHON_EXECUTABLE=${PYTHONHOME}/bin/python"
+CMAKE_ARGS="${CMAKE_ARGS} -DUSE_TEST_COVERAGE=OFF"
 CMAKE_ARGS="${CMAKE_ARGS} ${SRC_DIR}"
 
 cmake -G "Eclipse CDT4 - Unix Makefiles" ${CMAKE_ARGS}
index 13091e348d57ca84b967d877e92852d6755d574f..3b497009507c16737aed907cec250a21ff06c12c 100644 (file)
@@ -26,9 +26,8 @@ SET(XML_RESOURCES
   point_widget.xml
 )
 
-ADD_SUBDIRECTORY(Test)
-
 INSTALL(TARGETS ConstructionPlugin DESTINATION plugins)
 INSTALL(FILES ${XML_RESOURCES} DESTINATION plugins)
 
 ENABLE_TESTING()
+ADD_SUBDIRECTORY(Test)
index 36dd358f8d57f43fd3a070e5f7da67102d982671..2fbb8fca72991f6639182e8821f136ae87280e88 100644 (file)
@@ -1,5 +1,5 @@
 INCLUDE(Common)
 
 ENABLE_TESTING()
-ADD_TEST(ConstructionPluginTest 
+ADD_TEST(ModelAPITest 
          ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_point_name.py)
index a79ea6a88443b7d50f8ec5d0c9d5f2094a7cf231..883288049cd9b822c634b24ea0aa31e37c6606aa 100644 (file)
@@ -72,3 +72,6 @@ ENDIF(WIN32)
 INSTALL(TARGETS _ModelAPI DESTINATION swig)
 INSTALL(TARGETS ModelAPI DESTINATION bin)
 INSTALL(FILES ${SWIG_SCRIPTS} DESTINATION swig)
+
+ENABLE_TESTING()
+ADD_SUBDIRECTORY(Test)
diff --git a/src/ModelAPI/Test/CMakeLists.txt b/src/ModelAPI/Test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..bbab60e
--- /dev/null
@@ -0,0 +1,5 @@
+INCLUDE(Common)
+
+ENABLE_TESTING()
+ADD_TEST(ModelAPITest 
+         ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_undo.py)
diff --git a/src/ModelAPI/Test/test_undo.py b/src/ModelAPI/Test/test_undo.py
new file mode 100644 (file)
index 0000000..74a1315
--- /dev/null
@@ -0,0 +1,26 @@
+from ModelAPI import *\r
+plugin_manager = ModelAPI_PluginManager.get()\r
+doc = plugin_manager.rootDocument()\r
+assert(not doc.canUndo())\r
+assert(not doc.canRedo()) \r
+\r
+doc.startOperation()\r
+feature = doc.addFeature("Point")\r
+feature_name = feature.data().name()\r
+assert(feature_name == "Point_1")\r
+\r
+feature.execute()\r
+doc.finishOperation();\r
+assert(doc.size("Construction") == 1)\r
+assert(doc.canUndo())\r
+assert(not doc.canRedo()) \r
+\r
+doc.undo()\r
+assert(doc.size("Construction") == 0)\r
+assert(not doc.canUndo())\r
+assert(doc.canRedo())\r
+\r
+doc.redo()\r
+assert(doc.size("Construction") == 1)\r
+assert(doc.canUndo())\r
+assert(not doc.canRedo())\r