Salome HOME
c7fa250be1be63fd4984aea0993046bc9f32fc5a
[modules/shaper.git] / src / ModelAPI / Test / TestResults.py
1 """
2       TestResults.py
3       Cover specific working with the data model results
4
5 """
6 #=========================================================================
7 # Initialization of the test
8 #=========================================================================
9 from ModelAPI import *
10
11 __updated__ = "2016-20-16"
12
13 aSession = ModelAPI_Session.get()
14
15 #=========================================================================
16 # Check getting the initial construction plane by name
17 #=========================================================================
18 aPartSet = aSession.moduleDocument()
19 aSession.startOperation()
20 aPlaneX = aPartSet.addFeature("Plane")
21 aPlaneX.string("creation_method").setValue("by_general_equation")
22 aPlaneX.real("A").setValue(1.)
23 aPlaneX.real("B").setValue(0.)
24 aPlaneX.real("C").setValue(0.)
25 aPlaneX.real("D").setValue(0.)
26 assert(aPlaneX)
27 aSession.finishOperation()
28
29 aSession.startOperation()
30 aColors = aPlaneX.lastResult().data().intArray("Color")
31 assert(aColors)
32 # default colors, not filled array
33 assert(aColors.size() == 0)
34 aColors.setSize(3)
35 aColors.setValue(0, 100)
36 aColors.setValue(1, 200)
37 aColors.setValue(2, 250)
38 assert(aColors.size() == 3)
39 assert(aColors.value(0) == 100)
40 assert(aColors.value(1) == 200)
41 assert(aColors.value(2) == 250)
42 aSession.finishOperation()
43
44 from salome.shaper import model
45 assert(model.checkPythonDump())