Salome HOME
Update ParaVis non-regression test base in the following ways:
[modules/paravis.git] / test / VisuPrs / united / B0.py
1 # Copyright (C) 2010-2015  CEA/DEN, EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 # This case corresponds to: /visu/united1/B0 case
21
22 from paravistest import datadir, compare_lists
23 from presentations import *
24 import pvsimple
25
26 error=0
27
28 # 1. Import MED file
29 file_path = datadir + "TimeStamps.med"
30 pvsimple.OpenDataFile(file_path)
31 med_reader = pvsimple.GetActiveSource()
32
33 if med_reader is None:
34     print "FAILED"
35 else:
36     print "OK"
37
38 # 2. Create scalar map on deformed shape
39 smondefshape = DeformedShapeAndScalarMapOnField(med_reader, EntityType.NODE, 'vitesse', 1)
40 if smondefshape is None:
41     print "FAILED"
42 else:
43     print "OK"
44
45 # 3. Make compare
46
47 # Offset
48 smondefshape.Position = [0, 0, 0]
49 error = error + compare_lists(smondefshape.Position, [0,0,0])
50
51 # Scalar mode
52 smondefshape.LookupTable.VectorMode = 'Magnitude'
53 if smondefshape.LookupTable.VectorMode != 'Magnitude':
54     print "ScalarMode is wrong..."
55     error=error+1
56
57 # Scalar bar Position
58 bar = get_bar()
59 bar.Position = [0.01, 0.01]
60 error = error + compare_lists(bar.Position, [0.01, 0.01])
61
62 # Scalar bar size
63 bar.Position2 = [0.05, 0.5]
64 error = error + compare_lists(bar.Position2, [0.05, 0.5])
65
66 # Number of colors and labels
67 smondefshape.LookupTable.NumberOfTableValues = 4
68 bar.NumberOfLabels = 5
69
70 nb_colors = smondefshape.LookupTable.NumberOfTableValues
71 nb_labels = bar.NumberOfLabels
72 error = error + compare_lists([nb_colors, nb_labels], [4, 5])
73
74 # Title
75 bar.Title = 'Pression, Pa'
76 bar.ComponentTitle = "Comp."
77
78 if bar.Title != 'Pression, Pa':
79     print "Title is wrong..."
80     error=error+1
81
82 if bar.ComponentTitle!= 'Comp.':
83     print "Component title is wrong..."
84     error=error+1
85
86 # Scaling
87 smondefshape.LookupTable.UseLogScale = 0
88 if smondefshape.LookupTable.UseLogScale != 0:
89     print "Error!!! Scaling is wrong"
90     error=error+1
91
92 # Bar orientation
93 bar.Orientation = 'Horizontal'
94 if bar.Orientation != 'Horizontal':
95     print "ERROR!!! Scalar Bar orientation is wrong..."
96     error=error+1
97
98 # Scale factor
99 smondefshape.Input.ScaleFactor = 0.15
100 error = error + compare_lists([smondefshape.Input.ScaleFactor], [0.15])
101
102
103 if error > 0:
104     raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."