def validate_results(fname):
    from paraview import smtesting
    rv = CreateRenderView()
    rv.ViewSize = [400, 400]

    source = OpenDataFile(fname)
    display = Show()
    display.Representation = 'Slice'

    # get color transfer function/color map for 'scalars'
    scalarsLUT = GetColorTransferFunction('scalars')
    scalarsLUT.RGBPoints = [
        37.50877380371094, 0.231373, 0.298039, 0.752941, 105.91077423095703,
        0.865003, 0.865003, 0.865003, 174.31277465820312, 0.705882, 0.0156863,
        0.14902
    ]
    scalarsLUT.ScalarRangeInitialized = 1.0

    display.ColorArrayName = ['POINTS', 'scalars']
    display.LookupTable = scalarsLUT
    display.Diffuse = 0
    display.Specular = 0
    display.Ambient = 1

    Render()
    ResetCamera()
    smtesting.DoRegressionTesting(rv.SMProxy)
예제 #2
0
def runTest():
    options = servermanager.vtkRemotingCoreConfiguration.GetInstance()
    url = options.GetServerURL()
    smp.Connect(getHost(url), getPort(url))

    r = smp.CreateRenderView()
    r.RemoteRenderThreshold = 20
    s = smp.Sphere()
    s.PhiResolution = 80
    s.ThetaResolution = 80

    d = smp.Show()
    d.Representation = "Wireframe"
    smp.Render()
    r.RemoteRenderThreshold = 0
    smp.Render()
    s.PhiResolution = 8
    s.ThetaResolution = 8
    smp.Render()

    smtesting.ProcessCommandLineArguments()
    if not smtesting.DoRegressionTesting(r.SMProxy):
        raise smtesting.TestError ("Test failed!!!")
    print ("Test Passed")
예제 #3
0
if 'VEL' in fields:
    raise smtesting.TestError('VEL should not available.')

if 'ACCL' in fields:
    raise smtesting.TestError('ACCL should not available.')

reader.UpdatePipeline()

# Now test that the default animation is setup correctly for the data.
Show()

RenderView1 = Render()
RenderView1.CameraPosition = [0.21706008911132812, 55.74057374685633, -5.110947132110596]
RenderView1.CameraViewUp = [0.0, 0.0, 1.0]
RenderView1.CameraFocalPoint = [0.21706008911132812, 4.0, -5.110947132110596]
ResetCamera()

GetAnimationScene().GoToLast()
GetAnimationScene().Play()
GetAnimationScene().GoToFirst()
GetAnimationScene().GoToLast()
GetAnimationScene().GoToPrevious()
GetAnimationScene().GoToPrevious()
GetAnimationScene().GoToPrevious()
GetAnimationScene().GoToPrevious()
GetAnimationScene().GoToNext()

if not smtesting.DoRegressionTesting(GetActiveView().SMProxy):
  # This will lead to VTK object leaks.
  sys.exit(1)
예제 #4
0
from paraview.simple import *

from paraview import smtesting

smtesting.ProcessCommandLineArguments()

s = Sphere()
c = Cone(Resolution=10)
GroupDatasets(Input=[s, c])
GenerateIds()
r = Show()
r.ColorArrayName = None
SelectCells("Ids > 2")
RenderView1 = Render()

if not smtesting.DoRegressionTesting(RenderView1.SMProxy):
    # This will lead to VTK object leaks.
    import sys
    sys.exit(1)
예제 #5
0
sphere2 = None
sphere3 = None
pxm.UnRegisterProxies()
pxm.UnRegisterAllLinks()

# Load the saved state which also has the links.
smtesting.LoadServerManagerState(temp_state)
try:
    os.remove(saved_state)
except:
    pass
sphere1 = pxm.GetProxy("sources", "Sphere1")
sphere2 = pxm.GetProxy("sources", "Sphere2")
sphere3 = pxm.GetProxy("sources", "Sphere3")

# Do some changes.
sphere1.GetProperty("StartPhi").SetElement(0, 25)
sphere1.UpdateVTKObjects()

sphere3.GetProperty("EndTheta").SetElement(0, 100)
sphere3.GetProperty("ThetaResolution").SetElement(0, 10)
sphere3.GetProperty("PhiResolution").SetElement(0, 10)
sphere3.UpdateVTKObjects()

rmProxy = servermanager.GetRenderView()
rmProxy.StillRender()

if not smtesting.DoRegressionTesting():
    # This will lead to VTK object leaks.
    sys.exit(1)
                                   LabelFormat='%-#6.3g')

view.Representations.append(scalarbar)

# Update camera manipulator
manipulatorsProperty = view.GetProperty('Camera3DManipulators')
newList = []
for index in xrange(manipulatorsProperty.GetNumberOfProxies()):
    manipulator = servermanager._getPyProxy(
        manipulatorsProperty.GetProxy(index))
    if manipulator.ManipulatorName != 'Rotation':
        if manipulator.ManipulatorName == 'Pan2':
            manipulator.Shift = 0
        newList.append(manipulator)

manipulatorsProperty.RemoveAllProxies()
for manipulator in newList:
    manipulatorsProperty.AddProxy(manipulator.SMProxy)

view.CameraParallelProjection = 1
view.CameraParallelScale = 2000000
simple.Render()
scalarbar.Visibility = True
legend.Text = "123"
simple.Render()

if not smtesting.DoRegressionTesting(view.SMProxy):
    raise smtesting.TestError, 'Test failed.'

simple.Disconnect()
예제 #7
0
# destroy the scalar bar too
Delete(ren.Representations[0])

if len(ren.Representations) != 0:
    print("View should not have any representations at this point!")
    sys.exit(1)

# Confirm that the clip filter has been removed
if GetSources():
    print("All sources should have be removed.")
    sys.exit(1)

# change camera to confirm that trace restores it.
ren.CameraPosition = [-1, -1, -1]
Render()

# Compile the trace code and run it
code = compile(trace_string, "<string>", "exec")
exec(code)

# Confirm that the clip filter has been recreated
clip = [x for x in GetSources().values() if x.GetXMLLabel() == "Clip"]
if not clip:
    print("After replaying trace, could not find Clip filter.")
    sys.exit(1)

# Do a screenshot regression test
if not smtesting.DoRegressionTesting(ren.SMProxy):
    raise smtesting.TestError('Image comparison failed.')