aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick
diff options
context:
space:
mode:
authorSergio Ahumada <sergio.ahumada@digia.com>2013-03-22 13:16:59 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-22 13:16:59 +0100
commit503eec194ea8bc70bfdbfd06bd0832a77cfcc137 (patch)
tree6b32fb2c0d59f2efac71432fe3509af0aad2b8b0 /tests/auto/quick
parent99eac6e3fb53dc1ca6f8136a02f93c33be3ef52f (diff)
parentd815621963cee5571ed93fb89561c4884a685b6b (diff)
Merge "Merge branch 'dev' into stable" into refs/staging/stable
Diffstat (limited to 'tests/auto/quick')
-rw-r--r--tests/auto/quick/dialogs/data/RectWithFileDialog.qml33
-rw-r--r--tests/auto/quick/dialogs/dialogs.pro17
-rw-r--r--tests/auto/quick/dialogs/tst_dialogs.cpp156
-rw-r--r--tests/auto/quick/examples/tst_examples.cpp36
-rw-r--r--tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp86
-rw-r--r--tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp3
-rw-r--r--tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp3
-rw-r--r--tests/auto/quick/qquickanimations/qquickanimations.pro1
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/CanvasComponent.qml3
-rw-r--r--tests/auto/quick/qquickflickable/qquickflickable.pro1
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp183
-rw-r--r--tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp1
-rw-r--r--tests/auto/quick/qquickgridview/tst_qquickgridview.cpp8
-rw-r--r--tests/auto/quick/qquickimage/tst_qquickimage.cpp6
-rw-r--r--tests/auto/quick/qquickitem/tst_qquickitem.cpp8
-rw-r--r--tests/auto/quick/qquickitem2/data/activeFocusOnTab.qml136
-rw-r--r--tests/auto/quick/qquickitem2/data/activeFocusOnTab3.qml250
-rw-r--r--tests/auto/quick/qquickitem2/tst_qquickitem.cpp329
-rw-r--r--tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp2
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp12
-rw-r--r--tests/auto/quick/qquickloader/data/QTBUG_30183.qml12
-rw-r--r--tests/auto/quick/qquickloader/tst_qquickloader.cpp17
-rw-r--r--tests/auto/quick/qquickmousearea/data/pressedCanceled.qml9
-rw-r--r--tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp57
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp3
-rw-r--r--tests/auto/quick/qquickpathview/tst_qquickpathview.cpp256
-rw-r--r--tests/auto/quick/qquickpincharea/qquickpincharea.pro1
-rw-r--r--tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp29
-rw-r--r--tests/auto/quick/qquickpositioners/data/gridtest.qml6
-rw-r--r--tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp243
-rw-r--r--tests/auto/quick/qquickstates/tst_qquickstates.cpp3
-rw-r--r--tests/auto/quick/qquicktextdocument/data/text.qml6
-rw-r--r--tests/auto/quick/qquicktextdocument/qquicktextdocument.pro15
-rw-r--r--tests/auto/quick/qquicktextdocument/tst_qquicktextdocument.cpp87
-rw-r--r--tests/auto/quick/qquicktextedit/data/focusOutSelection.qml35
-rw-r--r--tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp169
-rw-r--r--tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp48
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp264
-rw-r--r--tests/auto/quick/qquickwindow/data/focus.qml4
-rw-r--r--tests/auto/quick/qquickwindow/data/ownershipRootItem.qml2
-rw-r--r--tests/auto/quick/qquickwindow/data/showHideAnimate.qml5
-rw-r--r--tests/auto/quick/qquickwindow/qquickwindow.pro4
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp193
-rw-r--r--tests/auto/quick/quick.pro4
-rw-r--r--tests/auto/quick/rendernode/rendernode.pro1
-rw-r--r--tests/auto/quick/touchmouse/tst_touchmouse.cpp7
46 files changed, 2140 insertions, 614 deletions
diff --git a/tests/auto/quick/dialogs/data/RectWithFileDialog.qml b/tests/auto/quick/dialogs/data/RectWithFileDialog.qml
new file mode 100644
index 0000000000..ca7ecc948a
--- /dev/null
+++ b/tests/auto/quick/dialogs/data/RectWithFileDialog.qml
@@ -0,0 +1,33 @@
+import QtQuick 2.0
+import QtQuick.Dialogs 1.0
+
+Rectangle {
+ width: 1024
+ height: 320
+ property alias fileDialog: fileDialog
+ property alias label: label
+ property alias mouseArea: mouseArea
+
+ FileDialog {
+ id: fileDialog
+ title: "Choose some files"
+ selectMultiple: true
+ nameFilters: [ "QML files (*.qml)", "All files (*)" ]
+ selectedNameFilter: "QML files (*.qml)"
+ onAccepted: label.text = fileDialog.filePaths
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: fileDialog.visible = !fileDialog.visible
+ }
+
+ Text {
+ id: label
+ text: "Click to open a file dialog"
+ wrapMode: Text.Wrap
+ anchors.fill: parent
+ anchors.margins: 10
+ }
+}
diff --git a/tests/auto/quick/dialogs/dialogs.pro b/tests/auto/quick/dialogs/dialogs.pro
new file mode 100644
index 0000000000..d28c623a1f
--- /dev/null
+++ b/tests/auto/quick/dialogs/dialogs.pro
@@ -0,0 +1,17 @@
+CONFIG += testcase
+TARGET = tst_dialogs
+SOURCES += tst_dialogs.cpp
+
+include (../../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+
+CONFIG += parallel_test
+QT += core-private gui-private qml-private quick-private v8-private testlib
+
+TESTDATA = data/*
+
+OTHER_FILES += \
+ data/FileDialog.qml \
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/dialogs/tst_dialogs.cpp b/tests/auto/quick/dialogs/tst_dialogs.cpp
new file mode 100644
index 0000000000..9f0dc8ec18
--- /dev/null
+++ b/tests/auto/quick/dialogs/tst_dialogs.cpp
@@ -0,0 +1,156 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include "../../shared/util.h"
+#include <QtQuick/QQuickItem>
+#include <QtQuick/QQuickView>
+#include <QSignalSpy>
+
+class tst_dialogs : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+
+private slots:
+ void initTestCase()
+ {
+ QQmlDataTest::initTestCase();
+ }
+
+ // FileDialog
+ void fileDialogDefaultModality();
+ void fileDialogNonModal();
+ void fileDialogNameFilters();
+
+private:
+};
+
+void tst_dialogs::fileDialogDefaultModality()
+{
+ QQuickView *window = new QQuickView;
+ QScopedPointer<QQuickWindow> cleanup(window);
+
+ window->setSource(testFileUrl("RectWithFileDialog.qml"));
+ window->setGeometry(240,240,1024,320);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ // Click to show
+ QObject *dlg = qvariant_cast<QObject *>(window->rootObject()->property("fileDialog"));
+ QSignalSpy spyVisibilityChanged(dlg, SIGNAL(visibilityChanged()));
+ QTest::mouseClick(window, Qt::LeftButton, 0, QPoint(1000, 100)); // show
+ QTRY_VERIFY(spyVisibilityChanged.count() > 0);
+ int visibilityChangedCount = spyVisibilityChanged.count();
+ // Can't hide by clicking the main window, because dialog is modal.
+ QTest::mouseClick(window, Qt::LeftButton, 0, QPoint(1000, 100));
+#ifdef Q_OS_MAC
+ /*
+ On the Mac, if you send an event directly to a window, the modal dialog
+ doesn't block the event, so the window will process it normally. This
+ is a different code path compared to having a user click the mouse and
+ generate a native event; in that case the OS does the filtering itself,
+ and Qt will not even see the event. But simulating real events in the
+ test framework is generally unstable. So there isn't a good way to test
+ modality on the mac.
+ */
+ QSKIP("Modality test doesn't work on Mac OS");
+#endif
+ // So we expect no change in visibility.
+ QCOMPARE(spyVisibilityChanged.count(), visibilityChangedCount);
+
+ QCOMPARE(dlg->property("visible").toBool(), true);
+ QMetaObject::invokeMethod(dlg, "close");
+ QTRY_VERIFY(spyVisibilityChanged.count() > visibilityChangedCount);
+ visibilityChangedCount = spyVisibilityChanged.count();
+ QCOMPARE(dlg->property("visible").toBool(), false);
+ QMetaObject::invokeMethod(dlg, "open");
+ QTRY_VERIFY(spyVisibilityChanged.count() > visibilityChangedCount);
+ QCOMPARE(dlg->property("visible").toBool(), true);
+ QCOMPARE(dlg->property("modality").toInt(), (int)Qt::WindowModal);
+}
+
+void tst_dialogs::fileDialogNonModal()
+{
+ QQuickView *window = new QQuickView;
+ QScopedPointer<QQuickWindow> cleanup(window);
+
+ window->setSource(testFileUrl("RectWithFileDialog.qml"));
+ window->setGeometry(240,240,1024,320);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ // Click to toggle visibility
+ QObject *dlg = qvariant_cast<QObject *>(window->rootObject()->property("fileDialog"));
+ dlg->setProperty("modality", QVariant((int)Qt::NonModal));
+ QSignalSpy spyVisibilityChanged(dlg, SIGNAL(visibilityChanged()));
+ QTest::mouseClick(window, Qt::LeftButton, 0, QPoint(1000, 100)); // show
+ int visibilityChangedCount = spyVisibilityChanged.count();
+ QTRY_VERIFY(visibilityChangedCount > 0);
+ QCOMPARE(dlg->property("visible").toBool(), true);
+ QTest::mouseClick(window, Qt::LeftButton, 0, QPoint(1000, 100)); // hide
+ QTRY_VERIFY(spyVisibilityChanged.count() > visibilityChangedCount);
+ QCOMPARE(dlg->property("visible").toBool(), false);
+ QCOMPARE(dlg->property("modality").toInt(), (int)Qt::NonModal);
+}
+
+void tst_dialogs::fileDialogNameFilters()
+{
+ QQuickView *window = new QQuickView;
+ QScopedPointer<QQuickWindow> cleanup(window);
+
+ window->setSource(testFileUrl("RectWithFileDialog.qml"));
+ window->setGeometry(240,240,1024,320);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QObject *dlg = qvariant_cast<QObject *>(window->rootObject()->property("fileDialog"));
+ QStringList filters;
+ filters << "QML files (*.qml)";
+ filters << "Image files (*.jpg, *.png, *.gif)";
+ filters << "All files (*)";
+ dlg->setProperty("nameFilters", QVariant(filters));
+ QCOMPARE(dlg->property("selectedNameFilter").toString(), filters.first());
+}
+
+QTEST_MAIN(tst_dialogs)
+
+#include "tst_dialogs.moc"
diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp
index 7055fb6e03..9c5fb88af2 100644
--- a/tests/auto/quick/examples/tst_examples.cpp
+++ b/tests/auto/quick/examples/tst_examples.cpp
@@ -82,11 +82,9 @@ private:
QStringList findQmlFiles(const QDir &);
QQmlEngine engine;
-
- QQuickWindow *window;
};
-tst_examples::tst_examples() : window(0)
+tst_examples::tst_examples()
{
// Add files to exclude here
excludedFiles << "examples/quick/canvas/tiger/tiger.qml"; // QTBUG-26528
@@ -94,7 +92,7 @@ tst_examples::tst_examples() : window(0)
// Add directories you want excluded here (don't add examples/, because they install to examples/qtdeclarative/)
excludedDirs << "shared"; //Not an example
- excludedDirs << "qtquick/text/fonts"; // QTBUG-21415
+ excludedDirs << "quick/text/fonts"; // QTBUG-29004
excludedDirs << "snippets/qml/path"; //No root QQuickItem
excludedDirs << "tutorials/gettingStartedQml"; //C++ example, but no cpp files in root dir
@@ -120,7 +118,6 @@ tst_examples::tst_examples() : window(0)
tst_examples::~tst_examples()
{
- delete window;
}
void tst_examples::init()
@@ -260,6 +257,9 @@ void tst_examples::sgexamples_data()
void tst_examples::sgexamples()
{
QFETCH(QString, file);
+ QQuickWindow window;
+ window.setPersistentOpenGLContext(true);
+ window.setPersistentSceneGraph(true);
QQmlComponent component(&engine, QUrl::fromLocalFile(file));
if (component.status() == QQmlComponent::Error)
@@ -272,13 +272,11 @@ void tst_examples::sgexamples()
component.completeCreate();
QVERIFY(root);
- if (!window) {
- window = new QQuickWindow();
- window->resize(240, 320);
- window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- }
- root->setParentItem(window->contentItem());
+ window.resize(240, 320);
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+
+ root->setParentItem(window.contentItem());
component.completeCreate();
qApp->processEvents();
@@ -303,6 +301,8 @@ void tst_examples::sgsnippets_data()
void tst_examples::sgsnippets()
{
+ QQuickWindow window;
+
QFETCH(QString, file);
QQmlComponent component(&engine, QUrl::fromLocalFile(file));
@@ -316,13 +316,11 @@ void tst_examples::sgsnippets()
component.completeCreate();
QVERIFY(root);
- if (!window) {
- window = new QQuickWindow();
- window->resize(240, 320);
- window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- }
- root->setParentItem(window->contentItem());
+ window.resize(240, 320);
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+
+ root->setParentItem(window.contentItem());
component.completeCreate();
qApp->processEvents();
diff --git a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
index 46141a946e..d0bb075f4e 100644
--- a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
+++ b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
@@ -55,8 +55,6 @@
#include "../../shared/util.h"
-typedef QSharedPointer<QAccessibleInterface> QAI;
-
#define EXPECT(cond) \
do { \
if (!errorAt && !(cond)) { \
@@ -82,14 +80,11 @@ static int verifyHierarchy(QAccessibleInterface *iface)
// navigate Ancestor...
QAccessibleInterface *parent = if2->parent();
EXPECT(iface->object() == parent->object());
- delete parent;
// verify children...
if (!errorAt)
errorAt = verifyHierarchy(if2);
- delete if2;
}
- delete middleChild;
--treelevel;
return errorAt;
@@ -149,7 +144,6 @@ void tst_QQuickAccessible::commonTests()
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(view);
QVERIFY(iface);
- delete iface;
delete view;
}
@@ -274,7 +268,7 @@ void tst_QQuickAccessible::quickAttachedProperties()
void tst_QQuickAccessible::basicPropertiesTest()
{
- QAI app = QAI(QAccessible::queryAccessibleInterface(qApp));
+ QAccessibleInterface *app = QAccessible::queryAccessibleInterface(qApp);
QCOMPARE(app->childCount(), 0);
QQuickView *window = new QQuickView();
@@ -282,19 +276,19 @@ void tst_QQuickAccessible::basicPropertiesTest()
window->show();
QCOMPARE(app->childCount(), 1);
- QAI iface = QAI(QAccessible::queryAccessibleInterface(window));
- QVERIFY(iface.data());
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(window);
+ QVERIFY(iface);
QCOMPARE(iface->childCount(), 1);
- QAI item = QAI(iface->child(0));
- QVERIFY(item.data());
+ QAccessibleInterface *item = iface->child(0);
+ QVERIFY(item);
QCOMPARE(item->childCount(), 2);
QCOMPARE(item->rect().size(), QSize(400, 400));
QCOMPARE(item->role(), QAccessible::Pane);
- QCOMPARE(iface->indexOfChild(item.data()), 0);
+ QCOMPARE(iface->indexOfChild(item), 0);
- QAI text = QAI(item->child(0));
- QVERIFY(text.data());
+ QAccessibleInterface *text = item->child(0);
+ QVERIFY(text);
QCOMPARE(text->childCount(), 0);
QCOMPARE(text->text(QAccessible::Name), QLatin1String("Hello Accessibility"));
@@ -302,10 +296,10 @@ void tst_QQuickAccessible::basicPropertiesTest()
QCOMPARE(text->rect().x(), item->rect().x() + 100);
QCOMPARE(text->rect().y(), item->rect().y() + 20);
QCOMPARE(text->role(), QAccessible::StaticText);
- QCOMPARE(item->indexOfChild(text.data()), 0);
+ QCOMPARE(item->indexOfChild(text), 0);
- QAI text2 = QAI(item->child(1));
- QVERIFY(text2.data());
+ QAccessibleInterface *text2 = item->child(1);
+ QVERIFY(text2);
QCOMPARE(text2->childCount(), 0);
QCOMPARE(text2->text(QAccessible::Name), QLatin1String("The Hello 2 accessible text"));
@@ -313,22 +307,22 @@ void tst_QQuickAccessible::basicPropertiesTest()
QCOMPARE(text2->rect().x(), item->rect().x() + 100);
QCOMPARE(text2->rect().y(), item->rect().y() + 40);
QCOMPARE(text2->role(), QAccessible::StaticText);
- QCOMPARE(item->indexOfChild(text2.data()), 1);
+ QCOMPARE(item->indexOfChild(text2), 1);
- QCOMPARE(iface->indexOfChild(text2.data()), -1);
- QCOMPARE(text2->indexOfChild(item.data()), -1);
+ QCOMPARE(iface->indexOfChild(text2), -1);
+ QCOMPARE(text2->indexOfChild(item), -1);
delete window;
}
-QAI topLevelChildAt(QAccessibleInterface *iface, int x, int y)
+QAccessibleInterface *topLevelChildAt(QAccessibleInterface *iface, int x, int y)
{
- QAI child = QAI(iface->childAt(x, y));
+ QAccessibleInterface *child = iface->childAt(x, y);
if (!child)
- return QAI();
+ return 0;
- QAI childOfChild;
- while (childOfChild = QAI(child->childAt(x, y))) {
+ QAccessibleInterface *childOfChild;
+ while (childOfChild = child->childAt(x, y)) {
child = childOfChild;
}
return child;
@@ -340,45 +334,45 @@ void tst_QQuickAccessible::hitTest()
window->setSource(testFileUrl("hittest.qml"));
window->show();
- QAI windowIface = QAI(QAccessible::queryAccessibleInterface(window));
- QVERIFY(windowIface.data());
- QAI rootItem = QAI(windowIface->child(0));
+ QAccessibleInterface *windowIface = QAccessible::queryAccessibleInterface(window);
+ QVERIFY(windowIface);
+ QAccessibleInterface *rootItem = windowIface->child(0);
QRect rootRect = rootItem->rect();
// check the root item from app
- QAI appIface = QAI(QAccessible::queryAccessibleInterface(qApp));
+ QAccessibleInterface *appIface = QAccessible::queryAccessibleInterface(qApp);
QVERIFY(appIface);
- QAI itemHit(appIface->childAt(rootRect.x() + 200, rootRect.y() + 50));
+ QAccessibleInterface *itemHit(appIface->childAt(rootRect.x() + 200, rootRect.y() + 50));
QVERIFY(itemHit);
QCOMPARE(rootRect, itemHit->rect());
// hit rect1
- QAI rect1(rootItem->child(0));
+ QAccessibleInterface *rect1(rootItem->child(0));
QRect rect1Rect = rect1->rect();
- QAI rootItemIface = QAI(rootItem->childAt(rect1Rect.x() + 10, rect1Rect.y() + 10));
+ QAccessibleInterface *rootItemIface = rootItem->childAt(rect1Rect.x() + 10, rect1Rect.y() + 10);
QVERIFY(rootItemIface);
QCOMPARE(rect1Rect, rootItemIface->rect());
QCOMPARE(rootItemIface->text(QAccessible::Name), QLatin1String("rect1"));
// should also work from top level (app)
- QAI app(QAccessible::queryAccessibleInterface(qApp));
- QAI itemHit2(topLevelChildAt(app.data(), rect1Rect.x() + 10, rect1Rect.y() + 10));
+ QAccessibleInterface *app(QAccessible::queryAccessibleInterface(qApp));
+ QAccessibleInterface *itemHit2(topLevelChildAt(app, rect1Rect.x() + 10, rect1Rect.y() + 10));
QVERIFY(itemHit2);
QCOMPARE(itemHit2->rect(), rect1Rect);
QCOMPARE(itemHit2->text(QAccessible::Name), QLatin1String("rect1"));
// hit rect201
- QAI rect2(rootItem->child(1));
+ QAccessibleInterface *rect2(rootItem->child(1));
QVERIFY(rect2);
// FIXME: This is seems broken on mac
// QCOMPARE(rect2->rect().translated(rootItem->rect().x(), rootItem->rect().y()), QRect(0, 50, 100, 100));
- QAI rect20(rect2->child(0));
+ QAccessibleInterface *rect20(rect2->child(0));
QVERIFY(rect20);
- QAI rect201(rect20->child(1));
+ QAccessibleInterface *rect201(rect20->child(1));
QVERIFY(rect201);
QRect rect201Rect = rect201->rect();
- rootItemIface = QAI(windowIface->childAt(rect201Rect.x() + 20, rect201Rect.y() + 20));
+ rootItemIface = windowIface->childAt(rect201Rect.x() + 20, rect201Rect.y() + 20);
QVERIFY(rootItemIface);
QCOMPARE(rootItemIface->rect(), rect201Rect);
QCOMPARE(rootItemIface->text(QAccessible::Name), QLatin1String("rect201"));
@@ -392,29 +386,29 @@ void tst_QQuickAccessible::checkableTest()
window->setSource(testFileUrl("checkbuttons.qml"));
window->show();
- QAI iface = QAI(QAccessible::queryAccessibleInterface(window));
- QVERIFY(iface.data());
- QAI root = QAI(iface->child(0));
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(window);
+ QVERIFY(iface);
+ QAccessibleInterface *root = iface->child(0);
- QAI button1 = QAI(root->child(0));
+ QAccessibleInterface *button1 = root->child(0);
QCOMPARE(button1->role(), QAccessible::Button);
QVERIFY(!(button1->state().checked));
QVERIFY(!(button1->state().checkable));
- QAI button2 = QAI(root->child(1));
+ QAccessibleInterface *button2 = root->child(1);
QVERIFY(!(button2->state().checked));
QVERIFY(button2->state().checkable);
- QAI button3 = QAI(root->child(2));
+ QAccessibleInterface *button3 = root->child(2);
QVERIFY(button3->state().checked);
QVERIFY(button3->state().checkable);
- QAI checkBox1 = QAI(root->child(3));
+ QAccessibleInterface *checkBox1 = root->child(3);
QCOMPARE(checkBox1->role(), QAccessible::CheckBox);
QVERIFY((checkBox1->state().checked));
QVERIFY(checkBox1->state().checkable);
- QAI checkBox2 = QAI(root->child(4));
+ QAccessibleInterface *checkBox2 = root->child(4);
QVERIFY(!(checkBox2->state().checked));
QVERIFY(checkBox2->state().checkable);
}
diff --git a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp
index aad1327e6f..201287b2a8 100644
--- a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp
+++ b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp
@@ -152,9 +152,8 @@ void tst_qquickanimatedimage::mirror_running()
QQuickView window;
window.setSource(testFileUrl("hearts.qml"));
- window.requestActivate();
window.show();
- QTest::qWaitForWindowActive(&window);
+ QTest::qWaitForWindowExposed(&window);
QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage *>(window.rootObject());
QVERIFY(anim);
diff --git a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp
index 7847268d94..34a1614ac5 100644
--- a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp
+++ b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp
@@ -93,8 +93,7 @@ void tst_qquickanimatedsprite::test_frameChangedSignal()
window->setSource(testFileUrl("frameChange.qml"));
window->show();
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window));
QVERIFY(window->rootObject());
QQuickAnimatedSprite* sprite = window->rootObject()->findChild<QQuickAnimatedSprite*>("sprite");
diff --git a/tests/auto/quick/qquickanimations/qquickanimations.pro b/tests/auto/quick/qquickanimations/qquickanimations.pro
index f3cf4832e5..747a2afdff 100644
--- a/tests/auto/quick/qquickanimations/qquickanimations.pro
+++ b/tests/auto/quick/qquickanimations/qquickanimations.pro
@@ -1,4 +1,5 @@
CONFIG += testcase
+mac:CONFIG+=insignificant_test # QTBUG-29062
TARGET = tst_qquickanimations
SOURCES += tst_qquickanimations.cpp
diff --git a/tests/auto/quick/qquickcanvasitem/data/CanvasComponent.qml b/tests/auto/quick/qquickcanvasitem/data/CanvasComponent.qml
index b9e8d75f5a..000888a36f 100644
--- a/tests/auto/quick/qquickcanvasitem/data/CanvasComponent.qml
+++ b/tests/auto/quick/qquickcanvasitem/data/CanvasComponent.qml
@@ -5,6 +5,7 @@ Component {
id:canvas
Canvas {
id:c
+ antialiasing: false;
width:100;height:100
onPaint :{} //this line is needed for some tests (make sure onPaint handler always called
property alias paintCount:spyPaint.count
@@ -27,4 +28,4 @@ Component {
SignalSpy {id: spyImageLoaded;target:c;signalName: "imageLoaded"}
SignalSpy {id: spyAvailableChanged;target:c;signalName: "availableChanged"}
}
-} \ No newline at end of file
+}
diff --git a/tests/auto/quick/qquickflickable/qquickflickable.pro b/tests/auto/quick/qquickflickable/qquickflickable.pro
index 95c703befe..67d5fc12f0 100644
--- a/tests/auto/quick/qquickflickable/qquickflickable.pro
+++ b/tests/auto/quick/qquickflickable/qquickflickable.pro
@@ -11,3 +11,4 @@ TESTDATA = data/*
QT += core-private gui-private v8-private qml-private quick-private testlib
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+CONFIG+=insignificant_test
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index c4f871fc11..3575dfa012 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -210,10 +210,10 @@ void tst_qquickflickable::boundsBehavior()
void tst_qquickflickable::rebound()
{
- QQuickView *window = new QQuickView;
+ QScopedPointer<QQuickView> window(new QQuickView);
window->setSource(testFileUrl("rebound.qml"));
window->show();
- window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
@@ -229,7 +229,7 @@ void tst_qquickflickable::rebound()
QSignalSpy hMoveSpy(flickable, SIGNAL(movingHorizontallyChanged()));
// flick and test the transition is run
- flick(window, QPoint(20,20), QPoint(120,120), 200);
+ flick(window.data(), QPoint(20,20), QPoint(120,120), 200);
QTRY_COMPARE(window->rootObject()->property("transitionsStarted").toInt(), 2);
QCOMPARE(hMoveSpy.count(), 1);
@@ -259,14 +259,13 @@ void tst_qquickflickable::rebound()
#ifdef Q_OS_MAC
QSKIP("QTBUG-26696 - sometimes fails on Mac");
- delete window;
return;
#endif
// flick and trigger the transition multiple times
// (moving signals are emitted as soon as the first transition starts)
- flick(window, QPoint(20,20), QPoint(120,120), 200); // both x and y will bounce back
- flick(window, QPoint(20,120), QPoint(120,20), 200); // only x will bounce back
+ flick(window.data(), QPoint(20,20), QPoint(120,120), 200); // both x and y will bounce back
+ flick(window.data(), QPoint(20,120), QPoint(120,20), 200); // only x will bounce back
QVERIFY(flickable->isMoving());
QVERIFY(window->rootObject()->property("transitionsStarted").toInt() >= 1);
@@ -295,7 +294,7 @@ void tst_qquickflickable::rebound()
// (i.e. moving but transition->running = false)
window->rootObject()->setProperty("transitionEnabled", false);
- flick(window, QPoint(20,20), QPoint(120,120), 200);
+ flick(window.data(), QPoint(20,20), QPoint(120,120), 200);
QCOMPARE(window->rootObject()->property("transitionsStarted").toInt(), 0);
QCOMPARE(hMoveSpy.count(), 1);
QCOMPARE(vMoveSpy.count(), 1);
@@ -308,8 +307,6 @@ void tst_qquickflickable::rebound()
QCOMPARE(movementStartedSpy.count(), 1);
QCOMPARE(movementEndedSpy.count(), 1);
QCOMPARE(window->rootObject()->property("transitionsStarted").toInt(), 0);
-
- delete window;
}
void tst_qquickflickable::maximumFlickVelocity()
@@ -355,7 +352,7 @@ void tst_qquickflickable::pressDelay()
QScopedPointer<QQuickView> window(new QQuickView);
window->setSource(testFileUrl("pressDelay.qml"));
window->show();
- window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
@@ -394,7 +391,7 @@ void tst_qquickflickable::nestedPressDelay()
QScopedPointer<QQuickView> window(new QQuickView);
window->setSource(testFileUrl("nestedPressDelay.qml"));
window->show();
- window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickFlickable *outer = qobject_cast<QQuickFlickable*>(window->rootObject());
@@ -503,7 +500,8 @@ void tst_qquickflickable::returnToBounds()
{
QFETCH(bool, setRebound);
- QQuickView *window = new QQuickView;
+ QScopedPointer<QQuickView> window(new QQuickView);
+
window->rootContext()->setContextProperty("setRebound", setRebound);
window->setSource(testFileUrl("resize.qml"));
QVERIFY(window->rootObject() != 0);
@@ -534,8 +532,6 @@ void tst_qquickflickable::returnToBounds()
QVERIFY(!rebound->running());
QCOMPARE(reboundSpy.count(), setRebound ? 2 : 0);
-
- delete window;
}
void tst_qquickflickable::returnToBounds_data()
@@ -548,10 +544,10 @@ void tst_qquickflickable::returnToBounds_data()
void tst_qquickflickable::wheel()
{
- QQuickView *window = new QQuickView;
+ QScopedPointer<QQuickView> window(new QQuickView);
window->setSource(testFileUrl("wheel.qml"));
window->show();
- window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickFlickable *flick = window->rootObject()->findChild<QQuickFlickable*>("flick");
@@ -561,7 +557,7 @@ void tst_qquickflickable::wheel()
QPoint pos(200, 200);
QWheelEvent event(pos, window->mapToGlobal(pos), QPoint(), QPoint(0,-120), -120, Qt::Vertical, Qt::NoButton, Qt::NoModifier);
event.setAccepted(false);
- QGuiApplication::sendEvent(window, &event);
+ QGuiApplication::sendEvent(window.data(), &event);
}
QTRY_VERIFY(flick->contentY() > 0);
@@ -575,13 +571,11 @@ void tst_qquickflickable::wheel()
QWheelEvent event(pos, window->mapToGlobal(pos), QPoint(), QPoint(-120,0), -120, Qt::Horizontal, Qt::NoButton, Qt::NoModifier);
event.setAccepted(false);
- QGuiApplication::sendEvent(window, &event);
+ QGuiApplication::sendEvent(window.data(), &event);
}
QTRY_VERIFY(flick->contentX() > 0);
QVERIFY(flick->contentY() == 0);
-
- delete window;
}
void tst_qquickflickable::movingAndFlicking_data()
@@ -616,11 +610,10 @@ void tst_qquickflickable::movingAndFlicking()
const QPoint flickFrom(50, 200); // centre
- QQuickView *window = new QQuickView;
+ QScopedPointer<QQuickView> window(new QQuickView);
window->setSource(testFileUrl("flickable03.qml"));
window->show();
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
@@ -639,7 +632,7 @@ void tst_qquickflickable::movingAndFlicking()
QSignalSpy flickEndSpy(flickable, SIGNAL(flickEnded()));
// do a flick that keeps the view within the bounds
- flick(window, flickFrom, flickToWithoutSnapBack, 200);
+ flick(window.data(), flickFrom, flickToWithoutSnapBack, 200);
QTRY_VERIFY(flickable->isMoving());
QCOMPARE(flickable->isMovingHorizontally(), horizontalEnabled);
@@ -698,7 +691,7 @@ void tst_qquickflickable::movingAndFlicking()
flickable->setContentX(0);
flickable->setContentY(0);
QTRY_VERIFY(!flickable->isMoving());
- flick(window, flickFrom, flickToWithSnapBack, 200);
+ flick(window.data(), flickFrom, flickToWithSnapBack, 10);
QTRY_VERIFY(flickable->isMoving());
QCOMPARE(flickable->isMovingHorizontally(), horizontalEnabled);
@@ -742,8 +735,6 @@ void tst_qquickflickable::movingAndFlicking()
QCOMPARE(flickable->contentX(), 0.0);
QCOMPARE(flickable->contentY(), 0.0);
-
- delete window;
}
@@ -779,11 +770,10 @@ void tst_qquickflickable::movingAndDragging()
const QPoint moveFrom(50, 200); // centre
- QQuickView *window = new QQuickView;
+ QScopedPointer<QQuickView> window(new QQuickView);
window->setSource(testFileUrl("flickable03.qml"));
window->show();
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
@@ -802,10 +792,10 @@ void tst_qquickflickable::movingAndDragging()
QSignalSpy moveEndSpy(flickable, SIGNAL(movementEnded()));
// start the drag
- QTest::mousePress(window, Qt::LeftButton, 0, moveFrom);
- QTest::mouseMove(window, moveFrom + moveByWithoutSnapBack);
- QTest::mouseMove(window, moveFrom + moveByWithoutSnapBack*2);
- QTest::mouseMove(window, moveFrom + moveByWithoutSnapBack*3);
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, moveFrom);
+ QTest::mouseMove(window.data(), moveFrom + moveByWithoutSnapBack);
+ QTest::mouseMove(window.data(), moveFrom + moveByWithoutSnapBack*2);
+ QTest::mouseMove(window.data(), moveFrom + moveByWithoutSnapBack*3);
QTRY_VERIFY(flickable->isMoving());
QCOMPARE(flickable->isMovingHorizontally(), horizontalEnabled);
@@ -829,7 +819,7 @@ void tst_qquickflickable::movingAndDragging()
QCOMPARE(moveStartSpy.count(), 1);
QCOMPARE(dragStartSpy.count(), 1);
- QTest::mouseRelease(window, Qt::LeftButton, 0, moveFrom + moveByWithoutSnapBack*3);
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, moveFrom + moveByWithoutSnapBack*3);
QVERIFY(!flickable->isDragging());
QVERIFY(!flickable->isDraggingHorizontally());
@@ -878,10 +868,10 @@ void tst_qquickflickable::movingAndDragging()
flickable->setContentX(0);
flickable->setContentY(0);
QTRY_VERIFY(!flickable->isMoving());
- QTest::mousePress(window, Qt::LeftButton, 0, moveFrom);
- QTest::mouseMove(window, moveFrom + moveByWithSnapBack);
- QTest::mouseMove(window, moveFrom + moveByWithSnapBack*2);
- QTest::mouseMove(window, moveFrom + moveByWithSnapBack*3);
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, moveFrom);
+ QTest::mouseMove(window.data(), moveFrom + moveByWithSnapBack);
+ QTest::mouseMove(window.data(), moveFrom + moveByWithSnapBack*2);
+ QTest::mouseMove(window.data(), moveFrom + moveByWithSnapBack*3);
QVERIFY(flickable->isMoving());
QCOMPARE(flickable->isMovingHorizontally(), horizontalEnabled);
@@ -902,7 +892,7 @@ void tst_qquickflickable::movingAndDragging()
QCOMPARE(dragStartSpy.count(), 1);
QCOMPARE(dragEndSpy.count(), 0);
- QTest::mouseRelease(window, Qt::LeftButton, 0, moveFrom + moveByWithSnapBack*3);
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, moveFrom + moveByWithSnapBack*3);
// should now start snapping back to bounds (moving but not dragging)
QVERIFY(flickable->isMoving());
@@ -945,17 +935,14 @@ void tst_qquickflickable::movingAndDragging()
QCOMPARE(flickable->contentX(), 0.0);
QCOMPARE(flickable->contentY(), 0.0);
-
- delete window;
}
void tst_qquickflickable::flickOnRelease()
{
- QQuickView *window = new QQuickView;
+ QScopedPointer<QQuickView> window(new QQuickView);
window->setSource(testFileUrl("flickable03.qml"));
window->show();
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
@@ -968,9 +955,9 @@ void tst_qquickflickable::flickOnRelease()
// underlying drivers will hopefully provide a pre-calculated velocity
// (based on more data than what the UI gets), thus making this use case
// working even with small movements.
- QTest::mousePress(window, Qt::LeftButton, 0, QPoint(50, 300));
- QTest::mouseMove(window, QPoint(50, 10), 10);
- QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(50, 10), 10);
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(50, 300));
+ QTest::mouseMove(window.data(), QPoint(50, 10), 10);
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(50, 10), 10);
QCOMPARE(vFlickSpy.count(), 1);
@@ -982,17 +969,14 @@ void tst_qquickflickable::flickOnRelease()
#endif
// Stop on a full pixel after user interaction
QCOMPARE(flickable->contentY(), (qreal)qRound(flickable->contentY()));
-
- delete window;
}
void tst_qquickflickable::pressWhileFlicking()
{
- QQuickView *window = new QQuickView;
+ QScopedPointer<QQuickView> window(new QQuickView);
window->setSource(testFileUrl("flickable03.qml"));
window->show();
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
@@ -1007,7 +991,7 @@ void tst_qquickflickable::pressWhileFlicking()
// flick then press while it is still moving
// flicking == false, moving == true;
- flick(window, QPoint(20,190), QPoint(20, 50), 200);
+ flick(window.data(), QPoint(20,190), QPoint(20, 50), 200);
QVERIFY(flickable->verticalVelocity() > 0.0);
QTRY_VERIFY(flickable->isFlicking());
QVERIFY(flickable->isFlickingVertically());
@@ -1022,77 +1006,72 @@ void tst_qquickflickable::pressWhileFlicking()
QCOMPARE(hFlickSpy.count(), 0);
QCOMPARE(flickSpy.count(), 1);
- QTest::mousePress(window, Qt::LeftButton, 0, QPoint(20, 50));
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(20, 50));
QTRY_VERIFY(!flickable->isFlicking());
QVERIFY(!flickable->isFlickingVertically());
QVERIFY(flickable->isMoving());
QVERIFY(flickable->isMovingVertically());
- QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(20,50));
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(20,50));
QVERIFY(!flickable->isFlicking());
QVERIFY(!flickable->isFlickingVertically());
QTRY_VERIFY(!flickable->isMoving());
QVERIFY(!flickable->isMovingVertically());
// Stop on a full pixel after user interaction
QCOMPARE(flickable->contentX(), (qreal)qRound(flickable->contentX()));
-
- delete window;
}
void tst_qquickflickable::disabled()
{
- QQuickView *window = new QQuickView;
+ QScopedPointer<QQuickView> window(new QQuickView);
window->setSource(testFileUrl("disabled.qml"));
window->show();
- window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickFlickable *flick = window->rootObject()->findChild<QQuickFlickable*>("flickable");
QVERIFY(flick != 0);
- QTest::mousePress(window, Qt::LeftButton, 0, QPoint(50, 90));
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(50, 90));
- QTest::mouseMove(window, QPoint(50, 80));
- QTest::mouseMove(window, QPoint(50, 70));
- QTest::mouseMove(window, QPoint(50, 60));
+ QTest::mouseMove(window.data(), QPoint(50, 80));
+ QTest::mouseMove(window.data(), QPoint(50, 70));
+ QTest::mouseMove(window.data(), QPoint(50, 60));
QVERIFY(flick->isMoving() == false);
- QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(50, 60));
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(50, 60));
// verify that mouse clicks on other elements still work (QTBUG-20584)
- QTest::mousePress(window, Qt::LeftButton, 0, QPoint(50, 10));
- QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(50, 10));
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(50, 10));
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(50, 10));
QTRY_VERIFY(window->rootObject()->property("clicked").toBool() == true);
-
- delete window;
}
void tst_qquickflickable::flickVelocity()
{
- QQuickView *window = new QQuickView;
+ QScopedPointer<QQuickView> window(new QQuickView);
window->setSource(testFileUrl("flickable03.qml"));
window->show();
- window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
QVERIFY(flickable != 0);
// flick up
- flick(window, QPoint(20,190), QPoint(20, 50), 200);
+ flick(window.data(), QPoint(20,190), QPoint(20, 50), 200);
QVERIFY(flickable->verticalVelocity() > 0.0);
QTRY_VERIFY(flickable->verticalVelocity() == 0.0);
// flick down
- flick(window, QPoint(20,10), QPoint(20, 140), 200);
- QVERIFY(flickable->verticalVelocity() < 0.0);
+ flick(window.data(), QPoint(20,10), QPoint(20, 140), 200);
+ QTRY_VERIFY(flickable->verticalVelocity() < 0.0);
QTRY_VERIFY(flickable->verticalVelocity() == 0.0);
#ifdef Q_OS_MAC
QSKIP("boost doesn't work on OS X");
- delete window;
return;
#endif
@@ -1100,17 +1079,15 @@ void tst_qquickflickable::flickVelocity()
QQuickFlickablePrivate *fp = QQuickFlickablePrivate::get(flickable);
bool boosted = false;
for (int i = 0; i < 6; ++i) {
- flick(window, QPoint(20,390), QPoint(20, 50), 100);
+ flick(window.data(), QPoint(20,390), QPoint(20, 50), 100);
boosted |= fp->flickBoost > 1.0;
}
QVERIFY(boosted);
// Flick in opposite direction -> boost cancelled.
- flick(window, QPoint(20,10), QPoint(20, 340), 200);
+ flick(window.data(), QPoint(20,10), QPoint(20, 340), 200);
QTRY_VERIFY(flickable->verticalVelocity() < 0.0);
QVERIFY(fp->flickBoost == 1.0);
-
- delete window;
}
void tst_qquickflickable::margins()
@@ -1174,20 +1151,20 @@ void tst_qquickflickable::margins()
void tst_qquickflickable::cancelOnMouseGrab()
{
- QQuickView *window = new QQuickView;
+ QScopedPointer<QQuickView> window(new QQuickView);
window->setSource(testFileUrl("cancel.qml"));
window->show();
- window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
QVERIFY(flickable != 0);
- QTest::mousePress(window, Qt::LeftButton, 0, QPoint(10, 10));
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(10, 10));
// drag out of bounds
- QTest::mouseMove(window, QPoint(50, 50));
- QTest::mouseMove(window, QPoint(100, 100));
- QTest::mouseMove(window, QPoint(150, 150));
+ QTest::mouseMove(window.data(), QPoint(50, 50));
+ QTest::mouseMove(window.data(), QPoint(100, 100));
+ QTest::mouseMove(window.data(), QPoint(150, 150));
QVERIFY(flickable->contentX() != 0);
QVERIFY(flickable->contentY() != 0);
@@ -1203,56 +1180,52 @@ void tst_qquickflickable::cancelOnMouseGrab()
QTRY_VERIFY(!flickable->isMoving());
QTRY_VERIFY(!flickable->isDragging());
- QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(50, 10));
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(50, 10));
- delete window;
}
void tst_qquickflickable::clickAndDragWhenTransformed()
{
- QQuickView *view = new QQuickView;
+ QScopedPointer<QQuickView> view(new QQuickView);
view->setSource(testFileUrl("transformedFlickable.qml"));
view->show();
- view->requestActivate();
- QVERIFY(QTest::qWaitForWindowExposed(view));
+ QVERIFY(QTest::qWaitForWindowExposed(view.data()));
QVERIFY(view->rootObject() != 0);
QQuickFlickable *flickable = view->rootObject()->findChild<QQuickFlickable*>("flickable");
QVERIFY(flickable != 0);
// click outside child rect
- QTest::mousePress(view, Qt::LeftButton, 0, QPoint(190, 190));
+ QTest::mousePress(view.data(), Qt::LeftButton, 0, QPoint(190, 190));
QTest::qWait(10);
QCOMPARE(flickable->property("itemPressed").toBool(), false);
- QTest::mouseRelease(view, Qt::LeftButton, 0, QPoint(190, 190));
+ QTest::mouseRelease(view.data(), Qt::LeftButton, 0, QPoint(190, 190));
// click inside child rect
- QTest::mousePress(view, Qt::LeftButton, 0, QPoint(200, 200));
+ QTest::mousePress(view.data(), Qt::LeftButton, 0, QPoint(200, 200));
QTest::qWait(10);
QCOMPARE(flickable->property("itemPressed").toBool(), true);
- QTest::mouseRelease(view, Qt::LeftButton, 0, QPoint(200, 200));
+ QTest::mouseRelease(view.data(), Qt::LeftButton, 0, QPoint(200, 200));
const int threshold = qApp->styleHints()->startDragDistance();
// drag outside bounds
- QTest::mousePress(view, Qt::LeftButton, 0, QPoint(160, 160));
+ QTest::mousePress(view.data(), Qt::LeftButton, 0, QPoint(160, 160));
QTest::qWait(10);
- QTest::mouseMove(view, QPoint(160 + threshold * 2, 160));
- QTest::mouseMove(view, QPoint(160 + threshold * 3, 160));
+ QTest::mouseMove(view.data(), QPoint(160 + threshold * 2, 160));
+ QTest::mouseMove(view.data(), QPoint(160 + threshold * 3, 160));
QCOMPARE(flickable->isDragging(), false);
QCOMPARE(flickable->property("itemPressed").toBool(), false);
- QTest::mouseRelease(view, Qt::LeftButton, 0, QPoint(180, 160));
+ QTest::mouseRelease(view.data(), Qt::LeftButton, 0, QPoint(180, 160));
// drag inside bounds
- QTest::mousePress(view, Qt::LeftButton, 0, QPoint(200, 140));
+ QTest::mousePress(view.data(), Qt::LeftButton, 0, QPoint(200, 140));
QTest::qWait(10);
- QTest::mouseMove(view, QPoint(200 + threshold * 2, 140));
- QTest::mouseMove(view, QPoint(200 + threshold * 3, 140));
+ QTest::mouseMove(view.data(), QPoint(200 + threshold * 2, 140));
+ QTest::mouseMove(view.data(), QPoint(200 + threshold * 3, 140));
QCOMPARE(flickable->isDragging(), true);
QCOMPARE(flickable->property("itemPressed").toBool(), false);
- QTest::mouseRelease(view, Qt::LeftButton, 0, QPoint(220, 140));
-
- delete view;
+ QTest::mouseRelease(view.data(), Qt::LeftButton, 0, QPoint(220, 140));
}
void tst_qquickflickable::flickTwiceUsingTouches()
@@ -1266,8 +1239,6 @@ void tst_qquickflickable::flickTwiceUsingTouches()
QQuickView *window = new QQuickView;
window->setSource(testFileUrl("longList.qml"));
window->show();
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
QVERIFY(window->rootObject() != 0);
QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
diff --git a/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp b/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp
index 19059c55df..b350abe953 100644
--- a/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp
+++ b/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp
@@ -525,7 +525,6 @@ void tst_qquickfocusscope::canvasFocus()
QSignalSpy scope2ActiveFocusSpy(scope2, SIGNAL(activeFocusChanged(bool)));
QSignalSpy item2ActiveFocusSpy(item2, SIGNAL(activeFocusChanged(bool)));
- QEXPECT_FAIL("", "QTBUG-22415", Abort);
QCOMPARE(rootItem->hasFocus(), false);
QCOMPARE(rootItem->hasActiveFocus(), false);
QCOMPARE(scope1->hasFocus(), true);
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
index 3c30f9e887..0c9788ab8e 100644
--- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
@@ -51,8 +51,7 @@
#include <QtQuick/private/qquickitem_p.h>
#include <QtQuick/private/qquickgridview_p.h>
#include <QtQuick/private/qquicktext_p.h>
-#include <QtQuick/private/qquickvisualitemmodel_p.h>
-#include <QtQml/private/qquicklistmodel_p.h>
+#include <QtQml/private/qqmllistmodel_p.h>
#include "../../shared/util.h"
#include "../shared/viewtestutil.h"
#include "../shared/visualtestutil.h"
@@ -2435,7 +2434,7 @@ void tst_QQuickGridView::modelChanges()
QQuickGridView *gridView = window->rootObject()->findChild<QQuickGridView*>("gridView");
QTRY_VERIFY(gridView);
- QQuickListModel *alternateModel = window->rootObject()->findChild<QQuickListModel*>("alternateModel");
+ QQmlListModel *alternateModel = window->rootObject()->findChild<QQmlListModel*>("alternateModel");
QTRY_VERIFY(alternateModel);
QVariant modelVariant = QVariant::fromValue<QObject *>(alternateModel);
QSignalSpy modelSpy(gridView, SIGNAL(modelChanged()));
@@ -2871,7 +2870,8 @@ void tst_QQuickGridView::enforceRange_rightToLeft()
ctxt->setContextProperty("testTopToBottom", QVariant(true));
window->setSource(testFileUrl("gridview-enforcerange.qml"));
- qApp->processEvents();
+ window->show();
+ QTRY_VERIFY(window->isExposed());
QVERIFY(window->rootObject() != 0);
QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
index 531bf1202e..0804c7b900 100644
--- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp
+++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
@@ -315,8 +315,7 @@ void tst_qquickimage::mirror()
obj->setFillMode(fillMode);
obj->setProperty("mirror", true);
window->show();
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window));
QImage screenshot = window->grabWindow();
screenshots[fillMode] = screenshot;
@@ -500,8 +499,7 @@ void tst_qquickimage::tiling_QTBUG_6716()
QQuickView view(testFileUrl(source));
view.show();
- view.requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(&view));
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QQuickImage *tiling = findItem<QQuickImage>(view.rootObject(), "tiling");
diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
index e237174eb1..a7343f686f 100644
--- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
@@ -175,6 +175,8 @@ private:
};
void ensureFocus(QWindow *w) {
+ if (w->width() <=0 || w->height() <= 0)
+ w->setGeometry(100, 100, 400, 300);
w->show();
w->requestActivate();
QTest::qWaitForWindowActive(w);
@@ -270,10 +272,6 @@ void tst_qquickitem::simpleFocus()
QQuickWindow window;
ensureFocus(&window);
-#ifdef Q_OS_MAC
- QSKIP("QTBUG-24094: fails on Mac OS X 10.7");
-#endif
-
QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
QQuickItem *l1c1 = new TestItem(window.contentItem());
@@ -732,7 +730,7 @@ void tst_qquickitem::focusSubItemInNonFocusScope()
QQuickView *view = new QQuickView;
view->setSource(testFileUrl("focusSubItemInNonFocusScope.qml"));
view->show();
- qApp->processEvents();
+ QTest::qWaitForWindowActive(view);
QQuickItem *dummyItem = view->rootObject()->findChild<QQuickItem *>("dummyItem");
QVERIFY(dummyItem);
diff --git a/tests/auto/quick/qquickitem2/data/activeFocusOnTab.qml b/tests/auto/quick/qquickitem2/data/activeFocusOnTab.qml
new file mode 100644
index 0000000000..e064b41efe
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/activeFocusOnTab.qml
@@ -0,0 +1,136 @@
+import QtQuick 2.0
+
+Item {
+ id: main
+ objectName: "main"
+ width: 800
+ height: 600
+ focus: true
+ Component.onCompleted: button12.focus = true
+ Item {
+ id: sub1
+ objectName: "sub1"
+ width: 230
+ height: 600
+ anchors.top: parent.top
+ anchors.left: parent.left
+ Item {
+ id: button11
+ objectName: "button11"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+
+ anchors.top: parent.top
+ anchors.topMargin: 100
+ }
+ Item {
+ id: button12
+ objectName: "button12"
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ width: 100
+ height: 50
+
+ anchors.top: button11.bottom
+ anchors.bottomMargin: 100
+ }
+ Item {
+ id: button13
+ objectName: "button13"
+ enabled: false
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ width: 100
+ height: 50
+
+ anchors.top: button12.bottom
+ anchors.bottomMargin: 100
+ }
+ Item {
+ id: button14
+ objectName: "button14"
+ visible: false
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ width: 100
+ height: 50
+
+ anchors.top: button12.bottom
+ anchors.bottomMargin: 100
+ }
+ }
+ Item {
+ id: sub2
+ objectName: "sub2"
+ activeFocusOnTab: true
+ width: 230
+ height: 600
+ anchors.top: parent.top
+ anchors.left: sub1.right
+ Item {
+ id: button21
+ objectName: "button21"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+
+ anchors.top: parent.top
+ anchors.topMargin: 100
+ }
+ Item {
+ id: button22
+ objectName: "button22"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+
+ anchors.top: button21.bottom
+ anchors.bottomMargin: 100
+ }
+ }
+ Item {
+ id: sub3
+ objectName: "sub3"
+ width: 230
+ height: 600
+ anchors.top: parent.top
+ anchors.left: sub2.right
+ TextEdit {
+ id: edit
+ objectName: "edit"
+ width: 230
+ height: 400
+ readOnly: false
+ activeFocusOnTab: true
+ wrapMode: TextEdit.Wrap
+ textFormat: TextEdit.RichText
+
+ text: "aaa\n"
+ +"bbb\n"
+ +"ccc\n"
+ +"ddd\n"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/activeFocusOnTab3.qml b/tests/auto/quick/qquickitem2/data/activeFocusOnTab3.qml
new file mode 100644
index 0000000000..00fb82d59e
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/activeFocusOnTab3.qml
@@ -0,0 +1,250 @@
+import QtQuick 2.0
+
+Item {
+ id: main
+ objectName: "main"
+ width: 400
+ height: 700
+ focus: true
+ Component.onCompleted: button1.focus = true
+ Item {
+ id: sub1
+ objectName: "sub1"
+ activeFocusOnTab: false
+ width: 100
+ height: 50
+ anchors.top: parent.top
+ Item {
+ id: button1
+ objectName: "button1"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ }
+ }
+ Row {
+ id: row_repeater
+ objectName: "row_repeater"
+ activeFocusOnTab: false
+ anchors.top: sub1.bottom
+ Repeater {
+ activeFocusOnTab: false
+ model: 3
+ Rectangle {
+ activeFocusOnTab: true
+ width: 100; height: 40
+ border.width: 1
+ color: activeFocus ? "red" : "yellow"
+ }
+ }
+ }
+ Item {
+ id: sub2
+ objectName: "sub2"
+ activeFocusOnTab: false
+ anchors.top: row_repeater.bottom
+ width: 100
+ height: 50
+ Item {
+ id: button2
+ objectName: "button2"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ }
+ }
+ Row {
+ id: row
+ objectName: "row"
+ activeFocusOnTab: false
+ anchors.top: sub2.bottom
+ Rectangle { activeFocusOnTab: true; color: activeFocus ? "red" : "yellow"; width: 50; height: 50 }
+ Rectangle { activeFocusOnTab: true; color: activeFocus ? "red" : "green"; width: 20; height: 50 }
+ Rectangle { activeFocusOnTab: true; color: activeFocus ? "red" : "blue"; width: 50; height: 20 }
+ }
+ Item {
+ id: sub3
+ objectName: "sub3"
+ activeFocusOnTab: false
+ anchors.top: row.bottom
+ width: 100
+ height: 50
+ Item {
+ id: button3
+ objectName: "button3"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ }
+ }
+ Flow {
+ id: flow
+ objectName: "flow"
+ activeFocusOnTab: false
+ anchors.top: sub3.bottom
+ width: parent.width
+ anchors.margins: 4
+ spacing: 10
+ Rectangle { activeFocusOnTab: true; color: activeFocus ? "red" : "yellow"; width: 50; height: 50 }
+ Rectangle { activeFocusOnTab: true; color: activeFocus ? "red" : "green"; width: 20; height: 50 }
+ Rectangle { activeFocusOnTab: true; color: activeFocus ? "red" : "blue"; width: 50; height: 20 }
+ }
+ Item {
+ id: sub4
+ objectName: "sub4"
+ activeFocusOnTab: false
+ anchors.top: flow.bottom
+ width: 100
+ height: 50
+ Item {
+ id: button4
+ objectName: "button4"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ }
+ }
+ FocusScope {
+ id: focusscope
+ objectName: "focusscope"
+ activeFocusOnTab: false
+ anchors.top: sub4.bottom
+ height: 40
+ Row {
+ id: row_focusscope
+ objectName: "row_focusscope"
+ activeFocusOnTab: false
+ anchors.fill: parent
+ Repeater {
+ activeFocusOnTab: false
+ model: 3
+ Rectangle {
+ activeFocusOnTab: true
+ width: 100; height: 40
+ border.width: 1
+ color: activeFocus ? "red" : "yellow"
+ }
+ }
+ }
+ }
+ Item {
+ id: sub5
+ objectName: "sub5"
+ activeFocusOnTab: false
+ anchors.top: focusscope.bottom
+ width: 100
+ height: 50
+ Item {
+ id: button5
+ objectName: "button5"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ }
+ }
+ FocusScope {
+ id: focusscope2
+ objectName: "focusscope2"
+ activeFocusOnTab: true
+ anchors.top: sub5.bottom
+ height: 40
+ Row {
+ id: row_focusscope2
+ objectName: "row_focusscope2"
+ activeFocusOnTab: false
+ anchors.fill: parent
+ Repeater {
+ activeFocusOnTab: false
+ model: 3
+ Rectangle {
+ activeFocusOnTab: true
+ focus: true
+ width: 100; height: 40
+ border.width: 1
+ color: activeFocus ? "red" : "yellow"
+ }
+ }
+ }
+ }
+ Item {
+ id: sub6
+ objectName: "sub6"
+ activeFocusOnTab: false
+ anchors.top: focusscope2.bottom
+ width: 100
+ height: 50
+ Item {
+ id: button6
+ objectName: "button6"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ }
+ }
+ FocusScope {
+ id: focusscope3
+ objectName: "focusscope3"
+ activeFocusOnTab: true
+ anchors.top: sub6.bottom
+ height: 40
+ Row {
+ id: row_focusscope3
+ objectName: "row_focusscope3"
+ activeFocusOnTab: false
+ anchors.fill: parent
+ Repeater {
+ activeFocusOnTab: false
+ model: 3
+ Rectangle {
+ activeFocusOnTab: true
+ width: 100; height: 40
+ border.width: 1
+ color: activeFocus ? "red" : "yellow"
+ }
+ }
+ }
+ }
+ Item {
+ id: sub7
+ objectName: "sub7"
+ activeFocusOnTab: false
+ anchors.top: focusscope3.bottom
+ width: 100
+ height: 50
+ Item {
+ id: button7
+ objectName: "button7"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
index c82372c287..668b5e2945 100644
--- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
@@ -64,6 +64,10 @@ private slots:
void initTestCase();
void cleanup();
+ void activeFocusOnTab();
+ void activeFocusOnTab2();
+ void activeFocusOnTab3();
+
void keys();
void keysProcessingOrder();
void keysim();
@@ -273,6 +277,331 @@ void tst_QQuickItem::cleanup()
inputMethodPrivate->testContext = 0;
}
+void tst_QQuickItem::activeFocusOnTab()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(800,600));
+
+ window->setSource(testFileUrl("activeFocusOnTab.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ // original: button12
+ QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "button12");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // Tab: button12->sub2
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "sub2");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // Tab: sub2->button21
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button21");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // Tab: button21->button22
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button22");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // Tab: button22->edit
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "edit");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: edit->button22
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button22");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: button22->button21
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button21");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: button21->sub2
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "sub2");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: sub2->button12
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button12");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: button12->button11
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button11");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: button11->edit
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "edit");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ delete window;
+}
+
+void tst_QQuickItem::activeFocusOnTab2()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(800,600));
+
+ window->setSource(testFileUrl("activeFocusOnTab.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ // original: button12
+ QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "button12");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: button12->button11
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button11");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: button11->edit
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "edit");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ delete window;
+}
+
+void tst_QQuickItem::activeFocusOnTab3()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(800,600));
+
+ window->setSource(testFileUrl("activeFocusOnTab3.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ // original: button1
+ QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "button1");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 Tabs: button1->button2, through a repeater
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);;
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button2");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 Tabs: button2->button3, through a row
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);;
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button3");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 Tabs: button3->button4, through a flow
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);;
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button4");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 Tabs: button4->button5, through a focusscope
+ // parent is activeFocusOnTab:false, one of children is focus:true
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);;
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button5");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 Tabs: button5->button6, through a focusscope
+ // parent is activeFocusOnTab:true, one of children is focus:true
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);;
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button6");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 5 Tabs: button6->button7, through a focusscope
+ // parent is activeFocusOnTab:true, none of children is focus:true
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);;
+ for (int i = 0; i < 5; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button7");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 BackTabs: button7->button6, through a focusscope
+ // parent is activeFocusOnTab:true, one of children got focus:true in previous code
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button6");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 Tabs: button6->button7, through a focusscope
+ // parent is activeFocusOnTab:true, one of children got focus:true in previous code
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);;
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button7");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 BackTabs: button7->button6, through a focusscope
+ // parent is activeFocusOnTab:true, one of children got focus:true in previous code
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button6");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 BackTabs: button6->button5, through a focusscope(parent is activeFocusOnTab: false)
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button5");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 BackTabs: button5->button4, through a focusscope(parent is activeFocusOnTab: false)
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button4");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 BackTabs: button4->button3, through a flow
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button3");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 BackTabs: button3->button2, through a row
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button2");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 BackTabs: button2->button1, through a repeater
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button1");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ delete window;
+}
+
void tst_QQuickItem::keys()
{
QQuickView *window = new QQuickView(0);
diff --git a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
index 9387264eb0..4f103bd1fa 100644
--- a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
+++ b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
@@ -266,7 +266,7 @@ void tst_QQuickItemLayer::layerVisibility()
view.show();
- QTest::qWaitForWindowActive(&view);
+ QTest::qWaitForWindowExposed(&view);
QImage fb = view.grabWindow();
uint pixel = fb.pixel(0, 0);
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 3b4a41e203..f8c7de6635 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -48,8 +48,8 @@
#include <QtQml/qqmlincubator.h>
#include <QtQuick/private/qquicklistview_p.h>
#include <QtQuick/private/qquicktext_p.h>
-#include <QtQuick/private/qquickvisualitemmodel_p.h>
-#include <QtQml/private/qquicklistmodel_p.h>
+#include <QtQml/private/qqmlobjectmodel_p.h>
+#include <QtQml/private/qqmllistmodel_p.h>
#include "../../shared/util.h"
#include "../shared/viewtestutil.h"
#include "../shared/visualtestutil.h"
@@ -2769,7 +2769,7 @@ void tst_QQuickListView::itemList()
QQuickItem *contentItem = listview->contentItem();
QTRY_VERIFY(contentItem != 0);
- QQuickVisualItemModel *model = window->rootObject()->findChild<QQuickVisualItemModel*>("itemModel");
+ QQmlObjectModel *model = window->rootObject()->findChild<QQmlObjectModel*>("itemModel");
QTRY_VERIFY(model != 0);
QTRY_VERIFY(model->count() == 3);
@@ -2810,7 +2810,7 @@ void tst_QQuickListView::itemListFlicker()
QQuickItem *contentItem = listview->contentItem();
QTRY_VERIFY(contentItem != 0);
- QQuickVisualItemModel *model = window->rootObject()->findChild<QQuickVisualItemModel*>("itemModel");
+ QQmlObjectModel *model = window->rootObject()->findChild<QQmlObjectModel*>("itemModel");
QTRY_VERIFY(model != 0);
QTRY_VERIFY(model->count() == 3);
@@ -3259,7 +3259,7 @@ void tst_QQuickListView::modelChanges()
QQuickListView *listView = window->rootObject()->findChild<QQuickListView*>("listView");
QTRY_VERIFY(listView);
- QQuickListModel *alternateModel = window->rootObject()->findChild<QQuickListModel*>("alternateModel");
+ QQmlListModel *alternateModel = window->rootObject()->findChild<QQmlListModel*>("alternateModel");
QTRY_VERIFY(alternateModel);
QVariant modelVariant = QVariant::fromValue<QObject *>(alternateModel);
QSignalSpy modelSpy(listView, SIGNAL(modelChanged()));
@@ -4607,7 +4607,7 @@ void tst_QQuickListView::rightToLeft()
QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
- QQuickVisualItemModel *model = window->rootObject()->findChild<QQuickVisualItemModel*>("itemModel");
+ QQmlObjectModel *model = window->rootObject()->findChild<QQmlObjectModel*>("itemModel");
QTRY_VERIFY(model != 0);
QTRY_VERIFY(model->count() == 3);
diff --git a/tests/auto/quick/qquickloader/data/QTBUG_30183.qml b/tests/auto/quick/qquickloader/data/QTBUG_30183.qml
new file mode 100644
index 0000000000..1f626d969f
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/QTBUG_30183.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Loader {
+ width: implicitWidth
+ height: implicitHeight
+
+ sourceComponent: Rectangle {
+ color: "green"
+ implicitWidth: 240
+ implicitHeight: 120
+ }
+}
diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
index d01e8aae52..50ded4d95a 100644
--- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp
+++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
@@ -126,6 +126,7 @@ private slots:
void parented();
void sizeBound();
+ void QTBUG_30183();
private:
QQmlEngine engine;
@@ -1126,6 +1127,22 @@ void tst_QQuickLoader::sizeBound()
delete root;
}
+void tst_QQuickLoader::QTBUG_30183()
+{
+ QQmlComponent component(&engine, testFileUrl("/QTBUG_30183.qml"));
+ QQuickLoader *loader = qobject_cast<QQuickLoader*>(component.create());
+ QVERIFY(loader != 0);
+ QCOMPARE(loader->width(), 240.0);
+ QCOMPARE(loader->height(), 120.0);
+
+ // the loaded item must follow the size
+ QQuickItem *rect = qobject_cast<QQuickItem*>(loader->item());
+ QVERIFY(rect);
+ QCOMPARE(rect->width(), 240.0);
+ QCOMPARE(rect->height(), 120.0);
+
+ delete loader;
+}
QTEST_MAIN(tst_QQuickLoader)
diff --git a/tests/auto/quick/qquickmousearea/data/pressedCanceled.qml b/tests/auto/quick/qquickmousearea/data/pressedCanceled.qml
index 231436d0f2..14630b8962 100644
--- a/tests/auto/quick/qquickmousearea/data/pressedCanceled.qml
+++ b/tests/auto/quick/qquickmousearea/data/pressedCanceled.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQuick.Window 2.0
Rectangle {
id: root
@@ -7,6 +8,12 @@ Rectangle {
property bool pressed:mouse.pressed
property bool canceled: false
property bool released: false
+ property alias secondWindow: secondWindow
+
+ Window {
+ id: secondWindow
+ x: root.x + root.width
+ }
MouseArea {
id: mouse
@@ -15,4 +22,4 @@ Rectangle {
onCanceled: {root.canceled = true}
onReleased: {root.released = true; root.canceled = false}
}
-} \ No newline at end of file
+}
diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
index 055facc9e1..fa33f3f626 100644
--- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
+++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
@@ -132,7 +132,7 @@ void tst_QQuickMouseArea::dragProperties()
window->setSource(testFileUrl("dragproperties.qml"));
window->show();
- window->requestActivate();
+ QTest::qWaitForWindowExposed(window);
QVERIFY(window->rootObject() != 0);
QQuickMouseArea *mouseRegion = window->rootObject()->findChild<QQuickMouseArea*>("mouseregion");
@@ -218,7 +218,7 @@ void tst_QQuickMouseArea::resetDrag()
window->rootContext()->setContextProperty("haveTarget", QVariant(true));
window->setSource(testFileUrl("dragreset.qml"));
window->show();
- window->requestActivate();
+ QTest::qWaitForWindowExposed(window);
QVERIFY(window->rootObject() != 0);
QQuickMouseArea *mouseRegion = window->rootObject()->findChild<QQuickMouseArea*>("mouseregion");
@@ -250,7 +250,7 @@ void tst_QQuickMouseArea::dragging()
window->setSource(testFileUrl("dragging.qml"));
window->show();
- window->requestActivate();
+ QTest::qWaitForWindowExposed(window);
QVERIFY(QTest::qWaitForWindowExposed(window));
QVERIFY(window->rootObject() != 0);
@@ -305,8 +305,7 @@ void tst_QQuickMouseArea::invalidDrag()
window->setSource(testFileUrl("dragging.qml"));
window->show();
- window->requestActivate();
- QTest::qWait(20);
+ QTest::qWaitForWindowExposed(window);
QVERIFY(window->rootObject() != 0);
QQuickMouseArea *mouseRegion = window->rootObject()->findChild<QQuickMouseArea*>("mouseregion");
@@ -357,8 +356,7 @@ void tst_QQuickMouseArea::setDragOnPressed()
window->setSource(testFileUrl("setDragOnPressed.qml"));
window->show();
- window->requestActivate();
- QTest::qWait(20);
+ QTest::qWaitForWindowExposed(window);
QVERIFY(window->rootObject() != 0);
QQuickMouseArea *mouseArea = qobject_cast<QQuickMouseArea *>(window->rootObject());
@@ -412,7 +410,7 @@ void tst_QQuickMouseArea::updateMouseAreaPosOnClick()
QQuickView *window = createView();
window->setSource(testFileUrl("updateMousePosOnClick.qml"));
window->show();
- window->requestActivate();
+ QTest::qWaitForWindowExposed(window);
QVERIFY(window->rootObject() != 0);
QQuickMouseArea *mouseRegion = window->rootObject()->findChild<QQuickMouseArea*>("mouseregion");
@@ -441,7 +439,7 @@ void tst_QQuickMouseArea::updateMouseAreaPosOnResize()
QQuickView *window = createView();
window->setSource(testFileUrl("updateMousePosOnResize.qml"));
window->show();
- window->requestActivate();
+ QTest::qWaitForWindowExposed(window);
QVERIFY(window->rootObject() != 0);
QQuickMouseArea *mouseRegion = window->rootObject()->findChild<QQuickMouseArea*>("mouseregion");
@@ -478,7 +476,7 @@ void tst_QQuickMouseArea::noOnClickedWithPressAndHold()
QQuickView *window = createView();
window->setSource(testFileUrl("clickandhold.qml"));
window->show();
- window->requestActivate();
+ QTest::qWaitForWindowExposed(window);
QVERIFY(window->rootObject() != 0);
QQuickMouseArea *mouseArea = qobject_cast<QQuickMouseArea*>(window->rootObject()->children().first());
QVERIFY(mouseArea);
@@ -511,7 +509,7 @@ void tst_QQuickMouseArea::noOnClickedWithPressAndHold()
QQuickView *window = createView();
window->setSource(testFileUrl("noclickandhold.qml"));
window->show();
- window->requestActivate();
+ QTest::qWaitForWindowExposed(window);
QVERIFY(window->rootObject() != 0);
QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
@@ -535,7 +533,7 @@ void tst_QQuickMouseArea::onMousePressRejected()
QQuickView *window = createView();
window->setSource(testFileUrl("rejectEvent.qml"));
window->show();
- window->requestActivate();
+ QTest::qWaitForWindowExposed(window);
QVERIFY(window->rootObject() != 0);
QVERIFY(window->rootObject()->property("enabled").toBool());
@@ -572,7 +570,7 @@ void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate()
QQuickView *window = createView();
window->setSource(testFileUrl("pressedCanceled.qml"));
window->show();
- window->requestActivate();
+ QTest::qWaitForWindowExposed(window);
QVERIFY(window->rootObject() != 0);
QVERIFY(!window->rootObject()->property("pressed").toBool());
QVERIFY(!window->rootObject()->property("canceled").toBool());
@@ -585,16 +583,14 @@ void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate()
QVERIFY(!window->rootObject()->property("canceled").toBool());
QVERIFY(!window->rootObject()->property("released").toBool());
- QTest::qWait(200);
+ QWindow *secondWindow = qvariant_cast<QWindow*>(window->rootObject()->property("secondWindow"));
+ secondWindow->setProperty("visible", true);
+ QTest::qWaitForWindowActive(secondWindow);
- QEvent windowDeactivateEvent(QEvent::WindowDeactivate);
- QGuiApplication::sendEvent(window, &windowDeactivateEvent);
QVERIFY(!window->rootObject()->property("pressed").toBool());
QVERIFY(window->rootObject()->property("canceled").toBool());
QVERIFY(!window->rootObject()->property("released").toBool());
- QTest::qWait(200);
-
//press again
QGuiApplication::sendEvent(window, &pressEvent);
QVERIFY(window->rootObject()->property("pressed").toBool());
@@ -621,7 +617,7 @@ void tst_QQuickMouseArea::doubleClick()
QQuickView *window = createView();
window->setSource(testFileUrl("doubleclick.qml"));
window->show();
- window->requestActivate();
+ QTest::qWaitForWindowExposed(window);
QVERIFY(window->rootObject() != 0);
QQuickMouseArea *mouseArea = window->rootObject()->findChild<QQuickMouseArea *>("mousearea");
@@ -659,7 +655,7 @@ void tst_QQuickMouseArea::clickTwice()
QQuickView *window = createView();
window->setSource(testFileUrl("clicktwice.qml"));
window->show();
- window->requestActivate();
+ QTest::qWaitForWindowExposed(window);
QVERIFY(window->rootObject() != 0);
QQuickMouseArea *mouseArea = window->rootObject()->findChild<QQuickMouseArea *>("mousearea");
@@ -696,7 +692,7 @@ void tst_QQuickMouseArea::invalidClick()
QQuickView *window = createView();
window->setSource(testFileUrl("doubleclick.qml"));
window->show();
- window->requestActivate();
+ QTest::qWaitForWindowExposed(window);
QVERIFY(window->rootObject() != 0);
QQuickMouseArea *mouseArea = window->rootObject()->findChild<QQuickMouseArea *>("mousearea");
@@ -730,7 +726,7 @@ void tst_QQuickMouseArea::pressedOrdering()
QQuickView *window = createView();
window->setSource(testFileUrl("pressedOrdering.qml"));
window->show();
- window->requestActivate();
+ QTest::qWaitForWindowExposed(window);
QVERIFY(window->rootObject() != 0);
QCOMPARE(window->rootObject()->property("value").toString(), QLatin1String("base"));
@@ -758,7 +754,7 @@ void tst_QQuickMouseArea::preventStealing()
window->setSource(testFileUrl("preventstealing.qml"));
window->show();
- window->requestActivate();
+ QTest::qWaitForWindowExposed(window);
QVERIFY(window->rootObject() != 0);
QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
@@ -822,7 +818,7 @@ void tst_QQuickMouseArea::clickThrough()
QQuickView *window = createView();
window->setSource(testFileUrl("clickThrough.qml"));
window->show();
- window->requestActivate();
+ QTest::qWaitForWindowExposed(window);
QVERIFY(window->rootObject() != 0);
QTest::mousePress(window, Qt::LeftButton, 0, QPoint(100,100));
@@ -857,7 +853,7 @@ void tst_QQuickMouseArea::clickThrough()
window = createView();
window->setSource(testFileUrl("clickThrough2.qml"));
window->show();
- window->requestActivate();
+ QTest::qWaitForWindowExposed(window);
QVERIFY(window->rootObject() != 0);
QTest::mousePress(window, Qt::LeftButton, 0, QPoint(100,100));
@@ -1016,8 +1012,7 @@ void tst_QQuickMouseArea::disableAfterPress()
QQuickView *window = createView();
window->setSource(testFileUrl("dragging.qml"));
window->show();
- window->requestActivate();
- QTest::qWait(20);
+ QTest::qWaitForWindowExposed(window);
QVERIFY(window->rootObject() != 0);
QQuickMouseArea *mouseArea = window->rootObject()->findChild<QQuickMouseArea*>("mouseregion");
@@ -1166,7 +1161,7 @@ void tst_QQuickMouseArea::transformedMouseArea()
QQuickView *window = createView();
window->setSource(testFileUrl("transformedMouseArea.qml"));
window->show();
- window->requestActivate();
+ QTest::qWaitForWindowExposed(window);
QVERIFY(window->rootObject() != 0);
QQuickMouseArea *mouseArea = window->rootObject()->findChild<QQuickMouseArea *>("mouseArea");
@@ -1284,7 +1279,7 @@ void tst_QQuickMouseArea::pressedMultipleButtons()
QQuickView *view = createView();
view->setSource(testFileUrl("simple.qml"));
view->show();
- view->requestActivate();
+ QTest::qWaitForWindowExposed(view);
QVERIFY(view->rootObject() != 0);
QQuickMouseArea *mouseArea = view->rootObject()->findChild<QQuickMouseArea *>("mousearea");
@@ -1321,7 +1316,7 @@ void tst_QQuickMouseArea::changeAxis()
view->setSource(testFileUrl("changeAxis.qml"));
view->show();
- view->requestActivate();
+ QTest::qWaitForWindowExposed(view);
QTRY_VERIFY(view->rootObject() != 0);
QQuickMouseArea *mouseRegion = view->rootObject()->findChild<QQuickMouseArea*>("mouseregion");
@@ -1413,7 +1408,7 @@ void tst_QQuickMouseArea::moveAndReleaseWithoutPress()
window->setSource(testFileUrl("moveAndReleaseWithoutPress.qml"));
window->show();
- window->requestActivate();
+ QTest::qWaitForWindowExposed(window);
QVERIFY(QTest::qWaitForWindowExposed(window));
QObject *root = window->rootObject();
diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
index 73c2cf68dd..663d02d921 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
+++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
@@ -851,8 +851,7 @@ QQuickView *tst_QQuickMultiPointTouchArea::createAndShowView(const QString &file
QQuickView *window = new QQuickView(0);
window->setSource(testFileUrl(file));
window->show();
- window->requestActivate();
- QTest::qWaitForWindowActive(window);
+ QTest::qWaitForWindowExposed(window);
return window;
}
diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
index 8821203902..e805a6b074 100644
--- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
+++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
@@ -50,7 +50,7 @@
#include <QtQuick/private/qquickpath_p.h>
#include <QtQuick/private/qquicktext_p.h>
#include <QtQuick/private/qquickrectangle_p.h>
-#include <QtQml/private/qquicklistmodel_p.h>
+#include <QtQml/private/qqmllistmodel_p.h>
#include <QtQml/private/qqmlvaluetype_p.h>
#include <QtGui/qstandarditemmodel.h>
#include <QStringListModel>
@@ -199,7 +199,7 @@ void tst_QQuickPathView::initValues()
void tst_QQuickPathView::items()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QaimModel model;
model.addItem("Fred", "12345");
@@ -238,8 +238,6 @@ void tst_QQuickPathView::items()
offset.setX(pathview->highlightItem()->width()/2);
offset.setY(pathview->highlightItem()->height()/2);
QCOMPARE(pathview->highlightItem()->position() + offset, start);
-
- delete window;
}
void tst_QQuickPathView::pathview2()
@@ -312,34 +310,34 @@ void tst_QQuickPathView::insertModel_data()
// We have 8 items, with currentIndex == 4
QTest::newRow("insert after current")
- << int(QQuickPathView::StrictlyEnforceRange) << 6 << 1 << 5. << 4;
+ << int(QQuickPathView::StrictlyEnforceRange) << 6 << 1 << qreal(5.) << 4;
QTest::newRow("insert before current")
- << int(QQuickPathView::StrictlyEnforceRange) << 2 << 1 << 4. << 5;
+ << int(QQuickPathView::StrictlyEnforceRange) << 2 << 1 << qreal(4.)<< 5;
QTest::newRow("insert multiple after current")
- << int(QQuickPathView::StrictlyEnforceRange) << 5 << 2 << 6. << 4;
+ << int(QQuickPathView::StrictlyEnforceRange) << 5 << 2 << qreal(6.) << 4;
QTest::newRow("insert multiple before current")
- << int(QQuickPathView::StrictlyEnforceRange) << 1 << 2 << 4. << 6;
+ << int(QQuickPathView::StrictlyEnforceRange) << 1 << 2 << qreal(4.) << 6;
QTest::newRow("insert at end")
- << int(QQuickPathView::StrictlyEnforceRange) << 8 << 1 << 5. << 4;
+ << int(QQuickPathView::StrictlyEnforceRange) << 8 << 1 << qreal(5.) << 4;
QTest::newRow("insert at beginning")
- << int(QQuickPathView::StrictlyEnforceRange) << 0 << 1 << 4. << 5;
+ << int(QQuickPathView::StrictlyEnforceRange) << 0 << 1 << qreal(4.) << 5;
QTest::newRow("insert at current")
- << int(QQuickPathView::StrictlyEnforceRange) << 4 << 1 << 4. << 5;
+ << int(QQuickPathView::StrictlyEnforceRange) << 4 << 1 << qreal(4.) << 5;
QTest::newRow("no range - insert after current")
- << int(QQuickPathView::NoHighlightRange) << 6 << 1 << 5. << 4;
+ << int(QQuickPathView::NoHighlightRange) << 6 << 1 << qreal(5.) << 4;
QTest::newRow("no range - insert before current")
- << int(QQuickPathView::NoHighlightRange) << 2 << 1 << 4. << 5;
+ << int(QQuickPathView::NoHighlightRange) << 2 << 1 << qreal(4.) << 5;
QTest::newRow("no range - insert multiple after current")
- << int(QQuickPathView::NoHighlightRange) << 5 << 2 << 6. << 4;
+ << int(QQuickPathView::NoHighlightRange) << 5 << 2 << qreal(6.) << 4;
QTest::newRow("no range - insert multiple before current")
- << int(QQuickPathView::NoHighlightRange) << 1 << 2 << 4. << 6;
+ << int(QQuickPathView::NoHighlightRange) << 1 << 2 << qreal(4.) << 6;
QTest::newRow("no range - insert at end")
- << int(QQuickPathView::NoHighlightRange) << 8 << 1 << 5. << 4;
+ << int(QQuickPathView::NoHighlightRange) << 8 << 1 << qreal(5.) << 4;
QTest::newRow("no range - insert at beginning")
- << int(QQuickPathView::NoHighlightRange) << 0 << 1 << 4. << 5;
+ << int(QQuickPathView::NoHighlightRange) << 0 << 1 << qreal(4.) << 5;
QTest::newRow("no range - insert at current")
- << int(QQuickPathView::NoHighlightRange) << 4 << 1 << 4. << 5;
+ << int(QQuickPathView::NoHighlightRange) << 4 << 1 << qreal(4.) << 5;
}
void tst_QQuickPathView::insertModel()
@@ -350,7 +348,7 @@ void tst_QQuickPathView::insertModel()
QFETCH(qreal, offset);
QFETCH(int, currentIndex);
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->show();
QaimModel model;
@@ -388,8 +386,6 @@ void tst_QQuickPathView::insertModel()
QTRY_COMPARE(pathview->offset(), offset);
QCOMPARE(pathview->currentIndex(), currentIndex);
-
- delete window;
}
void tst_QQuickPathView::removeModel_data()
@@ -402,38 +398,38 @@ void tst_QQuickPathView::removeModel_data()
// We have 8 items, with currentIndex == 4
QTest::newRow("remove after current")
- << int(QQuickPathView::StrictlyEnforceRange) << 6 << 1 << 3. << 4;
+ << int(QQuickPathView::StrictlyEnforceRange) << 6 << 1 << qreal(3.) << 4;
QTest::newRow("remove before current")
- << int(QQuickPathView::StrictlyEnforceRange) << 2 << 1 << 4. << 3;
+ << int(QQuickPathView::StrictlyEnforceRange) << 2 << 1 << qreal(4.) << 3;
QTest::newRow("remove multiple after current")
- << int(QQuickPathView::StrictlyEnforceRange) << 5 << 2 << 2. << 4;
+ << int(QQuickPathView::StrictlyEnforceRange) << 5 << 2 << qreal(2.) << 4;
QTest::newRow("remove multiple before current")
- << int(QQuickPathView::StrictlyEnforceRange) << 1 << 2 << 4. << 2;
+ << int(QQuickPathView::StrictlyEnforceRange) << 1 << 2 << qreal(4.) << 2;
QTest::newRow("remove last")
- << int(QQuickPathView::StrictlyEnforceRange) << 7 << 1 << 3. << 4;
+ << int(QQuickPathView::StrictlyEnforceRange) << 7 << 1 << qreal(3.) << 4;
QTest::newRow("remove first")
- << int(QQuickPathView::StrictlyEnforceRange) << 0 << 1 << 4. << 3;
+ << int(QQuickPathView::StrictlyEnforceRange) << 0 << 1 << qreal(4.) << 3;
QTest::newRow("remove current")
- << int(QQuickPathView::StrictlyEnforceRange) << 4 << 1 << 3. << 4;
+ << int(QQuickPathView::StrictlyEnforceRange) << 4 << 1 << qreal(3.) << 4;
QTest::newRow("remove all")
- << int(QQuickPathView::StrictlyEnforceRange) << 0 << 8 << 0. << 0;
+ << int(QQuickPathView::StrictlyEnforceRange) << 0 << 8 << qreal(0.) << 0;
QTest::newRow("no range - remove after current")
- << int(QQuickPathView::NoHighlightRange) << 6 << 1 << 3. << 4;
+ << int(QQuickPathView::NoHighlightRange) << 6 << 1 << qreal(3.) << 4;
QTest::newRow("no range - remove before current")
- << int(QQuickPathView::NoHighlightRange) << 2 << 1 << 4. << 3;
+ << int(QQuickPathView::NoHighlightRange) << 2 << 1 << qreal(4.) << 3;
QTest::newRow("no range - remove multiple after current")
- << int(QQuickPathView::NoHighlightRange) << 5 << 2 << 2. << 4;
+ << int(QQuickPathView::NoHighlightRange) << 5 << 2 << qreal(2.) << 4;
QTest::newRow("no range - remove multiple before current")
- << int(QQuickPathView::NoHighlightRange) << 1 << 2 << 4. << 2;
+ << int(QQuickPathView::NoHighlightRange) << 1 << 2 << qreal(4.) << 2;
QTest::newRow("no range - remove last")
- << int(QQuickPathView::NoHighlightRange) << 7 << 1 << 3. << 4;
+ << int(QQuickPathView::NoHighlightRange) << 7 << 1 << qreal(3.) << 4;
QTest::newRow("no range - remove first")
- << int(QQuickPathView::NoHighlightRange) << 0 << 1 << 4. << 3;
+ << int(QQuickPathView::NoHighlightRange) << 0 << 1 << qreal(4.) << 3;
QTest::newRow("no range - remove current offset")
- << int(QQuickPathView::NoHighlightRange) << 4 << 1 << 4. << 4;
+ << int(QQuickPathView::NoHighlightRange) << 4 << 1 << qreal(4.) << 4;
QTest::newRow("no range - remove all")
- << int(QQuickPathView::NoHighlightRange) << 0 << 8 << 0. << 0;
+ << int(QQuickPathView::NoHighlightRange) << 0 << 8 << qreal(0.) << 0;
}
void tst_QQuickPathView::removeModel()
@@ -444,7 +440,8 @@ void tst_QQuickPathView::removeModel()
QFETCH(qreal, offset);
QFETCH(int, currentIndex);
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
+
window->show();
QaimModel model;
@@ -478,8 +475,6 @@ void tst_QQuickPathView::removeModel()
QTRY_COMPARE(pathview->offset(), offset);
QCOMPARE(pathview->currentIndex(), currentIndex);
-
- delete window;
}
@@ -494,40 +489,40 @@ void tst_QQuickPathView::moveModel_data()
// We have 8 items, with currentIndex == 4
QTest::newRow("move after current")
- << int(QQuickPathView::StrictlyEnforceRange) << 5 << 6 << 1 << 4. << 4;
+ << int(QQuickPathView::StrictlyEnforceRange) << 5 << 6 << 1 << qreal(4.) << 4;
QTest::newRow("move before current")
- << int(QQuickPathView::StrictlyEnforceRange) << 2 << 3 << 1 << 4. << 4;
+ << int(QQuickPathView::StrictlyEnforceRange) << 2 << 3 << 1 << qreal(4.) << 4;
QTest::newRow("move before current to after")
- << int(QQuickPathView::StrictlyEnforceRange) << 2 << 6 << 1 << 5. << 3;
+ << int(QQuickPathView::StrictlyEnforceRange) << 2 << 6 << 1 << qreal(5.) << 3;
QTest::newRow("move multiple after current")
- << int(QQuickPathView::StrictlyEnforceRange) << 5 << 6 << 2 << 4. << 4;
+ << int(QQuickPathView::StrictlyEnforceRange) << 5 << 6 << 2 << qreal(4.) << 4;
QTest::newRow("move multiple before current")
- << int(QQuickPathView::StrictlyEnforceRange) << 0 << 1 << 2 << 4. << 4;
+ << int(QQuickPathView::StrictlyEnforceRange) << 0 << 1 << 2 << qreal(4.) << 4;
QTest::newRow("move before current to end")
- << int(QQuickPathView::StrictlyEnforceRange) << 2 << 7 << 1 << 5. << 3;
+ << int(QQuickPathView::StrictlyEnforceRange) << 2 << 7 << 1 << qreal(5.) << 3;
QTest::newRow("move last to beginning")
- << int(QQuickPathView::StrictlyEnforceRange) << 7 << 0 << 1 << 3. << 5;
+ << int(QQuickPathView::StrictlyEnforceRange) << 7 << 0 << 1 << qreal(3.) << 5;
QTest::newRow("move current")
- << int(QQuickPathView::StrictlyEnforceRange) << 4 << 6 << 1 << 2. << 6;
+ << int(QQuickPathView::StrictlyEnforceRange) << 4 << 6 << 1 << qreal(2.) << 6;
QTest::newRow("no range - move after current")
- << int(QQuickPathView::NoHighlightRange) << 5 << 6 << 1 << 4. << 4;
+ << int(QQuickPathView::NoHighlightRange) << 5 << 6 << 1 << qreal(4.) << 4;
QTest::newRow("no range - move before current")
- << int(QQuickPathView::NoHighlightRange) << 2 << 3 << 1 << 4. << 4;
+ << int(QQuickPathView::NoHighlightRange) << 2 << 3 << 1 << qreal(4.) << 4;
QTest::newRow("no range - move before current to after")
- << int(QQuickPathView::NoHighlightRange) << 2 << 6 << 1 << 5. << 3;
+ << int(QQuickPathView::NoHighlightRange) << 2 << 6 << 1 << qreal(5.) << 3;
QTest::newRow("no range - move multiple after current")
- << int(QQuickPathView::NoHighlightRange) << 5 << 6 << 2 << 4. << 4;
+ << int(QQuickPathView::NoHighlightRange) << 5 << 6 << 2 << qreal(4.) << 4;
QTest::newRow("no range - move multiple before current")
- << int(QQuickPathView::NoHighlightRange) << 0 << 1 << 2 << 4. << 4;
+ << int(QQuickPathView::NoHighlightRange) << 0 << 1 << 2 << qreal(4.) << 4;
QTest::newRow("no range - move before current to end")
- << int(QQuickPathView::NoHighlightRange) << 2 << 7 << 1 << 5. << 3;
+ << int(QQuickPathView::NoHighlightRange) << 2 << 7 << 1 << qreal(5.) << 3;
QTest::newRow("no range - move last to beginning")
- << int(QQuickPathView::NoHighlightRange) << 7 << 0 << 1 << 3. << 5;
+ << int(QQuickPathView::NoHighlightRange) << 7 << 0 << 1 << qreal(3.) << 5;
QTest::newRow("no range - move current")
- << int(QQuickPathView::NoHighlightRange) << 4 << 6 << 1 << 4. << 6;
+ << int(QQuickPathView::NoHighlightRange) << 4 << 6 << 1 << qreal(4.) << 6;
QTest::newRow("no range - move multiple incl. current")
- << int(QQuickPathView::NoHighlightRange) << 0 << 1 << 5 << 4. << 5;
+ << int(QQuickPathView::NoHighlightRange) << 0 << 1 << 5 << qreal(4.) << 5;
}
void tst_QQuickPathView::moveModel()
@@ -539,7 +534,7 @@ void tst_QQuickPathView::moveModel()
QFETCH(qreal, offset);
QFETCH(int, currentIndex);
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->show();
QaimModel model;
@@ -573,8 +568,6 @@ void tst_QQuickPathView::moveModel()
QTRY_COMPARE(pathview->offset(), offset);
QCOMPARE(pathview->currentIndex(), currentIndex);
-
- delete window;
}
void tst_QQuickPathView::consecutiveModelChanges_data()
@@ -640,7 +633,7 @@ void tst_QQuickPathView::consecutiveModelChanges()
QFETCH(qreal, offset);
QFETCH(int, currentIndex);
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->show();
QaimModel model;
@@ -704,7 +697,6 @@ void tst_QQuickPathView::consecutiveModelChanges()
QCOMPARE(pathview->currentIndex(), currentIndex);
- delete window;
}
void tst_QQuickPathView::path()
@@ -756,7 +748,7 @@ void tst_QQuickPathView::path()
void tst_QQuickPathView::dataModel()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->show();
QQmlContext *ctxt = window->rootContext();
@@ -865,13 +857,12 @@ void tst_QQuickPathView::dataModel()
model.removeItem(model.count()-1);
QCOMPARE(pathview->currentIndex(), model.count()-1);
- delete window;
delete testObject;
}
void tst_QQuickPathView::pathMoved()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->show();
QaimModel model;
@@ -926,7 +917,6 @@ void tst_QQuickPathView::pathMoved()
window->rootObject()->setProperty("delegateScale", 1.2);
QTRY_COMPARE(firstItem->position() + offset, start);
- delete window;
}
void tst_QQuickPathView::offset_data()
@@ -960,7 +950,7 @@ void tst_QQuickPathView::offset()
void tst_QQuickPathView::setCurrentIndex()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->show();
QaimModel model;
@@ -1103,12 +1093,11 @@ void tst_QQuickPathView::setCurrentIndex()
QCOMPARE(pathview->currentItem(), firstItem);
QCOMPARE(firstItem->property("onPath"), QVariant(true));
- delete window;
}
void tst_QQuickPathView::resetModel()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QStringList strings;
strings << "one" << "two" << "three";
@@ -1143,12 +1132,11 @@ void tst_QQuickPathView::resetModel()
QCOMPARE(display->text(), strings.at(i));
}
- delete window;
}
void tst_QQuickPathView::propertyChanges()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QVERIFY(window);
window->setSource(testFileUrl("propertychanges.qml"));
@@ -1185,12 +1173,11 @@ void tst_QQuickPathView::propertyChanges()
pathView->setMaximumFlickVelocity(1000);
QCOMPARE(maximumFlickVelocitySpy.count(), 1);
- delete window;
}
void tst_QQuickPathView::pathChanges()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QVERIFY(window);
window->setSource(testFileUrl("propertychanges.qml"));
@@ -1247,12 +1234,11 @@ void tst_QQuickPathView::pathChanges()
pathAttribute->setName("scale");
QCOMPARE(nameSpy.count(),1);
- delete window;
}
void tst_QQuickPathView::componentChanges()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QVERIFY(window);
window->setSource(testFileUrl("propertychanges.qml"));
@@ -1270,12 +1256,11 @@ void tst_QQuickPathView::componentChanges()
pathView->setDelegate(&delegateComponent);
QCOMPARE(delegateSpy.count(),1);
- delete window;
}
void tst_QQuickPathView::modelChanges()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QVERIFY(window);
window->setSource(testFileUrl("propertychanges.qml"));
@@ -1284,7 +1269,7 @@ void tst_QQuickPathView::modelChanges()
pathView->setCurrentIndex(3);
QTRY_COMPARE(pathView->offset(), 6.0);
- QQuickListModel *alternateModel = window->rootObject()->findChild<QQuickListModel*>("alternateModel");
+ QQmlListModel *alternateModel = window->rootObject()->findChild<QQmlListModel*>("alternateModel");
QVERIFY(alternateModel);
QVariant modelVariant = QVariant::fromValue<QObject *>(alternateModel);
QSignalSpy modelSpy(pathView, SIGNAL(modelChanged()));
@@ -1305,12 +1290,11 @@ void tst_QQuickPathView::modelChanges()
QCOMPARE(pathView->currentIndex(), 0);
QCOMPARE(currentIndexSpy.count(), 1);
- delete window;
}
void tst_QQuickPathView::pathUpdateOnStartChanged()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QVERIFY(window);
window->setSource(testFileUrl("pathUpdateOnStartChanged.qml"));
@@ -1327,17 +1311,16 @@ void tst_QQuickPathView::pathUpdateOnStartChanged()
QCOMPARE(item->x(), path->startX() - item->width() / 2.0);
QCOMPARE(item->y(), path->startY() - item->height() / 2.0);
- delete window;
}
void tst_QQuickPathView::package()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QVERIFY(window);
window->setSource(testFileUrl("pathview_package.qml"));
window->show();
window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QQuickPathView *pathView = window->rootObject()->findChild<QQuickPathView*>("photoPathView");
QVERIFY(pathView);
@@ -1350,13 +1333,12 @@ void tst_QQuickPathView::package()
QVERIFY(item);
QVERIFY(item->scale() != 1.0);
- delete window;
}
//QTBUG-13017
void tst_QQuickPathView::emptyModel()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QStringListModel model;
@@ -1371,7 +1353,6 @@ void tst_QQuickPathView::emptyModel()
QCOMPARE(pathview->offset(), qreal(0.0));
- delete window;
}
void tst_QQuickPathView::emptyPath()
@@ -1411,7 +1392,7 @@ void tst_QQuickPathView::closed()
// QTBUG-14239
void tst_QQuickPathView::pathUpdate()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QVERIFY(window);
window->setSource(testFileUrl("pathUpdate.qml"));
@@ -1422,7 +1403,6 @@ void tst_QQuickPathView::pathUpdate()
QVERIFY(item);
QCOMPARE(item->x(), 150.0);
- delete window;
}
void tst_QQuickPathView::visualDataModel()
@@ -1463,12 +1443,12 @@ void tst_QQuickPathView::undefinedPath()
void tst_QQuickPathView::mouseDrag()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("dragpath.qml"));
window->show();
window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
- QCOMPARE(window, qGuiApp->focusWindow());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+ QCOMPARE(window.data(), qGuiApp->focusWindow());
QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
QVERIFY(pathview != 0);
@@ -1482,12 +1462,12 @@ void tst_QQuickPathView::mouseDrag()
int current = pathview->currentIndex();
- QTest::mousePress(window, Qt::LeftButton, 0, QPoint(10,100));
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(10,100));
QTest::qWait(100);
{
QMouseEvent mv(QEvent::MouseMove, QPoint(30,100), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
- QGuiApplication::sendEvent(window, &mv);
+ QGuiApplication::sendEvent(window.data(), &mv);
}
// first move beyond threshold does not trigger drag
QVERIFY(!pathview->isMoving());
@@ -1501,7 +1481,7 @@ void tst_QQuickPathView::mouseDrag()
{
QMouseEvent mv(QEvent::MouseMove, QPoint(90,100), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
- QGuiApplication::sendEvent(window, &mv);
+ QGuiApplication::sendEvent(window.data(), &mv);
}
// next move beyond threshold does trigger drag
QVERIFY(pathview->isMoving());
@@ -1515,7 +1495,7 @@ void tst_QQuickPathView::mouseDrag()
QVERIFY(pathview->currentIndex() != current);
- QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(40,100));
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(40,100));
QVERIFY(!pathview->isDragging());
QCOMPARE(draggingSpy.count(), 2);
QCOMPARE(dragStartedSpy.count(), 1);
@@ -1524,12 +1504,11 @@ void tst_QQuickPathView::mouseDrag()
QTRY_COMPARE(moveEndedSpy.count(), 1);
QCOMPARE(moveStartedSpy.count(), 1);
- delete window;
}
void tst_QQuickPathView::treeModel()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->show();
QStandardItemModel model;
@@ -1552,18 +1531,17 @@ void tst_QQuickPathView::treeModel()
QTRY_VERIFY(item = findItem<QQuickText>(pathview, "wrapper", 0));
QTRY_COMPARE(item->text(), QLatin1String("Row 2 Child Item"));
- delete window;
}
void tst_QQuickPathView::changePreferredHighlight()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setGeometry(0,0,400,200);
window->setSource(testFileUrl("dragpath.qml"));
window->show();
window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
- QCOMPARE(window, qGuiApp->focusWindow());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+ QCOMPARE(window.data(), qGuiApp->focusWindow());
QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
QVERIFY(pathview != 0);
@@ -1587,7 +1565,6 @@ void tst_QQuickPathView::changePreferredHighlight()
QTRY_COMPARE(firstItem->position() + offset, start);
QCOMPARE(pathview->currentIndex(), 0);
- delete window;
}
void tst_QQuickPathView::creationContext()
@@ -1608,7 +1585,7 @@ void tst_QQuickPathView::creationContext()
// QTBUG-21320
void tst_QQuickPathView::currentOffsetOnInsertion()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->show();
QaimModel model;
@@ -1681,12 +1658,11 @@ void tst_QQuickPathView::currentOffsetOnInsertion()
// verify that current item (item 1) is still at offset 0.5
QCOMPARE(item->position() + offset, start);
- delete window;
}
void tst_QQuickPathView::asynchronous()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->show();
QQmlIncubationController controller;
window->engine()->setIncubationController(&controller);
@@ -1737,7 +1713,6 @@ void tst_QQuickPathView::asynchronous()
QCOMPARE(curItem->position() + offset, itemPos);
}
- delete window;
}
void tst_QQuickPathView::missingPercent()
@@ -1752,12 +1727,12 @@ void tst_QQuickPathView::missingPercent()
void tst_QQuickPathView::cancelDrag()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("dragpath.qml"));
window->show();
window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
- QCOMPARE(window, qGuiApp->focusWindow());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+ QCOMPARE(window.data(), qGuiApp->focusWindow());
QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
QVERIFY(pathview != 0);
@@ -1767,10 +1742,10 @@ void tst_QQuickPathView::cancelDrag()
QSignalSpy dragEndedSpy(pathview, SIGNAL(dragEnded()));
// drag between snap points
- QTest::mousePress(window, Qt::LeftButton, 0, QPoint(10,100));
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(10,100));
QTest::qWait(100);
- QTest::mouseMove(window, QPoint(30, 100));
- QTest::mouseMove(window, QPoint(85, 100));
+ QTest::mouseMove(window.data(), QPoint(30, 100));
+ QTest::mouseMove(window.data(), QPoint(85, 100));
QTRY_VERIFY(pathview->offset() != qFloor(pathview->offset()));
QTRY_VERIFY(pathview->isMoving());
@@ -1791,25 +1766,24 @@ void tst_QQuickPathView::cancelDrag()
QCOMPARE(dragStartedSpy.count(), 1);
QCOMPARE(dragEndedSpy.count(), 1);
- QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(40,100));
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(40,100));
- delete window;
}
void tst_QQuickPathView::maximumFlickVelocity()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("dragpath.qml"));
window->show();
window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
- QCOMPARE(window, qGuiApp->focusWindow());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+ QCOMPARE(window.data(), qGuiApp->focusWindow());
QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
QVERIFY(pathview != 0);
pathview->setMaximumFlickVelocity(700);
- flick(window, QPoint(200,10), QPoint(10,10), 180);
+ flick(window.data(), QPoint(200,10), QPoint(10,10), 180);
QVERIFY(pathview->isMoving());
QVERIFY(pathview->isFlicking());
QTRY_VERIFY_WITH_TIMEOUT(!pathview->isMoving(), 50000);
@@ -1818,7 +1792,7 @@ void tst_QQuickPathView::maximumFlickVelocity()
pathview->setOffset(0.);
pathview->setMaximumFlickVelocity(300);
- flick(window, QPoint(200,10), QPoint(10,10), 180);
+ flick(window.data(), QPoint(200,10), QPoint(10,10), 180);
QVERIFY(pathview->isMoving());
QVERIFY(pathview->isFlicking());
QTRY_VERIFY_WITH_TIMEOUT(!pathview->isMoving(), 50000);
@@ -1827,7 +1801,7 @@ void tst_QQuickPathView::maximumFlickVelocity()
pathview->setOffset(0.);
pathview->setMaximumFlickVelocity(500);
- flick(window, QPoint(200,10), QPoint(10,10), 180);
+ flick(window.data(), QPoint(200,10), QPoint(10,10), 180);
QVERIFY(pathview->isMoving());
QVERIFY(pathview->isFlicking());
QTRY_VERIFY_WITH_TIMEOUT(!pathview->isMoving(), 50000);
@@ -1838,14 +1812,13 @@ void tst_QQuickPathView::maximumFlickVelocity()
QVERIFY(dist3 > dist2);
QVERIFY(dist2 < dist1);
- delete window;
}
void tst_QQuickPathView::snapToItem()
{
QFETCH(bool, enforceRange);
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("panels.qml"));
QQuickPathView *pathview = window->rootObject()->findChild<QQuickPathView*>("view");
QVERIFY(pathview != 0);
@@ -1857,7 +1830,7 @@ void tst_QQuickPathView::snapToItem()
QSignalSpy snapModeSpy(pathview, SIGNAL(snapModeChanged()));
- flick(window, QPoint(200,10), QPoint(10,10), 180);
+ flick(window.data(), QPoint(200,10), QPoint(10,10), 180);
QVERIFY(pathview->isMoving());
QTRY_VERIFY(!pathview->isMoving());
@@ -1869,7 +1842,6 @@ void tst_QQuickPathView::snapToItem()
else
QVERIFY(pathview->currentIndex() == currentIndex);
- delete window;
}
void tst_QQuickPathView::snapToItem_data()
@@ -1884,12 +1856,12 @@ void tst_QQuickPathView::snapOneItem()
{
QFETCH(bool, enforceRange);
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("panels.qml"));
window->show();
window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
- QCOMPARE(window, qGuiApp->focusWindow());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+ QCOMPARE(window.data(), qGuiApp->focusWindow());
QQuickPathView *pathview = window->rootObject()->findChild<QQuickPathView*>("view");
QVERIFY(pathview != 0);
@@ -1905,7 +1877,7 @@ void tst_QQuickPathView::snapOneItem()
int currentIndex = pathview->currentIndex();
double startOffset = pathview->offset();
- flick(window, QPoint(200,10), QPoint(10,10), 180);
+ flick(window.data(), QPoint(200,10), QPoint(10,10), 180);
QVERIFY(pathview->isMoving());
QTRY_VERIFY(!pathview->isMoving());
@@ -1918,7 +1890,6 @@ void tst_QQuickPathView::snapOneItem()
else
QVERIFY(pathview->currentIndex() == currentIndex);
- delete window;
}
void tst_QQuickPathView::snapOneItem_data()
@@ -1938,12 +1909,12 @@ void tst_QQuickPathView::positionViewAtIndex()
QFETCH(QQuickPathView::PositionMode, mode);
QFETCH(qreal, offset);
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("pathview3.qml"));
window->show();
window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
- QCOMPARE(window, qGuiApp->focusWindow());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+ QCOMPARE(window.data(), qGuiApp->focusWindow());
QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
QVERIFY(pathview != 0);
@@ -1959,7 +1930,6 @@ void tst_QQuickPathView::positionViewAtIndex()
QCOMPARE(pathview->offset(), offset);
- delete window;
}
void tst_QQuickPathView::positionViewAtIndex_data()
@@ -2002,12 +1972,12 @@ void tst_QQuickPathView::indexAt_itemAt()
QFETCH(qreal, y);
QFETCH(int, index);
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("pathview3.qml"));
window->show();
window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
- QCOMPARE(window, qGuiApp->focusWindow());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+ QCOMPARE(window.data(), qGuiApp->focusWindow());
QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
QVERIFY(pathview != 0);
@@ -2020,7 +1990,6 @@ void tst_QQuickPathView::indexAt_itemAt()
QCOMPARE(pathview->indexAt(x,y), index);
QVERIFY(pathview->itemAt(x,y) == item);
- delete window;
}
void tst_QQuickPathView::indexAt_itemAt_data()
@@ -2029,16 +1998,16 @@ void tst_QQuickPathView::indexAt_itemAt_data()
QTest::addColumn<qreal>("y");
QTest::addColumn<int>("index");
- QTest::newRow("Item 0 - 585, 95") << 585. << 95. << 0;
- QTest::newRow("Item 0 - 660, 165") << 660. << 165. << 0;
- QTest::newRow("No Item a - 580, 95") << 580. << 95. << -1;
- QTest::newRow("No Item b - 585, 85") << 585. << 85. << -1;
- QTest::newRow("Item 7 - 360, 200") << 360. << 200. << 7;
+ QTest::newRow("Item 0 - 585, 95") << qreal(585.) << qreal(95.) << 0;
+ QTest::newRow("Item 0 - 660, 165") << qreal(660.) << qreal(165.) << 0;
+ QTest::newRow("No Item a - 580, 95") << qreal(580.) << qreal(95.) << -1;
+ QTest::newRow("No Item b - 585, 85") << qreal(585.) << qreal(85.) << -1;
+ QTest::newRow("Item 7 - 360, 200") << qreal(360.) << qreal(200.) << 7;
}
void tst_QQuickPathView::cacheItemCount()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("pathview3.qml"));
window->show();
@@ -2112,7 +2081,6 @@ void tst_QQuickPathView::cacheItemCount()
controller.incubateWhile(&b);
}
- delete window;
}
QTEST_MAIN(tst_QQuickPathView)
diff --git a/tests/auto/quick/qquickpincharea/qquickpincharea.pro b/tests/auto/quick/qquickpincharea/qquickpincharea.pro
index df3b14d8c0..970ce48851 100644
--- a/tests/auto/quick/qquickpincharea/qquickpincharea.pro
+++ b/tests/auto/quick/qquickpincharea/qquickpincharea.pro
@@ -1,4 +1,5 @@
CONFIG += testcase
+CONFIG += parallel_test
TARGET = tst_qquickpincharea
macx:CONFIG -= app_bundle
diff --git a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
index ba1db0e7cf..18595133d0 100644
--- a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
+++ b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
@@ -84,10 +84,9 @@ void tst_QQuickPinchArea::cleanupTestCase()
}
void tst_QQuickPinchArea::pinchProperties()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("pinchproperties.qml"));
window->show();
- window->requestActivate();
QVERIFY(window->rootObject() != 0);
QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea");
@@ -195,8 +194,6 @@ void tst_QQuickPinchArea::pinchProperties()
QCOMPARE(rotMinSpy.count(),1);
QCOMPARE(rotMaxSpy.count(),1);
-
- delete window;
}
QTouchEvent::TouchPoint makeTouchPoint(int id, QPoint p, QQuickView *v, QQuickItem *i)
@@ -211,10 +208,10 @@ QTouchEvent::TouchPoint makeTouchPoint(int id, QPoint p, QQuickView *v, QQuickIt
void tst_QQuickPinchArea::scale()
{
QQuickView *window = createView();
+ QScopedPointer<QQuickView> scope(window);
window->setSource(testFileUrl("pinchproperties.qml"));
window->show();
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window));
QVERIFY(window->rootObject() != 0);
qApp->processEvents();
@@ -267,17 +264,15 @@ void tst_QQuickPinchArea::scale()
pinchSequence.release(0, p1, window).release(1, p2, window).commit();
}
QVERIFY(!root->property("pinchActive").toBool());
-
- delete window;
}
void tst_QQuickPinchArea::pan()
{
QQuickView *window = createView();
+ QScopedPointer<QQuickView> scope(window);
window->setSource(testFileUrl("pinchproperties.qml"));
window->show();
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window));
QVERIFY(window->rootObject() != 0);
qApp->processEvents();
@@ -327,18 +322,16 @@ void tst_QQuickPinchArea::pan()
QTest::touchEvent(window, device).release(0, p1, window).release(1, p2, window);
QVERIFY(!root->property("pinchActive").toBool());
-
- delete window;
}
// test pinch, release one point, touch again to continue pinch
void tst_QQuickPinchArea::retouch()
{
QQuickView *window = createView();
+ QScopedPointer<QQuickView> scope(window);
window->setSource(testFileUrl("pinchproperties.qml"));
window->show();
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window));
QVERIFY(window->rootObject() != 0);
qApp->processEvents();
@@ -413,8 +406,6 @@ void tst_QQuickPinchArea::retouch()
QCOMPARE(startedSpy.count(), 2);
QCOMPARE(finishedSpy.count(), 1);
}
-
- delete window;
}
void tst_QQuickPinchArea::transformedPinchArea_data()
@@ -449,10 +440,10 @@ void tst_QQuickPinchArea::transformedPinchArea()
QFETCH(bool, shouldPinch);
QQuickView *view = createView();
+ QScopedPointer<QQuickView> scope(view);
view->setSource(testFileUrl("transformedPinchArea.qml"));
view->show();
- view->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(view));
+ QVERIFY(QTest::qWaitForWindowExposed(view));
QVERIFY(view->rootObject() != 0);
qApp->processEvents();
@@ -475,8 +466,6 @@ void tst_QQuickPinchArea::transformedPinchArea()
pinchSequence.release(0, p1, view).release(1, p2, view).commit();
QCOMPARE(pinchArea->property("pinching").toBool(), false);
}
-
- delete view;
}
QQuickView *tst_QQuickPinchArea::createView()
diff --git a/tests/auto/quick/qquickpositioners/data/gridtest.qml b/tests/auto/quick/qquickpositioners/data/gridtest.qml
index 50bec1377b..fbe0b22b15 100644
--- a/tests/auto/quick/qquickpositioners/data/gridtest.qml
+++ b/tests/auto/quick/qquickpositioners/data/gridtest.qml
@@ -1,11 +1,15 @@
-import QtQuick 2.0
+import QtQuick 2.1
Item {
width: 640
height: 480
property bool testRightToLeft: false
+ property int testHAlignment: Grid.AlignLeft;
+ property int testVAlignment: Grid.AlignTop;
Grid {
layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight
+ horizontalItemAlignment: testHAlignment
+ verticalItemAlignment: testVAlignment
objectName: "grid"
columns: 3
Rectangle {
diff --git a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
index 98999e540a..1f472a3f46 100644
--- a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
+++ b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
@@ -78,6 +78,8 @@ private slots:
void test_grid_animated();
void test_grid_animated_rightToLeft();
void test_grid_zero_columns();
+ void test_grid_H_alignment();
+ void test_grid_V_alignment();
void test_propertychanges();
void test_repeater();
void test_flow();
@@ -288,7 +290,7 @@ tst_qquickpositioners::tst_qquickpositioners()
void tst_qquickpositioners::test_horizontal()
{
- QQuickView *window = createView(testFile("horizontal.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("horizontal.qml")));
window->rootObject()->setProperty("testRightToLeft", false);
@@ -311,13 +313,11 @@ void tst_qquickpositioners::test_horizontal()
QQuickItem *row = window->rootObject()->findChild<QQuickItem*>("row");
QCOMPARE(row->width(), 110.0);
QCOMPARE(row->height(), 50.0);
-
- delete window;
}
void tst_qquickpositioners::test_horizontal_rtl()
{
- QQuickView *window = createView(testFile("horizontal.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("horizontal.qml")));
window->rootObject()->setProperty("testRightToLeft", true);
@@ -350,12 +350,11 @@ void tst_qquickpositioners::test_horizontal_rtl()
QCOMPARE(three->x(), 90.0);
QCOMPARE(three->y(), 0.0);
- delete window;
}
void tst_qquickpositioners::test_horizontal_spacing()
{
- QQuickView *window = createView(testFile("horizontal-spacing.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("horizontal-spacing.qml")));
window->rootObject()->setProperty("testRightToLeft", false);
@@ -379,12 +378,11 @@ void tst_qquickpositioners::test_horizontal_spacing()
QCOMPARE(row->width(), 130.0);
QCOMPARE(row->height(), 50.0);
- delete window;
}
void tst_qquickpositioners::test_horizontal_spacing_rightToLeft()
{
- QQuickView *window = createView(testFile("horizontal-spacing.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("horizontal-spacing.qml")));
window->rootObject()->setProperty("testRightToLeft", true);
@@ -408,12 +406,11 @@ void tst_qquickpositioners::test_horizontal_spacing_rightToLeft()
QCOMPARE(row->width(), 130.0);
QCOMPARE(row->height(), 50.0);
- delete window;
}
void tst_qquickpositioners::test_horizontal_animated()
{
- QQuickView *window = createView(testFile("horizontal-animated.qml"), false);
+ QScopedPointer<QQuickView> window(createView(testFile("horizontal-animated.qml"), false));
window->rootObject()->setProperty("testRightToLeft", false);
@@ -431,7 +428,7 @@ void tst_qquickpositioners::test_horizontal_animated()
QCOMPARE(two->x(), -100.0);
QCOMPARE(three->x(), -100.0);
- QVERIFY(QTest::qWaitForWindowExposed(window)); //It may not relayout until the next frame, so it needs to be drawn
+ QVERIFY(QTest::qWaitForWindowExposed(window.data())); //It may not relayout until the next frame, so it needs to be drawn
QQuickItem *row = window->rootObject()->findChild<QQuickItem*>("row");
QVERIFY(row);
@@ -462,12 +459,11 @@ void tst_qquickpositioners::test_horizontal_animated()
QTRY_COMPARE(two->x(), 50.0);
QTRY_COMPARE(three->x(), 100.0);
- delete window;
}
void tst_qquickpositioners::test_horizontal_animated_rightToLeft()
{
- QQuickView *window = createView(testFile("horizontal-animated.qml"), false);
+ QScopedPointer<QQuickView> window(createView(testFile("horizontal-animated.qml"), false));
window->rootObject()->setProperty("testRightToLeft", true);
@@ -485,7 +481,7 @@ void tst_qquickpositioners::test_horizontal_animated_rightToLeft()
QCOMPARE(two->x(), -100.0);
QCOMPARE(three->x(), -100.0);
- QVERIFY(QTest::qWaitForWindowExposed(window)); //It may not relayout until the next frame, so it needs to be drawn
+ QVERIFY(QTest::qWaitForWindowExposed(window.data())); //It may not relayout until the next frame, so it needs to be drawn
QQuickItem *row = window->rootObject()->findChild<QQuickItem*>("row");
QVERIFY(row);
@@ -518,12 +514,11 @@ void tst_qquickpositioners::test_horizontal_animated_rightToLeft()
QTRY_COMPARE(one->x(), 100.0);
QTRY_COMPARE(two->x(), 50.0);
- delete window;
}
void tst_qquickpositioners::test_horizontal_animated_disabled()
{
- QQuickView *window = createView(testFile("horizontal-animated-disabled.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("horizontal-animated-disabled.qml")));
QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
@@ -556,7 +551,6 @@ void tst_qquickpositioners::test_horizontal_animated_disabled()
QTRY_COMPARE(two->x(), 50.0);
QTRY_COMPARE(three->x(), 100.0);
- delete window;
}
void tst_qquickpositioners::populateTransitions(const QString &positionerObjectName)
@@ -576,7 +570,8 @@ void tst_qquickpositioners::populateTransitions(const QString &positionerObjectN
QaimModel model_targetItems_transitionFrom;
QaimModel model_displacedItems_transitionVia;
- QQuickView *window = QQuickViewTestUtil::createView();
+ QScopedPointer<QQuickView> window(QQuickViewTestUtil::createView());
+
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("usePopulateTransition", usePopulateTransition);
ctxt->setContextProperty("enableAddTransition", true);
@@ -592,6 +587,7 @@ void tst_qquickpositioners::populateTransitions(const QString &positionerObjectN
QQuickItem *positioner = window->rootObject()->findChild<QQuickItem*>(positionerObjectName);
QVERIFY(positioner);
window->show();
+ QTest::qWaitForWindowExposed(window.data());
qApp->processEvents();
if (!dynamicallyPopulate && usePopulateTransition) {
@@ -627,8 +623,6 @@ void tst_qquickpositioners::populateTransitions(const QString &positionerObjectN
model.insertItem(0, "new item", "");
QTRY_COMPARE(window->rootObject()->property("addTransitionsDone").toInt(), 1);
QTRY_COMPARE(window->rootObject()->property("populateTransitionsDone").toInt(), 0);
-
- delete window;
}
void tst_qquickpositioners::populateTransitions_data()
@@ -657,7 +651,7 @@ void tst_qquickpositioners::addTransitions(const QString &positionerObjectName)
QaimModel model_targetItems_transitionFrom;
QaimModel model_displacedItems_transitionVia;
- QQuickView *window = QQuickViewTestUtil::createView();
+ QScopedPointer<QQuickView> window(QQuickViewTestUtil::createView());
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("usePopulateTransition", QVariant(false));
ctxt->setContextProperty("enableAddTransition", QVariant(true));
@@ -667,6 +661,7 @@ void tst_qquickpositioners::addTransitions(const QString &positionerObjectName)
ctxt->setContextProperty("displacedItems_transitionVia", displacedItems_transitionVia);
window->setSource(testFileUrl("transitions.qml"));
window->show();
+ QTest::qWaitForWindowExposed(window.data());
qApp->processEvents();
QQuickItem *positioner = window->rootObject()->findChild<QQuickItem*>(positionerObjectName);
@@ -733,8 +728,6 @@ void tst_qquickpositioners::addTransitions(const QString &positionerObjectName)
}
checkItemPositions(positioner, &model, window->rootObject()->property("incrementalSize").toInt());
-
- delete window;
}
void tst_qquickpositioners::addTransitions_data()
@@ -770,7 +763,7 @@ void tst_qquickpositioners::moveTransitions(const QString &positionerObjectName)
QaimModel model_targetItems_transitionFrom;
QaimModel model_displacedItems_transitionVia;
- QQuickView *window = QQuickViewTestUtil::createView();
+ QScopedPointer<QQuickView> window(QQuickViewTestUtil::createView());
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("usePopulateTransition", QVariant(false));
ctxt->setContextProperty("enableAddTransition", QVariant(false));
@@ -780,6 +773,7 @@ void tst_qquickpositioners::moveTransitions(const QString &positionerObjectName)
ctxt->setContextProperty("displacedItems_transitionVia", displacedItems_transitionVia);
window->setSource(testFileUrl("transitions.qml"));
window->show();
+ QTest::qWaitForWindowExposed(window.data());
qApp->processEvents();
QList<QPair<QString,QString> > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model);
@@ -842,8 +836,6 @@ void tst_qquickpositioners::moveTransitions(const QString &positionerObjectName)
}
checkItemPositions(positioner, &model, window->rootObject()->property("incrementalSize").toInt());
-
- delete window;
}
void tst_qquickpositioners::moveTransitions_data()
@@ -929,7 +921,7 @@ void tst_qquickpositioners::checkItemPositions(QQuickItem *positioner, QaimModel
void tst_qquickpositioners::test_vertical()
{
- QQuickView *window = createView(testFile("vertical.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("vertical.qml")));
QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
@@ -952,12 +944,11 @@ void tst_qquickpositioners::test_vertical()
QCOMPARE(column->height(), 80.0);
QCOMPARE(column->width(), 50.0);
- delete window;
}
void tst_qquickpositioners::test_vertical_spacing()
{
- QQuickView *window = createView(testFile("vertical-spacing.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("vertical-spacing.qml")));
QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
@@ -979,12 +970,11 @@ void tst_qquickpositioners::test_vertical_spacing()
QCOMPARE(column->height(), 100.0);
QCOMPARE(column->width(), 50.0);
- delete window;
}
void tst_qquickpositioners::test_vertical_animated()
{
- QQuickView *window = createView(testFile("vertical-animated.qml"), false);
+ QScopedPointer<QQuickView> window(createView(testFile("vertical-animated.qml"), false));
//Note that they animate in
QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
@@ -999,7 +989,7 @@ void tst_qquickpositioners::test_vertical_animated()
QVERIFY(three != 0);
QCOMPARE(three->y(), -100.0);
- QVERIFY(QTest::qWaitForWindowExposed(window)); //It may not relayout until the next frame, so it needs to be drawn
+ QVERIFY(QTest::qWaitForWindowExposed(window.data())); //It may not relayout until the next frame, so it needs to be drawn
QQuickItem *column = window->rootObject()->findChild<QQuickItem*>("column");
QVERIFY(column);
@@ -1029,12 +1019,11 @@ void tst_qquickpositioners::test_vertical_animated()
QTRY_COMPARE(two->y(), 50.0);
QTRY_COMPARE(three->y(), 100.0);
- delete window;
}
void tst_qquickpositioners::test_grid()
{
- QQuickView *window = createView(testFile("gridtest.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("gridtest.qml")));
QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
@@ -1063,12 +1052,11 @@ void tst_qquickpositioners::test_grid()
QCOMPARE(grid->width(), 100.0);
QCOMPARE(grid->height(), 100.0);
- delete window;
}
void tst_qquickpositioners::test_grid_topToBottom()
{
- QQuickView *window = createView(testFile("grid-toptobottom.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("grid-toptobottom.qml")));
QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
@@ -1097,12 +1085,11 @@ void tst_qquickpositioners::test_grid_topToBottom()
QCOMPARE(grid->width(), 100.0);
QCOMPARE(grid->height(), 120.0);
- delete window;
}
void tst_qquickpositioners::test_grid_rightToLeft()
{
- QQuickView *window = createView(testFile("gridtest.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("gridtest.qml")));
window->rootObject()->setProperty("testRightToLeft", true);
@@ -1146,12 +1133,11 @@ void tst_qquickpositioners::test_grid_rightToLeft()
QCOMPARE(five->x(), 140.0);
QCOMPARE(five->y(), 50.0);
- delete window;
}
void tst_qquickpositioners::test_grid_spacing()
{
- QQuickView *window = createView(testFile("grid-spacing.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("grid-spacing.qml")));
QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
@@ -1179,12 +1165,11 @@ void tst_qquickpositioners::test_grid_spacing()
QCOMPARE(grid->width(), 128.0);
QCOMPARE(grid->height(), 104.0);
- delete window;
}
void tst_qquickpositioners::test_grid_row_column_spacing()
{
- QQuickView *window = createView(testFile("grid-row-column-spacing.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("grid-row-column-spacing.qml")));
QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
@@ -1212,12 +1197,11 @@ void tst_qquickpositioners::test_grid_row_column_spacing()
QCOMPARE(grid->width(), 142.0);
QCOMPARE(grid->height(), 107.0);
- delete window;
}
void tst_qquickpositioners::test_grid_animated()
{
- QQuickView *window = createView(testFile("grid-animated.qml"), false);
+ QScopedPointer<QQuickView> window(createView(testFile("grid-animated.qml"), false));
window->rootObject()->setProperty("testRightToLeft", false);
@@ -1247,7 +1231,7 @@ void tst_qquickpositioners::test_grid_animated()
QCOMPARE(five->x(), -100.0);
QCOMPARE(five->y(), -100.0);
- QVERIFY(QTest::qWaitForWindowExposed(window)); //It may not relayout until the next frame, so it needs to be drawn
+ QVERIFY(QTest::qWaitForWindowExposed(window.data())); //It may not relayout until the next frame, so it needs to be drawn
QQuickItem *grid = window->rootObject()->findChild<QQuickItem*>("grid");
QVERIFY(grid);
@@ -1297,12 +1281,11 @@ void tst_qquickpositioners::test_grid_animated()
QTRY_COMPARE(five->x(), 50.0);
QTRY_COMPARE(five->y(), 50.0);
- delete window;
}
void tst_qquickpositioners::test_grid_animated_rightToLeft()
{
- QQuickView *window = createView(testFile("grid-animated.qml"), false);
+ QScopedPointer<QQuickView> window(createView(testFile("grid-animated.qml"), false));
window->rootObject()->setProperty("testRightToLeft", true);
@@ -1332,7 +1315,7 @@ void tst_qquickpositioners::test_grid_animated_rightToLeft()
QCOMPARE(five->x(), -100.0);
QCOMPARE(five->y(), -100.0);
- QVERIFY(QTest::qWaitForWindowExposed(window)); //It may not relayout until the next frame, so it needs to be drawn
+ QVERIFY(QTest::qWaitForWindowExposed(window.data())); //It may not relayout until the next frame, so it needs to be drawn
QQuickItem *grid = window->rootObject()->findChild<QQuickItem*>("grid");
QVERIFY(grid);
@@ -1382,12 +1365,11 @@ void tst_qquickpositioners::test_grid_animated_rightToLeft()
QTRY_COMPARE(five->x(), 50.0);
QTRY_COMPARE(five->y(), 50.0);
- delete window;
}
void tst_qquickpositioners::test_grid_zero_columns()
{
- QQuickView *window = createView(testFile("gridzerocolumns.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("gridzerocolumns.qml")));
QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
@@ -1415,12 +1397,133 @@ void tst_qquickpositioners::test_grid_zero_columns()
QCOMPARE(grid->width(), 170.0);
QCOMPARE(grid->height(), 60.0);
- delete window;
+}
+
+void tst_qquickpositioners::test_grid_H_alignment()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("gridtest.qml")));
+
+ window->rootObject()->setProperty("testHAlignment", QQuickGrid::AlignHCenter);
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+ QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four");
+ QVERIFY(four != 0);
+ QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five");
+ QVERIFY(five != 0);
+
+ QCOMPARE(one->x(), 0.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 50.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 70.0);
+ QCOMPARE(three->y(), 0.0);
+ QCOMPARE(four->x(), 0.0);
+ QCOMPARE(four->y(), 50.0);
+ QCOMPARE(five->x(), 55.0);
+ QCOMPARE(five->y(), 50.0);
+
+ QQuickItem *grid = window->rootObject()->findChild<QQuickItem*>("grid");
+ QCOMPARE(grid->width(), 100.0);
+ QCOMPARE(grid->height(), 100.0);
+
+ window->rootObject()->setProperty("testHAlignment", QQuickGrid::AlignRight);
+
+ QCOMPARE(one->x(), 0.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 50.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 70.0);
+ QCOMPARE(three->y(), 0.0);
+ QCOMPARE(four->x(), 0.0);
+ QCOMPARE(four->y(), 50.0);
+ QCOMPARE(five->x(), 60.0);
+ QCOMPARE(five->y(), 50.0);
+ QCOMPARE(grid->width(), 100.0);
+ QCOMPARE(grid->height(), 100.0);
+
+ window->rootObject()->setProperty("testRightToLeft", true);
+
+ QCOMPARE(one->x(), 50.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 30.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 0.0);
+ QCOMPARE(three->y(), 0.0);
+ QCOMPARE(four->x(), 50.0);
+ QCOMPARE(four->y(), 50.0);
+ QCOMPARE(five->x(), 30.0);
+ QCOMPARE(five->y(), 50.0);
+ QCOMPARE(grid->width(), 100.0);
+ QCOMPARE(grid->height(), 100.0);
+
+ window->rootObject()->setProperty("testHAlignment", QQuickGrid::AlignHCenter);
+
+ QCOMPARE(one->x(), 50.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 30.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 0.0);
+ QCOMPARE(three->y(), 0.0);
+ QCOMPARE(four->x(), 50.0);
+ QCOMPARE(four->y(), 50.0);
+ QCOMPARE(five->x(), 35.0);
+ QCOMPARE(five->y(), 50.0);
+ QCOMPARE(grid->width(), 100.0);
+ QCOMPARE(grid->height(), 100.0);
+
+}
+
+void tst_qquickpositioners::test_grid_V_alignment()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("gridtest.qml")));
+
+ window->rootObject()->setProperty("testVAlignment", QQuickGrid::AlignVCenter);
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+ QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four");
+ QVERIFY(four != 0);
+ QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five");
+ QVERIFY(five != 0);
+
+ QCOMPARE(one->x(), 0.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 50.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 70.0);
+ QCOMPARE(three->y(), 15.0);
+ QCOMPARE(four->x(), 0.0);
+ QCOMPARE(four->y(), 50.0);
+ QCOMPARE(five->x(), 50.0);
+ QCOMPARE(five->y(), 70.0);
+
+ window->rootObject()->setProperty("testVAlignment", QQuickGrid::AlignBottom);
+
+ QCOMPARE(one->x(), 0.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 50.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 70.0);
+ QCOMPARE(three->y(), 30.0);
+ QCOMPARE(four->x(), 0.0);
+ QCOMPARE(four->y(), 50.0);
+ QCOMPARE(five->x(), 50.0);
+ QCOMPARE(five->y(), 90.0);
+
}
void tst_qquickpositioners::test_propertychanges()
{
- QQuickView *window = createView(testFile("propertychangestest.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("propertychangestest.qml")));
QQuickGrid *grid = qobject_cast<QQuickGrid*>(window->rootObject());
QVERIFY(grid != 0);
@@ -1474,12 +1577,11 @@ void tst_qquickpositioners::test_propertychanges()
QCOMPARE(columnsSpy.count(),2);
QCOMPARE(rowsSpy.count(),2);
- delete window;
}
void tst_qquickpositioners::test_repeater()
{
- QQuickView *window = createView(testFile("repeatertest.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("repeatertest.qml")));
QQuickRectangle *one = findItem<QQuickRectangle>(window->contentItem(), "one");
QVERIFY(one != 0);
@@ -1497,12 +1599,11 @@ void tst_qquickpositioners::test_repeater()
QCOMPARE(three->x(), 100.0);
QCOMPARE(three->y(), 0.0);
- delete window;
}
void tst_qquickpositioners::test_flow()
{
- QQuickView *window = createView(testFile("flowtest.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("flowtest.qml")));
window->rootObject()->setProperty("testRightToLeft", false);
@@ -1533,12 +1634,11 @@ void tst_qquickpositioners::test_flow()
QCOMPARE(flow->width(), 90.0);
QCOMPARE(flow->height(), 120.0);
- delete window;
}
void tst_qquickpositioners::test_flow_rightToLeft()
{
- QQuickView *window = createView(testFile("flowtest.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("flowtest.qml")));
window->rootObject()->setProperty("testRightToLeft", true);
@@ -1569,12 +1669,11 @@ void tst_qquickpositioners::test_flow_rightToLeft()
QCOMPARE(flow->width(), 90.0);
QCOMPARE(flow->height(), 120.0);
- delete window;
}
void tst_qquickpositioners::test_flow_topToBottom()
{
- QQuickView *window = createView(testFile("flowtest-toptobottom.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("flowtest-toptobottom.qml")));
window->rootObject()->setProperty("testRightToLeft", false);
@@ -1622,12 +1721,11 @@ void tst_qquickpositioners::test_flow_topToBottom()
QCOMPARE(five->x(), 40.0);
QCOMPARE(five->y(), 50.0);
- delete window;
}
void tst_qquickpositioners::test_flow_resize()
{
- QQuickView *window = createView(testFile("flowtest.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("flowtest.qml")));
QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject());
QVERIFY(root);
@@ -1656,12 +1754,11 @@ void tst_qquickpositioners::test_flow_resize()
QTRY_COMPARE(five->x(), 50.0);
QTRY_COMPARE(five->y(), 50.0);
- delete window;
}
void tst_qquickpositioners::test_flow_resize_rightToLeft()
{
- QQuickView *window = createView(testFile("flowtest.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("flowtest.qml")));
QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject());
QVERIFY(root);
@@ -1690,12 +1787,11 @@ void tst_qquickpositioners::test_flow_resize_rightToLeft()
QCOMPARE(five->x(), 65.0);
QCOMPARE(five->y(), 50.0);
- delete window;
}
void tst_qquickpositioners::test_flow_implicit_resize()
{
- QQuickView *window = createView(testFile("flow-testimplicitsize.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("flow-testimplicitsize.qml")));
QVERIFY(window->rootObject() != 0);
QQuickFlow *flow = window->rootObject()->findChild<QQuickFlow*>("flow");
@@ -1719,7 +1815,6 @@ void tst_qquickpositioners::test_flow_implicit_resize()
QCOMPARE(flow->width(), 220.0);
QCOMPARE(flow->height(), 50.0);
- delete window;
}
void tst_qquickpositioners::test_conflictinganchors()
@@ -1836,10 +1931,10 @@ void tst_qquickpositioners::test_mirroring()
objectNames << "one" << "two" << "three" << "four" << "five";
foreach (const QString qmlFile, qmlFiles) {
- QQuickView *windowA = createView(testFile(qmlFile));
+ QScopedPointer<QQuickView> windowA(createView(testFile(qmlFile)));
QQuickItem *rootA = qobject_cast<QQuickItem*>(windowA->rootObject());
- QQuickView *windowB = createView(testFile(qmlFile));
+ QScopedPointer<QQuickView> windowB(createView(testFile(qmlFile)));
QQuickItem *rootB = qobject_cast<QQuickItem*>(windowB->rootObject());
rootA->setProperty("testRightToLeft", true); // layoutDirection: Qt.RightToLeft
@@ -1881,15 +1976,13 @@ void tst_qquickpositioners::test_mirroring()
QQuickItem *itemB = rootB->findChild<QQuickItem*>(objectName);
QTRY_COMPARE(itemA->x(), itemB->x());
}
- delete windowA;
- delete windowB;
}
}
void tst_qquickpositioners::test_allInvisible()
{
//QTBUG-19361
- QQuickView *window = createView(testFile("allInvisible.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("allInvisible.qml")));
QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject());
QVERIFY(root);
@@ -1908,7 +2001,7 @@ void tst_qquickpositioners::test_attachedproperties()
{
QFETCH(QString, filename);
- QQuickView *window = createView(filename);
+ QScopedPointer<QQuickView> window(createView(filename));
QVERIFY(window->rootObject() != 0);
QQuickRectangle *greenRect = window->rootObject()->findChild<QQuickRectangle *>("greenRect");
@@ -1940,7 +2033,6 @@ void tst_qquickpositioners::test_attachedproperties()
isLast = yellowRect->property("isLastItem").toBool();
QVERIFY(isLast == true);
- delete window;
}
void tst_qquickpositioners::test_attachedproperties_data()
@@ -1955,7 +2047,7 @@ void tst_qquickpositioners::test_attachedproperties_data()
void tst_qquickpositioners::test_attachedproperties_dynamic()
{
- QQuickView *window = createView(testFile("attachedproperties-dynamic.qml"));
+ QScopedPointer<QQuickView> window(createView(testFile("attachedproperties-dynamic.qml")));
QVERIFY(window->rootObject() != 0);
QQuickRow *row = window->rootObject()->findChild<QQuickRow *>("pos");
@@ -2006,7 +2098,6 @@ void tst_qquickpositioners::test_attachedproperties_dynamic()
QTRY_VERIFY(rect1->property("firstItem").toBool() == false);
QTRY_VERIFY(rect1->property("lastItem").toBool() == true);
- delete window;
}
QQuickView *tst_qquickpositioners::createView(const QString &filename, bool wait)
diff --git a/tests/auto/quick/qquickstates/tst_qquickstates.cpp b/tests/auto/quick/qquickstates/tst_qquickstates.cpp
index 726d3a6e75..e165b559f7 100644
--- a/tests/auto/quick/qquickstates/tst_qquickstates.cpp
+++ b/tests/auto/quick/qquickstates/tst_qquickstates.cpp
@@ -1009,9 +1009,8 @@ void tst_qquickstates::anchorRewindBug()
view->setSource(testFileUrl("anchorRewindBug.qml"));
view->show();
- view->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(view));
+ QVERIFY(QTest::qWaitForWindowExposed(view));
QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(view->rootObject());
QVERIFY(rect != 0);
diff --git a/tests/auto/quick/qquicktextdocument/data/text.qml b/tests/auto/quick/qquicktextdocument/data/text.qml
new file mode 100644
index 0000000000..43a8c6bb82
--- /dev/null
+++ b/tests/auto/quick/qquicktextdocument/data/text.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.1
+
+TextEdit {
+ text: ""
+}
+
diff --git a/tests/auto/quick/qquicktextdocument/qquicktextdocument.pro b/tests/auto/quick/qquicktextdocument/qquicktextdocument.pro
new file mode 100644
index 0000000000..e6bfdbd099
--- /dev/null
+++ b/tests/auto/quick/qquicktextdocument/qquicktextdocument.pro
@@ -0,0 +1,15 @@
+CONFIG += testcase
+TARGET = tst_qquicktextdocument
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquicktextdocument.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
diff --git a/tests/auto/quick/qquicktextdocument/tst_qquicktextdocument.cpp b/tests/auto/quick/qquicktextdocument/tst_qquicktextdocument.cpp
new file mode 100644
index 0000000000..717496cf0e
--- /dev/null
+++ b/tests/auto/quick/qquicktextdocument/tst_qquicktextdocument.cpp
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtTest/QtTest>
+#include <QtQuick/QQuickTextDocument>
+#include <QtQuick/QQuickItem>
+#include <QtQuick/private/qquicktextedit_p.h>
+#include <QtGui/QTextDocument>
+#include <QtGui/QTextDocumentWriter>
+#include <QtQml/QQmlEngine>
+#include <QtQml/QQmlComponent>
+#include "../../shared/util.h"
+
+class tst_qquicktextdocument : public QQmlDataTest
+{
+ Q_OBJECT
+private slots:
+ void textDocumentWriter();
+};
+
+QString text = QStringLiteral("foo bar");
+
+void tst_qquicktextdocument::textDocumentWriter()
+{
+ QQmlEngine e;
+ QQmlComponent c(&e, testFileUrl("text.qml"));
+ QObject* o = c.create();
+ QVERIFY(o);
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit*>(o);
+ QVERIFY(edit);
+
+ QQuickTextDocument* quickDocument = qobject_cast<QQuickTextDocument*>(edit->property("textDocument").value<QObject*>());
+ QVERIFY(quickDocument->textDocument() != 0);
+
+ QBuffer output;
+ output.open(QBuffer::ReadWrite);
+ QVERIFY(output.buffer().isEmpty());
+
+ edit->setProperty("text", QVariant(text));
+ QTextDocumentWriter writer(&output, "plaintext");
+ QVERIFY(writer.write(quickDocument->textDocument()));
+ QCOMPARE(output.buffer(), text.toLatin1());
+ delete o;
+}
+
+QTEST_MAIN(tst_qquicktextdocument)
+
+#include "tst_qquicktextdocument.moc"
diff --git a/tests/auto/quick/qquicktextedit/data/focusOutSelection.qml b/tests/auto/quick/qquicktextedit/data/focusOutSelection.qml
new file mode 100644
index 0000000000..91a6ac900d
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/focusOutSelection.qml
@@ -0,0 +1,35 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: focusoutwindow
+
+ width: 100
+ height: 150
+
+ property alias text1: text1
+ property alias text2: text2
+
+ TextEdit {
+ x: 20
+ y: 30
+ id: text1
+ text: "text 1"
+ height: 20
+ width: 50
+ selectByMouse: true
+ activeFocusOnPress: true
+ objectName: "text1"
+ }
+
+ TextEdit {
+ x: 20
+ y: 80
+ id: text2
+ text: "text 2"
+ height: 20
+ width: 50
+ selectByMouse: true
+ activeFocusOnPress: true
+ objectName: "text2"
+ }
+}
diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
index c0fd1e94a5..bce1f9e4a2 100644
--- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
+++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
@@ -117,6 +117,7 @@ private slots:
void color();
void textMargin();
void persistentSelection();
+ void selectionOnFocusOut();
void focusOnPress();
void selection();
void isRightToLeft_data();
@@ -133,6 +134,9 @@ private slots:
void dragMouseSelection();
void mouseSelectionMode_accessors();
void selectByMouse();
+ void selectByKeyboard();
+ void keyboardSelection_data();
+ void keyboardSelection();
void renderType();
void inputMethodHints();
@@ -1163,6 +1167,48 @@ void tst_qquicktextedit::persistentSelection()
}
+void tst_qquicktextedit::selectionOnFocusOut()
+{
+ QQuickView window(testFileUrl("focusOutSelection.qml"));
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QPoint p1(25, 35);
+ QPoint p2(25, 85);
+
+ QQuickTextEdit *edit1 = window.rootObject()->findChild<QQuickTextEdit*>("text1");
+ QQuickTextEdit *edit2 = window.rootObject()->findChild<QQuickTextEdit*>("text2");
+
+ QTest::mouseClick(&window, Qt::LeftButton, 0, p1);
+ QVERIFY(edit1->hasActiveFocus());
+ QVERIFY(!edit2->hasActiveFocus());
+
+ edit1->selectAll();
+ QCOMPARE(edit1->selectedText(), QLatin1String("text 1"));
+
+ QTest::mouseClick(&window, Qt::LeftButton, 0, p2);
+
+ QCOMPARE(edit1->selectedText(), QLatin1String(""));
+ QVERIFY(!edit1->hasActiveFocus());
+ QVERIFY(edit2->hasActiveFocus());
+
+ edit2->selectAll();
+ QCOMPARE(edit2->selectedText(), QLatin1String("text 2"));
+
+
+ edit2->setFocus(false, Qt::ActiveWindowFocusReason);
+ QVERIFY(!edit2->hasActiveFocus());
+ QCOMPARE(edit2->selectedText(), QLatin1String("text 2"));
+
+ edit2->setFocus(true);
+ QVERIFY(edit2->hasActiveFocus());
+
+ edit2->setFocus(false, Qt::PopupFocusReason);
+ QVERIFY(!edit2->hasActiveFocus());
+ QCOMPARE(edit2->selectedText(), QLatin1String("text 2"));
+}
+
void tst_qquicktextedit::focusOnPress()
{
QString componentStr =
@@ -2020,6 +2066,127 @@ void tst_qquicktextedit::selectByMouse()
QCOMPARE(spy.at(1).at(0).toBool(), false);
}
+void tst_qquicktextedit::selectByKeyboard()
+{
+ QQmlComponent oldComponent(&engine);
+ oldComponent.setData("import QtQuick 2.0\n TextEdit { selectByKeyboard: true }", QUrl());
+ QVERIFY(!oldComponent.create());
+
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.1\n TextEdit { }", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(object.data());
+ QVERIFY(edit);
+
+ QSignalSpy spy(edit, SIGNAL(selectByKeyboardChanged(bool)));
+
+ QCOMPARE(edit->isReadOnly(), false);
+ QCOMPARE(edit->selectByKeyboard(), true);
+
+ edit->setReadOnly(true);
+ QCOMPARE(edit->selectByKeyboard(), false);
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.at(0).at(0).toBool(), false);
+
+ edit->setSelectByKeyboard(true);
+ QCOMPARE(edit->selectByKeyboard(), true);
+ QCOMPARE(spy.count(), 2);
+ QCOMPARE(spy.at(1).at(0).toBool(), true);
+
+ edit->setReadOnly(false);
+ QCOMPARE(edit->selectByKeyboard(), true);
+ QCOMPARE(spy.count(), 2);
+
+ edit->setSelectByKeyboard(false);
+ QCOMPARE(edit->selectByKeyboard(), false);
+ QCOMPARE(spy.count(), 3);
+ QCOMPARE(spy.at(2).at(0).toBool(), false);
+}
+
+Q_DECLARE_METATYPE(QKeySequence::StandardKey)
+
+void tst_qquicktextedit::keyboardSelection_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<bool>("readOnly");
+ QTest::addColumn<bool>("selectByKeyboard");
+ QTest::addColumn<int>("cursorPosition");
+ QTest::addColumn<QKeySequence::StandardKey>("standardKey");
+ QTest::addColumn<QString>("selectedText");
+
+ QTest::newRow("editable - select first char")
+ << QStringLiteral("editable - select first char") << false << true << 0 << QKeySequence::SelectNextChar << QStringLiteral("e");
+ QTest::newRow("editable - select first word")
+ << QStringLiteral("editable - select first char") << false << true << 0 << QKeySequence::SelectNextWord << QStringLiteral("editable ");
+
+ QTest::newRow("editable - cannot select first char")
+ << QStringLiteral("editable - cannot select first char") << false << false << 0 << QKeySequence::SelectNextChar << QStringLiteral("");
+ QTest::newRow("editable - cannot select first word")
+ << QStringLiteral("editable - cannot select first word") << false << false << 0 << QKeySequence::SelectNextWord << QStringLiteral("");
+
+ QTest::newRow("editable - select last char")
+ << QStringLiteral("editable - select last char") << false << true << 27 << QKeySequence::SelectPreviousChar << QStringLiteral("r");
+ QTest::newRow("editable - select last word")
+ << QStringLiteral("editable - select last word") << false << true << 27 << QKeySequence::SelectPreviousWord << QStringLiteral("word");
+
+ QTest::newRow("editable - cannot select last char")
+ << QStringLiteral("editable - cannot select last char") << false << false << 35 << QKeySequence::SelectPreviousChar << QStringLiteral("");
+ QTest::newRow("editable - cannot select last word")
+ << QStringLiteral("editable - cannot select last word") << false << false << 35 << QKeySequence::SelectPreviousWord << QStringLiteral("");
+
+ QTest::newRow("read-only - cannot select first char")
+ << QStringLiteral("read-only - cannot select first char") << true << false << 0 << QKeySequence::SelectNextChar << QStringLiteral("");
+ QTest::newRow("read-only - cannot select first word")
+ << QStringLiteral("read-only - cannot select first word") << true << false << 0 << QKeySequence::SelectNextWord << QStringLiteral("");
+
+ QTest::newRow("read-only - cannot select last char")
+ << QStringLiteral("read-only - cannot select last char") << true << false << 35 << QKeySequence::SelectPreviousChar << QStringLiteral("");
+ QTest::newRow("read-only - cannot select last word")
+ << QStringLiteral("read-only - cannot select last word") << true << false << 35 << QKeySequence::SelectPreviousWord << QStringLiteral("");
+
+ QTest::newRow("read-only - select first char")
+ << QStringLiteral("read-only - select first char") << true << true << 0 << QKeySequence::SelectNextChar << QStringLiteral("r");
+ QTest::newRow("read-only - select first word")
+ << QStringLiteral("read-only - select first word") << true << true << 0 << QKeySequence::SelectNextWord << QStringLiteral("read");
+
+ QTest::newRow("read-only - select last char")
+ << QStringLiteral("read-only - select last char") << true << true << 28 << QKeySequence::SelectPreviousChar << QStringLiteral("r");
+ QTest::newRow("read-only - select last word")
+ << QStringLiteral("read-only - select last word") << true << true << 28 << QKeySequence::SelectPreviousWord << QStringLiteral("word");
+}
+
+void tst_qquicktextedit::keyboardSelection()
+{
+ QFETCH(QString, text);
+ QFETCH(bool, readOnly);
+ QFETCH(bool, selectByKeyboard);
+ QFETCH(int, cursorPosition);
+ QFETCH(QKeySequence::StandardKey, standardKey);
+ QFETCH(QString, selectedText);
+
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.1\n TextEdit { focus: true }", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(object.data());
+ QVERIFY(edit);
+
+ edit->setText(text);
+ edit->setSelectByKeyboard(selectByKeyboard);
+ edit->setReadOnly(readOnly);
+ edit->setCursorPosition(cursorPosition);
+
+ QQuickWindow window;
+ edit->setParentItem(window.contentItem());
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+ QVERIFY(edit->hasActiveFocus());
+
+ simulateKeys(&window, standardKey);
+
+ QCOMPARE(edit->selectedText(), selectedText);
+}
+
void tst_qquicktextedit::renderType()
{
QQmlComponent component(&engine);
@@ -2225,6 +2392,7 @@ void tst_qquicktextedit::cursorDelegate()
QQuickView view(source);
view.show();
view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
QQuickTextEdit *textEditObject = view.rootObject()->findChild<QQuickTextEdit*>("textEditObject");
QVERIFY(textEditObject != 0);
// Delegate creation is deferred until focus in or cursor visibility is forced.
@@ -2340,6 +2508,7 @@ void tst_qquicktextedit::remoteCursorDelegate()
view.setSource(testFileUrl("cursorTestRemote.qml"));
view.show();
view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
QQuickTextEdit *textEditObject = view.rootObject()->findChild<QQuickTextEdit*>("textEditObject");
QVERIFY(textEditObject != 0);
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
index 339aa5854d..d1ed6dd05a 100644
--- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
@@ -167,6 +167,7 @@ private slots:
void openInputPanel();
void setHAlignClearCache();
void focusOutClearSelection();
+ void focusOutNotClearSelection();
void echoMode();
void passwordEchoDelay();
@@ -2665,6 +2666,7 @@ void tst_qquicktextinput::cursorDelegate()
QQuickView view(source);
view.show();
view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
QQuickTextInput *textInputObject = view.rootObject()->findChild<QQuickTextInput*>("textInputObject");
QVERIFY(textInputObject != 0);
// Delegate is created on demand, and so won't be available immediately. Focus in or
@@ -2773,6 +2775,7 @@ void tst_qquicktextinput::cursorDelegate()
void tst_qquicktextinput::remoteCursorDelegate()
{
+ QSKIP("This test is unstable");
TestHTTPServer server(SERVER_PORT);
server.serveDirectory(dataDirectory(), TestHTTPServer::Delay);
@@ -2784,6 +2787,7 @@ void tst_qquicktextinput::remoteCursorDelegate()
view.setSource(testFileUrl("cursorTestRemote.qml"));
view.show();
view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
QQuickTextInput *textInputObject = view.rootObject()->findChild<QQuickTextInput*>("textInputObject");
QVERIFY(textInputObject != 0);
@@ -2806,6 +2810,7 @@ void tst_qquicktextinput::remoteCursorDelegate()
void tst_qquicktextinput::cursorVisible()
{
+ QSKIP("This test is unstable");
QQuickTextInput input;
input.componentComplete();
QSignalSpy spy(&input, SIGNAL(cursorVisibleChanged(bool)));
@@ -3494,6 +3499,49 @@ void tst_qquicktextinput::focusOutClearSelection()
QTRY_COMPARE(input.selectedText(), QLatin1String(""));
}
+void tst_qquicktextinput::focusOutNotClearSelection()
+{
+ QQuickView view;
+ QQuickTextInput input;
+ input.setText(QLatin1String("Hello world"));
+ input.setFocus(true);
+ input.setParentItem(view.contentItem());
+ input.componentComplete();
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+
+ QVERIFY(input.hasActiveFocus());
+ input.select(2,5);
+ QTRY_COMPARE(input.selectedText(), QLatin1String("llo"));
+
+ // The selection should not be cleared when the focus
+ // out event has one of the following reason:
+ // Qt::ActiveWindowFocusReason
+ // Qt::PopupFocusReason
+
+ input.setFocus(false, Qt::ActiveWindowFocusReason);
+ QGuiApplication::processEvents();
+ QTRY_COMPARE(input.selectedText(), QLatin1String("llo"));
+ QTRY_COMPARE(input.hasActiveFocus(), false);
+
+ input.setFocus(true);
+ QTRY_COMPARE(input.hasActiveFocus(), true);
+
+ input.setFocus(false, Qt::PopupFocusReason);
+ QGuiApplication::processEvents();
+ QTRY_COMPARE(input.selectedText(), QLatin1String("llo"));
+ QTRY_COMPARE(input.hasActiveFocus(), false);
+
+ input.setFocus(true);
+ QTRY_COMPARE(input.hasActiveFocus(), true);
+
+ input.setFocus(false, Qt::OtherFocusReason);
+ QGuiApplication::processEvents();
+ QTRY_COMPARE(input.selectedText(), QLatin1String(""));
+ QTRY_COMPARE(input.hasActiveFocus(), false);
+}
+
void tst_qquicktextinput::geometrySignals()
{
QQmlComponent component(&engine, testFileUrl("geometrySignals.qml"));
diff --git a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
index 74c557871f..d16bf81d88 100644
--- a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
+++ b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
@@ -52,9 +52,9 @@
#include <QtQuick/qquickview.h>
#include <private/qquicklistview_p.h>
#include <QtQuick/private/qquicktext_p.h>
-#include <QtQuick/private/qquickvisualdatamodel_p.h>
+#include <QtQml/private/qqmldelegatemodel_p.h>
#include <private/qqmlvaluetype_p.h>
-#include <private/qquickchangeset_p.h>
+#include <private/qqmlchangeset_p.h>
#include <private/qqmlengine_p.h>
#include <math.h>
#include <QtGui/qstandarditemmodel.h>
@@ -360,21 +360,21 @@ public:
int indexCreated;
public Q_SLOTS:
- void initItem(int index, QQuickItem *item)
+ void initItem(int index, QObject *item)
{
- itemInitialized = item;
+ itemInitialized = qobject_cast<QQuickItem*>(item);
indexInitialized = index;
}
- void createdItem(int index, QQuickItem *item)
+ void createdItem(int index, QObject *item)
{
- itemCreated = item;
+ itemCreated = qobject_cast<QQuickItem*>(item);
indexCreated = index;
}
- void destroyingItem(QQuickItem *item)
+ void destroyingItem(QObject *item)
{
- itemDestroyed = item;
+ itemDestroyed = qobject_cast<QQuickItem*>(item);
}
};
@@ -452,9 +452,9 @@ private:
template <int N> void get_verify(
const SingleRoleModel &model,
- QQuickVisualDataModel *visualModel,
- QQuickVisualDataGroup *visibleItems,
- QQuickVisualDataGroup *selectedItems,
+ QQmlDelegateModel *visualModel,
+ QQmlDelegateModelGroup *visibleItems,
+ QQmlDelegateModelGroup *selectedItems,
const int (&mIndex)[N],
const int (&iIndex)[N],
const int (&vIndex)[N],
@@ -467,7 +467,7 @@ private:
QQmlEngine engine;
};
-Q_DECLARE_METATYPE(QQuickChangeSet)
+Q_DECLARE_METATYPE(QQmlChangeSet)
template <typename T> static T evaluate(QObject *scope, const QString &expression)
{
@@ -489,7 +489,7 @@ template <> void evaluate<void>(QObject *scope, const QString &expression)
void tst_qquickvisualdatamodel::initTestCase()
{
QQmlDataTest::initTestCase();
- qRegisterMetaType<QQuickChangeSet>();
+ qRegisterMetaType<QQmlChangeSet>();
qmlRegisterType<SingleRoleModel>("tst_qquickvisualdatamodel", 1, 0, "SingleRoleModel");
qmlRegisterType<DataObject>("tst_qquickvisualdatamodel", 1, 0, "DataObject");
@@ -517,7 +517,7 @@ void tst_qquickvisualdatamodel::rootIndex()
engine.rootContext()->setContextProperty("myModel", &model);
- QQuickVisualDataModel *obj = qobject_cast<QQuickVisualDataModel*>(c.create());
+ QQmlDelegateModel *obj = qobject_cast<QQmlDelegateModel*>(c.create());
QVERIFY(obj != 0);
QMetaObject::invokeMethod(obj, "setRoot");
@@ -611,7 +611,7 @@ void tst_qquickvisualdatamodel::childChanged()
QQuickItem *contentItem = listview->contentItem();
QVERIFY(contentItem != 0);
- QQuickVisualDataModel *vdm = listview->findChild<QQuickVisualDataModel*>("visualModel");
+ QQmlDelegateModel *vdm = listview->findChild<QQmlDelegateModel*>("visualModel");
vdm->setRootIndex(QVariant::fromValue(model.indexFromItem(model.item(1,0))));
QCOMPARE(listview->count(), 1);
@@ -922,7 +922,7 @@ void tst_qquickvisualdatamodel::noDelegate()
QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject());
QVERIFY(listview != 0);
- QQuickVisualDataModel *vdm = listview->findChild<QQuickVisualDataModel*>("visualModel");
+ QQmlDelegateModel *vdm = listview->findChild<QQmlDelegateModel*>("visualModel");
QVERIFY(vdm != 0);
QCOMPARE(vdm->count(), 3);
@@ -1052,15 +1052,15 @@ void tst_qquickvisualdatamodel::qaimRowsMoved()
SingleRoleModel model(list);
engine.rootContext()->setContextProperty("myModel", &model);
- QQuickVisualDataModel *obj = qobject_cast<QQuickVisualDataModel*>(c.create());
+ QQmlDelegateModel *obj = qobject_cast<QQmlDelegateModel*>(c.create());
QVERIFY(obj != 0);
- QSignalSpy spy(obj, SIGNAL(modelUpdated(QQuickChangeSet,bool)));
+ QSignalSpy spy(obj, SIGNAL(modelUpdated(QQmlChangeSet,bool)));
model.emitMove(sourceFirst, sourceLast, destinationChild);
QCOMPARE(spy.count(), 1);
QCOMPARE(spy[0].count(), 2);
- QQuickChangeSet changeSet = spy[0][0].value<QQuickChangeSet>();
+ QQmlChangeSet changeSet = spy[0][0].value<QQmlChangeSet>();
QCOMPARE(changeSet.removes().count(), 1);
QCOMPARE(changeSet.removes().at(0).index, expectFrom);
QCOMPARE(changeSet.removes().at(0).count, expectCount);
@@ -1115,11 +1115,11 @@ void tst_qquickvisualdatamodel::subtreeRowsMoved()
QQmlComponent component(&engine, testFileUrl("visualdatamodel.qml"));
QScopedPointer<QObject> object(component.create());
- QQuickVisualDataModel *vdm = qobject_cast<QQuickVisualDataModel*>(object.data());
+ QQmlDelegateModel *vdm = qobject_cast<QQmlDelegateModel*>(object.data());
QVERIFY(vdm);
- QSignalSpy spy(vdm, SIGNAL(modelUpdated(QQuickChangeSet,bool)));
- QQuickChangeSet changeSet;
+ QSignalSpy spy(vdm, SIGNAL(modelUpdated(QQmlChangeSet,bool)));
+ QQmlChangeSet changeSet;
QCOMPARE(vdm->count(), 4);
@@ -1127,7 +1127,7 @@ void tst_qquickvisualdatamodel::subtreeRowsMoved()
model.move(QModelIndex(), 1, model.index(0, 0), 3, 2);
QCOMPARE(vdm->count(), 2);
QCOMPARE(spy.count(), 1);
- changeSet = spy.last().at(0).value<QQuickChangeSet>();
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
QCOMPARE(changeSet.removes().count(), 1);
QCOMPARE(changeSet.removes().at(0).index, 1);
QCOMPARE(changeSet.removes().at(0).count, 2);
@@ -1137,7 +1137,7 @@ void tst_qquickvisualdatamodel::subtreeRowsMoved()
model.move(model.index(0, 0), 4, QModelIndex(), 2, 1);
QCOMPARE(vdm->count(), 3);
QCOMPARE(spy.count(), 2);
- changeSet = spy.last().at(0).value<QQuickChangeSet>();
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
QCOMPARE(changeSet.removes().count(), 0);
QCOMPARE(changeSet.inserts().count(), 1);
QCOMPARE(changeSet.inserts().at(0).index, 2);
@@ -1147,11 +1147,11 @@ void tst_qquickvisualdatamodel::subtreeRowsMoved()
QCOMPARE(vdm->rootIndex().value<QModelIndex>(), model.index(2, 0));
QCOMPARE(vdm->count(), 3);
QCOMPARE(spy.count(), 4);
- changeSet = spy.at(2).at(0).value<QQuickChangeSet>();
+ changeSet = spy.at(2).at(0).value<QQmlChangeSet>();
QCOMPARE(changeSet.removes().count(), 1);
QCOMPARE(changeSet.removes().at(0).index, 0);
QCOMPARE(changeSet.removes().at(0).count, 3);
- changeSet = spy.last().at(0).value<QQuickChangeSet>();
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
QCOMPARE(changeSet.inserts().count(), 1);
QCOMPARE(changeSet.inserts().at(0).index, 0);
QCOMPARE(changeSet.inserts().at(0).count, 3);
@@ -1182,7 +1182,7 @@ void tst_qquickvisualdatamodel::subtreeRowsMoved()
QCOMPARE(vdm->rootIndex().value<QModelIndex>(), QModelIndex());
QCOMPARE(vdm->count(), 0);
QCOMPARE(spy.count(), 5);
- changeSet = spy.last().at(0).value<QQuickChangeSet>();
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
QCOMPARE(changeSet.removes().count(), 1);
QCOMPARE(changeSet.removes().at(0).index, 0);
QCOMPARE(changeSet.removes().at(0).count, 3);
@@ -1192,7 +1192,7 @@ void tst_qquickvisualdatamodel::subtreeRowsMoved()
QCOMPARE(vdm->rootIndex().value<QModelIndex>(), QModelIndex());
QCOMPARE(vdm->count(), 2);
QCOMPARE(spy.count(), 6);
- changeSet = spy.last().at(0).value<QQuickChangeSet>();
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
QCOMPARE(changeSet.removes().count(), 0);
QCOMPARE(changeSet.inserts().count(), 1);
QCOMPARE(changeSet.inserts().at(0).index, 0);
@@ -1211,17 +1211,17 @@ void tst_qquickvisualdatamodel::watchedRoles()
QQmlComponent component(&engine, testFileUrl("visualdatamodel.qml"));
QScopedPointer<QObject> object(component.create());
- QQuickVisualDataModel *vdm = qobject_cast<QQuickVisualDataModel*>(object.data());
+ QQmlDelegateModel *vdm = qobject_cast<QQmlDelegateModel*>(object.data());
QVERIFY(vdm);
// VisualDataModel doesn't initialize model data until the first item is requested.
- QQuickItem *item = vdm->item(0);
+ QQuickItem *item = qobject_cast<QQuickItem*>(vdm->object(0));
QVERIFY(item);
vdm->release(item);
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // Ensure released items are deleted before test exits.
- QSignalSpy spy(vdm, SIGNAL(modelUpdated(QQuickChangeSet,bool)));
- QQuickChangeSet changeSet;
+ QSignalSpy spy(vdm, SIGNAL(modelUpdated(QQmlChangeSet,bool)));
+ QQmlChangeSet changeSet;
QCOMPARE(vdm->count(), 30);
@@ -1238,13 +1238,13 @@ void tst_qquickvisualdatamodel::watchedRoles()
emit model.dataChanged(model.index(0), model.index(4));
QCOMPARE(spy.count(), 1);
- changeSet = spy.last().at(0).value<QQuickChangeSet>();
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
QCOMPARE(changeSet.changes().at(0).index, 0);
QCOMPARE(changeSet.changes().at(0).count, 5);
emit model.dataChanged(model.index(1), model.index(6), QVector<int>() << QaimModel::Name);
QCOMPARE(spy.count(), 2);
- changeSet = spy.last().at(0).value<QQuickChangeSet>();
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
QCOMPARE(changeSet.changes().at(0).index, 1);
QCOMPARE(changeSet.changes().at(0).count, 6);
@@ -1255,7 +1255,7 @@ void tst_qquickvisualdatamodel::watchedRoles()
emit model.dataChanged(model.index(0), model.index(4));
QCOMPARE(spy.count(), 3);
- changeSet = spy.last().at(0).value<QQuickChangeSet>();
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
QCOMPARE(changeSet.changes().at(0).index, 0);
QCOMPARE(changeSet.changes().at(0).count, 5);
@@ -1264,7 +1264,7 @@ void tst_qquickvisualdatamodel::watchedRoles()
emit model.dataChanged(model.index(8), model.index(8), QVector<int>() << QaimModel::Number);
QCOMPARE(spy.count(), 4);
- changeSet = spy.last().at(0).value<QQuickChangeSet>();
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
QCOMPARE(changeSet.changes().at(0).index, 8);
QCOMPARE(changeSet.changes().at(0).count, 1);
@@ -1272,19 +1272,19 @@ void tst_qquickvisualdatamodel::watchedRoles()
emit model.dataChanged(model.index(0), model.index(4));
QCOMPARE(spy.count(), 5);
- changeSet = spy.last().at(0).value<QQuickChangeSet>();
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
QCOMPARE(changeSet.changes().at(0).index, 0);
QCOMPARE(changeSet.changes().at(0).count, 5);
emit model.dataChanged(model.index(1), model.index(6), QVector<int>() << QaimModel::Name);
QCOMPARE(spy.count(), 6);
- changeSet = spy.last().at(0).value<QQuickChangeSet>();
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
QCOMPARE(changeSet.changes().at(0).index, 1);
QCOMPARE(changeSet.changes().at(0).count, 6);
emit model.dataChanged(model.index(8), model.index(8), QVector<int>() << QaimModel::Number);
QCOMPARE(spy.count(), 7);
- changeSet = spy.last().at(0).value<QQuickChangeSet>();
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
QCOMPARE(changeSet.changes().at(0).index, 8);
QCOMPARE(changeSet.changes().at(0).count, 1);
}
@@ -1301,29 +1301,29 @@ void tst_qquickvisualdatamodel::hasModelChildren()
QQmlComponent component(&engine, testFileUrl("visualdatamodel.qml"));
QScopedPointer<QObject> object(component.create());
- QQuickVisualDataModel *vdm = qobject_cast<QQuickVisualDataModel*>(object.data());
+ QQmlDelegateModel *vdm = qobject_cast<QQmlDelegateModel*>(object.data());
QVERIFY(vdm);
QCOMPARE(vdm->count(), 4);
QQuickItem *item = 0;
- item = vdm->item(0);
+ item = qobject_cast<QQuickItem*>(vdm->object(0));
QVERIFY(item);
QCOMPARE(item->property("modelChildren").toBool(), true);
vdm->release(item);
- item = vdm->item(1);
+ item = qobject_cast<QQuickItem*>(vdm->object(1));
QVERIFY(item);
QCOMPARE(item->property("modelChildren").toBool(), false);
vdm->release(item);
- item = vdm->item(2);
+ item = qobject_cast<QQuickItem*>(vdm->object(2));
QVERIFY(item);
QCOMPARE(item->property("modelChildren").toBool(), true);
vdm->release(item);
- item = vdm->item(3);
+ item = qobject_cast<QQuickItem*>(vdm->object(3));
QVERIFY(item);
QCOMPARE(item->property("modelChildren").toBool(), false);
vdm->release(item);
@@ -1351,14 +1351,14 @@ void tst_qquickvisualdatamodel::setValue()
QQmlComponent component(&engine, testFileUrl("visualdatamodel.qml"));
QScopedPointer<QObject> object(component.create());
- QQuickVisualDataModel *vdm = qobject_cast<QQuickVisualDataModel*>(object.data());
+ QQmlDelegateModel *vdm = qobject_cast<QQmlDelegateModel*>(object.data());
QVERIFY(vdm);
QCOMPARE(vdm->count(), 3);
QQuickItem *item = 0;
- item = vdm->item(0);
+ item = qobject_cast<QQuickItem*>(vdm->object(0));
QVERIFY(item);
QCOMPARE(evaluate<QString>(item, "display"), QString("Row 1 Item"));
evaluate<void>(item, "display = 'Changed Item 1'");
@@ -1412,7 +1412,7 @@ void tst_qquickvisualdatamodel::remove()
QQuickItem *contentItem = listview->contentItem();
QVERIFY(contentItem != 0);
- QQuickVisualDataModel *visualModel = qobject_cast<QQuickVisualDataModel *>(qvariant_cast<QObject *>(listview->model()));
+ QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel *>(qvariant_cast<QObject *>(listview->model()));
QVERIFY(visualModel);
{
@@ -1521,7 +1521,7 @@ void tst_qquickvisualdatamodel::move()
QQuickItem *contentItem = listview->contentItem();
QVERIFY(contentItem != 0);
- QQuickVisualDataModel *visualModel = qobject_cast<QQuickVisualDataModel *>(qvariant_cast<QObject *>(listview->model()));
+ QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel *>(qvariant_cast<QObject *>(listview->model()));
QVERIFY(visualModel);
{
@@ -1710,13 +1710,13 @@ void tst_qquickvisualdatamodel::groups()
QQuickItem *contentItem = listview->contentItem();
QVERIFY(contentItem != 0);
- QQuickVisualDataModel *visualModel = listview->findChild<QQuickVisualDataModel *>("visualModel");
+ QQmlDelegateModel *visualModel = listview->findChild<QQmlDelegateModel *>("visualModel");
QVERIFY(visualModel);
- QQuickVisualDataGroup *visibleItems = listview->findChild<QQuickVisualDataGroup *>("visibleItems");
+ QQmlDelegateModelGroup *visibleItems = listview->findChild<QQmlDelegateModelGroup *>("visibleItems");
QVERIFY(visibleItems);
- QQuickVisualDataGroup *selectedItems = listview->findChild<QQuickVisualDataGroup *>("selectedItems");
+ QQmlDelegateModelGroup *selectedItems = listview->findChild<QQmlDelegateModelGroup *>("selectedItems");
QVERIFY(selectedItems);
const bool f = false;
@@ -1939,9 +1939,9 @@ void tst_qquickvisualdatamodel::groups()
template <int N> void tst_qquickvisualdatamodel::get_verify(
const SingleRoleModel &model,
- QQuickVisualDataModel *visualModel,
- QQuickVisualDataGroup *visibleItems,
- QQuickVisualDataGroup *selectedItems,
+ QQmlDelegateModel *visualModel,
+ QQmlDelegateModelGroup *visibleItems,
+ QQmlDelegateModelGroup *selectedItems,
const int (&mIndex)[N],
const int (&iIndex)[N],
const int (&vIndex)[N],
@@ -2030,13 +2030,13 @@ void tst_qquickvisualdatamodel::get()
QQuickItem *contentItem = listview->contentItem();
QVERIFY(contentItem != 0);
- QQuickVisualDataModel *visualModel = qobject_cast<QQuickVisualDataModel *>(qvariant_cast<QObject *>(listview->model()));
+ QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel *>(qvariant_cast<QObject *>(listview->model()));
QVERIFY(visualModel);
- QQuickVisualDataGroup *visibleItems = visualModel->findChild<QQuickVisualDataGroup *>("visibleItems");
+ QQmlDelegateModelGroup *visibleItems = visualModel->findChild<QQmlDelegateModelGroup *>("visibleItems");
QVERIFY(visibleItems);
- QQuickVisualDataGroup *selectedItems = visualModel->findChild<QQuickVisualDataGroup *>("selectedItems");
+ QQmlDelegateModelGroup *selectedItems = visualModel->findChild<QQmlDelegateModelGroup *>("selectedItems");
QVERIFY(selectedItems);
QV8Engine *v8Engine = QQmlEnginePrivate::getV8Engine(ctxt->engine());
@@ -2154,7 +2154,7 @@ void tst_qquickvisualdatamodel::get()
void tst_qquickvisualdatamodel::invalidGroups()
{
QUrl source = testFileUrl("groups-invalid.qml");
- QTest::ignoreMessage(QtWarningMsg, (source.toString() + ":12:9: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("Group names must start with a lower case letter")).toUtf8());
+ QTest::ignoreMessage(QtWarningMsg, (source.toString() + ":12:9: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("Group names must start with a lower case letter")).toUtf8());
QQmlComponent component(&engine, source);
QScopedPointer<QObject> object(component.create());
@@ -2326,7 +2326,7 @@ void tst_qquickvisualdatamodel::create()
QQuickItem *contentItem = listview->contentItem();
QVERIFY(contentItem != 0);
- QQuickVisualDataModel *visualModel = qobject_cast<QQuickVisualDataModel *>(qvariant_cast<QObject *>(listview->model()));
+ QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel *>(qvariant_cast<QObject *>(listview->model()));
QVERIFY(visualModel);
QCOMPARE(listview->count(), 20);
@@ -2440,7 +2440,7 @@ void tst_qquickvisualdatamodel::incompleteModel()
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
- QQuickVisualDataModel *model = qobject_cast<QQuickVisualDataModel *>(object.data());
+ QQmlDelegateModel *model = qobject_cast<QQmlDelegateModel *>(object.data());
QVERIFY(model);
QSignalSpy itemsSpy(model->items(), SIGNAL(countChanged()));
@@ -3665,67 +3665,67 @@ void tst_qquickvisualdatamodel::warnings_data()
QTest::newRow("insert < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.insert(-2, {\"number\": \"eight\"})")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("insert: index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("insert: index out of range"))
<< 4;
QTest::newRow("insert > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.insert(8, {\"number\": \"eight\"})")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("insert: index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("insert: index out of range"))
<< 4;
QTest::newRow("create < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.create(-2, {\"number\": \"eight\"})")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("create: index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("create: index out of range"))
<< 4;
QTest::newRow("create > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.create(8, {\"number\": \"eight\"})")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("create: index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("create: index out of range"))
<< 4;
QTest::newRow("resolve from < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(-2, 3)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("resolve: from index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: from index out of range"))
<< 4;
QTest::newRow("resolve from > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(8, 3)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("resolve: from index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: from index out of range"))
<< 4;
QTest::newRow("resolve to < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(3, -2)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("resolve: to index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: to index out of range"))
<< 4;
QTest::newRow("resolve to > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(3, 8)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("resolve: to index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: to index out of range"))
<< 4;
QTest::newRow("resolve from invalid index")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(\"two\", 3)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("resolve: from index invalid"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: from index invalid"))
<< 4;
QTest::newRow("resolve to invalid index")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(3, \"two\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("resolve: to index invalid"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: to index invalid"))
<< 4;
QTest::newRow("resolve already resolved item")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(3, 2)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("resolve: from is not an unresolved item"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: from is not an unresolved item"))
<< 4;
QTest::newRow("resolve already resolved item")
@@ -3733,193 +3733,193 @@ void tst_qquickvisualdatamodel::warnings_data()
<< QString("{ items.insert(0, {\"number\": \"eight\"});"
"items.insert(1, {\"number\": \"seven\"});"
"items.resolve(0, 1)}")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("resolve: to is not a model item"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: to is not a model item"))
<< 6;
QTest::newRow("remove index < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.remove(-2, 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("remove: index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: index out of range"))
<< 4;
QTest::newRow("remove index == length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.remove(4, 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("remove: index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: index out of range"))
<< 4;
QTest::newRow("remove index > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.remove(9, 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("remove: index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: index out of range"))
<< 4;
QTest::newRow("remove invalid index")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.remove(\"nine\", 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("remove: invalid index"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: invalid index"))
<< 4;
QTest::newRow("remove count < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.remove(1, -2)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("remove: invalid count"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: invalid count"))
<< 4;
QTest::newRow("remove index + count > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.remove(2, 4, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("remove: invalid count"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: invalid count"))
<< 4;
QTest::newRow("addGroups index < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.addGroups(-2, 1, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("addGroups: index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("addGroups: index out of range"))
<< 4;
QTest::newRow("addGroups index == length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.addGroups(4, 1, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("addGroups: index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("addGroups: index out of range"))
<< 4;
QTest::newRow("addGroups index > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.addGroups(9, 1, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("addGroups: index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("addGroups: index out of range"))
<< 4;
QTest::newRow("addGroups count < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.addGroups(1, -2, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("addGroups: invalid count"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("addGroups: invalid count"))
<< 4;
QTest::newRow("addGroups index + count > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.addGroups(2, 4, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("addGroups: invalid count"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("addGroups: invalid count"))
<< 4;
QTest::newRow("removeGroups index < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.removeGroups(-2, 1, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("removeGroups: index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("removeGroups: index out of range"))
<< 4;
QTest::newRow("removeGroups index == length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.removeGroups(4, 1, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("removeGroups: index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("removeGroups: index out of range"))
<< 4;
QTest::newRow("removeGroups index > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.removeGroups(9, 1, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("removeGroups: index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("removeGroups: index out of range"))
<< 4;
QTest::newRow("removeGroups count < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.removeGroups(1, -2, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("removeGroups: invalid count"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("removeGroups: invalid count"))
<< 4;
QTest::newRow("removeGroups index + count > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.removeGroups(2, 4, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("removeGroups: invalid count"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("removeGroups: invalid count"))
<< 4;
QTest::newRow("setGroups index < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.setGroups(-2, 1, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("setGroups: index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("setGroups: index out of range"))
<< 4;
QTest::newRow("setGroups index == length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.setGroups(4, 1, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("setGroups: index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("setGroups: index out of range"))
<< 4;
QTest::newRow("setGroups index > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.setGroups(9, 1, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("setGroups: index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("setGroups: index out of range"))
<< 4;
QTest::newRow("setGroups count < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.setGroups(1, -2, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("setGroups: invalid count"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("setGroups: invalid count"))
<< 4;
QTest::newRow("setGroups index + count > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.setGroups(2, 4, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("setGroups: invalid count"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("setGroups: invalid count"))
<< 4;
QTest::newRow("move from < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(-2, 1, 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("move: from index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
<< 4;
QTest::newRow("move from == length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(4, 1, 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("move: from index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
<< 4;
QTest::newRow("move from > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(9, 1, 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("move: from index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
<< 4;
QTest::newRow("move invalid from")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(\"nine\", 1, 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("move: invalid from index"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: invalid from index"))
<< 4;
QTest::newRow("move to < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(1, -2, 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("move: to index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: to index out of range"))
<< 4;
QTest::newRow("move to == length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(1, 4, 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("move: to index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: to index out of range"))
<< 4;
QTest::newRow("move to > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(1, 9, 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("move: to index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: to index out of range"))
<< 4;
QTest::newRow("move invalid to")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(1, \"nine\", 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("move: invalid to index"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: invalid to index"))
<< 4;
QTest::newRow("move count < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(1, 1, -2)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("move: invalid count"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: invalid count"))
<< 4;
QTest::newRow("move from + count > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(2, 1, 4)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQuickVisualDataGroup::tr("move: from index out of range"))
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
<< 4;
}
@@ -3961,19 +3961,19 @@ void tst_qquickvisualdatamodel::invalidAttachment()
QCOMPARE(component.errors().count(), 0);
QVariant property = object->property("invalidVdm");
- QCOMPARE(property.userType(), qMetaTypeId<QQuickVisualDataModel *>());
- QVERIFY(!property.value<QQuickVisualDataModel *>());
+ QCOMPARE(property.userType(), qMetaTypeId<QQmlDelegateModel *>());
+ QVERIFY(!property.value<QQmlDelegateModel *>());
QQuickItem *item = findItem<QQuickItem>(static_cast<QQuickItem *>(object.data()), "delegate");
QVERIFY(item);
property = item->property("validVdm");
- QCOMPARE(property.userType(), qMetaTypeId<QQuickVisualDataModel *>());
- QVERIFY(property.value<QQuickVisualDataModel *>());
+ QCOMPARE(property.userType(), qMetaTypeId<QQmlDelegateModel *>());
+ QVERIFY(property.value<QQmlDelegateModel *>());
property = item->property("invalidVdm");
- QCOMPARE(property.userType(), qMetaTypeId<QQuickVisualDataModel *>());
- QVERIFY(!property.value<QQuickVisualDataModel *>());
+ QCOMPARE(property.userType(), qMetaTypeId<QQmlDelegateModel *>());
+ QVERIFY(!property.value<QQmlDelegateModel *>());
}
void tst_qquickvisualdatamodel::asynchronousInsert_data()
@@ -4005,15 +4005,15 @@ void tst_qquickvisualdatamodel::asynchronousInsert()
engine.rootContext()->setContextProperty("myModel", &model);
- QQuickVisualDataModel *visualModel = qobject_cast<QQuickVisualDataModel*>(c.create());
+ QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel*>(c.create());
QVERIFY(visualModel);
ItemRequester requester;
- connect(visualModel, SIGNAL(initItem(int,QQuickItem*)), &requester, SLOT(initItem(int,QQuickItem*)));
- connect(visualModel, SIGNAL(createdItem(int,QQuickItem*)), &requester, SLOT(createdItem(int,QQuickItem*)));
- connect(visualModel, SIGNAL(destroyingItem(QQuickItem*)), &requester, SLOT(destroyingItem(QQuickItem*)));
+ connect(visualModel, SIGNAL(initItem(int,QObject*)), &requester, SLOT(initItem(int,QObject*)));
+ connect(visualModel, SIGNAL(createdItem(int,QObject*)), &requester, SLOT(createdItem(int,QObject*)));
+ connect(visualModel, SIGNAL(destroyingItem(QObject*)), &requester, SLOT(destroyingItem(QObject*)));
- QQuickItem *item = visualModel->item(requestIndex, true);
+ QQuickItem *item = qobject_cast<QQuickItem*>(visualModel->object(requestIndex, true));
QVERIFY(!item);
QVERIFY(!requester.itemInitialized);
@@ -4025,7 +4025,7 @@ void tst_qquickvisualdatamodel::asynchronousInsert()
newItems.append(qMakePair(QLatin1String("New item") + QString::number(i), QString(QLatin1String(""))));
model.insertItems(insertIndex, newItems);
- item = visualModel->item(completeIndex, false);
+ item = qobject_cast<QQuickItem*>(visualModel->object(completeIndex, false));
QVERIFY(item);
QCOMPARE(requester.itemInitialized, item);
@@ -4070,15 +4070,15 @@ void tst_qquickvisualdatamodel::asynchronousRemove()
engine.rootContext()->setContextProperty("myModel", &model);
- QQuickVisualDataModel *visualModel = qobject_cast<QQuickVisualDataModel*>(c.create());
+ QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel*>(c.create());
QVERIFY(visualModel);
ItemRequester requester;
- connect(visualModel, SIGNAL(initItem(int,QQuickItem*)), &requester, SLOT(initItem(int,QQuickItem*)));
- connect(visualModel, SIGNAL(createdItem(int,QQuickItem*)), &requester, SLOT(createdItem(int,QQuickItem*)));
- connect(visualModel, SIGNAL(destroyingItem(QQuickItem*)), &requester, SLOT(destroyingItem(QQuickItem*)));
+ connect(visualModel, SIGNAL(initItem(int,QObject*)), &requester, SLOT(initItem(int,QObject*)));
+ connect(visualModel, SIGNAL(createdItem(int,QObject*)), &requester, SLOT(createdItem(int,QObject*)));
+ connect(visualModel, SIGNAL(destroyingItem(QObject*)), &requester, SLOT(destroyingItem(QObject*)));
- QQuickItem *item = visualModel->item(requestIndex, true);
+ QQuickItem *item = qobject_cast<QQuickItem*>(visualModel->object(requestIndex, true));
QVERIFY(!item);
QVERIFY(!requester.itemInitialized);
@@ -4098,7 +4098,7 @@ void tst_qquickvisualdatamodel::asynchronousRemove()
QCOMPARE(requester.itemCreated, requester.itemInitialized);
QCOMPARE(requester.itemDestroyed, requester.itemInitialized);
} else {
- item = visualModel->item(completeIndex, false);
+ item = qobject_cast<QQuickItem*>(visualModel->object(completeIndex, false));
QVERIFY(item);
QCOMPARE(requester.itemInitialized, item);
@@ -4148,15 +4148,15 @@ void tst_qquickvisualdatamodel::asynchronousMove()
engine.rootContext()->setContextProperty("myModel", &model);
- QQuickVisualDataModel *visualModel = qobject_cast<QQuickVisualDataModel*>(c.create());
+ QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel*>(c.create());
QVERIFY(visualModel);
ItemRequester requester;
- connect(visualModel, SIGNAL(initItem(int,QQuickItem*)), &requester, SLOT(initItem(int,QQuickItem*)));
- connect(visualModel, SIGNAL(createdItem(int,QQuickItem*)), &requester, SLOT(createdItem(int,QQuickItem*)));
- connect(visualModel, SIGNAL(destroyingItem(QQuickItem*)), &requester, SLOT(destroyingItem(QQuickItem*)));
+ connect(visualModel, SIGNAL(initItem(int,QObject*)), &requester, SLOT(initItem(int,QObject*)));
+ connect(visualModel, SIGNAL(createdItem(int,QObject*)), &requester, SLOT(createdItem(int,QObject*)));
+ connect(visualModel, SIGNAL(destroyingItem(QObject*)), &requester, SLOT(destroyingItem(QObject*)));
- QQuickItem *item = visualModel->item(requestIndex, true);
+ QQuickItem *item = qobject_cast<QQuickItem*>(visualModel->object(requestIndex, true));
QVERIFY(!item);
QVERIFY(!requester.itemInitialized);
@@ -4165,7 +4165,7 @@ void tst_qquickvisualdatamodel::asynchronousMove()
model.moveItems(from, to, count);
- item = visualModel->item(completeIndex, false);
+ item = qobject_cast<QQuickItem*>(visualModel->object(completeIndex, false));
QVERIFY(item);
@@ -4196,10 +4196,10 @@ void tst_qquickvisualdatamodel::asynchronousCancel()
engine.rootContext()->setContextProperty("myModel", &model);
- QQuickVisualDataModel *visualModel = qobject_cast<QQuickVisualDataModel*>(c.create());
+ QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel*>(c.create());
QVERIFY(visualModel);
- QQuickItem *item = visualModel->item(requestIndex, true);
+ QQuickItem *item = qobject_cast<QQuickItem*>(visualModel->object(requestIndex, true));
QVERIFY(!item);
QCOMPARE(controller.incubatingObjectCount(), 1);
@@ -4221,10 +4221,10 @@ void tst_qquickvisualdatamodel::invalidContext()
QQmlComponent c(&engine, testFileUrl("visualdatamodel.qml"));
- QQuickVisualDataModel *visualModel = qobject_cast<QQuickVisualDataModel*>(c.create(context.data()));
+ QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel*>(c.create(context.data()));
QVERIFY(visualModel);
- QQuickItem *item = visualModel->item(4, false);
+ QQuickItem *item = qobject_cast<QQuickItem*>(visualModel->object(4, false));
QVERIFY(item);
visualModel->release(item);
@@ -4232,7 +4232,7 @@ void tst_qquickvisualdatamodel::invalidContext()
model.insertItem(4, "new item", "");
- item = visualModel->item(4, false);
+ item = qobject_cast<QQuickItem*>(visualModel->object(4, false));
QVERIFY(!item);
}
diff --git a/tests/auto/quick/qquickwindow/data/focus.qml b/tests/auto/quick/qquickwindow/data/focus.qml
index 901f2fcf2e..899b999cdc 100644
--- a/tests/auto/quick/qquickwindow/data/focus.qml
+++ b/tests/auto/quick/qquickwindow/data/focus.qml
@@ -2,6 +2,10 @@ import QtQuick 2.0
import QtQuick.Window 2.0 as Window
Window.Window {
+
+ width: 400
+ height: 300
+
Item {
objectName: "item1"
}
diff --git a/tests/auto/quick/qquickwindow/data/ownershipRootItem.qml b/tests/auto/quick/qquickwindow/data/ownershipRootItem.qml
index 955304e317..03400ba673 100644
--- a/tests/auto/quick/qquickwindow/data/ownershipRootItem.qml
+++ b/tests/auto/quick/qquickwindow/data/ownershipRootItem.qml
@@ -10,6 +10,6 @@ Window.Window {
RootItemAccessor {
id:accessor
objectName:"accessor"
- Component.onCompleted:accessor.rootItem();
+ Component.onCompleted:accessor.contentItem();
}
}
diff --git a/tests/auto/quick/qquickwindow/data/showHideAnimate.qml b/tests/auto/quick/qquickwindow/data/showHideAnimate.qml
new file mode 100644
index 0000000000..e83910c5a5
--- /dev/null
+++ b/tests/auto/quick/qquickwindow/data/showHideAnimate.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ NumberAnimation on opacity { from: 0; to: 1; duration: 100; loops: Animation.Infinite }
+}
diff --git a/tests/auto/quick/qquickwindow/qquickwindow.pro b/tests/auto/quick/qquickwindow/qquickwindow.pro
index 9ae63a9ef1..b1fc5cd4f2 100644
--- a/tests/auto/quick/qquickwindow/qquickwindow.pro
+++ b/tests/auto/quick/qquickwindow/qquickwindow.pro
@@ -6,13 +6,13 @@ include (../../shared/util.pri)
macx:CONFIG -= app_bundle
-CONFIG += parallel_test
QT += core-private gui-private qml-private quick-private v8-private testlib
TESTDATA = data/*
OTHER_FILES += \
data/AnimationsWhileHidden.qml \
- data/Headless.qml
+ data/Headless.qml \
+ data/showHideAnimate.qml
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index 3e3a35f8d1..2d3c8f7ca7 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -284,8 +284,11 @@ private slots:
void constantUpdates();
+ void constantUpdatesOnWindow_data();
+ void constantUpdatesOnWindow();
void mouseFiltering();
void headless();
+ void noUpdateWhenNothingChanges();
void touchEvent_basic();
void touchEvent_propagation();
@@ -312,6 +315,13 @@ private slots:
void ownershipRootItem();
+ void hideThenDelete_data();
+ void hideThenDelete();
+
+ void showHideAnimate();
+
+ void testExpose();
+
#ifndef QT_NO_CURSOR
void cursor();
#endif
@@ -331,6 +341,56 @@ void tst_qquickwindow::constantUpdates()
QTRY_VERIFY(item.iterations > 60);
}
+void tst_qquickwindow::constantUpdatesOnWindow_data()
+{
+ QTest::addColumn<bool>("blockedGui");
+ QTest::addColumn<QByteArray>("signal");
+
+ QQuickWindow window;
+ window.setGeometry(100, 100, 300, 200);
+ window.show();
+ QTest::qWaitForWindowExposed(&window);
+ bool threaded = window.openglContext()->thread() != QGuiApplication::instance()->thread();
+
+ if (threaded) {
+ QTest::newRow("blocked, beforeSync") << true << QByteArray(SIGNAL(beforeSynchronizing()));
+ QTest::newRow("blocked, beforeRender") << true << QByteArray(SIGNAL(beforeRendering()));
+ QTest::newRow("blocked, afterRender") << true << QByteArray(SIGNAL(afterRendering()));
+ QTest::newRow("blocked, swapped") << true << QByteArray(SIGNAL(frameSwapped()));
+ }
+ QTest::newRow("unblocked, beforeSync") << false << QByteArray(SIGNAL(beforeSynchronizing()));
+ QTest::newRow("unblocked, beforeRender") << false << QByteArray(SIGNAL(beforeRendering()));
+ QTest::newRow("unblocked, afterRender") << false << QByteArray(SIGNAL(afterRendering()));
+ QTest::newRow("unblocked, swapped") << false << QByteArray(SIGNAL(frameSwapped()));
+}
+
+void tst_qquickwindow::constantUpdatesOnWindow()
+{
+ QSKIP("This test fails frequently on the present overworked CI mac machines");
+ QFETCH(bool, blockedGui);
+ QFETCH(QByteArray, signal);
+
+ QQuickWindow window;
+ window.setGeometry(100, 100, 300, 200);
+
+ connect(&window, signal.constData(), &window, SLOT(update()), Qt::DirectConnection);
+ window.show();
+ QTRY_VERIFY(window.isExposed());
+
+ QSignalSpy catcher(&window, SIGNAL(frameSwapped()));
+ if (blockedGui)
+ QTest::qSleep(1000);
+ else {
+ window.update();
+ QTest::qWait(1000);
+ }
+ window.hide();
+
+ // We should expect 60, but under loaded conditions we could be skipping
+ // frames, so don't expect too much.
+ QVERIFY(catcher.size() > 10);
+}
+
void tst_qquickwindow::touchEvent_basic()
{
TestTouchItem::clearMousePressCounter();
@@ -945,6 +1005,8 @@ void tst_qquickwindow::headless()
QScopedPointer<QObject> cleanup(created);
QQuickWindow* window = qobject_cast<QQuickWindow*>(created);
+ window->setPersistentOpenGLContext(false);
+ window->setPersistentSceneGraph(false);
QVERIFY(window);
window->show();
@@ -984,6 +1046,28 @@ void tst_qquickwindow::headless()
QCOMPARE(originalContent, newContent);
}
+void tst_qquickwindow::noUpdateWhenNothingChanges()
+{
+ QQuickWindow window;
+ window.setGeometry(100, 100, 300, 200);
+
+ QQuickRectangle rect(window.contentItem());
+
+ window.show();
+ QTRY_VERIFY(window.isExposed());
+
+ if (window.openglContext()->thread() == QGuiApplication::instance()->thread()) {
+ QSKIP("Only threaded renderloop implements this feature");
+ return;
+ }
+
+ QSignalSpy spy(&window, SIGNAL(frameSwapped()));
+ rect.update();
+ QTest::qWait(500);
+
+ QCOMPARE(spy.size(), 0);
+}
+
void tst_qquickwindow::focusObject()
{
QQmlEngine engine;
@@ -997,6 +1081,11 @@ void tst_qquickwindow::focusObject()
QQuickWindow *window = qobject_cast<QQuickWindow*>(created);
QVERIFY(window);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+
QQuickItem *item1 = window->findChild<QQuickItem*>("item1");
QVERIFY(item1);
item1->setFocus(true);
@@ -1207,6 +1296,110 @@ void tst_qquickwindow::cursor()
}
#endif
+void tst_qquickwindow::hideThenDelete_data()
+{
+ QTest::addColumn<bool>("persistentSG");
+ QTest::addColumn<bool>("persistentGL");
+
+ QTest::newRow("persistent:SG=false,GL=false") << false << false;
+ QTest::newRow("persistent:SG=true,GL=false") << true << false;
+ QTest::newRow("persistent:SG=false,GL=true") << false << true;
+ QTest::newRow("persistent:SG=true,GL=true") << true << true;
+}
+
+void tst_qquickwindow::hideThenDelete()
+{
+ if (QGuiApplication::platformName() == QStringLiteral("xcb")) {
+ QSKIP("For some obscure reason this test fails in CI only");
+ return;
+ }
+
+ QFETCH(bool, persistentSG);
+ QFETCH(bool, persistentGL);
+
+ QSignalSpy *openglDestroyed = 0;
+ QSignalSpy *sgInvalidated = 0;
+
+ {
+ QQuickWindow window;
+ window.setColor(Qt::red);
+
+ window.setPersistentSceneGraph(persistentSG);
+ window.setPersistentOpenGLContext(persistentGL);
+
+ window.resize(400, 300);
+ window.show();
+
+ QTest::qWaitForWindowExposed(&window);
+
+ openglDestroyed = new QSignalSpy(window.openglContext(), SIGNAL(aboutToBeDestroyed()));
+ sgInvalidated = new QSignalSpy(&window, SIGNAL(sceneGraphInvalidated()));
+
+ window.hide();
+
+ QTRY_VERIFY(!window.isExposed());
+
+ if (!persistentSG) {
+ QVERIFY(sgInvalidated->size() > 0);
+ if (!persistentGL)
+ QVERIFY(openglDestroyed->size() > 0);
+ else
+ QVERIFY(openglDestroyed->size() == 0);
+ } else {
+ QVERIFY(sgInvalidated->size() == 0);
+ QVERIFY(openglDestroyed->size() == 0);
+ }
+ }
+
+ QVERIFY(sgInvalidated->size() > 0);
+ QVERIFY(openglDestroyed->size() > 0);
+}
+
+void tst_qquickwindow::showHideAnimate()
+{
+ // This test tries to mimick a bug triggered in the qquickanimatedimage test
+ // A window is shown, then removed again before it is exposed. This left
+ // traces in the render loop which prevent other animations from running
+ // later on.
+ {
+ QQuickWindow window;
+ window.resize(400, 300);
+ window.show();
+ }
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("showHideAnimate.qml"));
+ QQuickItem* created = qobject_cast<QQuickItem *>(component.create());
+
+ QVERIFY(created);
+
+ QTRY_VERIFY(created->opacity() > 0.5);
+ QTRY_VERIFY(created->opacity() < 0.5);
+}
+
+void tst_qquickwindow::testExpose()
+{
+ QQuickWindow window;
+ window.setGeometry(100, 100, 300, 200);
+
+ window.show();
+ QTRY_VERIFY(window.isExposed());
+
+ QSignalSpy swapSpy(&window, SIGNAL(frameSwapped()));
+
+ // exhaust pending exposes, as some platforms send us plenty
+ // while showing the first time
+ QTest::qWait(1000);
+ while (swapSpy.size() != 0) {
+ swapSpy.clear();
+ QTest::qWait(100);
+ }
+
+ QWindowSystemInterface::handleExposeEvent(&window, QRegion(10, 10, 20, 20));
+ QTRY_COMPARE(swapSpy.size(), 1);
+}
+
QTEST_MAIN(tst_qquickwindow)
#include "tst_qquickwindow.moc"
diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro
index c4a4173e0f..6cb091b04a 100644
--- a/tests/auto/quick/quick.pro
+++ b/tests/auto/quick/quick.pro
@@ -31,7 +31,7 @@ PRIVATETESTS += \
!qtHaveModule(xmlpatterns): PRIVATETESTS -= qquickxmllistmodel
QUICKTESTS = \
- qquickaccessible \
+# qquickaccessible \
qquickanchors \
qquickanimatedimage \
qquickanimatedsprite \
@@ -61,6 +61,7 @@ QUICKTESTS = \
qquickshadereffect \
qquickspritesequence \
qquicktext \
+ qquicktextdocument \
qquicktextedit \
qquicktextinput \
qquickvisualdatamodel \
@@ -68,6 +69,7 @@ QUICKTESTS = \
qquickcanvasitem \
qquickscreen \
touchmouse \
+ dialogs \
SUBDIRS += $$PUBLICTESTS
diff --git a/tests/auto/quick/rendernode/rendernode.pro b/tests/auto/quick/rendernode/rendernode.pro
index 425faef0a6..1e2c50a6d1 100644
--- a/tests/auto/quick/rendernode/rendernode.pro
+++ b/tests/auto/quick/rendernode/rendernode.pro
@@ -15,3 +15,4 @@ OTHER_FILES += \
data/RenderOrder.qml \
data/MessUpState.qml \
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+CONFIG+=insignificant_test
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
index caad2539be..15a4f0cc27 100644
--- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp
+++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
@@ -148,7 +148,7 @@ private slots:
void initTestCase();
void simpleTouchEvent();
- void eventFilter();
+ void testEventFilter();
void mouse();
void touchOverMouse();
void mouseOverTouch();
@@ -303,7 +303,7 @@ void tst_TouchMouse::simpleTouchEvent()
delete window;
}
-void tst_TouchMouse::eventFilter()
+void tst_TouchMouse::testEventFilter()
{
// // install event filter on item and see that it can grab events
// QQuickView *window = createView();
@@ -824,8 +824,7 @@ void tst_TouchMouse::mouseOnFlickableOnPinch()
QQuickView *window = createView();
window->setSource(testFileUrl("mouseonflickableonpinch.qml"));
window->show();
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window));
QVERIFY(window->rootObject() != 0);
QRect windowRect = QRect(window->position(), window->size());
QCursor::setPos(windowRect.center());