Salome HOME
Update baselines for OpenGL2
[modules/paravis.git] / src / Plugins / MEDReader / Test / testMEDReader11.py
index a659175ae7d12d9bbf0b14e0509efb9ccc7051be..29fb4f134f6dac254fe5a45c73d3327148485cca 100644 (file)
@@ -1,10 +1,10 @@
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014  CEA/DEN, EDF R&D
+# Copyright (C) 2007-2017  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
 # License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -85,7 +85,7 @@ for name,arrs in [("ENERGIE RECUE",(nrj_0_1,nrj_0_1)),("ENTHALPIE",(h_0,h_1)),("
         f1ts0=MEDFileField1TS()
         f=MEDCouplingFieldDouble(ON_CELLS) ; f.setName(name) ; f.setTime(ft,dt,it) ; f.setMesh(sup)
         f.setArray(arrs[its])
-        f.checkCoherency()
+        f.checkConsistencyLight()
         f1ts0.setFieldProfile(f,mm,0,pfl0)
         fmts0.pushBackTimeStep(f1ts0)
         pass
@@ -135,9 +135,6 @@ fs.pushField(fmts0)
 fs.write(fname,0)
 ################### MED write is done -> Go to MEDReader
 from paraview.simple import *
-try: paraview.simple
-except: from paraview.simple import *
-paraview.simple._DisableFirstRenderCameraReset()
 
 testMEDReader11_med = MEDReader( FileName=fname )
 
@@ -158,9 +155,8 @@ a1_ENTHALPIE_PiecewiseFunction = CreatePiecewiseFunction( Points=[1278022.919558
 
 DataRepresentation1.Representation = 'Wireframe'
 DataRepresentation1.ScalarOpacityFunction = a1_ENTHALPIE_PiecewiseFunction
-DataRepresentation1.ColorArrayName = ('CELL_DATA', 'ENTHALPIE')
+DataRepresentation1.ColorArrayName = ('CELLS', 'ENTHALPIE')
 DataRepresentation1.LookupTable = a1_ENTHALPIE_PVLookupTable
-DataRepresentation1.ColorAttributeType = 'CELL_DATA'
 
 testMEDReader11_med = MEDReader( FileName=fname )
 
@@ -181,9 +177,8 @@ a1_VITESSEX_PVLookupTable = GetLookupTableForArray( "VITESSE X", 1, RGBPoints=[0
 a1_VITESSEX_PiecewiseFunction = CreatePiecewiseFunction( Points=[0.0, 0.0, 0.5, 0.0, 1e-16, 1.0, 0.5, 0.0] )
 
 DataRepresentation2.ScalarOpacityFunction = a1_VITESSEX_PiecewiseFunction
-DataRepresentation2.ColorArrayName = ('CELL_DATA', 'VITESSE X')
+DataRepresentation2.ColorArrayName = ('CELLS', 'VITESSE X')
 DataRepresentation2.LookupTable = a1_VITESSEX_PVLookupTable
-DataRepresentation2.ColorAttributeType = 'CELL_DATA'
 
 a1_VITESSEX_PVLookupTable.RGBPoints = [-0.04176214531137861, 0.23, 0.299, 0.754, 0.35689831830849095, 0.865, 0.865, 0.865, 0.7555587819283606, 0.706, 0.016, 0.15]
 a1_VITESSEX_PVLookupTable.ScalarOpacityFunction = a1_VITESSEX_PiecewiseFunction
@@ -193,10 +188,24 @@ a1_VITESSEX_PiecewiseFunction.Points = [-0.04176214531137861, 0.0, 0.5, 0.0, 0.7
 RenderView1.CenterOfRotation = [2.4192, 2.4192, 4.32745]
 RenderView1.CameraViewUp = [-0.09460871052363676, 0.6302516648802655, 0.7706049771502312]
 RenderView1.CameraPosition = [4.325977740713708, -0.6239049541402536, 7.050401199739401]
-RenderView1.CameraClippingRange = [2.404636927989219, 7.163736971217594]
 RenderView1.CameraFocalPoint = [2.4191999999999996, 2.4191999999999996, 4.32745]
 RenderView1.ViewTime = 2.0
 
-Render()
 RenderView1.ViewSize =[300,300]
-WriteImage(outImgName)
+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, "testMEDReader11.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()