Commit 064836e7 authored by Timothy M. Shead's avatar Timothy M. Shead
Browse files

ENH: Remove pqTesting class, QtTest already provides identical functionality

parent 1b484d28
......@@ -3,6 +3,7 @@ PROJECT(QtTesting)
INCLUDE_DIRECTORIES(
${QtTesting_BINARY_DIR}
${QtTesting_SOURCE_DIR}
${QT_QTTEST_INCLUDE_DIR}
${VTK_INCLUDE_DIR}
)
......@@ -84,8 +85,6 @@ ADD_LIBRARY(QtTesting
pqRecordEventsDialog.h
pqSpinBoxEventTranslator.cxx
pqSpinBoxEventTranslator.h
pqTesting.cxx
pqTesting.h
pqWidgetEventPlayer.h
pqWidgetEventTranslator.h
${MOC_BUILT_SOURCES}
......@@ -98,8 +97,8 @@ SOURCE_GROUP("Generated" FILES
)
TARGET_LINK_LIBRARIES(QtTesting
${QT_LIBRARIES}
${QT_XML_LIBRARIES}
${QT_LIBRARIES}
${QT_QTTEST_LIBRARY}
)
INSTALL(TARGETS QtTesting
......
......@@ -31,7 +31,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#include "pqAbstractActivateEventPlayer.h"
#include "pqTesting.h"
#include <QAction>
#include <QApplication>
......@@ -39,6 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QMenu>
#include <QMenuBar>
#include <QPushButton>
#include <QtTest>
#include <QtDebug>
pqAbstractActivateEventPlayer::pqAbstractActivateEventPlayer()
......@@ -94,7 +94,7 @@ bool pqAbstractActivateEventPlayer::playEvent(QObject* Object,
{
menu_bar->setActiveAction(next->menuAction());
while(!next->isVisible())
pqTesting::NonBlockingSleep(100);
QTest::qWait(100);
}
else if(QMenu* menu = qobject_cast<QMenu*>(p))
{
......@@ -112,7 +112,7 @@ bool pqAbstractActivateEventPlayer::playEvent(QObject* Object,
QApplication::sendEvent(menu, &button_release);
while(!next->isVisible())
pqTesting::NonBlockingSleep(100);
QTest::qWait(100);
}
}
......
......@@ -31,7 +31,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#include "pqBasicWidgetEventPlayer.h"
#include "pqTesting.h"
#include <QApplication>
#include <QContextMenuEvent>
......
......@@ -39,7 +39,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "pqBasicWidgetEventPlayer.h"
#include "pqEventPlayer.h"
#include "pqObjectNaming.h"
#include "pqTesting.h"
#include <QApplication>
#include <QObject>
......
/*=========================================================================
Program: ParaView
Module: pqTesting.cxx
Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.1.
See License_v1.1.txt for the full ParaView license.
A copy of this license can be obtained by contacting
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065
USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#include "pqTesting.h"
#include <QCoreApplication>
#include <QTime>
#ifdef Q_OS_UNIX
#include <time.h>
#endif
#ifdef Q_OS_WIN32
#include <windows.h>
#endif
void pqTesting::NonBlockingSleep(int Milliseconds)
{
QTime timer;
timer.start();
while(timer.elapsed() < Milliseconds)
{
QCoreApplication::processEvents(QEventLoop::AllEvents, Milliseconds);
#ifdef Q_OS_WIN32
Sleep(Milliseconds / 10);
#else
struct timespec ts = { 0, 0 };
ts.tv_nsec = Milliseconds * 1000 * 1000 / 10;
nanosleep(&ts, NULL);
#endif
}
}
/*=========================================================================
Program: ParaView
Module: pqTesting.h
Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.1.
See License_v1.1.txt for the full ParaView license.
A copy of this license can be obtained by contacting
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065
USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#ifndef _pqTesting_h
#define _pqTesting_h
#include "QtTestingExport.h"
/// General-purpose regression-test-related functionality that doesn't fit anywhere else
class QTTESTING_EXPORT pqTesting
{
public:
/// Provides a portable Sleep() that doesn't block processing of UI events
static void NonBlockingSleep(int Milliseconds);
};
#endif // !_pqTesting_h
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