]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
[PythonAPI] added tests in the standard way for Shaper
authorRenaud NEDELEC <renaud.nedelec@opencascade.com>
Wed, 14 Oct 2015 14:43:27 +0000 (16:43 +0200)
committerRenaud NEDELEC <renaud.nedelec@opencascade.com>
Wed, 14 Oct 2015 14:43:27 +0000 (16:43 +0200)
src/PythonAPI/CMakeLists.txt
src/PythonAPI/Test/CMakeLists.txt [new file with mode: 0644]
src/PythonAPI/Test/TestModeler.py [new file with mode: 0644]
src/PythonAPI/Test/TestSketcher.py [new file with mode: 0644]
src/PythonAPI/Test/test_sketcher.py [new file with mode: 0644]
src/PythonAPI/modeler/tests/CMakeLists.txt [deleted file]
src/PythonAPI/modeler/tests/modeler_test_case.py [deleted file]
src/PythonAPI/modeler/tests/test_sketcher.py [deleted file]
src/PythonAPI/unit_test_experiment/CMakeLists.txt [deleted file]
src/PythonAPI/unit_test_experiment/test.py [deleted file]

index c89a7986859a74850eae271b9d9adb61d49b8778..ac99093691274977159bc306e398b871d7bcd484 100644 (file)
@@ -4,3 +4,11 @@
 SET(CMAKE_AUTOMOC ON)
 
 INSTALL(DIRECTORY extension geom modeler DESTINATION pythonAPI)
+
+# --------- Unit tests -----------
+INCLUDE(UnitTest)
+
+ADD_UNIT_TESTS(
+  TestModeler.py
+  TestSketcher.py
+  ) 
diff --git a/src/PythonAPI/Test/CMakeLists.txt b/src/PythonAPI/Test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c42456c
--- /dev/null
@@ -0,0 +1,2 @@
+enable_testing()
+add_test(NAME "test_modeler" COMMAND "python" "modeler_test_case.py")
diff --git a/src/PythonAPI/Test/TestModeler.py b/src/PythonAPI/Test/TestModeler.py
new file mode 100644 (file)
index 0000000..347aa5a
--- /dev/null
@@ -0,0 +1,18 @@
+import unittest
+import modeler
+
+class ModelerTestCase(unittest.TestCase):
+    def setUp(self):
+        modeler.begin()
+        partset = modeler.moduleDocument()
+        self.part = modeler.addPart(partset).document()
+
+    def tearDown(self):
+        modeler.end()
+
+    def test_add_sketch(self):
+        plane = modeler.defaultPlane("XOY")
+        modeler.addSketch(self.part, plane)
+
+if __name__ == "__main__":
+    unittest.main()
diff --git a/src/PythonAPI/Test/TestSketcher.py b/src/PythonAPI/Test/TestSketcher.py
new file mode 100644 (file)
index 0000000..ece5331
--- /dev/null
@@ -0,0 +1,26 @@
+import unittest
+import modeler
+
+class SketcherTestCase(unittest.TestCase):
+    def setUp(self):
+        modeler.begin()
+        partset = modeler.moduleDocument()
+        part = modeler.addPart(partset).document()
+        plane = modeler.defaultPlane("XOY")
+        self.sketch = modeler.addSketch(part, plane)
+
+    def tearDown(self):
+        modeler.end()
+
+    def test_add_line(self):
+        print "add_line"
+        self.sketch.addLine(0, 0, 0, 1)
+    
+    def test_set_coincident(self):
+        print "set_coincident"
+        l1 = self.sketch.addLine(0, 0, 0, 1)
+        l2 = self.sketch.addLine(0, 1, 1, 1)
+        self.sketch.setCoincident(l1.endPointData(), l2.startPointData())
+
+if __name__ == "__main__":
+    unittest.main()
diff --git a/src/PythonAPI/Test/test_sketcher.py b/src/PythonAPI/Test/test_sketcher.py
new file mode 100644 (file)
index 0000000..b1f641b
--- /dev/null
@@ -0,0 +1,14 @@
+import unittest
+import modeler 
+
+class TestSketcher(unittest.TestCase):
+    def test_init_sketch(self):
+        modeler.begin()
+        partset = modeler.moduleDocument()
+        part = modeler.addPart(partset).document()
+        plane = modeler.defaultPlane("XOY")
+        modeler.addSketch(part, plane)
+        modeler.end()
+
+if __name__ == "__main__":
+    unittest.main()
diff --git a/src/PythonAPI/modeler/tests/CMakeLists.txt b/src/PythonAPI/modeler/tests/CMakeLists.txt
deleted file mode 100644 (file)
index c42456c..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-enable_testing()
-add_test(NAME "test_modeler" COMMAND "python" "modeler_test_case.py")
diff --git a/src/PythonAPI/modeler/tests/modeler_test_case.py b/src/PythonAPI/modeler/tests/modeler_test_case.py
deleted file mode 100644 (file)
index 347aa5a..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-import unittest
-import modeler
-
-class ModelerTestCase(unittest.TestCase):
-    def setUp(self):
-        modeler.begin()
-        partset = modeler.moduleDocument()
-        self.part = modeler.addPart(partset).document()
-
-    def tearDown(self):
-        modeler.end()
-
-    def test_add_sketch(self):
-        plane = modeler.defaultPlane("XOY")
-        modeler.addSketch(self.part, plane)
-
-if __name__ == "__main__":
-    unittest.main()
diff --git a/src/PythonAPI/modeler/tests/test_sketcher.py b/src/PythonAPI/modeler/tests/test_sketcher.py
deleted file mode 100644 (file)
index b1f641b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-import unittest
-import modeler 
-
-class TestSketcher(unittest.TestCase):
-    def test_init_sketch(self):
-        modeler.begin()
-        partset = modeler.moduleDocument()
-        part = modeler.addPart(partset).document()
-        plane = modeler.defaultPlane("XOY")
-        modeler.addSketch(part, plane)
-        modeler.end()
-
-if __name__ == "__main__":
-    unittest.main()
diff --git a/src/PythonAPI/unit_test_experiment/CMakeLists.txt b/src/PythonAPI/unit_test_experiment/CMakeLists.txt
deleted file mode 100644 (file)
index a90bdef..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-enable_testing()
-add_test(NAME "test" COMMAND "python" "test.py")
diff --git a/src/PythonAPI/unit_test_experiment/test.py b/src/PythonAPI/unit_test_experiment/test.py
deleted file mode 100644 (file)
index 9a5184a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-import unittest
-
-class Test(unittest.TestCase):
-    def test_assert_false(self):
-        self.assertFalse(False)
-
-if __name__ == "__main__":
-    unittest.main()