mirror of
https://github.com/OpenFOAM/ThirdParty-6.git
synced 2025-12-08 06:57:43 +00:00
ParaView-5.0.1: Added the source-tree to ThirdParty-dev and patched as described in the README file
Resolves bug-report http://bugs.openfoam.org/view.php?id=2098
This commit is contained in:
@ -0,0 +1,121 @@
|
||||
include(ParaViewTestingMacros)
|
||||
|
||||
# Check that matplotlib is available
|
||||
include(FindPythonModules)
|
||||
find_python_module(matplotlib matplotlib_found)
|
||||
|
||||
# Set variables to make the testing functions.
|
||||
set(vtk-module pvpython)
|
||||
set(${vtk-module}_TEST_LABELS PARAVIEW)
|
||||
|
||||
paraview_test_load_data(""
|
||||
can.ex2
|
||||
multicomb_0.vts
|
||||
)
|
||||
|
||||
# only enable TestPythonAnnotationFilter test if numpy is available
|
||||
find_python_module(numpy numpy_found)
|
||||
if (numpy_found)
|
||||
set(PARAVIEW_PYTHON_ARGS
|
||||
--data=${PARAVIEW_TEST_OUTPUT_DATA_DIR}/can.ex2)
|
||||
# Add pvpython tests
|
||||
paraview_add_test_python(
|
||||
NO_DATA NO_VALID NO_OUTPUT NO_RT
|
||||
TestPythonAnnotationFilter.py
|
||||
TestPythonAnnotationFilterNoMerge.py
|
||||
TestAnnotateAttributeData.py
|
||||
)
|
||||
set(PARAVIEW_PYTHON_ARGS)
|
||||
|
||||
if (PARAVIEW_ENABLE_MATPLOTLIB AND matplotlib_found)
|
||||
# add Matplotlib tests only if matplotlib was found at configure time.
|
||||
paraview_add_test_python(
|
||||
NO_DATA NO_RT
|
||||
TestPythonViewMatplotlibScript.py
|
||||
)
|
||||
endif()
|
||||
|
||||
paraview_add_test_python(
|
||||
NO_DATA NO_RT
|
||||
TestPythonViewNumpyScript.py
|
||||
)
|
||||
endif()
|
||||
|
||||
paraview_add_test_python(
|
||||
NO_DATA NO_RT
|
||||
TestPythonViewScript.py
|
||||
TestColorHistogram.py
|
||||
TestClipCylinder.py
|
||||
)
|
||||
|
||||
paraview_add_test_pvbatch(
|
||||
NO_DATA NO_RT
|
||||
CinemaTest.py
|
||||
)
|
||||
|
||||
# these tests could run safely in serial and
|
||||
# in parallel.
|
||||
set(PVBATCH_TESTS
|
||||
StructuredGridVolumeRendering.py
|
||||
)
|
||||
foreach (tfile IN LISTS PVBATCH_TESTS)
|
||||
get_filename_component(test ${tfile} NAME_WE)
|
||||
set(${test}_ARGS
|
||||
--state ${CMAKE_CURRENT_SOURCE_DIR}/${test}.pvsm)
|
||||
endforeach ()
|
||||
if (PARAVIEW_USE_MPI AND VTK_MPIRUN_EXE)
|
||||
# run the tests in parallel
|
||||
set(${vtk-module}_NUMPROCS 3)
|
||||
paraview_add_test_pvbatch_mpi(
|
||||
JUST_VALID
|
||||
${PVBATCH_TESTS}
|
||||
)
|
||||
|
||||
if (numpy_found)
|
||||
paraview_add_test_pvbatch_mpi(
|
||||
NO_DATA NO_VALID NO_OUTPUT NO_RT
|
||||
TestAnnotateAttributeData.py
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
# run the test serially
|
||||
paraview_add_test_pvbatch(
|
||||
JUST_VALID
|
||||
${PVBATCH_TESTS}
|
||||
)
|
||||
if (numpy_found)
|
||||
paraview_add_test_pvbatch(
|
||||
NO_DATA NO_VALID NO_OUTPUT NO_RT
|
||||
TestAnnotateAttributeData.py
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
paraview_add_test_driven(
|
||||
JUST_VALID
|
||||
TestCompositedGeometryCulling.py
|
||||
)
|
||||
|
||||
# Python Multi-servers test
|
||||
# => Only for shared build as we dynamically load plugins
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(vtk-module multi-servers)
|
||||
set(TestMultiServersConfig_ARGS
|
||||
--test-multi-servers 2
|
||||
)
|
||||
set(TestMultiServersRemoteProxy_ARGS
|
||||
--test-multi-servers 3
|
||||
)
|
||||
set(${vtk-module}_TEST_LABELS PARAVIEW)
|
||||
|
||||
paraview_add_test_driven(
|
||||
NO_DATA NO_VALID NO_OUTPUT NO_RT
|
||||
TestMultiServersConfig.py
|
||||
TestMultiServersRemoteProxy.py
|
||||
TestRemoteProgrammableFilter.py
|
||||
)
|
||||
endif()
|
||||
|
||||
# Extend timeout for CinemaTest
|
||||
set_tests_properties(pvpythonPython-Batch-CinemaTest PROPERTIES TIMEOUT 500)
|
||||
@ -0,0 +1,25 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
import QtTesting
|
||||
import QtTestingImage
|
||||
|
||||
object1 = 'pqClientMainWindow/MainControlsToolbar/actionOpenData'
|
||||
QtTesting.playCommand(object1, 'activate', '')
|
||||
object2 = 'pqClientMainWindow/FileOpenDialog'
|
||||
QtTesting.playCommand(object2, 'filesSelected', '$PARAVIEW_DATA_ROOT/SPCTH/Dave_Karelitz_Small/spcth_a')
|
||||
object3 = 'pqClientMainWindow/proxyTabDock/proxyTabWidget/qt_tabwidget_stackedwidget/objectInspector/ScrollArea/qt_scrollarea_viewport/PanelArea/Editor/CellArrayStatus/1QHeaderView0'
|
||||
QtTesting.playCommand(object3, 'mousePress', '1,1,0,0,0,0')
|
||||
QtTesting.playCommand(object3, 'mouseRelease', '1,0,0,0,0,0')
|
||||
object4 = 'pqClientMainWindow/proxyTabDock/proxyTabWidget/qt_tabwidget_stackedwidget/objectInspector/Accept'
|
||||
QtTesting.playCommand(object4, 'activate', '')
|
||||
object5 = 'pqClientMainWindow/representationToolbar/displayRepresentation/comboBox'
|
||||
QtTesting.playCommand(object5, 'set_string', 'Surface')
|
||||
object6 = 'pqClientMainWindow/cameraToolbar/actionNegativeY'
|
||||
QtTesting.playCommand(object6, 'activate', '')
|
||||
object7 = 'pqClientMainWindow/variableToolbar/displayColor/Variables'
|
||||
QtTesting.playCommand(object7, 'set_string', 'Pressure (dynes/cm^2^)')
|
||||
# DO_IMAGE_COMPARE
|
||||
snapshotWidget = 'pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport'
|
||||
QtTestingImage.compareImage(snapshotWidget, 'CTHAMRBaseline.png', 300, 300)
|
||||
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
import QtTesting
|
||||
import QtTestingImage
|
||||
|
||||
object1 = 'pqClientMainWindow/MainControlsToolbar/actionOpenData'
|
||||
QtTesting.playCommand(object1, 'activate', '')
|
||||
object2 = 'pqClientMainWindow/FileOpenDialog'
|
||||
QtTesting.playCommand(object2, 'filesSelected', '$PARAVIEW_DATA_ROOT/SPCTH/Dave_Karelitz_Small/spcth_a')
|
||||
object3 = 'pqClientMainWindow/proxyTabDock/proxyTabWidget/qt_tabwidget_stackedwidget/objectInspector/ScrollArea/qt_scrollarea_viewport/PanelArea/Editor/CellArrayStatus/1QHeaderView0'
|
||||
QtTesting.playCommand(object3, 'mousePress', '1,1,0,0,0,0')
|
||||
QtTesting.playCommand(object3, 'mouseRelease', '1,0,0,0,0,0')
|
||||
object4 = 'pqClientMainWindow/proxyTabDock/proxyTabWidget/qt_tabwidget_stackedwidget/objectInspector/Accept'
|
||||
QtTesting.playCommand(object4, 'activate', '')
|
||||
object5 = 'pqClientMainWindow/representationToolbar/displayRepresentation/comboBox'
|
||||
QtTesting.playCommand(object5, 'set_string', 'Surface')
|
||||
object6 = 'pqClientMainWindow/variableToolbar/displayColor/Variables'
|
||||
QtTesting.playCommand(object6, 'set_string', 'Pressure (dynes/cm^2^)')
|
||||
object7 = 'pqClientMainWindow/cameraToolbar/actionPositiveX'
|
||||
QtTesting.playCommand(object7, 'activate', '')
|
||||
object8 = 'pqClientMainWindow/menubar/menuFilters/pqProxyGroupMenuManager0/Cut'
|
||||
QtTesting.playCommand(object8, 'activate', '')
|
||||
QtTesting.playCommand(object4, 'activate', '')
|
||||
object9 = 'pqClientMainWindow/proxyTabDock/proxyTabWidget/qt_tabwidget_stackedwidget/objectInspector/ScrollArea/qt_scrollarea_viewport/PanelArea/Editor/CutFunction/pqImplicitPlaneWidget/show3DWidget'
|
||||
QtTesting.playCommand(object9, 'set_boolean', 'false')
|
||||
# DO_IMAGE_COMPARE
|
||||
snapshotWidget = 'pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport'
|
||||
QtTestingImage.compareImage(snapshotWidget, 'CTHAMRClip.png', 300, 300)
|
||||
@ -0,0 +1,33 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
import QtTesting
|
||||
import QtTestingImage
|
||||
|
||||
object1 = 'pqClientMainWindow/MainControlsToolbar/actionOpenData'
|
||||
QtTesting.playCommand(object1, 'activate', '')
|
||||
object2 = 'pqClientMainWindow/FileOpenDialog'
|
||||
QtTesting.playCommand(object2, 'filesSelected', '$PARAVIEW_DATA_ROOT/SPCTH/Dave_Karelitz_Small/spcth_a')
|
||||
object3 = 'pqClientMainWindow/proxyTabDock/proxyTabWidget/qt_tabwidget_stackedwidget/objectInspector/ScrollArea/qt_scrollarea_viewport/PanelArea/Editor/CellArrayStatus/1QHeaderView0'
|
||||
QtTesting.playCommand(object3, 'mousePress', '1,1,0,0,0,0')
|
||||
QtTesting.playCommand(object3, 'mouseRelease', '1,0,0,0,0,0')
|
||||
object4 = 'pqClientMainWindow/proxyTabDock/proxyTabWidget/qt_tabwidget_stackedwidget/objectInspector/Accept'
|
||||
QtTesting.playCommand(object4, 'activate', '')
|
||||
object5 = 'pqClientMainWindow/representationToolbar/displayRepresentation/comboBox'
|
||||
QtTesting.playCommand(object5, 'set_string', 'Surface')
|
||||
object6 = 'pqClientMainWindow/cameraToolbar/actionNegativeY'
|
||||
QtTesting.playCommand(object6, 'activate', '')
|
||||
object7 = 'pqClientMainWindow/variableToolbar/displayColor/Variables'
|
||||
QtTesting.playCommand(object7, 'set_string', 'Pressure (dynes/cm^2^)')
|
||||
object8 = 'pqClientMainWindow/menubar'
|
||||
QtTesting.playCommand(object8, 'activate', 'menuFilters')
|
||||
object9 = 'pqClientMainWindow/menubar/menuFilters/Alphabetical'
|
||||
QtTesting.playCommand(object9, 'activate', 'AMRDualContour')
|
||||
object10 = 'pqClientMainWindow/proxyTabDock/proxyTabWidget/qt_tabwidget_stackedwidget/objectInspector/ScrollArea/qt_scrollarea_viewport/PanelArea/Editor/SelectMaterialArrays/1QHeaderView0'
|
||||
QtTesting.playCommand(object10, 'mousePress', '1,1,0,0,0,0')
|
||||
QtTesting.playCommand(object10, 'mouseRelease', '1,0,0,0,0,0')
|
||||
QtTesting.playCommand(object4, 'activate', '')
|
||||
QtTesting.playCommand(object7, 'set_string', 'Pressure (dynes/cm^2^) (partial)')
|
||||
# DO_IMAGE_COMPARE
|
||||
snapshotWidget = 'pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport'
|
||||
QtTestingImage.compareImage(snapshotWidget, 'CTHAMRContour.png', 300, 300)
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
import QtTesting
|
||||
import QtTestingImage
|
||||
|
||||
QtTesting.playCommand(object1, 'activate', '')
|
||||
QtTesting.playCommand(object2, 'filesSelected', '$PARAVIEW_DATA_ROOT/SPCTH/Dave_Karelitz_Small/spcth_a')
|
||||
QtTesting.playCommand(object3, 'mousePress', '1,1,0,0,0,0')
|
||||
QtTesting.playCommand(object3, 'mouseRelease', '1,0,0,0,0,0')
|
||||
QtTesting.playCommand(object4, 'activate', '')
|
||||
QtTesting.playCommand(object5, 'set_string', 'Surface')
|
||||
QtTesting.playCommand(object6, 'activate', '')
|
||||
QtTesting.playCommand(object7, 'set_string', 'Pressure (dynes/cm^2^)')
|
||||
QtTesting.playCommand(object8, 'activate', 'menuFilters')
|
||||
QtTesting.playCommand(object9, 'activate', 'AMRDualClip')
|
||||
QtTesting.playCommand(object10, 'mousePress', '1,1,0,0,0,0')
|
||||
QtTesting.playCommand(object10, 'mouseRelease', '1,0,0,0,0,0')
|
||||
QtTesting.playCommand(object4, 'activate', '')
|
||||
QtTesting.playCommand(object7, 'set_string', 'Pressure (dynes/cm^2^) (partial)')
|
||||
# DO_IMAGE_COMPARE
|
||||
snapshotWidget = 'pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport'
|
||||
QtTestingImage.compareImage(snapshotWidget, 'CTHAMRDualClip.png', 300, 300)
|
||||
@ -0,0 +1,20 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
import QtTesting
|
||||
import QtTestingImage
|
||||
|
||||
QtTesting.playCommand(object1, 'activate', '')
|
||||
QtTesting.playCommand(object2, 'filesSelected', '$PARAVIEW_DATA_ROOT/SPCTH/Dave_Karelitz_Small/spcth_a')
|
||||
QtTesting.playCommand(object3, 'mousePress', '1,1,0,0,0,0')
|
||||
QtTesting.playCommand(object3, 'mouseMove', '1,0,0,0,0,0')
|
||||
QtTesting.playCommand(object3, 'mouseRelease', '1,0,0,0,0,0')
|
||||
QtTesting.playCommand(object4, 'activate', '')
|
||||
QtTesting.playCommand(object10, 'activate', 'menuFilters')
|
||||
QtTesting.playCommand(object11, 'activate', 'MaterialInterfaceFilter')
|
||||
object23 = 'pqClientMainWindow/proxyTabDock/proxyTabWidget/qt_tabwidget_stackedwidget/objectInspector/ScrollArea/qt_scrollarea_viewport/PanelArea/Editor/SelectMassArray/1QHeaderView0'
|
||||
QtTesting.playCommand(object23, 'mousePress', '1,1,0,0,0,0')
|
||||
QtTesting.playCommand(object23, 'mouseRelease', '1,0,0,0,0,0')
|
||||
QtTesting.playCommand(object4, 'activate', '')
|
||||
# DO_IMAGE_COMPARE
|
||||
snapshotWidget = 'pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport'
|
||||
QtTestingImage.compareImage(snapshotWidget, 'CTHAMRMaterialInterfaceFilter.png', 300, 300)
|
||||
@ -0,0 +1,144 @@
|
||||
import os, json
|
||||
|
||||
from paraview import simple
|
||||
from paraview import smtesting
|
||||
from paraview import data_exploration as cinema
|
||||
|
||||
smtesting.ProcessCommandLineArguments()
|
||||
work_directory = os.path.join(smtesting.TempDir, 'cinema')
|
||||
has_rgbz_view = True
|
||||
|
||||
try:
|
||||
simple.LoadDistributedPlugin('RGBZView', ns=globals())
|
||||
except:
|
||||
has_rgbz_view = False
|
||||
|
||||
# === Data to explore and configuration =======================================
|
||||
|
||||
data_to_explore = simple.Wavelet()
|
||||
min = 63.96153259277344
|
||||
max = 250.22056579589844
|
||||
center_of_rotation = [0.0, 0.0, 0.0]
|
||||
rotation_axis = [0.0, 0.0, 1.0]
|
||||
angle_steps = (72, 60)
|
||||
distance = 60
|
||||
lut = simple.GetLookupTableForArray(
|
||||
"RTData", 1,
|
||||
RGBPoints=[min, 0.23, 0.299, 0.754, (min+max)*0.5, 0.865, 0.865, 0.865, max, 0.706, 0.016, 0.15],
|
||||
ColorSpace='Diverging',
|
||||
ScalarRangeInitialized=1.0 )
|
||||
iso_values = [ ((float(x) * (max-min) * 0.1) + min) for x in range(10)]
|
||||
|
||||
# === Create analysis =========================================================
|
||||
|
||||
analysis = cinema.AnalysisManager( work_directory, "Cinema Test", "Test various cinema explorers.")
|
||||
analysis.begin()
|
||||
|
||||
# === SliceExplorer ===========================================================
|
||||
|
||||
analysis.register_analysis(
|
||||
"slice", # id
|
||||
"Slice exploration", # title
|
||||
"Perform 10 slice along X", # description
|
||||
"{sliceColor}_{slicePosition}.jpg", # data structure
|
||||
cinema.SliceExplorer.get_data_type())
|
||||
nb_slices = 5
|
||||
colorByArray = { "RTData": { "lut": lut , "type": 'POINT_DATA'} }
|
||||
view = simple.CreateRenderView()
|
||||
|
||||
fng = analysis.get_file_name_generator("slice")
|
||||
exporter = cinema.SliceExplorer(fng, view, data_to_explore, colorByArray, nb_slices)
|
||||
exporter.set_analysis(analysis)
|
||||
|
||||
# Explore
|
||||
exporter.UpdatePipeline()
|
||||
|
||||
# === ContourExplorer + ThreeSixtyImageStackExporter ==========================
|
||||
|
||||
analysis.register_analysis(
|
||||
"contour-360", # id
|
||||
"Contour", # title
|
||||
"Perform 15 contour", # description
|
||||
"{contourBy}/{contourValue}/{theta}_{phi}.jpg", # data structure
|
||||
cinema.ThreeSixtyImageStackExporter.get_data_type())
|
||||
fng = analysis.get_file_name_generator("contour-360")
|
||||
arrayName = ('POINT_DATA', 'RTData')
|
||||
view2 = simple.CreateRenderView()
|
||||
|
||||
cExplorer = cinema.ContourExplorer(fng, data_to_explore, arrayName, [min,max], 15)
|
||||
proxy = cExplorer.getContour()
|
||||
rep = simple.Show(proxy, view2)
|
||||
rep.LookupTable = lut
|
||||
rep.ColorArrayName = arrayName
|
||||
|
||||
exp = cinema.ThreeSixtyImageStackExporter(fng, view2, center_of_rotation, distance, rotation_axis, angle_steps)
|
||||
for progress in cExplorer:
|
||||
exp.UpdatePipeline()
|
||||
|
||||
# === ImageResampler ==========================================================
|
||||
|
||||
analysis.register_analysis(
|
||||
"interactive-prober", # id
|
||||
"Interactive prober", # title
|
||||
"Sample data in image stack for line probing", # description
|
||||
"{field}/{slice}.{format}", # data structure
|
||||
cinema.ImageResampler.get_data_type())
|
||||
fng = analysis.get_file_name_generator("interactive-prober")
|
||||
arrays = { "RTData" : lut }
|
||||
exp = cinema.ImageResampler(fng, data_to_explore, [21,21,21], arrays)
|
||||
exp.UpdatePipeline()
|
||||
|
||||
|
||||
|
||||
# === CompositeImageExporter ==================================================
|
||||
# CompositeImageExporter(file_name_generator, data_list, colorBy_list, luts, camera_handler, view_size, data_list_pipeline, axisVisibility=1, orientationVisibility=1, format='jpg')
|
||||
if has_rgbz_view:
|
||||
analysis.register_analysis(
|
||||
"composite",
|
||||
"Composite rendering",
|
||||
"Performing composite on contour",
|
||||
'{theta}/{phi}/{filename}', cinema.CompositeImageExporter.get_data_type())
|
||||
fng = analysis.get_file_name_generator("composite")
|
||||
|
||||
# Create pipeline to compose
|
||||
contour_values = [ 64.0, 90.6, 117.2, 143.8, 170.4, 197.0, 223.6, 250.2]
|
||||
color_type = [('POINT_DATA', "RTData")]
|
||||
luts = { "RTData": lut }
|
||||
filters = [ data_to_explore ]
|
||||
filters_description = [ {'name': 'Wavelet'} ]
|
||||
color_by = [ color_type ]
|
||||
|
||||
for iso_value in contour_values:
|
||||
filters.append( simple.Contour( Input=data_to_explore, PointMergeMethod="Uniform Binning", ContourBy = ['POINTS', 'RTData'], Isosurfaces = [iso_value], ComputeScalars = 1 ) )
|
||||
color_by.append( color_type )
|
||||
filters_description.append({'name': 'iso=%s' % str(iso_value)})
|
||||
|
||||
|
||||
# Data exploration ------------------------------------------------------------
|
||||
camera_handler = cinema.ThreeSixtyCameraHandler(fng, None, [ float(r) for r in range(0, 360, 72)], [ float(r) for r in range(-60, 61, 45)], center_of_rotation, rotation_axis, distance)
|
||||
exporter = cinema.CompositeImageExporter(fng, filters, color_by, luts, camera_handler, [400,400], filters_description, 0, 0)
|
||||
exporter.set_analysis(analysis)
|
||||
exporter.UpdatePipeline()
|
||||
|
||||
# === TODO ====================================================================
|
||||
# ThreeSixtyImageStackExporter(file_name_generator, view_proxy, focal_point=[0.0,0.0,0.0], distance=100.0, rotation_axis=[0,0,1], angular_steps=[10,15])
|
||||
# LineProber(file_name_generator, data_to_probe, points_series, number_of_points)
|
||||
# DataProber(file_name_generator, data_to_probe, points_series, fields)
|
||||
# TimeSerieDataProber(file_name_generator, data_to_probe, point_series, fields, time_to_write)
|
||||
# === TODO ====================================================================
|
||||
|
||||
analysis.end()
|
||||
|
||||
# Print analysis info.json
|
||||
analysisInfo = None
|
||||
with open(os.path.join(work_directory, 'info.json'), 'r') as json_file:
|
||||
analysisInfo = json.load(json_file)
|
||||
|
||||
print json.dumps(analysisInfo, sort_keys=True, indent=4, separators=(',', ': '))
|
||||
|
||||
# === Execute embedded test functions =========================================
|
||||
|
||||
test_dir = os.path.join(smtesting.TempDir, 'cinema-test')
|
||||
cinema.test(test_dir)
|
||||
cinema.test2(test_dir)
|
||||
cinema.test3(test_dir)
|
||||
@ -0,0 +1,65 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
#Tests manta server side rendering for CS mode
|
||||
#MantaTest.py tests client side rendering in builtin and CS mode
|
||||
|
||||
import QtTesting
|
||||
import QtTestingImage
|
||||
|
||||
#TODO fix test recording so that it actually records these events
|
||||
#most of which I had to hack in by hand
|
||||
|
||||
#force server side rendering by setting threshold to 0
|
||||
object2 = 'pqClientMainWindow/menubar/menu_Edit'
|
||||
QtTesting.playCommand(object2, 'activate', 'actionEditSettings')
|
||||
objectb2 = 'pqClientMainWindow/ApplicationSettings/PageNames'
|
||||
QtTesting.playCommand(objectb2, 'setCurrent', '4.0')
|
||||
QtTesting.playCommand(objectb2, 'expand', '4.0')
|
||||
QtTesting.playCommand(objectb2, 'setCurrent', '4.0.2.0')
|
||||
objectb3 = 'pqClientMainWindow/ApplicationSettings/Stack/pqGlobalRenderViewOptions/stackedWidget/Server/compositingParameters/compositeThreshold'
|
||||
QtTesting.playCommand(objectb3, 'set_int', '0')
|
||||
objectb4 = 'pqClientMainWindow/ApplicationSettings/CloseButton'
|
||||
QtTesting.playCommand(objectb4, 'activate', '')
|
||||
|
||||
#load manta plugin on client and server sides
|
||||
hack1='pqClientMainWindow/menubar'
|
||||
QtTesting.playCommand(hack1, 'activate', 'menuTools')
|
||||
hack2='pqClientMainWindow/menubar/menuTools'
|
||||
QtTesting.playCommand(hack2, 'activate', 'actionManage_Plugins')
|
||||
object1 = 'pqClientMainWindow/PluginManagerDialog/localGroup/localPlugins'
|
||||
QtTesting.playCommand(object1, 'setCurrent', 'MantaView')
|
||||
object2 = 'pqClientMainWindow/PluginManagerDialog/localGroup/loadSelected_Local'
|
||||
QtTesting.playCommand(object2, 'activate', '')
|
||||
objecta1 = 'pqClientMainWindow/PluginManagerDialog/remoteGroup/remotePlugins'
|
||||
QtTesting.playCommand(objecta1, 'setCurrent', 'MantaView')
|
||||
objecta2 = 'pqClientMainWindow/PluginManagerDialog/remoteGroup/loadSelected_Remote'
|
||||
QtTesting.playCommand(objecta2, 'activate', '')
|
||||
object3 = 'pqClientMainWindow/PluginManagerDialog/buttonBox/1QPushButton0'
|
||||
QtTesting.playCommand(object3, 'activate', '')
|
||||
|
||||
#close the 3D view and make a manta view
|
||||
object4 = 'pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Close'
|
||||
QtTesting.playCommand(object4, 'activate', '')
|
||||
object5 = 'pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/CentralWidgetFrame/EmptyView/scrollArea/qt_scrollarea_viewport/widgetFoo/ConvertActionsFrame/MantaView'
|
||||
QtTesting.playCommand(object5, 'activate', '')
|
||||
|
||||
#show something
|
||||
hack3 = 'pqClientMainWindow/menubar'
|
||||
QtTesting.playCommand(hack3, 'activate', 'menuSources')
|
||||
hack4 = 'pqClientMainWindow/menubar/menuSources'
|
||||
QtTesting.playCommand(hack4, 'activate', 'SphereSource')
|
||||
object6 = 'pqClientMainWindow/objectInspectorDock/objectInspector/Accept'
|
||||
QtTesting.playCommand(object6, 'activate', '')
|
||||
|
||||
#test sphere 'glyphs' while we are at it
|
||||
objectfoo = 'pqClientMainWindow/representationToolbar/displayRepresentation/comboBox'
|
||||
QtTesting.playCommand(objectfoo, 'set_string', 'Points')
|
||||
|
||||
object7 = 'pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport'
|
||||
QtTesting.playCommand(object7, 'mousePress', '(0.719373,0.369784,1,1,0)')
|
||||
QtTesting.playCommand(object7, 'mouseMove', '(0.605413,0.271942,1,0,0)')
|
||||
QtTesting.playCommand(object7, 'mouseRelease', '(0.605413,0.271942,1,0,0)')
|
||||
|
||||
# Image comparison
|
||||
snapshotWidget = 'pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport'
|
||||
QtTestingImage.compareImage(snapshotWidget, 'MantaSSImage.png', 300, 300);
|
||||
136
ParaView-5.0.1/Applications/ParaView/Testing/Python/MantaTest.py
Normal file
136
ParaView-5.0.1/Applications/ParaView/Testing/Python/MantaTest.py
Normal file
@ -0,0 +1,136 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
#Tests manta client side rendering for both builtin and CS mode
|
||||
#MantaServerSideTest.py tests server side rendering in CS mode
|
||||
|
||||
import QtTesting
|
||||
import QtTestingImage
|
||||
|
||||
#load manta plugin on client and server sides
|
||||
object1='pqClientMainWindow/menubar'
|
||||
QtTesting.playCommand(object1, 'activate', 'menuTools')
|
||||
hack2='pqClientMainWindow/menubar/menuTools'
|
||||
QtTesting.playCommand(hack2, 'activate', 'actionManage_Plugins')
|
||||
objectA = 'pqClientMainWindow/PluginManagerDialog/localGroup/localPlugins'
|
||||
QtTesting.playCommand(objectA, 'setCurrent', 'MantaView')
|
||||
object2 = 'pqClientMainWindow/PluginManagerDialog/localGroup/loadSelected_Local'
|
||||
QtTesting.playCommand(object2, 'activate', '')
|
||||
objecta1 = 'pqClientMainWindow/PluginManagerDialog/remoteGroup/remotePlugins'
|
||||
QtTesting.playCommand(objecta1, 'setCurrent', 'MantaView')
|
||||
objecta2 = 'pqClientMainWindow/PluginManagerDialog/remoteGroup/loadSelected_Remote'
|
||||
QtTesting.playCommand(objecta2, 'activate', '')
|
||||
object3 = 'pqClientMainWindow/PluginManagerDialog/buttonBox/1QPushButton0'
|
||||
QtTesting.playCommand(object3, 'activate', '')
|
||||
|
||||
#create two manta and one gl window
|
||||
object6 = 'pqClientMainWindow/centralwidget/MultiViewManager/SplitterFrame/MultiViewSplitter/0/MultiViewFrameMenu/CloseAction'
|
||||
QtTesting.playCommand(object6, 'activate', '')
|
||||
object7 = 'pqClientMainWindow/centralwidget/MultiViewManager/SplitterFrame/MultiViewSplitter/0/1QWidget0/1QScrollArea0/qt_scrollarea_viewport/CentralWidgetFrame/EmptyView/ConvertActionsFrame/Manta'
|
||||
QtTesting.playCommand(object7, 'activate', '')
|
||||
object8 = 'pqClientMainWindow/centralwidget/MultiViewManager/SplitterFrame/MultiViewSplitter/0/MultiViewFrameMenu/SplitHorizontalAction'
|
||||
QtTesting.playCommand(object8, 'activate', '')
|
||||
object9 = 'pqClientMainWindow/centralwidget/MultiViewManager/SplitterFrame/MultiViewSplitter/1/MultiViewFrameMenu/SplitHorizontalAction'
|
||||
QtTesting.playCommand(object9, 'activate', '')
|
||||
QtTesting.playCommand(object8, 'activate', '')
|
||||
object10 = 'pqClientMainWindow/centralwidget/MultiViewManager/SplitterFrame/MultiViewSplitter/1/MultiViewFrameMenu/CloseAction'
|
||||
QtTesting.playCommand(object10, 'activate', '')
|
||||
object11 = 'pqClientMainWindow/centralwidget/MultiViewManager/SplitterFrame/MultiViewSplitter/1/1QWidget0/1QScrollArea0/qt_scrollarea_viewport/CentralWidgetFrame/EmptyView/ConvertActionsFrame/Manta'
|
||||
QtTesting.playCommand(object11, 'activate', '')
|
||||
object12 = 'pqClientMainWindow/centralwidget/MultiViewManager/SplitterFrame/MultiViewSplitter/2/1QWidget0/1QScrollArea0/qt_scrollarea_viewport/CentralWidgetFrame/EmptyView/ConvertActionsFrame/3D View'
|
||||
QtTesting.playCommand(object12, 'activate', '')
|
||||
|
||||
#create some geometry to show
|
||||
QtTesting.playCommand(object1, 'activate', 'menuSources')
|
||||
object13 = 'pqClientMainWindow/menubar/menuSources'
|
||||
QtTesting.playCommand(object13, 'activate', 'SphereSource')
|
||||
object14 = 'pqClientMainWindow/objectInspectorDock/objectInspector/ScrollArea/qt_scrollarea_viewport/PanelArea/Editor/ThetaResolution'
|
||||
QtTesting.playCommand(object14, 'key', '16777219')
|
||||
QtTesting.playCommand(object14, 'set_string', '20')
|
||||
QtTesting.playCommand(object14, 'set_string', '20')
|
||||
object15 = 'pqClientMainWindow/objectInspectorDock/objectInspector/ScrollArea/qt_scrollarea_viewport/PanelArea/Editor/StartTheta/LineEdit'
|
||||
QtTesting.playCommand(object15, 'key', '16777217')
|
||||
object16 = 'pqClientMainWindow/objectInspectorDock/objectInspector/ScrollArea/qt_scrollarea_viewport/PanelArea/Editor/EndTheta/LineEdit'
|
||||
QtTesting.playCommand(object16, 'key', '16777217')
|
||||
object17 = 'pqClientMainWindow/objectInspectorDock/objectInspector/ScrollArea/qt_scrollarea_viewport/PanelArea/Editor/PhiResolution'
|
||||
QtTesting.playCommand(object17, 'key', '16777217')
|
||||
QtTesting.playCommand(object17, 'set_string', '20')
|
||||
QtTesting.playCommand(object17, 'set_string', '20')
|
||||
object18 = 'pqClientMainWindow/objectInspectorDock/objectInspector/Accept'
|
||||
QtTesting.playCommand(object18, 'activate', '')
|
||||
|
||||
#ascribe some data values to test color mapping
|
||||
object19 = 'pqClientMainWindow/menubar/menuFilters/pqProxyGroupMenuManager0/Calculator'
|
||||
QtTesting.playCommand(object19, 'activate', '')
|
||||
object20 = 'pqClientMainWindow/objectInspectorDock/objectInspector/ScrollArea/qt_scrollarea_viewport/PanelArea/Editor/Function'
|
||||
QtTesting.playCommand(object20, 'set_string', 'coordsX')
|
||||
QtTesting.playCommand(object18, 'activate', '')
|
||||
|
||||
#make it visible in all three views
|
||||
object21 = 'pqClientMainWindow/centralwidget/MultiViewManager/SplitterFrame/MultiViewSplitter/1/Viewport'
|
||||
QtTesting.playCommand(object21, 'mousePress', '(0.474654,0.393281,1,1,0)')
|
||||
QtTesting.playCommand(object21, 'mouseMove', '(0.474654,0.393281,1,0,0)')
|
||||
QtTesting.playCommand(object21, 'mouseRelease', '(0.474654,0.393281,1,0,0)')
|
||||
object22 = 'pqClientMainWindow/pipelineBrowserDock/pipelineBrowser'
|
||||
QtTesting.playCommand(object22, 'mousePress', '1,1,0,15,11,/0:0/0:0/0:1')
|
||||
QtTesting.playCommand(object22, 'mouseRelease', '1,0,0,15,11,/0:0/0:0/0:1')
|
||||
object27 = 'pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport'
|
||||
QtTesting.playCommand(object27, 'mousePress', '(0.456221,0.411067,1,1,0)')
|
||||
QtTesting.playCommand(object27, 'mouseMove', '(0.456221,0.411067,1,0,0)')
|
||||
QtTesting.playCommand(object27, 'mouseRelease', '(0.456221,0.411067,1,0,0)')
|
||||
QtTesting.playCommand(object22, 'mousePress', '1,1,0,11,10,/0:0/0:0/0:1')
|
||||
QtTesting.playCommand(object22, 'mouseRelease', '1,0,0,11,10,/0:0/0:0/0:1')
|
||||
QtTesting.playCommand(object27, 'mousePress', '(0.806452,0.290514,1,1,67108864)')
|
||||
QtTesting.playCommand(object27, 'mouseMove', '(0.806452,0.290514,1,0,67108864)')
|
||||
QtTesting.playCommand(object27, 'mouseRelease', '(0.806452,0.290514,1,0,67108864)')
|
||||
QtTesting.playCommand(object27, 'mousePress', '(0.806452,0.290514,1,1,67108864)')
|
||||
QtTesting.playCommand(object27, 'mouseMove', '(0.806452,0.290514,1,0,67108864)')
|
||||
QtTesting.playCommand(object27, 'mouseRelease', '(0.806452,0.290514,1,0,67108864)')
|
||||
QtTesting.playCommand(object27, 'mousePress', '(0.806452,0.290514,1,1,33554432)')
|
||||
QtTesting.playCommand(object27, 'mouseMove', '(0.806452,0.290514,1,0,33554432)')
|
||||
QtTesting.playCommand(object27, 'mouseRelease', '(0.806452,0.290514,1,0,33554432)')
|
||||
QtTesting.playCommand(object21, 'mousePress', '(0.419355,0.304348,1,1,0)')
|
||||
QtTesting.playCommand(object21, 'mouseMove', '(0.419355,0.304348,1,0,0)')
|
||||
QtTesting.playCommand(object21, 'mouseRelease', '(0.419355,0.304348,1,0,0)')
|
||||
|
||||
#test manta material in the middle view
|
||||
object37 = 'pqClientMainWindow/variableToolbar/displayColor/Variables'
|
||||
QtTesting.playCommand(object37, 'set_string', 'Solid Color')
|
||||
object38 = 'pqClientMainWindow/1QTabBar1'
|
||||
QtTesting.playCommand(object38, 'set_tab_with_text', 'Display')
|
||||
object39 = 'pqClientMainWindow/displayDock/displayWidgetFrame/displayScrollArea/qt_scrollarea_vcontainer/1QScrollBar0'
|
||||
QtTesting.playCommand(object39, 'mousePress', '1,1,0,8,40')
|
||||
QtTesting.playCommand(object39, 'mouseMove', '1,0,0,10,241')
|
||||
QtTesting.playCommand(object39, 'mouseRelease', '1,0,0,10,241')
|
||||
object40 = 'pqClientMainWindow/displayDock/displayWidgetFrame/displayScrollArea/qt_scrollarea_viewport/displayWidget/pqDisplayProxyEditor/MantaDisplay/material'
|
||||
QtTesting.playCommand(object40, 'set_string', 'phong')
|
||||
object41 = 'pqClientMainWindow/displayDock/displayWidgetFrame/displayScrollArea/qt_scrollarea_viewport/displayWidget/pqDisplayProxyEditor/MantaDisplay/reflectance'
|
||||
QtTesting.playCommand(object41, 'set_double', '0.5')
|
||||
object42 = 'pqClientMainWindow/displayDock/displayWidgetFrame/displayScrollArea/qt_scrollarea_viewport/displayWidget/pqDisplayProxyEditor/MantaDisplay/eta'
|
||||
|
||||
#make refresh all three views
|
||||
object1 = 'pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport'
|
||||
QtTesting.playCommand(object1, 'mousePress', '(0.691244,0.23913,1,1,0)')
|
||||
QtTesting.playCommand(object1, 'mouseMove', '(0.691244,0.23913,1,0,0)')
|
||||
QtTesting.playCommand(object1, 'mouseRelease', '(0.691244,0.23913,1,0,0)')
|
||||
QtTesting.playCommand(object1, 'mousePress', '(0.37788,0.181818,1,1,0)')
|
||||
QtTesting.playCommand(object1, 'mouseMove', '(0.37788,0.181818,1,0,0)')
|
||||
QtTesting.playCommand(object1, 'mouseRelease', '(0.37788,0.181818,1,0,0)')
|
||||
object2 = 'pqClientMainWindow/centralwidget/MultiViewManager/SplitterFrame/MultiViewSplitter/1/Viewport'
|
||||
QtTesting.playCommand(object2, 'mousePress', '(0.391705,0.199605,1,1,0)')
|
||||
QtTesting.playCommand(object2, 'mouseMove', '(0.391705,0.199605,1,0,0)')
|
||||
QtTesting.playCommand(object2, 'mouseRelease', '(0.391705,0.199605,1,0,0)')
|
||||
object3 = 'pqClientMainWindow/centralwidget/MultiViewManager/SplitterFrame/MultiViewSplitter/2/Viewport'
|
||||
QtTesting.playCommand(object3, 'mousePress', '(0.686636,0.215415,1,1,0)')
|
||||
QtTesting.playCommand(object3, 'mouseMove', '(0.686636,0.215415,1,0,0)')
|
||||
QtTesting.playCommand(object3, 'mouseRelease', '(0.686636,0.215415,1,0,0)')
|
||||
QtTesting.playCommand(object2, 'mousePress', '(0.502304,0.22332,1,1,0)')
|
||||
QtTesting.playCommand(object2, 'mouseMove', '(0.502304,0.22332,1,0,0)')
|
||||
QtTesting.playCommand(object2, 'mouseRelease', '(0.502304,0.22332,1,0,0)')
|
||||
QtTesting.playCommand(object1, 'mousePress', '(0.465438,0.270751,1,1,0)')
|
||||
QtTesting.playCommand(object1, 'mouseMove', '(0.465438,0.270751,1,0,0)')
|
||||
QtTesting.playCommand(object1, 'mouseRelease', '(0.465438,0.270751,1,0,0)')
|
||||
|
||||
|
||||
# Image comparison
|
||||
snapshotWidget = 'pqClientMainWindow/centralwidget/MultiViewManager'
|
||||
QtTestingImage.compareImage(snapshotWidget, 'MantaImage.png', 300, 300);
|
||||
@ -0,0 +1,30 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
import QtTesting
|
||||
import sys
|
||||
|
||||
libname = 'libGUIConePanel.so'
|
||||
if sys.platform == 'win32':
|
||||
libname = 'GUIConePanel.dll'
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
libname = 'libGUIConePanel.dylib'
|
||||
|
||||
object1 = 'pqClientMainWindow/menubar/menuTools'
|
||||
QtTesting.playCommand(object1, 'activate', 'actionManage_Plugins')
|
||||
object2 = 'pqClientMainWindow/pqPluginDialog/localGroup/loadLocal'
|
||||
QtTesting.playCommand(object2, 'activate', '')
|
||||
object3 = 'pqClientMainWindow/pqPluginDialog/pqFileDialog'
|
||||
QtTesting.playCommand(object3, 'filesSelected', libname)
|
||||
object4 = 'pqClientMainWindow/pqPluginDialog/buttonBox/1QPushButton0'
|
||||
QtTesting.playCommand(object4, 'activate', '')
|
||||
object5 = 'pqClientMainWindow/menubar/menuSources'
|
||||
QtTesting.playCommand(object5, 'activate', 'Cone')
|
||||
object7 = 'pqClientMainWindow/objectInspectorDock/objectInspector/Accept'
|
||||
QtTesting.playCommand(object7, 'activate', '')
|
||||
|
||||
object8 = 'pqClientMainWindow/objectInspectorDock/objectInspector/ScrollArea/qt_scrollarea_viewport/PanelArea/Editor/1QLabel0'
|
||||
|
||||
text = QtTesting.getProperty(object8, 'text')
|
||||
print text
|
||||
|
||||
@ -0,0 +1,73 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
|
||||
blotScriptBody = \
|
||||
"""
|
||||
diskwrite off
|
||||
|
||||
detour
|
||||
solid
|
||||
rotate x 100
|
||||
tmin 0.001
|
||||
tmax 0.003
|
||||
nintv 20
|
||||
plot
|
||||
|
||||
tplot
|
||||
VELX 1 to 1000 by 200
|
||||
overlay
|
||||
plot
|
||||
reset
|
||||
|
||||
xyplot
|
||||
displx 200 to 300 by 20
|
||||
velx 200 to 300 by 20
|
||||
plot
|
||||
|
||||
"""
|
||||
|
||||
|
||||
import QtTesting
|
||||
import sys
|
||||
|
||||
pluginFile = 'libpvblot.so'
|
||||
if sys.platform == 'win32':
|
||||
pluginFile = 'pvblot.dll'
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
pluginFile = 'libpvblot.dylib'
|
||||
|
||||
dataFile = '$PARAVIEW_DATA_ROOT/can.ex2'
|
||||
|
||||
object1 = 'pqClientMainWindow/menubar/menuTools'
|
||||
object2 = 'pqClientMainWindow/pqPluginDialog/localGroup/loadLocal'
|
||||
object3 = 'pqClientMainWindow/pqPluginDialog/pqFileDialog'
|
||||
object4 = 'pqClientMainWindow/pqPluginDialog/buttonBox/1QPushButton0'
|
||||
object5 = 'pqClientMainWindow/pqFileDialog'
|
||||
object6 = 'pqClientMainWindow/pqBlotDialog/buttons/runScript'
|
||||
object7 = 'pqClientMainWindow/pqBlotDialog/BLOTShellRunScriptDialog'
|
||||
object8 = 'pqClientMainWindow/pqBlotDialog/buttons/close'
|
||||
|
||||
|
||||
testDir = QtTesting.getProperty('pqClientMainWindow', 'TestDirectory')
|
||||
|
||||
|
||||
blotTestFile = "%s/PVBlotTest1.bl" % testDir
|
||||
|
||||
blotFile = open(blotTestFile, 'w')
|
||||
blotFile.write(blotScriptBody)
|
||||
blotFile.close()
|
||||
|
||||
QtTesting.playCommand(object1, 'activate', 'actionManage_Plugins')
|
||||
QtTesting.playCommand(object2, 'activate', '')
|
||||
QtTesting.playCommand(object3, 'filesSelected', pluginFile)
|
||||
QtTesting.playCommand(object4, 'activate', '')
|
||||
QtTesting.playCommand(object1, 'activate', 'PVBlot')
|
||||
QtTesting.playCommand(object5, 'filesSelected', dataFile)
|
||||
QtTesting.playCommand(object6, 'activate', '')
|
||||
QtTesting.playCommand(object7, 'filesSelected', blotTestFile)
|
||||
QtTesting.playCommand(object8, 'activate', '')
|
||||
|
||||
import time
|
||||
time.sleep(10)
|
||||
|
||||
@ -0,0 +1,91 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
import QtTesting
|
||||
import QtTestingImage
|
||||
import time
|
||||
|
||||
object1 = 'pqClientMainWindow/menubar/menuSources'
|
||||
QtTesting.playCommand(object1, 'activate', 'Wavelet')
|
||||
object2 = 'pqClientMainWindow/objectInspectorDock/objectInspector/Accept'
|
||||
QtTesting.playCommand(object2, 'activate', '')
|
||||
object6 = 'pqClientMainWindow/1QTabBar1'
|
||||
QtTesting.playCommand(object6, 'set_tab_with_text', 'Display')
|
||||
object24 = 'pqClientMainWindow/displayDock/displayWidgetFrame/displayScrollArea/qt_scrollarea_viewport/displayWidget/pqDisplayProxyEditor/StyleGroup/StyleRepresentation/comboBox'
|
||||
QtTesting.playCommand(object24, 'set_string', 'Surface')
|
||||
object25 = 'pqClientMainWindow/displayDock/displayWidgetFrame/displayScrollArea/qt_scrollarea_viewport/displayWidget/pqDisplayProxyEditor/ColorGroup/ColorBy/Variables'
|
||||
QtTesting.playCommand(object25, 'set_string', 'RTData')
|
||||
QtTesting.playCommand(object6, 'set_tab_with_text', 'Properties')
|
||||
object3 = 'pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/SplitHorizontal'
|
||||
QtTesting.playCommand(object3, 'activate', '')
|
||||
|
||||
QtTesting.playCommand(object1, 'activate', 'Arrow')
|
||||
QtTesting.playCommand(object2, 'activate', '')
|
||||
object4 = 'pqClientMainWindow/objectInspectorDock/objectInspector/Delete'
|
||||
QtTesting.playCommand(object4, 'activate', '')
|
||||
|
||||
object4 = 'pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Splitter.0/Frame.2/SplitVertical'
|
||||
QtTesting.playCommand(object4, 'activate', '')
|
||||
QtTesting.playCommand(object1, 'activate', 'Sphere')
|
||||
QtTesting.playCommand(object2, 'activate', '')
|
||||
QtTesting.playCommand(object6, 'set_tab_with_text', 'Display')
|
||||
object8 = 'pqClientMainWindow/displayDock/displayWidgetFrame/displayScrollArea/qt_scrollarea_viewport/displayWidget/Form/ViewGroup/ViewData'
|
||||
QtTesting.playCommand(object8, 'set_boolean', 'false')
|
||||
QtTesting.playCommand(object8, 'set_boolean', 'false')
|
||||
QtTesting.playCommand(object8, 'set_boolean', 'false')
|
||||
QtTesting.playCommand(object8, 'set_boolean', 'false')
|
||||
object9 = 'pqClientMainWindow/menubar/menu_File'
|
||||
QtTesting.playCommand(object9, 'activate', 'actionFileOpen')
|
||||
QtTesting.playCommand(object6, 'set_tab_with_text', 'Properties')
|
||||
object10 = 'pqClientMainWindow/FileOpenDialog'
|
||||
QtTesting.playCommand(object10, 'filesSelected', '$PARAVIEW_DATA_ROOT/dualSphereAnimation.pvd')
|
||||
QtTesting.playCommand(object2, 'activate', '')
|
||||
object11 = 'pqClientMainWindow/menubar/menuView'
|
||||
QtTesting.playCommand(object11, 'activate', 'Animation View')
|
||||
|
||||
|
||||
object15 = 'pqClientMainWindow/pipelineBrowserDock/pipelineBrowser'
|
||||
QtTesting.playCommand(object15, 'currentChanged', '/0/1|0')
|
||||
|
||||
#object12 = 'pqClientMainWindow/animationPanelDock/1pqAnimationPanel0/scrollArea/qt_scrollarea_viewport/AnimationPanel/tracksGroup/propertyName'
|
||||
#object14 = 'pqClientMainWindow/animationPanelDock/1pqAnimationPanel0/scrollArea/qt_scrollarea_viewport/AnimationPanel/keyFramePropertiesGroup/addKeyFrame'
|
||||
#QtTesting.playCommand(object12, 'set_string', 'End Theta')
|
||||
#QtTesting.playCommand(object14, 'activate', '')
|
||||
|
||||
object12 = 'pqClientMainWindow/animationViewDock/animationView/pqAnimationWidget/CreateDeleteWidget/PropertyCombo'
|
||||
QtTesting.playCommand(object12, 'set_string', 'End Theta')
|
||||
object10 = "pqClientMainWindow/animationViewDock/animationView/1pqAnimationWidget0/1QHeaderView0"
|
||||
QtTesting.playCommand(object10, "mousePress", "1,1,0,0,0,2")
|
||||
QtTesting.playCommand(object10, "mouseRelease", "1,1,0,0,0,2")
|
||||
|
||||
QtTesting.playCommand(object15, 'currentChanged', '/0/0|0')
|
||||
QtTesting.playCommand(object10, "mousePress", "1,1,0,0,0,3")
|
||||
QtTesting.playCommand(object10, "mouseRelease", "1,1,0,0,0,3")
|
||||
|
||||
object17 = 'pqClientMainWindow/VCRToolbar/1QToolButton0'
|
||||
QtTesting.playCommand(object17, 'activate', '')
|
||||
object18 = 'pqClientMainWindow/VCRToolbar/1QToolButton3'
|
||||
|
||||
#object19 = 'pqClientMainWindow/animationPanelDock/1pqAnimationPanel0/scrollArea/qt_scrollarea_viewport/AnimationPanel/keyFramePropertiesGroup/editorFrame/SignalAdaptorKeyFrameValue/lineEdit'
|
||||
#QtTesting.playCommand(object19, 'set_string', '10')
|
||||
#QtTesting.playCommand(object19, 'set_string', '10')
|
||||
object20 = 'pqClientMainWindow/VCRToolbar/1QToolButton1'
|
||||
QtTesting.playCommand(object11, 'activate', 'Animation View')
|
||||
QtTesting.playCommand(object11, 'activate', 'Object Inspector')
|
||||
QtTesting.playCommand(object11, 'activate', 'Pipeline Browser')
|
||||
QtTesting.playCommand(object9, 'activate', 'actionFileSaveAnimation')
|
||||
object21 = 'Dialog/spinBoxWidth'
|
||||
QtTesting.playCommand(object21, 'set_int', '800')
|
||||
object22 = 'Dialog/spinBoxHeight'
|
||||
QtTesting.playCommand(object22, 'set_int', '800')
|
||||
object22 = 'Dialog/okButton'
|
||||
QtTesting.playCommand(object22, 'activate', '')
|
||||
objectSaveAnimationDialog = 'FileSaveAnimationDialog'
|
||||
QtTesting.playCommand(objectSaveAnimationDialog, 'filesSelected', '$PARAVIEW_TEST_ROOT/movie_test.png')
|
||||
|
||||
time.sleep(3);
|
||||
objectPlayButton = 'pqClientMainWindow/VCRToolbar/1QToolButton2'
|
||||
while QtTesting.getProperty(objectPlayButton, "text") != 'Play' :
|
||||
time.sleep(1);
|
||||
|
||||
QtTestingImage.compareImage('$PARAVIEW_TEST_ROOT/movie_test.0005.png', 'SaveAnimationMultiView.png');
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,46 @@
|
||||
from paraview.simple import *
|
||||
from paraview import smtesting
|
||||
import vtk
|
||||
import vtk.vtkRenderingVolume
|
||||
import os
|
||||
|
||||
paraview.simple._DisableFirstRenderCameraReset()
|
||||
|
||||
# need a baseline?
|
||||
saveImage = False
|
||||
|
||||
# check for driver support first
|
||||
rw = vtk.vtkRenderWindow()
|
||||
rw.SetSize(1,1)
|
||||
rw.Render()
|
||||
ptm = vtk.vtkProjectedTetrahedraMapper()
|
||||
ok = ptm.IsSupported(rw)
|
||||
print
|
||||
print 'ProjectedTetrahedraMapper %s supported '%(
|
||||
'is' if(ok) else 'is not')
|
||||
del ptm
|
||||
del rw
|
||||
|
||||
if ok:
|
||||
smtesting.ProcessCommandLineArguments()
|
||||
smtesting.LoadServerManagerState(smtesting.StateXMLFileName)
|
||||
|
||||
view = GetRenderView()
|
||||
view.RemoteRenderThreshold = 0;
|
||||
|
||||
if saveImage:
|
||||
SetActiveView(view)
|
||||
Render()
|
||||
imageFile = os.path.splitext(os.path.basename(smtesting.StateXMLFileName))[0]
|
||||
WriteImage('%s/../../%s.png'%(smtesting.TempDir, imageFile))
|
||||
|
||||
if not smtesting.DoRegressionTesting(view.SMProxy):
|
||||
raise smtesting.TestError, 'Test failed.'
|
||||
|
||||
print
|
||||
print 'Test passes'
|
||||
|
||||
else:
|
||||
print 'Skipped untested.'
|
||||
|
||||
print
|
||||
@ -0,0 +1,15 @@
|
||||
from paraview.simple import *
|
||||
|
||||
s = Sphere()
|
||||
e = Elevation(LowPoint=[-0.5,-0.5,-0.5],
|
||||
HighPoint=[0.5, 0.5, 0.5])
|
||||
UpdatePipeline()
|
||||
a = AnnotateAttributeData(
|
||||
Prefix="Hello: ",
|
||||
ArrayName= "Elevation",
|
||||
ArrayAssociation="Point Data",
|
||||
ElementId=0,
|
||||
ProcessId=0
|
||||
)
|
||||
UpdatePipeline()
|
||||
assert a.GetClientSideObject().GetComputedAnnotationValue() == "Hello: 0.666667"
|
||||
@ -0,0 +1,34 @@
|
||||
#### import the simple module from the paraview
|
||||
from paraview.simple import *
|
||||
|
||||
# Create a wavelet and clip it with a Cylinder.
|
||||
wavelet = Wavelet()
|
||||
Show()
|
||||
|
||||
clip = Clip()
|
||||
clip.ClipType = "Cylinder"
|
||||
clip.InsideOut = True
|
||||
Show()
|
||||
|
||||
cylinder = clip.ClipType
|
||||
cylinder.Axis = [-1, 1, -1]
|
||||
cylinder.Center = [8, 4, -3]
|
||||
cylinder.Radius = 3
|
||||
|
||||
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, "TestClipCylinder.png")
|
||||
import vtk.test.Testing
|
||||
vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
|
||||
vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file,
|
||||
threshold=25)
|
||||
vtk.test.Testing.interact()
|
||||
@ -0,0 +1,84 @@
|
||||
#### import the simple module from the paraview
|
||||
from paraview.simple import *
|
||||
#### disable automatic camera reset on 'Show'
|
||||
paraview.simple._DisableFirstRenderCameraReset()
|
||||
|
||||
# create a new 'Wavelet'
|
||||
wavelet1 = Wavelet()
|
||||
|
||||
# get active view
|
||||
renderView1 = GetActiveViewOrCreate('RenderView')
|
||||
# uncomment following to set a specific view size
|
||||
# renderView1.ViewSize = [1013, 781]
|
||||
|
||||
# show data in view
|
||||
wavelet1Display = Show(wavelet1, renderView1)
|
||||
# trace defaults for the display properties.
|
||||
wavelet1Display.Representation = 'Outline'
|
||||
wavelet1Display.ColorArrayName = ['POINTS', '']
|
||||
wavelet1Display.ScalarOpacityUnitDistance = 1.7320508075688779
|
||||
wavelet1Display.Slice = 10
|
||||
|
||||
# reset view to fit data
|
||||
renderView1.ResetCamera()
|
||||
|
||||
# change representation type
|
||||
wavelet1Display.SetRepresentationType('Surface')
|
||||
|
||||
# set scalar coloring
|
||||
ColorBy(wavelet1Display, ('POINTS', 'RTData'))
|
||||
|
||||
# rescale color and/or opacity maps used to include current data range
|
||||
wavelet1Display.RescaleTransferFunctionToDataRange(True)
|
||||
|
||||
# show color bar/color legend
|
||||
wavelet1Display.SetScalarBarVisibility(renderView1, True)
|
||||
|
||||
# get color transfer function/color map for 'RTData'
|
||||
rTDataLUT = GetColorTransferFunction('RTData')
|
||||
|
||||
# get opacity transfer function/opacity map for 'RTData'
|
||||
rTDataPWF = GetOpacityTransferFunction('RTData')
|
||||
|
||||
# get layout
|
||||
viewLayout1 = GetLayout()
|
||||
|
||||
# split cell
|
||||
viewLayout1.SplitHorizontal(0, 0.5)
|
||||
|
||||
# set active view
|
||||
SetActiveView(None)
|
||||
|
||||
# Create a new 'Histogram View'
|
||||
histogramView1 = CreateView('XYHistogramChartView')
|
||||
histogramView1.ViewSize = [503, 781]
|
||||
|
||||
# place view in the layout
|
||||
viewLayout1.AssignView(2, histogramView1)
|
||||
|
||||
# set active source
|
||||
SetActiveSource(wavelet1)
|
||||
|
||||
# show data in view
|
||||
histogram = Show(wavelet1, histogramView1)
|
||||
# trace defaults for the display properties.
|
||||
histogram.SelectInputArray = ['POINTS', 'RTData']
|
||||
histogram.CustomBinRanges = [37.35310363769531, 276.8288269042969]
|
||||
histogram.UseColorMapping = True
|
||||
histogram.LookupTable = rTDataLUT
|
||||
|
||||
Render(histogramView1)
|
||||
|
||||
# compare histogramView 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."
|
||||
baseline_file = os.path.join(baselinePath, "TestColorHistogram.png")
|
||||
import vtk.test.Testing
|
||||
vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
|
||||
vtk.test.Testing.compareImage(histogramView1.GetRenderWindow(), baseline_file, threshold=40)
|
||||
vtk.test.Testing.interact()
|
||||
@ -0,0 +1,38 @@
|
||||
from paraview import servermanager
|
||||
from paraview import simple as smp
|
||||
from paraview import smtesting
|
||||
|
||||
# Make sure the test driver know that process has properly started
|
||||
print "Process started"
|
||||
|
||||
def getHost(url):
|
||||
return url.split(':')[1][2:]
|
||||
def getPort(url):
|
||||
return int(url.split(':')[2])
|
||||
|
||||
|
||||
def runTest():
|
||||
options = servermanager.vtkProcessModule.GetProcessModule().GetOptions()
|
||||
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"
|
||||
runTest()
|
||||
@ -0,0 +1,28 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
import QtTesting
|
||||
|
||||
object1 = 'pqClientMainWindow/menubar/menuSources'
|
||||
QtTesting.playCommand(object1, 'activate', 'RTAnalyticSource')
|
||||
object2 = 'pqClientMainWindow/propertiesDock/propertiesPanel/Accept'
|
||||
QtTesting.playCommand(object2, 'activate', '')
|
||||
object3 = 'pqClientMainWindow/menubar/menuFilters/Common'
|
||||
QtTesting.playCommand(object3, 'activate', 'Contour')
|
||||
QtTesting.playCommand(object2, 'activate', '')
|
||||
object5 = 'pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ContourValues/ScalarValueList'
|
||||
QtTesting.setProperty(object5, 'scalars', '120')
|
||||
QtTesting.playCommand(object2, 'activate', '')
|
||||
QtTesting.setProperty(object5, 'scalars', '120;130;140;150')
|
||||
QtTesting.playCommand(object2, 'activate', '')
|
||||
object1 = 'pqClientMainWindow/menubar/menu_Edit'
|
||||
QtTesting.playCommand(object1, 'activate', 'actionEditUndo')
|
||||
# Need to wait a moment to allow the GUI to update.
|
||||
import time
|
||||
time.sleep(1)
|
||||
val = QtTesting.getProperty(object5, 'scalars')
|
||||
|
||||
if val != "120":
|
||||
import exceptions
|
||||
raise exceptions.RuntimeError, "Expecting 120, received: " + val
|
||||
else:
|
||||
print "Value comparison successful -- Test passed."
|
||||
@ -0,0 +1,152 @@
|
||||
from paraview.simple import *
|
||||
from paraview import servermanager
|
||||
|
||||
import time
|
||||
|
||||
# Make sure the test driver know that process has properly started
|
||||
print "Process started"
|
||||
errors = 0
|
||||
|
||||
#-------------------- Helpers methods ----------------
|
||||
def getHost(url):
|
||||
return url.split(':')[1][2:]
|
||||
|
||||
def getScheme(url):
|
||||
return url.split(':')[0]
|
||||
|
||||
def getPort(url):
|
||||
return int(url.split(':')[2])
|
||||
#--------------------
|
||||
import os
|
||||
|
||||
def findInSubdirectory(filename, subdirectory=''):
|
||||
if subdirectory:
|
||||
path = subdirectory
|
||||
else:
|
||||
path = os.getcwd()
|
||||
for root, dirs, names in os.walk(path):
|
||||
for name in names:
|
||||
if (name.find(filename) > -1) and ( (name.find('.dll') > -1) or (name.find('.so') > -1) or (name.find('.dylib') > -1)):
|
||||
return os.path.join(root, name)
|
||||
raise 'File not found'
|
||||
#--------------------
|
||||
|
||||
print "Start multi-server testing"
|
||||
|
||||
options = servermanager.vtkProcessModule.GetProcessModule().GetOptions()
|
||||
available_server_urls = options.GetServerURL().split('|')
|
||||
built_in_connection = servermanager.ActiveConnection
|
||||
|
||||
# Test if the built-in connection is here
|
||||
if (len(servermanager.Connections) != 1):
|
||||
errors += 1
|
||||
print "Error pvpython should be connected to a built-in session. Currently connected to ", servermanager.Connections
|
||||
|
||||
url = available_server_urls[0]
|
||||
print "Connect to first server ", url
|
||||
server1_connection = Connect(getHost(url), getPort(url))
|
||||
|
||||
# Test that we have one more connection
|
||||
if (len(servermanager.Connections) != 2):
|
||||
errors += 1
|
||||
print "Error pvpython should be connected to a built-in session + one remote one. Currently connected to ", servermanager.Connections
|
||||
|
||||
url = available_server_urls[1]
|
||||
print "Connect to second server ", url
|
||||
server2_connection = Connect(getHost(url), getPort(url))
|
||||
|
||||
# Test that we have one more connection
|
||||
if (len(servermanager.Connections) != 3):
|
||||
errors += 1
|
||||
print "Error pvpython should be connected to a built-in session + two remote one. Currently connected to ", servermanager.Connections
|
||||
|
||||
print "Available connections: ", servermanager.Connections
|
||||
|
||||
# Test that last created connection is the active one
|
||||
if ( servermanager.ActiveConnection != server2_connection):
|
||||
errors += 1
|
||||
print "Error Invalid active connection. Expected ", server2_connection, " and got ", servermanager.ActiveConnection
|
||||
|
||||
# Test that SetActiveConnection is working as expected
|
||||
SetActiveConnection(server1_connection, globals())
|
||||
if ( servermanager.ActiveConnection != server1_connection):
|
||||
errors += 1
|
||||
print "Error Invalid active connection. Expected ", server1_connection, " and got ", servermanager.ActiveConnection
|
||||
|
||||
# Test that SetActiveConnection is working as expected
|
||||
SetActiveConnection(built_in_connection, globals())
|
||||
if ( servermanager.ActiveConnection != built_in_connection):
|
||||
errors += 1
|
||||
print "Error Invalid active connection. Expected ", built_in_connection, " and got ", servermanager.ActiveConnection
|
||||
|
||||
# Test that SetActiveConnection is working as expected
|
||||
SetActiveConnection(server2_connection, globals())
|
||||
if ( servermanager.ActiveConnection != server2_connection):
|
||||
errors += 1
|
||||
print "Error Invalid active connection. Expected ", server2_connection, " and got ", servermanager.ActiveConnection
|
||||
|
||||
|
||||
# Load plugin on server2
|
||||
SetActiveConnection(server2_connection, globals())
|
||||
LoadDistributedPlugin("PacMan", True, globals())
|
||||
|
||||
# Create PacMan on server2
|
||||
pacMan_s2 = PacMan()
|
||||
|
||||
# Swtich to server1 and Create PacMan ==> This should fail
|
||||
SetActiveConnection(server1_connection, globals())
|
||||
try:
|
||||
pacMan_s1 = PacMan()
|
||||
errors += 1
|
||||
print "Error: PacMan should not be available on Server1"
|
||||
except NameError:
|
||||
print "OK: PacMan is not available on server1"
|
||||
|
||||
# Swtich to server2 with globals and switch back to server1 with not updating the globals
|
||||
SetActiveConnection(server2_connection, globals())
|
||||
SetActiveConnection(server1_connection)
|
||||
|
||||
# Create PacMan ==> This should fail
|
||||
try:
|
||||
pacMan_s1 = PacMan()
|
||||
errors += 1
|
||||
print "Error: PacMan should not be available on Server1"
|
||||
except RuntimeError:
|
||||
print "OK: PacMan is not available on server1"
|
||||
|
||||
# Make sure built-in as not the pacMan
|
||||
SetActiveConnection(server2_connection, globals())
|
||||
SetActiveConnection(built_in_connection, globals())
|
||||
try:
|
||||
pacMan_builtin = PacMan()
|
||||
errors += 1
|
||||
print "Error: PacMan should not be available on built-in"
|
||||
except NameError:
|
||||
print "OK: PacMan is not available on built-in"
|
||||
|
||||
# Load plugin localy for built-in
|
||||
# Create PacMan ==> This should be OK on built-in
|
||||
SetActiveConnection(built_in_connection, globals())
|
||||
LoadDistributedPlugin("PacMan", False, globals())
|
||||
pacMan_builtin = PacMan()
|
||||
print "After loading the plugin locally in built-in, the PacMan definition is available"
|
||||
|
||||
# Swtich to server1 and Create PacMan ==> This should fail
|
||||
SetActiveConnection(server1_connection, globals())
|
||||
try:
|
||||
pacMan_s1 = PacMan()
|
||||
errors += 1
|
||||
print "Error: PacMan should not be available on Server1"
|
||||
except NameError:
|
||||
print "OK: PacMan is still not available on server1"
|
||||
|
||||
# Disconnect and quit application...
|
||||
Disconnect()
|
||||
print "Available connections after disconnect: ", servermanager.Connections
|
||||
Disconnect()
|
||||
print "Available connections after disconnect: ", servermanager.Connections
|
||||
Disconnect()
|
||||
print "Available connections after disconnect: ", servermanager.Connections
|
||||
|
||||
if errors > 0:
|
||||
raise RuntimeError, "An error occured during the execution"
|
||||
@ -0,0 +1,150 @@
|
||||
from paraview.simple import *
|
||||
from paraview import servermanager
|
||||
|
||||
import time
|
||||
|
||||
# Make sure the test driver know that process has properly started
|
||||
print "Process started"
|
||||
errors = 0
|
||||
|
||||
#-------------------- Helpers methods ----------------
|
||||
def getHost(url):
|
||||
return url.split(':')[1][2:]
|
||||
|
||||
def getScheme(url):
|
||||
return url.split(':')[0]
|
||||
|
||||
def getPort(url):
|
||||
return int(url.split(':')[2])
|
||||
#--------------------
|
||||
|
||||
print "Start multi-server testing"
|
||||
|
||||
options = servermanager.vtkProcessModule.GetProcessModule().GetOptions()
|
||||
available_server_urls = options.GetServerURL().split('|')
|
||||
built_in_connection = servermanager.ActiveConnection
|
||||
|
||||
# Test if the built-in connection is here
|
||||
if (len(servermanager.Connections) != 1):
|
||||
errors += 1
|
||||
print "Error pvpython should be connected to a built-in session. Currently connected to ", servermanager.Connections
|
||||
|
||||
url = available_server_urls[0]
|
||||
print "Connect to first server ", url
|
||||
server1_connection = Connect(getHost(url), getPort(url))
|
||||
|
||||
# Test that we have one more connection
|
||||
if (len(servermanager.Connections) != 2):
|
||||
errors += 1
|
||||
print "Error pvpython should be connected to a built-in session + one remote one. Currently connected to ", servermanager.Connections
|
||||
|
||||
url = available_server_urls[1]
|
||||
print "Connect to second server ", url
|
||||
server2_connection = Connect(getHost(url), getPort(url))
|
||||
|
||||
# Test that we have one more connection
|
||||
if (len(servermanager.Connections) != 3):
|
||||
errors += 1
|
||||
print "Error pvpython should be connected to a built-in session + two remote one. Currently connected to ", servermanager.Connections
|
||||
|
||||
url = available_server_urls[2]
|
||||
print "Connect to third server ", url
|
||||
server3_connection = Connect(getHost(url), getPort(url))
|
||||
|
||||
# Test that we have one more connection
|
||||
if (len(servermanager.Connections) != 4):
|
||||
errors += 1
|
||||
print "Error pvpython should be connected to a built-in session + three remote one. Currently connected to ", servermanager.Connections
|
||||
|
||||
print "Available connections: ", servermanager.Connections
|
||||
|
||||
# Test that last created connection is the active one
|
||||
if ( servermanager.ActiveConnection != server3_connection):
|
||||
errors += 1
|
||||
print "Error Invalid active connection. Expected ", server3_connection, " and got ", servermanager.ActiveConnection
|
||||
|
||||
# ------- Do the proper RemoteSourceProxy testing --------------
|
||||
|
||||
# Create a set of sphere across the remote sessions
|
||||
SetActiveConnection(server1_connection, globals())
|
||||
rSphere1 = Sphere(ThetaResolution=10, PhiResolution=10)
|
||||
rSphere1.UpdatePipeline()
|
||||
size1 = rSphere1.GetDataInformation().GetNumberOfPoints()
|
||||
|
||||
SetActiveConnection(server2_connection, globals())
|
||||
rSphere2 = Sphere(ThetaResolution=11, PhiResolution=11)
|
||||
rSphere2.UpdatePipeline()
|
||||
size2 = rSphere2.GetDataInformation().GetNumberOfPoints()
|
||||
|
||||
SetActiveConnection(server3_connection, globals())
|
||||
rSphere3 = Sphere(ThetaResolution=12, PhiResolution=12)
|
||||
rSphere3.UpdatePipeline()
|
||||
size3 = rSphere3.GetDataInformation().GetNumberOfPoints()
|
||||
|
||||
# Create remote source on the built-in session
|
||||
SetActiveConnection(built_in_connection, globals())
|
||||
remoteProxy = RemoteSourceProxy()
|
||||
remoteProxy.SetExternalProxy(rSphere1, 0)
|
||||
remoteProxy.UpdatePipeline()
|
||||
|
||||
# Test that the data in built-in is the same size as the remote one
|
||||
remoteProxy.UpdatePipeline()
|
||||
size = remoteProxy.GetDataInformation().GetNumberOfPoints()
|
||||
if ( size1 != size ):
|
||||
errors += 1
|
||||
print "Error Invalid data size. Expected ", size1, " and got ", size
|
||||
else:
|
||||
print "Found size ", size, " for server 1"
|
||||
|
||||
# Switch to proxy on server 2 and test size
|
||||
remoteProxy.SetExternalProxy(rSphere2, 0)
|
||||
remoteProxy.UpdatePipeline()
|
||||
size = remoteProxy.GetDataInformation().GetNumberOfPoints()
|
||||
if ( size2 != size ):
|
||||
errors += 1
|
||||
print "Error Invalid data size. Expected ", size2, " and got ", size
|
||||
else:
|
||||
print "Found size ", size, " for server 2"
|
||||
|
||||
# Switch to proxy on server 3 and test size
|
||||
remoteProxy.SetExternalProxy(rSphere3, 0)
|
||||
remoteProxy.UpdatePipeline()
|
||||
size = remoteProxy.GetDataInformation().GetNumberOfPoints()
|
||||
if ( size3 != size ):
|
||||
errors += 1
|
||||
print "Error Invalid data size. Expected ", size3, " and got ", size
|
||||
else:
|
||||
print "Found size ", size, " for server 3"
|
||||
|
||||
# Change data size on server 3 and make sure the change get propagated to the built-in
|
||||
rSphere3.ThetaResolution = 13
|
||||
rSphere3.PhiResolution = 13
|
||||
rSphere3.UpdatePipeline()
|
||||
size3 = rSphere3.GetDataInformation().GetNumberOfPoints()
|
||||
|
||||
remoteProxy.UpdatePipeline()
|
||||
size = remoteProxy.GetDataInformation().GetNumberOfPoints()
|
||||
if ( size3 != size ):
|
||||
errors += 1
|
||||
print "Error Invalid data size. Expected ", size3, " and got ", size
|
||||
else:
|
||||
print "Found size ", size, " for server 3 after update"
|
||||
|
||||
# Make sure the size is not 0
|
||||
if ( size == 0 or size1 == 0 or size1 == 0 or size1 == 0):
|
||||
errors += 1
|
||||
print "Error Invalid data size. None of them should be 0"
|
||||
|
||||
# --------------------------------------------------------------
|
||||
# Disconnect and quit application...
|
||||
Disconnect()
|
||||
print "Available connections after disconnect: ", servermanager.Connections
|
||||
Disconnect()
|
||||
print "Available connections after disconnect: ", servermanager.Connections
|
||||
Disconnect()
|
||||
print "Available connections after disconnect: ", servermanager.Connections
|
||||
Disconnect()
|
||||
print "Available connections after disconnect: ", servermanager.Connections
|
||||
|
||||
if errors > 0:
|
||||
raise RuntimeError, "An error occured during the execution"
|
||||
@ -0,0 +1,121 @@
|
||||
from paraview.simple import *
|
||||
from paraview import servermanager
|
||||
|
||||
import time
|
||||
|
||||
# Make sure the test driver know that process has properly started
|
||||
print "Process started"
|
||||
errors = 0
|
||||
|
||||
#-------------------- Comparison helper ----------------------
|
||||
|
||||
def equal(a, b):
|
||||
if a == b:
|
||||
return True
|
||||
aList = a.replace(","," ").replace("["," ").replace("]", " ").split(" ")
|
||||
bList = b.replace(","," ").replace("["," ").replace("]", " ").split(" ")
|
||||
size = len(aList)
|
||||
if size != len(bList):
|
||||
return False
|
||||
for i in xrange(size):
|
||||
if len(aList[i]) > 0:
|
||||
af = float(aList[i])
|
||||
bf = float(bList[i])
|
||||
if ((af-bf)*(af-bf)) > 0.000001:
|
||||
return False
|
||||
return True
|
||||
|
||||
#-------------------- Start testing --------------------------
|
||||
|
||||
print "Start PythonAnnotationFilter testing"
|
||||
|
||||
options = servermanager.vtkProcessModule.GetProcessModule().GetOptions()
|
||||
dataToLoad = options.GetParaViewDataName()
|
||||
|
||||
|
||||
# Load data file
|
||||
reader = OpenDataFile(dataToLoad)
|
||||
reader.GlobalVariables = ['KE', 'XMOM', 'YMOM', 'ZMOM', 'NSTEPS', 'TMSTEP']
|
||||
reader.UpdatePipeline()
|
||||
|
||||
# Time management
|
||||
controller = servermanager.ParaViewPipelineController()
|
||||
timekeeper = controller.FindTimeKeeper(servermanager.ActiveConnection.Session)
|
||||
timesteps = timekeeper.TimestepValues
|
||||
time = timesteps[5]
|
||||
|
||||
# Merge blocks
|
||||
merge = MergeBlocks()
|
||||
|
||||
# Annotation filter
|
||||
annotation = PythonAnnotation()
|
||||
annotation.Expression = '"%f %f %f" % (XMOM[t_index], YMOM[t_index], ZMOM[t_index])'
|
||||
|
||||
# Update time and trigger pipeline execution
|
||||
time = timesteps[5]
|
||||
annotation.UpdatePipeline(time)
|
||||
|
||||
annotation.SMProxy.UpdatePropertyInformation()
|
||||
value = annotation.SMProxy.GetProperty('AnnotationValue').GetElement(0)
|
||||
expected = "0.012132 0.001378 -1158.252808"
|
||||
|
||||
if not equal(value, expected):
|
||||
errors += 1
|
||||
print "Error: Expected ", expected, " and got ", value
|
||||
|
||||
# Update time and trigger pipeline execution
|
||||
time = timesteps[7]
|
||||
annotation.UpdatePipeline(time)
|
||||
|
||||
annotation.SMProxy.UpdatePropertyInformation()
|
||||
value = annotation.SMProxy.GetProperty('AnnotationValue').GetElement(0)
|
||||
expected = "0.013970 0.001319 -1141.020020"
|
||||
|
||||
if not equal(value, expected):
|
||||
errors += 1
|
||||
print "Error: Expected ", expected, " and got ", value
|
||||
|
||||
# Check time infos
|
||||
annotation.Expression = '"%i %f %s" % (t_index, t_value, str(t_range))'
|
||||
|
||||
# Update time and trigger pipeline execution
|
||||
time = timesteps[7]
|
||||
annotation.UpdatePipeline(time)
|
||||
|
||||
annotation.SMProxy.UpdatePropertyInformation()
|
||||
value = annotation.SMProxy.GetProperty('AnnotationValue').GetElement(0)
|
||||
expected = "7 0.000700 (0.0, 0.004299988504499197)"
|
||||
|
||||
if not equal(value, expected):
|
||||
errors += 1
|
||||
print "Error: Expected ", expected, " and got ", value
|
||||
|
||||
# Update time and trigger pipeline execution
|
||||
time = timesteps[27]
|
||||
annotation.UpdatePipeline(time)
|
||||
|
||||
annotation.SMProxy.UpdatePropertyInformation()
|
||||
value = annotation.SMProxy.GetProperty('AnnotationValue').GetElement(0)
|
||||
expected = "27 0.002700 (0.0, 0.004299988504499197)"
|
||||
|
||||
if not equal(value, expected):
|
||||
errors += 1
|
||||
print "Error: Expected ", expected, " and got ", value
|
||||
|
||||
# Update time and trigger pipeline execution
|
||||
time = timesteps[len(timesteps)-1]
|
||||
annotation.UpdatePipeline(time)
|
||||
|
||||
annotation.SMProxy.UpdatePropertyInformation()
|
||||
value = annotation.SMProxy.GetProperty('AnnotationValue').GetElement(0)
|
||||
expected = "43 0.004300 (0.0, 0.004299988504499197)"
|
||||
|
||||
if not equal(value, expected):
|
||||
errors += 1
|
||||
print "Error: Expected ", expected, " and got ", value
|
||||
|
||||
# Disconnect and quit application...
|
||||
Disconnect()
|
||||
|
||||
if errors > 0:
|
||||
raise RuntimeError, "An error occured during the execution"
|
||||
@ -0,0 +1,121 @@
|
||||
from paraview.simple import *
|
||||
from paraview import servermanager
|
||||
|
||||
import time
|
||||
|
||||
# Make sure the test driver know that process has properly started
|
||||
print "Process started"
|
||||
errors = 0
|
||||
|
||||
#-------------------- Comparison helper ----------------------
|
||||
|
||||
def equal(a, b):
|
||||
if a == b:
|
||||
return True
|
||||
aList = a.replace(","," ").replace("["," ").replace("]", " ").split(" ")
|
||||
bList = b.replace(","," ").replace("["," ").replace("]", " ").split(" ")
|
||||
size = len(aList)
|
||||
if size != len(bList):
|
||||
return False
|
||||
for i in xrange(size):
|
||||
if len(aList[i]) > 0:
|
||||
af = float(aList[i])
|
||||
bf = float(bList[i])
|
||||
if ((af-bf)*(af-bf)) > 0.000001:
|
||||
return False
|
||||
return True
|
||||
|
||||
#-------------------- Start testing --------------------------
|
||||
|
||||
print "Start PythonAnnotationFilter testing"
|
||||
|
||||
options = servermanager.vtkProcessModule.GetProcessModule().GetOptions()
|
||||
dataToLoad = options.GetParaViewDataName()
|
||||
|
||||
|
||||
# Load data file
|
||||
reader = OpenDataFile(dataToLoad)
|
||||
reader.GlobalVariables = ['KE', 'XMOM', 'YMOM', 'ZMOM', 'NSTEPS', 'TMSTEP']
|
||||
reader.UpdatePipeline()
|
||||
|
||||
# Time management
|
||||
controller = servermanager.ParaViewPipelineController()
|
||||
timekeeper = controller.FindTimeKeeper(servermanager.ActiveConnection.Session)
|
||||
timesteps = timekeeper.TimestepValues
|
||||
time = timesteps[5]
|
||||
|
||||
# Merge blocks
|
||||
### Just skip the merge = MergeBlocks()
|
||||
|
||||
# Annotation filter
|
||||
annotation = PythonAnnotation()
|
||||
annotation.Expression = '"%f %f %f" % (XMOM[t_index], YMOM[t_index], ZMOM[t_index])'
|
||||
|
||||
# Update time and trigger pipeline execution
|
||||
time = timesteps[5]
|
||||
annotation.UpdatePipeline(time)
|
||||
|
||||
annotation.SMProxy.UpdatePropertyInformation()
|
||||
value = annotation.SMProxy.GetProperty('AnnotationValue').GetElement(0)
|
||||
expected = "0.012132 0.001378 -1158.252808"
|
||||
|
||||
if not equal(value, expected):
|
||||
errors += 1
|
||||
print "Error: Expected ", expected, " and got ", value
|
||||
|
||||
# Update time and trigger pipeline execution
|
||||
time = timesteps[7]
|
||||
annotation.UpdatePipeline(time)
|
||||
|
||||
annotation.SMProxy.UpdatePropertyInformation()
|
||||
value = annotation.SMProxy.GetProperty('AnnotationValue').GetElement(0)
|
||||
expected = "0.013970 0.001319 -1141.020020"
|
||||
|
||||
if not equal(value, expected):
|
||||
errors += 1
|
||||
print "Error: Expected ", expected, " and got ", value
|
||||
|
||||
# Check time infos
|
||||
annotation.Expression = '"%i %f %s" % (t_index, t_value, str(t_range))'
|
||||
|
||||
# Update time and trigger pipeline execution
|
||||
time = timesteps[7]
|
||||
annotation.UpdatePipeline(time)
|
||||
|
||||
annotation.SMProxy.UpdatePropertyInformation()
|
||||
value = annotation.SMProxy.GetProperty('AnnotationValue').GetElement(0)
|
||||
expected = "7 0.000700 (0.0, 0.004299988504499197)"
|
||||
|
||||
if not equal(value, expected):
|
||||
errors += 1
|
||||
print "Error: Expected ", expected, " and got ", value
|
||||
|
||||
# Update time and trigger pipeline execution
|
||||
time = timesteps[27]
|
||||
annotation.UpdatePipeline(time)
|
||||
|
||||
annotation.SMProxy.UpdatePropertyInformation()
|
||||
value = annotation.SMProxy.GetProperty('AnnotationValue').GetElement(0)
|
||||
expected = "27 0.002700 (0.0, 0.004299988504499197)"
|
||||
|
||||
if not equal(value, expected):
|
||||
errors += 1
|
||||
print "Error: Expected ", expected, " and got ", value
|
||||
|
||||
# Update time and trigger pipeline execution
|
||||
time = timesteps[len(timesteps)-1]
|
||||
annotation.UpdatePipeline(time)
|
||||
|
||||
annotation.SMProxy.UpdatePropertyInformation()
|
||||
value = annotation.SMProxy.GetProperty('AnnotationValue').GetElement(0)
|
||||
expected = "43 0.004300 (0.0, 0.004299988504499197)"
|
||||
|
||||
if not equal(value, expected):
|
||||
errors += 1
|
||||
print "Error: Expected ", expected, " and got ", value
|
||||
|
||||
# Disconnect and quit application...
|
||||
Disconnect()
|
||||
|
||||
if errors > 0:
|
||||
raise RuntimeError, "An error occured during the execution"
|
||||
@ -0,0 +1,70 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
# Global python import
|
||||
import exceptions, logging, random, sys, threading, time, os
|
||||
|
||||
# Update python path to have ParaView libs
|
||||
build_path='/Volumes/SebKitSSD/Kitware/code/ParaView/build-ninja'
|
||||
sys.path.append('%s/lib'%build_path)
|
||||
sys.path.append('%s/lib/site-packages'%build_path)
|
||||
|
||||
# iPython import
|
||||
#from IPython.display import HTML
|
||||
#from IPython.parallel import Client
|
||||
import paraview
|
||||
from paraview.web import ipython as pv_ipython
|
||||
from vtk import *
|
||||
|
||||
iPythonClient = None
|
||||
paraviewHelper = pv_ipython.ParaViewIPython()
|
||||
webArguments = pv_ipython.WebArguments('/.../path-to-web-directory')
|
||||
|
||||
def _start_paraview():
|
||||
paraviewHelper.Initialize()
|
||||
|
||||
paraviewHelper.SetWebProtocol(IPythonProtocol, webArguments)
|
||||
return paraviewHelper.Start()
|
||||
|
||||
|
||||
def _stop_paraview():
|
||||
paraviewHelper.Finalize()
|
||||
|
||||
|
||||
def _pv_activate_dataset():
|
||||
IPythonProtocol.ActivateDataSet('iPython-demo')
|
||||
|
||||
|
||||
def _push_new_timestep():
|
||||
# processing code generating new vtkDataSet
|
||||
# newDataset = ...
|
||||
IPythonProtocol.RegisterDataSet('iPython-demo', newDataset)
|
||||
|
||||
|
||||
def StartParaView(height=600, path='/apps/WebVisualizer/'):
|
||||
global iPythonClient, paraviewHelper
|
||||
if not iPythonClient:
|
||||
iPythonClient = Client()
|
||||
urls = iPythonClient[:].apply_sync(lambda:_start_paraview())
|
||||
url = ""
|
||||
for i in urls:
|
||||
if len(i) > 0:
|
||||
url = i
|
||||
return HTML("<iframe src='%s/%s' width='100%%' height='%i'></iframe>"%(url, path, height))
|
||||
|
||||
|
||||
def StopParaView():
|
||||
global iPythonClient, paraviewHelper
|
||||
iPythonClient[:].apply_sync(lambda:_stop_paraview())
|
||||
|
||||
|
||||
def ActivateDataSet():
|
||||
iPythonClient[:].apply_sync(lambda:_pv_activate_dataset())
|
||||
|
||||
|
||||
def ComputeNextTimeStep(ds):
|
||||
iPythonClient[:].apply_sync(lambda:_push_new_timestep())
|
||||
|
||||
|
||||
print "Start waiting"
|
||||
time.sleep(10)
|
||||
print "Done"
|
||||
@ -0,0 +1,107 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
# Global python import
|
||||
import exceptions, traceback, logging, random, sys, threading, time, os
|
||||
|
||||
# Update python path to have ParaView libs
|
||||
build_path='/Volumes/SebKitSSD/Kitware/code/ParaView/build-ninja'
|
||||
sys.path.append('%s/lib'%build_path)
|
||||
sys.path.append('%s/lib/site-packages'%build_path)
|
||||
|
||||
# ParaView import
|
||||
from vtk.web import server
|
||||
from paraview.vtk import *
|
||||
from paraview.web import wamp as pv_wamp
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# InLine protocol
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
class TestProtocol(pv_wamp.PVServerProtocol):
|
||||
dataDir = None
|
||||
authKey = "vtkweb-secret"
|
||||
fileToLoad = None
|
||||
groupRegex = "[0-9]+\\."
|
||||
excludeRegex = "^\\.|~$|^\\$"
|
||||
|
||||
@staticmethod
|
||||
def updateArguments(options):
|
||||
TestProtocol.dataDir = options.dataDir
|
||||
TestProtocol.authKey = options.authKey
|
||||
TestProtocol.fileToLoad = options.fileToLoad
|
||||
TestProtocol.authKey = options.authKey
|
||||
TestProtocol.groupRegex = options.groupRegex
|
||||
TestProtocol.excludeRegex = options.excludeRegex
|
||||
|
||||
def initialize(self):
|
||||
from paraview import simple
|
||||
from paraview.web import protocols as pv_protocols
|
||||
|
||||
# Bring used components
|
||||
self.registerVtkWebProtocol(pv_protocols.ParaViewWebFileListing(TestProtocol.dataDir, "Home", TestProtocol.excludeRegex, TestProtocol.groupRegex))
|
||||
self.registerVtkWebProtocol(pv_protocols.ParaViewWebPipelineManager(TestProtocol.dataDir, TestProtocol.fileToLoad))
|
||||
self.registerVtkWebProtocol(pv_protocols.ParaViewWebMouseHandler())
|
||||
self.registerVtkWebProtocol(pv_protocols.ParaViewWebViewPort())
|
||||
self.registerVtkWebProtocol(pv_protocols.ParaViewWebViewPortImageDelivery())
|
||||
self.registerVtkWebProtocol(pv_protocols.ParaViewWebViewPortGeometryDelivery())
|
||||
self.registerVtkWebProtocol(pv_protocols.ParaViewWebTimeHandler())
|
||||
self.registerVtkWebProtocol(pv_protocols.ParaViewWebRemoteConnection())
|
||||
self.registerVtkWebProtocol(pv_protocols.ParaViewWebFileManager(TestProtocol.dataDir))
|
||||
|
||||
# Update authentication key to use
|
||||
self.updateSecret(TestProtocol.authKey)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# ParaView Test default arguments
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
class WebArguments(object):
|
||||
|
||||
def __init__(self, webDir = None):
|
||||
self.content = webDir
|
||||
self.port = 8080
|
||||
self.host = 'localhost'
|
||||
self.debug = 0
|
||||
self.timeout = 120
|
||||
self.nosignalhandlers = True
|
||||
self.authKey = 'vtkweb-secret'
|
||||
self.uploadDir = ""
|
||||
self.testScriptPath = ""
|
||||
self.baselineImgDir = ""
|
||||
self.useBrowser = ""
|
||||
self.tmpDirectory = ""
|
||||
self.testImgFile = ""
|
||||
self.forceFlush = False
|
||||
self.dataDir = '.'
|
||||
self.groupRegex = "[0-9]+\\."
|
||||
self.excludeRegex = "^\\.|~$|^\\$"
|
||||
self.fileToLoad = None
|
||||
|
||||
|
||||
def __str__(self):
|
||||
return "http://%s:%d/%s" % (self.host, self.port, self.content)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Start server
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
def start():
|
||||
args = WebArguments('%s/www' % build_path)
|
||||
TestProtocol.updateArguments(args)
|
||||
server.start_webserver(options=args, protocol=TestProtocol)
|
||||
|
||||
def start_thread():
|
||||
thread = threading.Thread(target=start)
|
||||
print "Starting thread"
|
||||
thread.start()
|
||||
for i in range(20):
|
||||
print "Working... %ds" % (i*5)
|
||||
time.sleep(5)
|
||||
thread.join()
|
||||
print "Done"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Main
|
||||
#------------------------------------------------------------------------------
|
||||
if __name__ == "__main__":
|
||||
start_thread()
|
||||
@ -0,0 +1,93 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
# Global python import
|
||||
import exceptions, traceback, logging, random, sys, threading, time, os
|
||||
|
||||
# Update python path to have ParaView libs
|
||||
build_path='/Volumes/SebKitSSD/Kitware/code/ParaView/build-ninja'
|
||||
sys.path.append('%s/lib'%build_path)
|
||||
sys.path.append('%s/lib/site-packages'%build_path)
|
||||
|
||||
# ParaView import
|
||||
from vtk.web import server
|
||||
from paraview.vtk import *
|
||||
from paraview.web import wamp as pv_wamp
|
||||
from paraview.web import ipython as pv_ipython
|
||||
|
||||
from vtkCommonCorePython import *
|
||||
from vtkCommonDataModelPython import *
|
||||
from vtkCommonExecutionModelPython import *
|
||||
from vtkFiltersSourcesPython import *
|
||||
from vtkParallelCorePython import *
|
||||
from vtkParaViewWebCorePython import *
|
||||
from vtkPVClientServerCoreCorePython import *
|
||||
from vtkPVServerManagerApplicationPython import *
|
||||
from vtkPVServerManagerCorePython import *
|
||||
from vtkPVVTKExtensionsCorePython import *
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# InLine protocol
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
class TestProtocol(pv_wamp.PVServerProtocol):
|
||||
dataDir = None
|
||||
authKey = "vtkweb-secret"
|
||||
fileToLoad = None
|
||||
groupRegex = "[0-9]+\\."
|
||||
excludeRegex = "^\\.|~$|^\\$"
|
||||
|
||||
@staticmethod
|
||||
def updateArguments(options):
|
||||
TestProtocol.dataDir = options.dataDir
|
||||
TestProtocol.authKey = options.authKey
|
||||
TestProtocol.fileToLoad = options.fileToLoad
|
||||
TestProtocol.authKey = options.authKey
|
||||
TestProtocol.groupRegex = options.groupRegex
|
||||
TestProtocol.excludeRegex = options.excludeRegex
|
||||
|
||||
def initialize(self):
|
||||
from paraview import simple
|
||||
from paraview.web import protocols as pv_protocols
|
||||
|
||||
# Bring used components
|
||||
self.registerVtkWebProtocol(pv_protocols.ParaViewWebFileListing(TestProtocol.dataDir, "Home", TestProtocol.excludeRegex, TestProtocol.groupRegex))
|
||||
self.registerVtkWebProtocol(pv_protocols.ParaViewWebPipelineManager(TestProtocol.dataDir, TestProtocol.fileToLoad))
|
||||
self.registerVtkWebProtocol(pv_protocols.ParaViewWebMouseHandler())
|
||||
self.registerVtkWebProtocol(pv_protocols.ParaViewWebViewPort())
|
||||
self.registerVtkWebProtocol(pv_protocols.ParaViewWebViewPortImageDelivery())
|
||||
self.registerVtkWebProtocol(pv_protocols.ParaViewWebViewPortGeometryDelivery())
|
||||
self.registerVtkWebProtocol(pv_protocols.ParaViewWebTimeHandler())
|
||||
self.registerVtkWebProtocol(pv_protocols.ParaViewWebRemoteConnection())
|
||||
self.registerVtkWebProtocol(pv_protocols.ParaViewWebFileManager(TestProtocol.dataDir))
|
||||
|
||||
# Update authentication key to use
|
||||
self.updateSecret(TestProtocol.authKey)
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Start server
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
paraviewHelper = pv_ipython.ParaViewIPython()
|
||||
webArguments = pv_ipython.WebArguments('%s/www' % build_path)
|
||||
|
||||
def start():
|
||||
paraviewHelper.Initialize(os.path.join(os.getcwd(), 'Testing', 'Temporary', 'mpi-python'))
|
||||
paraviewHelper.SetWebProtocol(TestProtocol, webArguments)
|
||||
return paraviewHelper.Start()
|
||||
|
||||
def start_thread():
|
||||
thread = threading.Thread(target=start)
|
||||
print "Starting thread"
|
||||
thread.start()
|
||||
for i in range(20):
|
||||
print "Working... %ds" % (i*5)
|
||||
time.sleep(5)
|
||||
thread.join()
|
||||
print "Done"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Main
|
||||
#------------------------------------------------------------------------------
|
||||
if __name__ == "__main__":
|
||||
start_thread()
|
||||
@ -0,0 +1,72 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
# Global python import
|
||||
import exceptions, traceback, logging, random, sys, threading, time, os
|
||||
|
||||
# Update python path to have ParaView libs
|
||||
build_path='/Volumes/SebKitSSD/Kitware/code/ParaView/build-ninja'
|
||||
sys.path.append('%s/lib'%build_path)
|
||||
sys.path.append('%s/lib/site-packages'%build_path)
|
||||
|
||||
# ParaView import
|
||||
from vtk.web import server
|
||||
from paraview.vtk import *
|
||||
from paraview.web import wamp as pv_wamp
|
||||
from paraview.web import ipython as pv_ipython
|
||||
|
||||
from vtkCommonCorePython import *
|
||||
from vtkCommonDataModelPython import *
|
||||
from vtkCommonExecutionModelPython import *
|
||||
from vtkFiltersSourcesPython import *
|
||||
from vtkParallelCorePython import *
|
||||
from vtkParaViewWebCorePython import *
|
||||
from vtkPVClientServerCoreCorePython import *
|
||||
from vtkPVServerManagerApplicationPython import *
|
||||
from vtkPVServerManagerCorePython import *
|
||||
from vtkPVVTKExtensionsCorePython import *
|
||||
from vtk import *
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Start server
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
paraviewHelper = pv_ipython.ParaViewIPython()
|
||||
webArguments = pv_ipython.WebArguments('%s/www' % build_path)
|
||||
sphere = None
|
||||
|
||||
def start():
|
||||
paraviewHelper.Initialize(os.path.join(os.getcwd(), 'Testing', 'Temporary', 'mpi-python'))
|
||||
pv_ipython.IPythonProtocol.updateArguments(webArguments)
|
||||
paraviewHelper.SetWebProtocol(pv_ipython.IPythonProtocol, webArguments)
|
||||
return paraviewHelper.Start()
|
||||
|
||||
def start_thread():
|
||||
# Register some data at startup
|
||||
global sphere
|
||||
position = [random.random() * 2, random.random() * 2, random.random() * 2]
|
||||
sphere = vtkSphereSource()
|
||||
sphere.SetCenter(position)
|
||||
sphere.Update()
|
||||
pv_ipython.IPythonProtocol.RegisterDataSet('iPython-demo', sphere.GetOutput())
|
||||
|
||||
# Start root+satelites
|
||||
thread = threading.Thread(target=start)
|
||||
print "Starting thread"
|
||||
thread.start()
|
||||
for i in range(20):
|
||||
print "Working... %ds" % (i*5)
|
||||
position = [random.random() * 2, random.random() * 2, random.random() * 2]
|
||||
print position
|
||||
sphere.SetCenter(position)
|
||||
sphere.Update()
|
||||
pv_ipython.IPythonProtocol.RegisterDataSet('iPython-demo', sphere.GetOutput())
|
||||
time.sleep(5)
|
||||
pv_ipython.IPythonProtocol.ActivateDataSet('iPython-demo')
|
||||
thread.join()
|
||||
print "Done"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Main
|
||||
#------------------------------------------------------------------------------
|
||||
if __name__ == "__main__":
|
||||
start_thread()
|
||||
@ -0,0 +1,24 @@
|
||||
import unittest
|
||||
|
||||
from paraview import simple
|
||||
from paraview import servermanager
|
||||
|
||||
|
||||
class TestSimpleModule(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.pxm = servermanager.ProxyManager()
|
||||
|
||||
def test_RenameSource(self):
|
||||
source = simple.Sphere(guiName='oldName')
|
||||
simple.SetActiveSource(source)
|
||||
simple.RenameSource('newName')
|
||||
# changing the source name should unregister the old name
|
||||
self.assertEqual(None, self.pxm.GetProxy('sources', 'oldName'))
|
||||
self.assertEqual(source, self.pxm.GetProxy('sources', 'newName'))
|
||||
# renaming as the current name should not unregister the source
|
||||
simple.RenameSource('newName')
|
||||
self.assertEqual(source, self.pxm.GetProxy('sources', 'newName'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@ -0,0 +1,70 @@
|
||||
# Set up a basic scene for rendering.
|
||||
from paraview.simple import *
|
||||
import os
|
||||
import sys
|
||||
|
||||
script = """
|
||||
import paraview.numpy_support
|
||||
|
||||
# Utility to get next color
|
||||
def getNextColor():
|
||||
colors = 'bgrcmykw'
|
||||
for c in colors:
|
||||
yield c
|
||||
|
||||
# This function must be defined. It is where specific data arrays are requested.
|
||||
def setup_data(view):
|
||||
print "Setting up data"
|
||||
|
||||
# This function must be defined. It is where the actual rendering commands for matplotlib go.
|
||||
def render(view,width,height):
|
||||
from paraview import python_view
|
||||
figure = python_view.matplotlib_figure(width,height)
|
||||
|
||||
ax = figure.add_subplot(111)
|
||||
ax.hold = True
|
||||
numObjects = view.GetNumberOfVisibleDataObjects()
|
||||
print "num visible objects: ", numObjects
|
||||
for i, color in zip(xrange(0,numObjects), getNextColor()):
|
||||
dataObject = view.GetVisibleDataObjectForRendering(i)
|
||||
if dataObject:
|
||||
vtk_points = dataObject.GetPoints()
|
||||
if vtk_points:
|
||||
vtk_points_data = vtk_points.GetData()
|
||||
pts = paraview.numpy_support.vtk_to_numpy(vtk_points_data)
|
||||
x, y = pts[:,0], pts[:,1]
|
||||
ax.scatter(x, y, color=color)
|
||||
|
||||
ax.hold = False
|
||||
|
||||
return python_view.figure_to_image(figure)
|
||||
"""
|
||||
|
||||
view = CreateView("PythonView")
|
||||
view.Script = script
|
||||
|
||||
cone = Cone()
|
||||
Show(cone, view)
|
||||
|
||||
sphere = Sphere()
|
||||
Show(sphere, view)
|
||||
|
||||
Render()
|
||||
|
||||
try:
|
||||
baselineIndex = sys.argv.index('-B')+1
|
||||
baselinePath = sys.argv[baselineIndex]
|
||||
except:
|
||||
print "Could not get baseline directory. Test failed."
|
||||
|
||||
baseline_file = os.path.join(baselinePath, "TestPythonViewMatplotlibScript.png")
|
||||
import vtk.test.Testing
|
||||
vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
|
||||
vtk.test.Testing.compareImage(view.GetRenderWindow(), baseline_file, threshold=25)
|
||||
vtk.test.Testing.interact()
|
||||
|
||||
Delete(cone)
|
||||
del cone
|
||||
|
||||
Delete(sphere)
|
||||
del sphere
|
||||
@ -0,0 +1,42 @@
|
||||
# Set up a basic scene for rendering.
|
||||
from paraview.simple import *
|
||||
import sys
|
||||
|
||||
script = """
|
||||
import numpy
|
||||
import paraview.numpy_support
|
||||
|
||||
def setup_data(view):
|
||||
# Don't actually need any data
|
||||
pass
|
||||
|
||||
def render(view, width, height):
|
||||
cb = numpy.zeros((height, width, 4), dtype=numpy.uint8)
|
||||
for i in xrange(width):
|
||||
cb[:,i,0] = i%255
|
||||
|
||||
for i in xrange(height):
|
||||
cb[i,:,1] = i%255
|
||||
|
||||
from paraview.python_view import numpy_to_image
|
||||
|
||||
return numpy_to_image(cb)
|
||||
"""
|
||||
|
||||
view = CreateView("PythonView")
|
||||
view.Script = script
|
||||
|
||||
Render()
|
||||
|
||||
try:
|
||||
baselineIndex = sys.argv.index('-B')+1
|
||||
baselinePath = sys.argv[baselineIndex]
|
||||
except:
|
||||
print "Could not get baseline directory. Test failed."
|
||||
|
||||
import os
|
||||
baseline_file = os.path.join(baselinePath, "TestPythonViewNumpyScript.png")
|
||||
import vtk.test.Testing
|
||||
vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
|
||||
vtk.test.Testing.compareImage(view.GetRenderWindow(), baseline_file, threshold=25)
|
||||
vtk.test.Testing.interact()
|
||||
@ -0,0 +1,53 @@
|
||||
# Set up a basic scene for rendering.
|
||||
from paraview.simple import *
|
||||
import sys
|
||||
|
||||
script = """
|
||||
import vtk
|
||||
|
||||
def setup_data(view):
|
||||
# Don't actually need any data
|
||||
pass
|
||||
|
||||
def render(view, width, height):
|
||||
canvas = vtk.vtkImageCanvasSource2D()
|
||||
canvas.SetExtent(0, width-1, 0, height-1, 0, 0)
|
||||
canvas.SetNumberOfScalarComponents(3)
|
||||
canvas.SetScalarTypeToUnsignedChar()
|
||||
canvas.SetDrawColor(0, 0, 0)
|
||||
canvas.FillBox(0,width-1,0,height-1)
|
||||
canvas.SetDrawColor(255, 255, 0)
|
||||
canvas.DrawCircle(int(width/2), int(height/2), 10)
|
||||
canvas.SetDrawColor(255, 0, 0)
|
||||
canvas.FillTube(10, 10, 30, 200, 7)
|
||||
canvas.SetDrawColor(0, 0, 255)
|
||||
canvas.FillTriangle(width-20, height-20,
|
||||
int(width/2)+10, int(height/2)-10,
|
||||
width - 100, height - 150)
|
||||
canvas.Update()
|
||||
|
||||
image = vtk.vtkImageData()
|
||||
image.DeepCopy(canvas.GetOutput())
|
||||
|
||||
print image
|
||||
|
||||
return image
|
||||
"""
|
||||
|
||||
view = CreateView("PythonView")
|
||||
view.Script = script
|
||||
|
||||
Render()
|
||||
|
||||
try:
|
||||
baselineIndex = sys.argv.index('-B')+1
|
||||
baselinePath = sys.argv[baselineIndex]
|
||||
except:
|
||||
print "Could not get baseline directory. Test failed."
|
||||
|
||||
import os
|
||||
baseline_file = os.path.join(baselinePath, "TestPythonViewScript.png")
|
||||
import vtk.test.Testing
|
||||
vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
|
||||
vtk.test.Testing.compareImage(view.GetRenderWindow(), baseline_file, threshold=25)
|
||||
vtk.test.Testing.interact()
|
||||
@ -0,0 +1,56 @@
|
||||
import os
|
||||
import random
|
||||
import textwrap
|
||||
|
||||
from paraview import servermanager
|
||||
import paraview.simple as smp
|
||||
|
||||
|
||||
# Make sure the test driver know that process has properly started
|
||||
print "Process started"
|
||||
|
||||
|
||||
def getHost(url):
|
||||
return url.split(':')[1][2:]
|
||||
|
||||
|
||||
def getPort(url):
|
||||
return int(url.split(':')[2])
|
||||
|
||||
|
||||
def testScript(programmableFilter, script):
|
||||
|
||||
arrayName = str(random.random())
|
||||
programmableFilter.Script = script + textwrap.dedent('''
|
||||
passedArray = vtk.vtkIntArray()
|
||||
passedArray.SetName('%s')
|
||||
self.GetOutput().GetFieldData().AddArray(passedArray)''' % arrayName)
|
||||
|
||||
programmableFilter.UpdatePipeline()
|
||||
return programmableFilter.FieldData.GetArray(arrayName) is not None
|
||||
|
||||
|
||||
def runTest():
|
||||
|
||||
options = servermanager.vtkProcessModule.GetProcessModule().GetOptions()
|
||||
url = options.GetServerURL()
|
||||
|
||||
smp.Connect(getHost(url), getPort(url))
|
||||
|
||||
sphere = smp.Sphere()
|
||||
|
||||
f = smp.ProgrammableFilter(sphere)
|
||||
|
||||
# test that vtk is imported automatically and contains the name vtkPolyData
|
||||
script = 'assert vtk.vtkPolyData'
|
||||
assert testScript(f, script)
|
||||
|
||||
# test that variables can be passed using the Parameters property
|
||||
script = 'assert foo == "bar"'
|
||||
f.SetPropertyWithName('Parameters', ['foo', '"bar"'])
|
||||
assert testScript(f, script)
|
||||
|
||||
smp.Disconnect()
|
||||
|
||||
|
||||
runTest()
|
||||
@ -0,0 +1,25 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
import QtTesting
|
||||
import sys
|
||||
|
||||
libname = 'libGUIMyToolBar.so'
|
||||
if sys.platform == 'win32':
|
||||
libname = 'GUIMyToolBar.dll'
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
libname = 'libGUIMyToolBar.dylib'
|
||||
|
||||
object1 = 'pqClientMainWindow/menubar/menuTools'
|
||||
QtTesting.playCommand(object1, 'activate', 'actionManage_Plugins')
|
||||
object2 = "pqClientMainWindow/pqPluginDialog/localGroup/loadLocal"
|
||||
QtTesting.playCommand(object2, 'activate', '')
|
||||
object3 = 'pqClientMainWindow/pqPluginDialog/pqFileDialog'
|
||||
QtTesting.playCommand(object3, 'filesSelected', libname)
|
||||
object4 = 'pqClientMainWindow/pqPluginDialog/buttonBox/1QPushButton0'
|
||||
QtTesting.playCommand(object4, 'activate', '')
|
||||
object5 = 'pqClientMainWindow/MyActions/1QToolButton0'
|
||||
QtTesting.playCommand(object5, 'activate', '')
|
||||
object6 = '1QMessageBox0/qt_msgbox_buttonbox/1QPushButton0'
|
||||
QtTesting.playCommand(object6, 'activate', '')
|
||||
|
||||
Reference in New Issue
Block a user