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")
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})
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}
point_widget.xml
)
-ADD_SUBDIRECTORY(Test)
-
INSTALL(TARGETS ConstructionPlugin DESTINATION plugins)
INSTALL(FILES ${XML_RESOURCES} DESTINATION plugins)
ENABLE_TESTING()
+ADD_SUBDIRECTORY(Test)
INCLUDE(Common)
ENABLE_TESTING()
-ADD_TEST(ConstructionPluginTest
+ADD_TEST(ModelAPITest
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_point_name.py)
INSTALL(TARGETS _ModelAPI DESTINATION swig)
INSTALL(TARGETS ModelAPI DESTINATION bin)
INSTALL(FILES ${SWIG_SCRIPTS} DESTINATION swig)
+
+ENABLE_TESTING()
+ADD_SUBDIRECTORY(Test)
--- /dev/null
+INCLUDE(Common)
+
+ENABLE_TESTING()
+ADD_TEST(ModelAPITest
+ ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_undo.py)
--- /dev/null
+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