]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Test for rectangle feature
authordbv <dbv@opencascade.com>
Wed, 7 Sep 2016 14:38:37 +0000 (17:38 +0300)
committerdbv <dbv@opencascade.com>
Wed, 7 Sep 2016 14:38:37 +0000 (17:38 +0300)
src/PythonAddons/CMakeLists.txt
src/PythonAddons/Test/TestRectangle.py [new file with mode: 0644]

index b6704ac65c1b75b253b762f8e92c9c532fe2ab71..a79a28cb51b0c77f30e1b74ebb0e4ae8d17fbf5b 100644 (file)
@@ -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 (file)
index 0000000..0efe470
--- /dev/null
@@ -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())