Salome HOME
Added python dump checking for every unit test where it is useful.
[modules/shaper.git] / src / ConstructionPlugin / Test / TestPoint.py
1 """
2 Test case for Construction Point feature. Written on High API.
3 """
4 from ModelAPI import *
5 from GeomAPI import *
6
7 import model
8
9 # Get session
10 aSession = ModelAPI_Session.get()
11
12 # Create a part
13 aDocument = aSession.activeDocument()
14 aSession.startOperation()
15 model.addPart(aDocument)
16 aDocument = aSession.activeDocument()
17 aSession.finishOperation()
18
19 # Create a point by coordinates
20 aSession.startOperation()
21 aPoint = model.addPoint(aDocument, 50, 50, 50)
22 aSession.finishOperation()
23 assert (len(aPoint.result()) > 0)
24
25 # # Create a sketch with lines
26 # aSession.startOperation()
27 # anOrigin = GeomAPI_Pnt(0, 0, 0)
28 # aDirX = GeomAPI_Dir(1, 0, 0)
29 # aNorm = GeomAPI_Dir(0, 0, 1)
30 # aSketch = model.addSketch(aDocument, GeomAPI_Ax3(anOrigin, aDirX, aNorm))
31 # aSketchLine1 = aSketch.addLine(0, 0, 100, 100)
32 # aSketchLine2 = aSketch.addLine(0, 100, 100, 0)
33 # aSession.finishOperation()
34 #
35 # # Create a point on line
36 # aSession.startOperation()
37 # aPoint = model.addPoint(aDocument, aSketchLine1.result()[0], 25, True, False)
38 # aSession.finishOperation()
39 # assert (len(aPoint.result()) > 0)
40 #
41 # # Create plane
42 # aSession.startOperation()
43 # aPlane = model.addPlane(aDocument, 1, 1, 1, 1)
44 # aSession.finishOperation()
45 #
46 # # Create a point by projection
47 # aSession.startOperation()
48 # aPoint = model.addPoint(aDocument, aPoint.result()[0], aPlane.result()[0])
49 # aSession.finishOperation()
50 # assert (len(aPoint.result()) > 0)
51 #
52 # # Create a point by lines intersection
53 # aSession.startOperation()
54 # aPoint = model.addPoint(aDocument, aSketchLine1.result()[0], aSketchLine2.result()[0])
55 # aSession.finishOperation()
56 # assert (len(aPoint.result()) > 0)
57 #
58 # # Create a point by line and plane intersection
59 # aSession.startOperation()
60 # aPoint = model.addPoint(aDocument, aSketchLine1.result()[0], aPlane.result()[0])
61 # aSession.finishOperation()
62 # assert (len(aPoint.result()) > 0)
63
64 assert(model.checkPythonDump())