summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@jollamobile.com>2013-05-28 11:31:56 +0000
committerRobin Burchell <robin+qt@viroteck.net>2013-06-11 01:02:03 +0200
commita23a23cbcfa27366da9d12e535899864f6eb4cbd (patch)
tree0772239acb4865914e4075d0fffb5c66fb8bc6b3 /src
parent7c357e999dec36f4c990671dd0e082c08150c915 (diff)
Remove QUICK_TEST_SCENEGRAPH.HEADmaster
This is outdated (QSGView and friends are long gone) and not really needed given that Qt 5 has its own copy of this code living in qtdeclarative. Change-Id: I947366ce280a87c59c9e60f6665f8c6ab52b832f Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au>
Diffstat (limited to 'src')
-rw-r--r--src/quicktestlib/quicktest.cpp193
-rw-r--r--src/quicktestlib/quicktestevent.cpp30
2 files changed, 65 insertions, 158 deletions
diff --git a/src/quicktestlib/quicktest.cpp b/src/quicktestlib/quicktest.cpp
index b7c42dc..029b8d7 100644
--- a/src/quicktestlib/quicktest.cpp
+++ b/src/quicktestlib/quicktest.cpp
@@ -48,10 +48,6 @@
#include <QtDeclarative/qdeclarativeview.h>
#include <QtDeclarative/qdeclarativeengine.h>
#include <QtDeclarative/qdeclarativecontext.h>
-#if defined(QML_VERSION) && QML_VERSION >= 0x020000
-#include <QtDeclarative/qsgview.h>
-#define QUICK_TEST_SCENEGRAPH 1
-#endif
#include <QtScript/qscriptvalue.h>
#include <QtScript/qscriptcontext.h>
#include <QtScript/qscriptengine.h>
@@ -119,11 +115,9 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport
// -import dir Specify an import directory.
// -input dir Specify the input directory for test cases.
// -translation file Specify a .qm file to load
- // -qtquick2 Run with QtQuick 2 rather than QtQuick 1.
QStringList imports;
QStringList qmfiles;
QString testPath;
- bool qtQuick2 = false;
int outargc = 1;
int index = 1;
while (index < argc) {
@@ -135,9 +129,6 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport
index += 2;
} else if (strcmp(argv[index], "-opengl") == 0) {
++index;
- } else if (strcmp(argv[index], "-qtquick2") == 0) {
- qtQuick2 = true;
- ++index;
} else if (strcmp(argv[index], "-translation") == 0) {
qmfiles += stripQuotes(QString::fromLocal8Bit(argv[index + 1]));
index += 2;
@@ -191,132 +182,66 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport
// Scan through all of the "tst_*.qml" files and run each of them
// in turn with a QDeclarativeView.
-#ifdef QUICK_TEST_SCENEGRAPH
- if (qtQuick2) {
- foreach (QString file, files) {
- QFileInfo fi(file);
- if (!fi.exists())
- continue;
- QSGView view;
- QTestRootObject rootobj;
- QEventLoop eventLoop;
- QObject::connect(view.engine(), SIGNAL(quit()),
- &rootobj, SLOT(quit()));
- QObject::connect(view.engine(), SIGNAL(quit()),
- &eventLoop, SLOT(quit()));
- view.rootContext()->setContextProperty
- (QLatin1String("qtest"), &rootobj);
- QScriptEngine *engine;
- engine = QDeclarativeDebugHelper::getScriptEngine(view.engine());
- QScriptValue qtObject
- = engine->globalObject().property(QLatin1String("Qt"));
- qtObject.setProperty
- (QLatin1String("qtest_wrapper"), QScriptValue(true));
- qtObject.setProperty
- (QLatin1String("qtest_printAvailableFunctions"),
- QScriptValue(QTest::printAvailableFunctions));
- foreach (QString path, imports)
- view.engine()->addImportPath(path);
- QString path = fi.absoluteFilePath();
- if (path.startsWith(QLatin1String(":/")))
- view.setSource(QUrl(QLatin1String("qrc:") + path.mid(2)));
- else
- view.setSource(QUrl::fromLocalFile(path));
- if (QTest::printAvailableFunctions)
- continue;
- if (view.status() == QSGView::Error) {
- // Error compiling the test - flag failure in the log and continue.
- QList<QDeclarativeError> errors = view.errors();
- QuickTestResult results;
- results.setTestCaseName(fi.baseName());
- results.startLogging();
- results.setFunctionName(QLatin1String("compile"));
- results.setFunctionType(QuickTestResult::Func);
- results.fail(errors.at(0).description(),
- errors.at(0).url().toString(),
- errors.at(0).line());
- results.finishTestFunction();
- results.setFunctionName(QString());
- results.setFunctionType(QuickTestResult::NoWhere);
- results.stopLogging();
- continue;
- }
- if (!rootobj.hasQuit) {
- // If the test already quit, then it was performed
- // synchronously during setSource(). Otherwise it is
- // an asynchronous test and we need to show the window
- // and wait for the quit indication.
- view.show();
- QTest::qWaitForWindowShown(&view);
- rootobj.setWindowShown(true);
- if (!rootobj.hasQuit)
- eventLoop.exec();
- }
+ foreach (QString file, files) {
+ QFileInfo fi(file);
+ if (!fi.exists())
+ continue;
+ QDeclarativeView view;
+ QTestRootObject rootobj;
+ QEventLoop eventLoop;
+ QObject::connect(view.engine(), SIGNAL(quit()),
+ &rootobj, SLOT(quit()));
+ QObject::connect(view.engine(), SIGNAL(quit()),
+ &eventLoop, SLOT(quit()));
+ if (createViewport)
+ view.setViewport((*createViewport)());
+ view.rootContext()->setContextProperty
+ (QLatin1String("qtest"), &rootobj);
+ QScriptEngine *engine;
+ engine = QDeclarativeDebugHelper::getScriptEngine(view.engine());
+ QScriptValue qtObject
+ = engine->globalObject().property(QLatin1String("Qt"));
+ qtObject.setProperty
+ (QLatin1String("qtest_wrapper"), QScriptValue(true));
+ qtObject.setProperty
+ (QLatin1String("qtest_printAvailableFunctions"),
+ QScriptValue(QTest::printAvailableFunctions));
+ foreach (QString path, imports)
+ view.engine()->addImportPath(path);
+ QString path = fi.absoluteFilePath();
+ if (path.startsWith(QLatin1String(":/")))
+ view.setSource(QUrl(QLatin1String("qrc:") + path.mid(2)));
+ else
+ view.setSource(QUrl::fromLocalFile(path));
+ if (QTest::printAvailableFunctions)
+ continue;
+ if (view.status() == QDeclarativeView::Error) {
+ // Error compiling the test - flag failure in the log and continue.
+ QList<QDeclarativeError> errors = view.errors();
+ QuickTestResult results;
+ results.setTestCaseName(fi.baseName());
+ results.startLogging();
+ results.setFunctionName(QLatin1String("compile"));
+ results.setFunctionType(QuickTestResult::Func);
+ results.fail(errors.at(0).description(),
+ errors.at(0).url().toString(),
+ errors.at(0).line());
+ results.finishTestFunction();
+ results.setFunctionName(QString());
+ results.setFunctionType(QuickTestResult::NoWhere);
+ results.stopLogging();
+ continue;
}
- } else
-#endif
- {
- foreach (QString file, files) {
- QFileInfo fi(file);
- if (!fi.exists())
- continue;
- QDeclarativeView view;
- QTestRootObject rootobj;
- QEventLoop eventLoop;
- QObject::connect(view.engine(), SIGNAL(quit()),
- &rootobj, SLOT(quit()));
- QObject::connect(view.engine(), SIGNAL(quit()),
- &eventLoop, SLOT(quit()));
- if (createViewport)
- view.setViewport((*createViewport)());
- view.rootContext()->setContextProperty
- (QLatin1String("qtest"), &rootobj);
- QScriptEngine *engine;
- engine = QDeclarativeDebugHelper::getScriptEngine(view.engine());
- QScriptValue qtObject
- = engine->globalObject().property(QLatin1String("Qt"));
- qtObject.setProperty
- (QLatin1String("qtest_wrapper"), QScriptValue(true));
- qtObject.setProperty
- (QLatin1String("qtest_printAvailableFunctions"),
- QScriptValue(QTest::printAvailableFunctions));
- foreach (QString path, imports)
- view.engine()->addImportPath(path);
- QString path = fi.absoluteFilePath();
- if (path.startsWith(QLatin1String(":/")))
- view.setSource(QUrl(QLatin1String("qrc:") + path.mid(2)));
- else
- view.setSource(QUrl::fromLocalFile(path));
- if (QTest::printAvailableFunctions)
- continue;
- if (view.status() == QDeclarativeView::Error) {
- // Error compiling the test - flag failure in the log and continue.
- QList<QDeclarativeError> errors = view.errors();
- QuickTestResult results;
- results.setTestCaseName(fi.baseName());
- results.startLogging();
- results.setFunctionName(QLatin1String("compile"));
- results.setFunctionType(QuickTestResult::Func);
- results.fail(errors.at(0).description(),
- errors.at(0).url().toString(),
- errors.at(0).line());
- results.finishTestFunction();
- results.setFunctionName(QString());
- results.setFunctionType(QuickTestResult::NoWhere);
- results.stopLogging();
- continue;
- }
- if (!rootobj.hasQuit) {
- // If the test already quit, then it was performed
- // synchronously during setSource(). Otherwise it is
- // an asynchronous test and we need to show the window
- // and wait for the quit indication.
- view.show();
- QTest::qWaitForWindowShown(&view);
- rootobj.setWindowShown(true);
- if (!rootobj.hasQuit)
- eventLoop.exec();
- }
+ if (!rootobj.hasQuit) {
+ // If the test already quit, then it was performed
+ // synchronously during setSource(). Otherwise it is
+ // an asynchronous test and we need to show the window
+ // and wait for the quit indication.
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+ rootobj.setWindowShown(true);
+ if (!rootobj.hasQuit)
+ eventLoop.exec();
}
}
diff --git a/src/quicktestlib/quicktestevent.cpp b/src/quicktestlib/quicktestevent.cpp
index fe66cbb..163e5a9 100644
--- a/src/quicktestlib/quicktestevent.cpp
+++ b/src/quicktestlib/quicktestevent.cpp
@@ -44,11 +44,6 @@
#include <QtDeclarative/qdeclarative.h>
#include <QtDeclarative/qdeclarativeitem.h>
#include <QtDeclarative/qdeclarativeview.h>
-#if defined(QML_VERSION) && QML_VERSION >= 0x020000
-#include <QtDeclarative/qsgitem.h>
-#include <QtDeclarative/qsgcanvas.h>
-#define QUICK_TEST_SCENEGRAPH 1
-#endif
#include <QtGui/qgraphicsscene.h>
QT_BEGIN_NAMESPACE
@@ -123,21 +118,13 @@ namespace QtQuickTest
QPoint pos;
QDeclarativeView *view = qobject_cast<QDeclarativeView *>(widget);
QWidget *eventWidget = widget;
-#ifdef QUICK_TEST_SCENEGRAPH
- QSGItem *sgitem = qobject_cast<QSGItem *>(item);
- if (sgitem) {
- pos = sgitem->mapToScene(_pos).toPoint();
- } else
-#endif
- {
- QDeclarativeItem *ditem = qobject_cast<QDeclarativeItem *>(item);
- if (!ditem) {
- qWarning("Mouse event target is not an Item");
- return;
- }
- pos = view->mapFromScene(ditem->mapToScene(_pos));
- eventWidget = view->viewport();
+ QDeclarativeItem *ditem = qobject_cast<QDeclarativeItem *>(item);
+ if (!ditem) {
+ qWarning("Mouse event target is not an Item");
+ return;
}
+ pos = view->mapFromScene(ditem->mapToScene(_pos));
+ eventWidget = view->viewport();
QTEST_ASSERT(button == Qt::NoButton || button & Qt::MouseButtonMask);
QTEST_ASSERT(stateKey == 0 || stateKey & Qt::KeyboardModifierMask);
@@ -250,11 +237,6 @@ bool QuickTestEvent::mouseMove
QWidget *QuickTestEvent::eventWidget()
{
-#ifdef QUICK_TEST_SCENEGRAPH
- QSGItem *sgitem = qobject_cast<QSGItem *>(parent());
- if (sgitem)
- return sgitem->canvas();
-#endif
QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(parent());
if (!item)
return 0;