Commit 7de86c89 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Added support for testing streaming.

Added a new test to test AMR outline streaming. Currently only builtin test
is supported. Need to extend smTestDriver for streaming to add client-server
tests.

Change-Id: Ib6ed13b4c205f5c065bd9f9118c07d3e7ec962dd
parent 977eb537
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/MainControlsToolbar/actionOpenData" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FileOpenDialog" command="filesSelected" arguments="@smooth_flash@" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ArrayStatus/SelectionWidget" command="setCheckState" arguments="6.0,2" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<!-- stop automatic streaming -->
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="stop_streaming" />
<!-- switch to a representation that supports streaming -->
<pqevent object="pqClientMainWindow/representationToolbar/displayRepresentation/comboBox" command="set_string" arguments="AMR Blocks" />
<!-- step down the streaming updates a few times -->
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow/cameraToolbar/actionPositiveY" command="activate" arguments="" />
</pqevents>
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/MainControlsToolbar/actionOpenData" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FileOpenDialog" command="filesSelected" arguments="@smooth_flash@" />
<pqevent object="pqClientMainWindow/pqSelectReaderDialog/listWidget" command="mousePress" arguments="1,1,0,81,5,/0:0" />
<pqevent object="pqClientMainWindow/pqSelectReaderDialog/listWidget" command="mouseRelease" arguments="1,0,0,81,5,/0:0" />
<pqevent object="pqClientMainWindow/pqSelectReaderDialog/okButton" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ArrayStatus/SelectionWidget" command="setCheckState" arguments="6.0,2" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<!-- stop automatic streaming -->
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="stop_streaming" />
<!-- switch to a representation that supports streaming -->
<pqevent object="pqClientMainWindow/representationToolbar/displayRepresentation/comboBox" command="set_string" arguments="AMR Blocks" />
<!-- step down the streaming updates a few times -->
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow/cameraToolbar/actionPositiveY" command="activate" arguments="" />
</pqevents>
......@@ -147,6 +147,54 @@ SET (TESTS_WITH_BASELINES
# ${CMAKE_CURRENT_SOURCE_DIR}/XYBarChart.xml
)
#------------------------------------------------------------------------------
# Add streaming tests.
# We need to locate smooth.flash since it's not included in the default testing
# datasets.
find_file(smooth_flash NAMES smooth.flash
DOC "Path to smooth.flash data file."
NO_DEFAULT_PATH)
mark_as_advanced(smooth_flash)
if (EXISTS "${smooth_flash}" AND PARAVIEW_DATA_ROOT)
if (PARAVIEW_USE_VISITBRIDGE)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/AMRStreaming.VisIt.xml.in"
"${CMAKE_CURRENT_BINARY_DIR}/AMRStreaming.xml" @ONLY)
else()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/AMRStreaming.NoVisIt.xml.in"
"${CMAKE_CURRENT_BINARY_DIR}/AMRStreaming.xml" @ONLY)
endif()
set (streaming_tests
${CMAKE_CURRENT_BINARY_DIR}/AMRStreaming.xml)
set(AMRStreaming_USE_NEW_PANELS TRUE)
foreach (tname ${streaming_tests})
add_pv_test("pv" "_DISABLE_C"
COMMAND --client ${CLIENT_EXECUTABLE}
-dr
--enable-streaming
--disable-light-kit
--test-directory=${PARAVIEW_TEST_DIR}
BASELINE_DIR ${PARAVIEW_DATA_ROOT}/Baseline
TEST_SCRIPTS ${tname})
# testing framework doesn't allow adding of arguments of pvserver. We need
# to extend testing framework to pass in enable-streaming argument.
#add_pv_test(pvcs "_DISABLE_CS"
# COMMAND
# --server $<TARGET_FILE:pvserver> --enable-streaming
# --client ${CLIENT_EXECUTABLE}
# -dr
# --enable-streaming
# --disable-light-kit
# --test-directory=${PARAVIEW_TEST_DIR}
# BASELINE_DIR ${PARAVIEW_DATA_ROOT}/Baseline
# TEST_SCRIPTS ${tname})
endforeach()
endif()
#------------------------------------------------------------------------------
# Probe picking does not work in render server mode
set(ProbePicking_DISABLE_CRS TRUE)
......
......@@ -33,6 +33,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "pqActiveObjects.h"
#include "pqApplicationCore.h"
#include "pqCoreTestUtility.h"
#include "pqEventPlayer.h"
#include "pqWidgetEventPlayer.h"
#include "pqServer.h"
#include "pqServerManagerModel.h"
#include "pqView.h"
......@@ -43,10 +46,54 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkSMRenderViewProxy.h"
#include "vtkSMSession.h"
class pqStreamingTestingEventPlayer : public pqWidgetEventPlayer
{
typedef pqWidgetEventPlayer Superclass;
public:
QPointer<pqViewStreamingBehavior> StreamingBehavior;
pqStreamingTestingEventPlayer(QObject* p) : Superclass(p) { }
virtual bool playEvent(QObject*,
const QString& command, const QString& arguments, bool& error)
{
if (command == "pqViewStreamingBehavior" && this->StreamingBehavior)
{
if (arguments == "stop_streaming")
{
this->StreamingBehavior->stopAutoUpdates();
}
else if (arguments == "resume_streaming")
{
this->StreamingBehavior->resumeAutoUpdates();
}
else if (arguments == "next")
{
this->StreamingBehavior->triggerSingleUpdate();
}
else
{
error = true;
}
return true;
}
else
{
return false;
}
}
};
//-----------------------------------------------------------------------------
pqViewStreamingBehavior::pqViewStreamingBehavior(QObject* parentObject)
: Superclass(parentObject), Pass(0), DelayUpdate(false)
: Superclass(parentObject), Pass(0), DelayUpdate(false), DisableAutomaticUpdates(false)
{
pqStreamingTestingEventPlayer* player = new pqStreamingTestingEventPlayer(NULL);
player->StreamingBehavior = this;
// the testUtility takes ownership of the player.
pqApplicationCore::instance()->testUtility()->eventPlayer()->addWidgetEventPlayer(
player);
pqServerManagerModel* smmodel =
pqApplicationCore::instance()->getServerManagerModel();
QObject::connect(smmodel, SIGNAL(viewAdded(pqView*)),
......@@ -88,7 +135,10 @@ void pqViewStreamingBehavior::onViewUpdated(
{
vtkStreamingStatusMacro("View updated. Restarting streaming loop.");
this->Pass = 0;
this->Timer.start(1000);
if (!this->DisableAutomaticUpdates)
{
this->Timer.start(1000);
}
rvProxy->GetInteractor()->AddObserver(
vtkCommand::StartInteractionEvent,
this, &pqViewStreamingBehavior::onStartInteractionEvent);
......@@ -139,7 +189,14 @@ void pqViewStreamingBehavior::onTimeout()
if (to_continue)
{
this->Pass++;
this->Timer.start(0);
if (this->DisableAutomaticUpdates)
{
vtkStreamingStatusMacro("Pausing, since automatic updates are disabled.");
}
else
{
this->Timer.start(0);
}
}
else
{
......@@ -148,3 +205,26 @@ void pqViewStreamingBehavior::onTimeout()
}
}
}
//-----------------------------------------------------------------------------
void pqViewStreamingBehavior::stopAutoUpdates()
{
vtkStreamingStatusMacro("Pausing automatic updates.");
this->Timer.stop();
this->DisableAutomaticUpdates = true;
}
//-----------------------------------------------------------------------------
void pqViewStreamingBehavior::resumeAutoUpdates()
{
vtkStreamingStatusMacro("Resuming automatic updates.");
this->Timer.start(1000);
this->DisableAutomaticUpdates = false;
}
//-----------------------------------------------------------------------------
void pqViewStreamingBehavior::triggerSingleUpdate()
{
vtkStreamingStatusMacro("Trigger single automatic updates.");
this->onTimeout();
}
......@@ -50,6 +50,12 @@ public:
pqViewStreamingBehavior(QObject* parent=0);
virtual ~pqViewStreamingBehavior();
/// This API is for testing purposes. It enables pausing/stepping/resuming
/// automatic updates.
void stopAutoUpdates();
void resumeAutoUpdates();
void triggerSingleUpdate();
protected slots:
void onViewAdded(pqView*);
void onViewUpdated(vtkObject*, unsigned long, void*);
......@@ -60,6 +66,7 @@ private:
QTimer Timer;
int Pass;
bool DelayUpdate;
bool DisableAutomaticUpdates;
void onStartInteractionEvent();
void onEndInteractionEvent();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment