Salome HOME
[bos #16777] [CEA] generateVectors makes SALOME crash
[modules/paravis.git] / src / Plugins / MEDReader / Test / testMEDReader15.py
index 3902efdefbf627d4d83228cee1f7d5aa983947f2..8d6bdef2e602bc79279502c3ea98c3e67a170226 100644 (file)
@@ -1,5 +1,5 @@
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2017  CEA/DEN, EDF R&D
+# Copyright (C) 2007-2019  CEA/DEN, EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -19,6 +19,9 @@
 #
 # Author : Anthony Geay (EDF R&D)
 
+import os
+import sys
+
 from MEDLoader import *
 
 """ This test is a non regression test that checks the behaviour of MEDReader when a mesh has the same name than a field.
@@ -49,41 +52,41 @@ ExpectedEntries=['TS0/zeName/ComSup0/zeName@@][@@P1','TS0/zeName/ComSup0/MESH@ze
 assert(reader.GetProperty("FieldsTreeInfo")[::2]==ExpectedEntries)
 
 #
-glyph1=Glyph(Input=reader,GlyphType='Arrow',Scalars='FamilyIdNode',Vectors='zeName',GlyphMode='All Points',ScaleFactor=0.1,GlyphTransform='Transform2')
+glyph1=Glyph(Input=reader,GlyphType='Arrow',ScaleArray='FamilyIdNode',OrientationArray='zeName',GlyphMode='All Points',MaximumGlyphSize=0.1,GlyphTransform='Transform2')
 
-renderView1=GetActiveViewOrCreate('RenderView')
-renderView1.InteractionMode='3D'
-zeNameLUT = GetColorTransferFunction('zeName')
-zeNameLUT.RGBPoints = [1.0, 0.231373, 0.298039, 0.752941, 1.2071067811865475, 0.865003, 0.865003, 0.865003, 1.4142135623730951, 0.705882, 0.0156863, 0.14902]
-zeNameLUT.ScalarRangeInitialized = 1.
-zeNameLUT.VectorMode = 'Component'
+if '-D' not in sys.argv:
+  renderView1=GetActiveViewOrCreate('RenderView')
+  renderView1.InteractionMode='3D'
+  zeNameLUT = GetColorTransferFunction('zeName')
+  zeNameLUT.RGBPoints = [1.0, 0.231373, 0.298039, 0.752941, 1.2071067811865475, 0.865003, 0.865003, 0.865003, 1.4142135623730951, 0.705882, 0.0156863, 0.14902]
+  zeNameLUT.ScalarRangeInitialized = 1.
+  zeNameLUT.VectorMode = 'Component'
 
-glyph1Display=Show(glyph1,renderView1)
-glyph1Display.ColorArrayName = ['POINTS', 'FamilyIdNode']
-glyph1Display.LookupTable = zeNameLUT
-# set scalar coloring
-ColorBy(glyph1Display, ('POINTS', 'zeName'))
-# rescale color and/or opacity maps used to include current data range
-glyph1Display.RescaleTransferFunctionToDataRange(True)
-# do not show color bar/color legend
-glyph1Display.SetScalarBarVisibility(renderView1, False)
-#
-renderView1.ViewSize =[300,300]
-renderView1.GetRenderWindow().DoubleBufferOff()
-Render()
+  glyph1Display=Show(glyph1,renderView1)
+  glyph1Display.ColorArrayName = ['POINTS', 'FamilyIdNode']
+  glyph1Display.LookupTable = zeNameLUT
+  # set scalar coloring
+  ColorBy(glyph1Display, ('POINTS', 'zeName'))
+  # rescale color and/or opacity maps used to include current data range
+  glyph1Display.RescaleTransferFunctionToDataRange(True)
+  # do not show color bar/color legend
+  glyph1Display.SetScalarBarVisibility(renderView1, False)
+  #
+  renderView1.ViewSize =[300,300]
+  renderView1.GetRenderWindow().DoubleBufferOff()
+  Render()
 
-# compare with baseline image
-import os
-import sys
-try:
-  baselineIndex = sys.argv.index('-B')+1
-  baselinePath = sys.argv[baselineIndex]
-except:
-  print("Could not get baseline directory. Test failed.")
-  exit(1)
-baseline_file = os.path.join(baselinePath, "testMEDReader15.png")
-import vtk.test.Testing
-vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
-vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file,
-                                                            threshold=1)
-vtk.test.Testing.interact()
+  # compare with baseline image
+  try:
+    baselineIndex = sys.argv.index('-B')+1
+    baselinePath = sys.argv[baselineIndex]
+  except:
+    print("Could not get baseline directory. Test failed.")
+    exit(1)
+  baseline_file = os.path.join(baselinePath, "testMEDReader15.png")
+  import vtk.test.Testing
+  from vtk.util.misc import vtkGetTempDir
+  vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
+  vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file,
+                                                              threshold=1)
+  vtk.test.Testing.interact()