diff options
author | Matthew Vogt <matthew.vogt@nokia.com> | 2012-01-31 16:52:36 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-03 00:39:18 +0100 |
commit | 01dc7e2ea476e0e6dcdce2e72979bbc858f4057d (patch) | |
tree | d8796f7695bbf8ad42abf47cd84c1b5e000ef795 /src/qmltest | |
parent | 5e07b57b818326da47a46d384415041fa4cea0ba (diff) |
Remove QtQuick1 elements from qtdeclarative
QtQuick1 is now contained in a separate repository.
Task-number: QTBUG-23737
Change-Id: I09eae67af5693a22b896b916f816f73ccc3a89b1
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/qmltest')
-rw-r--r-- | src/qmltest/qmltest.pro | 3 | ||||
-rw-r--r-- | src/qmltest/quicktest.cpp | 44 | ||||
-rw-r--r-- | src/qmltest/quicktestevent.cpp | 29 |
3 files changed, 10 insertions, 66 deletions
diff --git a/src/qmltest/qmltest.pro b/src/qmltest/qmltest.pro index cc2466639c..39b7dc8a3f 100644 --- a/src/qmltest/qmltest.pro +++ b/src/qmltest/qmltest.pro @@ -7,10 +7,9 @@ CONFIG += module CONFIG += dll warn_on declarative_debug MODULE_PRI += ../../modules/qt_qmltest.pri -QT += testlib-private declarative testlib quick qtquick1 widgets widgets-private gui +QT += testlib-private declarative testlib quick widgets widgets-private gui DEFINES += QT_BUILD_QUICK_TEST_LIB QT_NO_URL_CAST_FROM_STRING - load(qt_module_config) # Install qmltestcase.prf into the Qt mkspecs so that "CONFIG += qmltestcase" diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp index dbc4fc75a1..28033785ba 100644 --- a/src/qmltest/quicktest.cpp +++ b/src/qmltest/quicktest.cpp @@ -45,7 +45,6 @@ #include "qtestoptions_p.h" #include <QApplication> #include <QtDeclarative/qdeclarative.h> -#include <QtQuick1/qdeclarativeview.h> #include <QtDeclarative/qdeclarativeengine.h> #include <QtDeclarative/qdeclarativecontext.h> #if defined(QML_VERSION) && QML_VERSION >= 0x020000 @@ -331,47 +330,8 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport } 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); - 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. - handleCompileErrors(fi, view); - 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(); - } - } + qWarning("No suitable QtQuick1 implementation is available!"); + return 1; } // Flush the current logging stream. diff --git a/src/qmltest/quicktestevent.cpp b/src/qmltest/quicktestevent.cpp index 6551d2feaa..4dee9bee77 100644 --- a/src/qmltest/quicktestevent.cpp +++ b/src/qmltest/quicktestevent.cpp @@ -42,8 +42,6 @@ #include "quicktestevent_p.h" #include <QtTest/qtestkeyboard.h> #include <QtDeclarative/qdeclarative.h> -#include <QtQuick1/qdeclarativeitem.h> -#include <QtQuick1/qdeclarativeview.h> #if defined(QML_VERSION) && QML_VERSION >= 0x020000 #include <QtQuick/qquickitem.h> #include <QtQuick/qquickcanvas.h> @@ -116,8 +114,6 @@ namespace QtQuickTest } QPoint pos; - QDeclarativeView *view = qobject_cast<QDeclarativeView *>(window); - QWindow *eventWindow = window; #ifdef QUICK_TEST_SCENEGRAPH QQuickItem *sgitem = qobject_cast<QQuickItem *>(item); if (sgitem) { @@ -125,13 +121,7 @@ namespace QtQuickTest } 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)); - eventWindow = view->viewport()->windowHandle(); + qWarning("No suitable QtQuick1 implementation is available!"); } QTEST_ASSERT(button == Qt::NoButton || button & Qt::MouseButtonMask); QTEST_ASSERT(stateKey == 0 || stateKey & Qt::KeyboardModifierMask); @@ -158,7 +148,7 @@ namespace QtQuickTest QTEST_ASSERT(false); } QSpontaneKeyEvent::setSpontaneous(&me); - if (!qApp->notify(eventWindow, &me)) { + if (!qApp->notify(window, &me)) { static const char *mouseActionNames[] = { "MousePress", "MouseRelease", "MouseClick", "MouseDoubleClick", "MouseMove" }; QString warning = QString::fromLatin1("Mouse event \"%1\" not accepted by receiving window"); @@ -178,8 +168,6 @@ namespace QtQuickTest QTest::qWait(delay); QPoint pos; - QDeclarativeView *view = qobject_cast<QDeclarativeView *>(window); - QWindow *eventWindow = window; #ifdef QUICK_TEST_SCENEGRAPH QQuickItem *sgitem = qobject_cast<QQuickItem *>(item); if (sgitem) { @@ -187,13 +175,7 @@ namespace QtQuickTest } 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)); - eventWindow = view->viewport()->windowHandle(); + qWarning("No suitable QtQuick1 implementation is available!"); } QTEST_ASSERT(buttons == Qt::NoButton || buttons & Qt::MouseButtonMask); QTEST_ASSERT(stateKey == 0 || stateKey & Qt::KeyboardModifierMask); @@ -202,7 +184,7 @@ namespace QtQuickTest QWheelEvent we(pos, window->mapToGlobal(pos), delta, buttons, stateKey, orientation); QSpontaneKeyEvent::setSpontaneous(&we); // hmmmm - if (!qApp->notify(eventWindow, &we)) + if (!qApp->notify(window, &we)) QTest::qWarn("Wheel event not accepted by receiving window"); } }; @@ -295,6 +277,8 @@ QWindow *QuickTestEvent::eventWindow() if (sgitem) return sgitem->canvas(); #endif + return 0; + /* QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(parent()); if (!item) return 0; @@ -305,6 +289,7 @@ QWindow *QuickTestEvent::eventWindow() if (views.isEmpty()) return 0; return views.at(0)->windowHandle(); + */ } QT_END_NAMESPACE |