From db228e5caa8123d251e0c9df72c1ebc2e977d96a Mon Sep 17 00:00:00 2001 From: dbv Date: Wed, 7 Sep 2016 17:38:37 +0300 Subject: [PATCH] Test for rectangle feature --- src/PythonAddons/CMakeLists.txt | 6 ++++++ src/PythonAddons/Test/TestRectangle.py | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/PythonAddons/Test/TestRectangle.py diff --git a/src/PythonAddons/CMakeLists.txt b/src/PythonAddons/CMakeLists.txt index b6704ac65..a79a28cb5 100644 --- a/src/PythonAddons/CMakeLists.txt +++ b/src/PythonAddons/CMakeLists.txt @@ -26,3 +26,9 @@ INSTALL(FILES __init__.py DESTINATION ${SHAPER_INSTALL_ADDONS}) INSTALL(DIRECTORY macros DESTINATION ${SHAPER_INSTALL_ADDONS}) INSTALL(DIRECTORY macros/box/icons/ macros/rectangle/icons/ DESTINATION ${SHAPER_INSTALL_XML_RESOURCES}/icons/Addons) INSTALL(FILES ${TEXT_RESOURCES} DESTINATION ${SHAPER_INSTALL_XML_RESOURCES}) + +INCLUDE(UnitTest) + +ADD_UNIT_TESTS( + TestRectangle.py +) diff --git a/src/PythonAddons/Test/TestRectangle.py b/src/PythonAddons/Test/TestRectangle.py new file mode 100644 index 000000000..0efe470f6 --- /dev/null +++ b/src/PythonAddons/Test/TestRectangle.py @@ -0,0 +1,17 @@ +import model +import geom + +model.begin() +partSet = model.moduleDocument() +part = model.addPart(partSet).document() + +sketch = model.addSketch(part, model.defaultPlane("XOY")) +rectangle_1 = sketch.addRectangle(0, 0, 50, 50) + +startPoint = geom.Pnt2d(50, 50) +endPoint = geom.Pnt2d(100, 100) + +rectangle_2 = sketch.addRectangle(startPoint, endPoint) +model.end() + +assert(model.checkPythonDump()) -- 2.39.2