From c46b030cd301fc2ff05830765952a668bbdbc188 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Mon, 5 Mar 2012 15:55:31 +1000 Subject: Make headersclean in qtdeclarative enforce correct header conventions. This test wasn't testing much before. Refactor it to reuse headersclean from qtbase. It will now fail to compile if the headers from this module don't follow the rules. Change-Id: I2816b85543da74f66b993b7ee705cdb9e1c0f1c8 Reviewed-by: Jason McDonald --- tests/auto/headersclean/headersclean.pro | 13 +++-- tests/auto/headersclean/qt_headersclean_headers.h | 51 +++++++++++++++++++ tests/auto/headersclean/tst_headersclean.cpp | 62 ----------------------- tests/auto/host.pro | 8 +-- 4 files changed, 61 insertions(+), 73 deletions(-) create mode 100644 tests/auto/headersclean/qt_headersclean_headers.h delete mode 100644 tests/auto/headersclean/tst_headersclean.cpp diff --git a/tests/auto/headersclean/headersclean.pro b/tests/auto/headersclean/headersclean.pro index 4ce05fe512..379648e950 100644 --- a/tests/auto/headersclean/headersclean.pro +++ b/tests/auto/headersclean/headersclean.pro @@ -1,6 +1,9 @@ -CONFIG += testcase -TARGET = tst_headersclean -SOURCES += tst_headersclean.cpp -QT = core testlib +QT = core testlib declarative qml quick qmltest qmldevtools +HEADERSCLEAN_PRI = $${QT.core.sources}/../../tests/auto/other/headersclean/headersclean.pri +isEmpty(QT.core.sources)|!include($$HEADERSCLEAN_PRI) { + warning("headersclean.pri from QtCore sources not available. test disabled") + TEMPLATE=subdirs +} -contains(QT_CONFIG,qml): QT += qml qml-private +# shadowing problems in scenegraph, allow it for now +*-g++*: QMAKE_CXXFLAGS -= -Wshadow diff --git a/tests/auto/headersclean/qt_headersclean_headers.h b/tests/auto/headersclean/qt_headersclean_headers.h new file mode 100644 index 0000000000..d3f4e4b5c8 --- /dev/null +++ b/tests/auto/headersclean/qt_headersclean_headers.h @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT_HEADERSCLEAN_HEADERS +#define QT_HEADERSCLEAN_HEADERS + +#include +#include +#include +#include +#include + +#endif diff --git a/tests/auto/headersclean/tst_headersclean.cpp b/tests/auto/headersclean/tst_headersclean.cpp deleted file mode 100644 index d5131f96cd..0000000000 --- a/tests/auto/headersclean/tst_headersclean.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#define QT_NO_KEYWORDS -#define signals int -#define slots int -#define emit public:; -#define foreach public:; -#define forever public:; - -#include -#include - -#include - -class tst_HeadersClean: public QObject -{ - Q_OBJECT -public: - tst_HeadersClean() {} -}; - -QTEST_MAIN(tst_HeadersClean) -#include "tst_headersclean.moc" diff --git a/tests/auto/host.pro b/tests/auto/host.pro index 0a96ef0413..eab6de2981 100644 --- a/tests/auto/host.pro +++ b/tests/auto/host.pro @@ -1,9 +1,5 @@ TEMPLATE=subdirs -# FIXME -# This test is crrently broken: -#SUBDIRS=\ - #headersclean \ - -SUBDIRS= +SUBDIRS=\ + headersclean \ -- cgit v1.2.3 From d4c25e803bc362e33cacbd20af00cb199204bda3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 7 Mar 2012 21:17:02 +0100 Subject: Remove undefined method. Change-Id: Id95aebcfc5beac0154db4b1137fc08d5172f3428 Reviewed-by: Aaron Kennedy --- src/qml/qml/qqmlmetatype_p.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qml/qml/qqmlmetatype_p.h b/src/qml/qml/qqmlmetatype_p.h index ad6a2aa055..b715d0c8f2 100644 --- a/src/qml/qml/qqmlmetatype_p.h +++ b/src/qml/qml/qqmlmetatype_p.h @@ -180,7 +180,6 @@ public: int attachedPropertiesId() const; int parserStatusCast() const; - QVariant fromObject(QObject *) const; const char *interfaceIId() const; int propertyValueSourceCast() const; int propertyValueInterceptorCast() const; -- cgit v1.2.3 From ebd9af56a3e9383682db04b2b7ff53fa0a51ee30 Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Fri, 9 Mar 2012 11:34:18 +1000 Subject: Return early if animationjob was deleted in all callback methods. Change-Id: I703c8a8904ffd760683de4ee74544dff9eb53144 Reviewed-by: Michael Brasser --- src/qml/animations/qabstractanimationjob.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/qml/animations/qabstractanimationjob.cpp b/src/qml/animations/qabstractanimationjob.cpp index 2bfc66fea0..a540382847 100644 --- a/src/qml/animations/qabstractanimationjob.cpp +++ b/src/qml/animations/qabstractanimationjob.cpp @@ -499,8 +499,9 @@ void QAbstractAnimationJob::finished() //TODO: update this code so it is valid to delete the animation in animationFinished for (int i = 0; i < changeListeners.count(); ++i) { const QAbstractAnimationJob::ChangeListener &change = changeListeners.at(i); - if (change.types & QAbstractAnimationJob::Completion) - change.listener->animationFinished(this); + if (change.types & QAbstractAnimationJob::Completion) { + RETURN_IF_DELETED(change.listener->animationFinished(this)); + } } if (m_group && (duration() == -1 || loopCount() < 0)) { @@ -513,8 +514,9 @@ void QAbstractAnimationJob::stateChanged(QAbstractAnimationJob::State newState, { for (int i = 0; i < changeListeners.count(); ++i) { const QAbstractAnimationJob::ChangeListener &change = changeListeners.at(i); - if (change.types & QAbstractAnimationJob::StateChange) - change.listener->animationStateChanged(this, newState, oldState); + if (change.types & QAbstractAnimationJob::StateChange) { + RETURN_IF_DELETED(change.listener->animationStateChanged(this, newState, oldState)); + } } } @@ -523,8 +525,9 @@ void QAbstractAnimationJob::currentLoopChanged(int currentLoop) Q_UNUSED(currentLoop); for (int i = 0; i < changeListeners.count(); ++i) { const QAbstractAnimationJob::ChangeListener &change = changeListeners.at(i); - if (change.types & QAbstractAnimationJob::CurrentLoop) - change.listener->animationCurrentLoopChanged(this); + if (change.types & QAbstractAnimationJob::CurrentLoop) { + RETURN_IF_DELETED(change.listener->animationCurrentLoopChanged(this)); + } } } -- cgit v1.2.3 From c787809e8fa89562f83a051c53db5c9839da2db4 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 12 Mar 2012 17:01:16 +0100 Subject: Mark presumed unstable test as insignificant. Change-Id: Iea22ae6596c04ba95d59bcb3957bdc3cf9263ae2 Reviewed-by: Kent Hansen --- tests/auto/quick/qquickpixmapcache/qquickpixmapcache.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/quick/qquickpixmapcache/qquickpixmapcache.pro b/tests/auto/quick/qquickpixmapcache/qquickpixmapcache.pro index a13b0b6f43..a24ea52e11 100644 --- a/tests/auto/quick/qquickpixmapcache/qquickpixmapcache.pro +++ b/tests/auto/quick/qquickpixmapcache/qquickpixmapcache.pro @@ -15,5 +15,6 @@ TESTDATA = data/* # LIBS += -lgcov CONFIG += parallel_test +CONFIG += insignificant_test QT += core-private gui-private qml-private quick-private network testlib concurrent -- cgit v1.2.3 From 255357541d8d6e692e8958dcf905b75642ef6b92 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 12 Mar 2012 16:02:43 +0100 Subject: Fix flakiness in qquicklistmodel autotest The worker_remove_element test calls processEvents() before calling waitForWorker(). It's possible that the worker actually finishes during the processEvents() call. In such a situation, waitForWorker() should return right away; otherwise it would wait for 10000ms for a signal that had already emitted, and the test would fail. Change-Id: I8e98a3297cf5f360c1c405b1baa7524cc6593d81 Reviewed-by: Lars Knoll --- tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp b/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp index 69a8d2ecd8..8d6237679f 100644 --- a/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp +++ b/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp @@ -216,17 +216,21 @@ QQuickItem *tst_qquicklistmodel::createWorkerTest(QQmlEngine *eng, QQmlComponent void tst_qquicklistmodel::waitForWorker(QQuickItem *item) { + QQmlProperty prop(item, "done"); + QVERIFY(prop.isValid()); + if (prop.read().toBool()) + return; // already finished + QEventLoop loop; QTimer timer; timer.setSingleShot(true); connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); - QQmlProperty prop(item, "done"); - QVERIFY(prop.isValid()); QVERIFY(prop.connectNotifySignal(&loop, SLOT(quit()))); timer.start(10000); loop.exec(); QVERIFY(timer.isActive()); + QVERIFY(prop.read().toBool()); } void tst_qquicklistmodel::static_types_data() -- cgit v1.2.3 From cbb7f8b10e99fad675839d7625d3236ed67b3e01 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 12 Mar 2012 13:13:48 +0100 Subject: Skip test that accesses deleted QML engine The test is blocking the CI because it crashes on linux/x64. By "luck" it doesn't crash on the other test machines -- valgrind still complains, though. Task-number: QTBUG-24734 Change-Id: I6bc12ca72f8900339bc9139b40cf828aff8e47ba Reviewed-by: Lars Knoll --- tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp index ae300900c9..13ea1abd73 100644 --- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp +++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp @@ -1553,6 +1553,8 @@ void tst_qqmlproperty::crashOnValueProperty() delete engine; engine = 0; + QSKIP("QTBUG-24734: test accesses deleted QML engine from QQmlProperty::propertyTypeName()"); + QCOMPARE(p.propertyTypeName(), "int"); QCOMPARE(p.read(), QVariant(10)); p.write(QVariant(20)); -- cgit v1.2.3 From 406f74189a351489585308f1e9637777662b436d Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Tue, 6 Mar 2012 13:17:16 +0100 Subject: Remove pin of qtbase for qtdeclarative. Change-Id: Ib70a3438d085adbed3a1ca7df81d593c7a512ae0 Reviewed-by: Kent Hansen --- sync.profile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sync.profile b/sync.profile index 554dd14fbf..36b45b35d0 100644 --- a/sync.profile +++ b/sync.profile @@ -216,7 +216,7 @@ # - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch) # %dependencies = ( - "qtbase" => "3d19422ef16a230bb11dbbfe4a8cc9667f39bf15", + "qtbase" => "refs/heads/master", "qtxmlpatterns" => "refs/heads/master", "qtjsbackend" => "refs/heads/master", ); -- cgit v1.2.3 From cb1ff7a8e5db8925afbca5cb00826deb87818cd7 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 9 Mar 2012 12:00:29 +0200 Subject: Fix double click handler in QQuickItem. The legacy, desktop-oriented way of calling mousePressed from the default handlers for mouseDoubleClick is not working properly with QWindow and QGuiApplication: In Qt 5 a double click will never suppress any lower level events (like press or release) and therefore simulating a mouse press in the double click handlers is wrong. Change-Id: Ic0ad97a5efbcd3deb1717229010dcb84681d7ed4 Reviewed-by: Kent Hansen --- src/quick/items/qquickitem.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 77808a61d9..2b3bb55527 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -3040,9 +3040,8 @@ void QQuickItem::mouseReleaseEvent(QMouseEvent *event) event->ignore(); } -void QQuickItem::mouseDoubleClickEvent(QMouseEvent *event) +void QQuickItem::mouseDoubleClickEvent(QMouseEvent *) { - mousePressEvent(event); } void QQuickItem::mouseUngrabEvent() -- cgit v1.2.3 From 6cf36b2497f0fdcfced155cd85e403b64bfa269e Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 12 Mar 2012 10:55:25 +1000 Subject: Fix tst_qquicktextedit. Recent changes to mouse double-click handling mean that two calls to QTest::mouseClick with the same position will result in a double click, which was causing this test to fail. Change-Id: I21e6aa7ab2221b6ea82b1afd13e36b7ba0aef8dc Reviewed-by: Kent Hansen --- tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index 85a9033dd7..c98e5ebf8e 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -1855,6 +1855,7 @@ void tst_qquicktextedit::cursorDelegate() textEditObject->setSelectByMouse(true); textEditObject->setCursorPosition(0); const QPoint point1 = textEditObject->positionToRectangle(5).center().toPoint(); + QTest::qWait(400); //ensure this isn't treated as a double-click QTest::mouseClick(&view, Qt::LeftButton, 0, point1); QTest::qWait(50); QTRY_VERIFY(textEditObject->cursorPosition() != 0); @@ -1864,6 +1865,7 @@ void tst_qquicktextedit::cursorDelegate() // Test delegate gets moved on mouse drag textEditObject->setCursorPosition(0); const QPoint point2 = textEditObject->positionToRectangle(10).center().toPoint(); + QTest::qWait(400); //ensure this isn't treated as a double-click QTest::mousePress(&view, Qt::LeftButton, 0, point1); QMouseEvent mv(QEvent::MouseMove, point2, Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); QGuiApplication::sendEvent(&view, &mv); @@ -1874,6 +1876,7 @@ void tst_qquicktextedit::cursorDelegate() textEditObject->setReadOnly(true); textEditObject->setCursorPosition(0); + QTest::qWait(400); //ensure this isn't treated as a double-click QTest::mouseClick(&view, Qt::LeftButton, 0, textEditObject->positionToRectangle(5).center().toPoint()); QTest::qWait(50); QTRY_VERIFY(textEditObject->cursorPosition() != 0); @@ -1881,6 +1884,7 @@ void tst_qquicktextedit::cursorDelegate() QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y()); textEditObject->setCursorPosition(0); + QTest::qWait(400); //ensure this isn't treated as a double-click QTest::mouseClick(&view, Qt::LeftButton, 0, textEditObject->positionToRectangle(5).center().toPoint()); QTest::qWait(50); QTRY_VERIFY(textEditObject->cursorPosition() != 0); -- cgit v1.2.3 From dda130fb2f01b3ed6f8833c3d6522b1a494d9641 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 12 Mar 2012 08:40:52 +0200 Subject: Fix MouseArea autotest. The hover test seems to be simply wrong. The double click tests worked before due to the obscure handling of double click but were somewhat incorrect in any case. Change-Id: Ie5690e26eb5921fe149e128d24d331f52a5a9075 Reviewed-by: Kent Hansen --- tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index 0b4a6fa438..82563b07f9 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -468,6 +468,8 @@ void tst_QQuickMouseArea::doubleClick() canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); + // The sequence for a double click is: + // press, release, (click), press, double click, release QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); QGuiApplication::sendEvent(canvas, &pressEvent); @@ -476,9 +478,9 @@ void tst_QQuickMouseArea::doubleClick() QCOMPARE(canvas->rootObject()->property("released").toInt(), 1); + QGuiApplication::sendEvent(canvas, &pressEvent); pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); QGuiApplication::sendEvent(canvas, &pressEvent); - QGuiApplication::sendEvent(canvas, &releaseEvent); QCOMPARE(canvas->rootObject()->property("clicked").toInt(), 1); @@ -507,9 +509,8 @@ void tst_QQuickMouseArea::clickTwice() QCOMPARE(canvas->rootObject()->property("released").toInt(), 1); QCOMPARE(canvas->rootObject()->property("clicked").toInt(), 1); - pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); QGuiApplication::sendEvent(canvas, &pressEvent); - + pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); QGuiApplication::sendEvent(canvas, &pressEvent); QGuiApplication::sendEvent(canvas, &releaseEvent); @@ -787,13 +788,17 @@ void tst_QQuickMouseArea::hoverVisible() QSignalSpy enteredSpy(mouseTracker, SIGNAL(entered())); - QTest::mouseMove(canvas,QPoint(10,32)); + // Note: We need to use a position that is different from the position in the last event + // generated in the previous test case. Otherwise it is not interpreted as a move. + QTest::mouseMove(canvas,QPoint(11,33)); QCOMPARE(mouseTracker->hovered(), false); QCOMPARE(enteredSpy.count(), 0); mouseTracker->setVisible(true); + QTest::mouseMove(canvas,QPoint(10,31)); + QCOMPARE(mouseTracker->hovered(), true); QCOMPARE(enteredSpy.count(), 1); -- cgit v1.2.3 From 16e29f30e3483568a36dba7b37520ea1645d9a2e Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 29 Feb 2012 20:43:09 +0100 Subject: Remove unneeded dependencies to QtWidgets and QtOpenGL Change-Id: I43bb54524f5786a838073df8812107dda7b0d56e Reviewed-by: Kent Hansen --- tests/auto/particles/qquickage/qquickage.pro | 2 +- .../auto/particles/qquickangleddirection/qquickangleddirection.pro | 2 +- .../qquickcumulativedirection/qquickcumulativedirection.pro | 2 +- tests/auto/particles/qquickcustomaffector/qquickcustomaffector.pro | 2 +- tests/auto/particles/qquickcustomparticle/qquickcustomparticle.pro | 2 +- .../auto/particles/qquickellipseextruder/qquickellipseextruder.pro | 2 +- tests/auto/particles/qquickfriction/qquickfriction.pro | 2 +- tests/auto/particles/qquickgravity/qquickgravity.pro | 2 +- tests/auto/particles/qquickgroupgoal/qquickgroupgoal.pro | 2 +- tests/auto/particles/qquickimageparticle/qquickimageparticle.pro | 2 +- tests/auto/particles/qquickitemparticle/qquickitemparticle.pro | 2 +- tests/auto/particles/qquicklineextruder/qquicklineextruder.pro | 2 +- tests/auto/particles/qquickmaskextruder/qquickmaskextruder.pro | 2 +- tests/auto/particles/qquickparticlegroup/qquickparticlegroup.pro | 2 +- tests/auto/particles/qquickparticlesystem/qquickparticlesystem.pro | 2 +- tests/auto/particles/qquickpointattractor/qquickpointattractor.pro | 2 +- tests/auto/particles/qquickpointdirection/qquickpointdirection.pro | 2 +- .../particles/qquickrectangleextruder/qquickrectangleextruder.pro | 2 +- tests/auto/particles/qquickspritegoal/qquickspritegoal.pro | 2 +- .../auto/particles/qquicktargetdirection/qquicktargetdirection.pro | 2 +- tests/auto/particles/qquicktrailemitter/qquicktrailemitter.pro | 2 +- tests/auto/particles/qquickturbulence/qquickturbulence.pro | 2 +- tests/auto/particles/qquickwander/qquickwander.pro | 2 +- tests/auto/qml/debugger/qqmlinspector/app/app.pro | 2 +- tests/auto/qml/qqmlincubator/qqmlincubator.pro | 2 +- tests/auto/qml/qqmlinfo/qqmlinfo.pro | 2 +- tests/auto/qml/qqmlmetatype/qqmlmetatype.pro | 2 +- tests/auto/qml/qqmlproperty/qqmlproperty.pro | 2 +- tests/auto/qml/qquickconnection/qquickconnection.pro | 2 +- tests/auto/qml/qquicklistmodel/qquicklistmodel.pro | 2 +- tests/auto/quick/examples/examples.pro | 2 +- tests/auto/quick/geometry/geometry.pro | 2 +- tests/auto/quick/qquickanimations/qquickanimations.pro | 2 +- tests/auto/quick/qquickanimations/tst_qquickanimations.cpp | 6 ------ tests/auto/quick/qquickbehaviors/qquickbehaviors.pro | 2 +- tests/auto/quick/qquickborderimage/qquickborderimage.pro | 2 +- tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp | 1 - tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro | 2 +- tests/auto/quick/qquickflickable/tst_qquickflickable.cpp | 1 - tests/auto/quick/qquickflipable/tst_qquickflipable.cpp | 1 - tests/auto/quick/qquickgridview/qquickgridview.pro | 2 +- tests/auto/quick/qquickitem/qquickitem.pro | 2 +- tests/auto/quick/qquickitem2/qquickitem2.pro | 2 +- tests/auto/quick/qquicklistview/qquicklistview.pro | 2 +- tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp | 1 - tests/auto/quick/qquickpositioners/qquickpositioners.pro | 2 +- tests/auto/quick/qquickshadereffect/qquickshadereffect.pro | 2 +- tests/auto/quick/qquickstates/qquickstates.pro | 2 +- tests/auto/quick/qquicktext/qquicktext.pro | 2 +- tests/auto/quick/qquicktext/tst_qquicktext.cpp | 3 +-- tests/auto/quick/qquicktextedit/qquicktextedit.pro | 2 +- tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp | 1 - tests/auto/quick/qquicktextinput/qquicktextinput.pro | 2 +- tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp | 2 -- 54 files changed, 47 insertions(+), 61 deletions(-) diff --git a/tests/auto/particles/qquickage/qquickage.pro b/tests/auto/particles/qquickage/qquickage.pro index 99c768fdb1..8e5c2f0e33 100644 --- a/tests/auto/particles/qquickage/qquickage.pro +++ b/tests/auto/particles/qquickage/qquickage.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickangleddirection/qquickangleddirection.pro b/tests/auto/particles/qquickangleddirection/qquickangleddirection.pro index 6899ee60d9..df8d460d3e 100644 --- a/tests/auto/particles/qquickangleddirection/qquickangleddirection.pro +++ b/tests/auto/particles/qquickangleddirection/qquickangleddirection.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickcumulativedirection/qquickcumulativedirection.pro b/tests/auto/particles/qquickcumulativedirection/qquickcumulativedirection.pro index b5d3efac6d..4ea8739c21 100644 --- a/tests/auto/particles/qquickcumulativedirection/qquickcumulativedirection.pro +++ b/tests/auto/particles/qquickcumulativedirection/qquickcumulativedirection.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickcustomaffector/qquickcustomaffector.pro b/tests/auto/particles/qquickcustomaffector/qquickcustomaffector.pro index b1533d6be1..0855187d47 100644 --- a/tests/auto/particles/qquickcustomaffector/qquickcustomaffector.pro +++ b/tests/auto/particles/qquickcustomaffector/qquickcustomaffector.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickcustomparticle/qquickcustomparticle.pro b/tests/auto/particles/qquickcustomparticle/qquickcustomparticle.pro index 6666c91d7e..d5c21abef3 100644 --- a/tests/auto/particles/qquickcustomparticle/qquickcustomparticle.pro +++ b/tests/auto/particles/qquickcustomparticle/qquickcustomparticle.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickellipseextruder/qquickellipseextruder.pro b/tests/auto/particles/qquickellipseextruder/qquickellipseextruder.pro index b7eedb00f1..33241a4792 100644 --- a/tests/auto/particles/qquickellipseextruder/qquickellipseextruder.pro +++ b/tests/auto/particles/qquickellipseextruder/qquickellipseextruder.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickfriction/qquickfriction.pro b/tests/auto/particles/qquickfriction/qquickfriction.pro index 19c789ddfe..36cf9aaa60 100644 --- a/tests/auto/particles/qquickfriction/qquickfriction.pro +++ b/tests/auto/particles/qquickfriction/qquickfriction.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickgravity/qquickgravity.pro b/tests/auto/particles/qquickgravity/qquickgravity.pro index a3fab3837c..331def26b5 100644 --- a/tests/auto/particles/qquickgravity/qquickgravity.pro +++ b/tests/auto/particles/qquickgravity/qquickgravity.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickgroupgoal/qquickgroupgoal.pro b/tests/auto/particles/qquickgroupgoal/qquickgroupgoal.pro index b97549eeee..f7f09ed9d0 100644 --- a/tests/auto/particles/qquickgroupgoal/qquickgroupgoal.pro +++ b/tests/auto/particles/qquickgroupgoal/qquickgroupgoal.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private opengl-private testlib +QT += core-private gui-private v8-private qml-private testlib diff --git a/tests/auto/particles/qquickimageparticle/qquickimageparticle.pro b/tests/auto/particles/qquickimageparticle/qquickimageparticle.pro index 590f698510..226d844263 100644 --- a/tests/auto/particles/qquickimageparticle/qquickimageparticle.pro +++ b/tests/auto/particles/qquickimageparticle/qquickimageparticle.pro @@ -6,4 +6,4 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickitemparticle/qquickitemparticle.pro b/tests/auto/particles/qquickitemparticle/qquickitemparticle.pro index b275e4bf08..ec7fa48e26 100644 --- a/tests/auto/particles/qquickitemparticle/qquickitemparticle.pro +++ b/tests/auto/particles/qquickitemparticle/qquickitemparticle.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquicklineextruder/qquicklineextruder.pro b/tests/auto/particles/qquicklineextruder/qquicklineextruder.pro index 519b3e4927..a1297b1e26 100644 --- a/tests/auto/particles/qquicklineextruder/qquicklineextruder.pro +++ b/tests/auto/particles/qquicklineextruder/qquicklineextruder.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickmaskextruder/qquickmaskextruder.pro b/tests/auto/particles/qquickmaskextruder/qquickmaskextruder.pro index 48aeaddc5e..99f50a286d 100644 --- a/tests/auto/particles/qquickmaskextruder/qquickmaskextruder.pro +++ b/tests/auto/particles/qquickmaskextruder/qquickmaskextruder.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickparticlegroup/qquickparticlegroup.pro b/tests/auto/particles/qquickparticlegroup/qquickparticlegroup.pro index d3e132fc83..c5c908e305 100644 --- a/tests/auto/particles/qquickparticlegroup/qquickparticlegroup.pro +++ b/tests/auto/particles/qquickparticlegroup/qquickparticlegroup.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickparticlesystem/qquickparticlesystem.pro b/tests/auto/particles/qquickparticlesystem/qquickparticlesystem.pro index b241048d9e..2179ae3ae9 100644 --- a/tests/auto/particles/qquickparticlesystem/qquickparticlesystem.pro +++ b/tests/auto/particles/qquickparticlesystem/qquickparticlesystem.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickpointattractor/qquickpointattractor.pro b/tests/auto/particles/qquickpointattractor/qquickpointattractor.pro index 22a9ac5d87..43c8022b0a 100644 --- a/tests/auto/particles/qquickpointattractor/qquickpointattractor.pro +++ b/tests/auto/particles/qquickpointattractor/qquickpointattractor.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickpointdirection/qquickpointdirection.pro b/tests/auto/particles/qquickpointdirection/qquickpointdirection.pro index 319bdee22f..71b21e5f56 100644 --- a/tests/auto/particles/qquickpointdirection/qquickpointdirection.pro +++ b/tests/auto/particles/qquickpointdirection/qquickpointdirection.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickrectangleextruder/qquickrectangleextruder.pro b/tests/auto/particles/qquickrectangleextruder/qquickrectangleextruder.pro index 683f77ec55..5e595204cc 100644 --- a/tests/auto/particles/qquickrectangleextruder/qquickrectangleextruder.pro +++ b/tests/auto/particles/qquickrectangleextruder/qquickrectangleextruder.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickspritegoal/qquickspritegoal.pro b/tests/auto/particles/qquickspritegoal/qquickspritegoal.pro index 95cf68f459..cfe932aabd 100644 --- a/tests/auto/particles/qquickspritegoal/qquickspritegoal.pro +++ b/tests/auto/particles/qquickspritegoal/qquickspritegoal.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private opengl-private testlib +QT += core-private gui-private v8-private qml-private testlib diff --git a/tests/auto/particles/qquicktargetdirection/qquicktargetdirection.pro b/tests/auto/particles/qquicktargetdirection/qquicktargetdirection.pro index a4a09ae6de..b7ba905f2e 100644 --- a/tests/auto/particles/qquicktargetdirection/qquicktargetdirection.pro +++ b/tests/auto/particles/qquicktargetdirection/qquicktargetdirection.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquicktrailemitter/qquicktrailemitter.pro b/tests/auto/particles/qquicktrailemitter/qquicktrailemitter.pro index e169ccdfe2..5a76e2fba4 100644 --- a/tests/auto/particles/qquicktrailemitter/qquicktrailemitter.pro +++ b/tests/auto/particles/qquicktrailemitter/qquicktrailemitter.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickturbulence/qquickturbulence.pro b/tests/auto/particles/qquickturbulence/qquickturbulence.pro index 306d58d223..3bfb94addf 100644 --- a/tests/auto/particles/qquickturbulence/qquickturbulence.pro +++ b/tests/auto/particles/qquickturbulence/qquickturbulence.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickwander/qquickwander.pro b/tests/auto/particles/qquickwander/qquickwander.pro index 94b88379f0..1cd4269074 100644 --- a/tests/auto/particles/qquickwander/qquickwander.pro +++ b/tests/auto/particles/qquickwander/qquickwander.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/qml/debugger/qqmlinspector/app/app.pro b/tests/auto/qml/debugger/qqmlinspector/app/app.pro index f6ef983735..9c7574a97e 100644 --- a/tests/auto/qml/debugger/qqmlinspector/app/app.pro +++ b/tests/auto/qml/debugger/qqmlinspector/app/app.pro @@ -1,5 +1,5 @@ TARGET = app -QT += qml quick widgets +QT += qml quick CONFIG += declarative_debug macx:CONFIG -= app_bundle diff --git a/tests/auto/qml/qqmlincubator/qqmlincubator.pro b/tests/auto/qml/qqmlincubator/qqmlincubator.pro index b6ce22d4cf..6c4692db96 100644 --- a/tests/auto/qml/qqmlincubator/qqmlincubator.pro +++ b/tests/auto/qml/qqmlincubator/qqmlincubator.pro @@ -13,4 +13,4 @@ TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private network widgets testlib +QT += core-private gui-private v8-private qml-private network testlib diff --git a/tests/auto/qml/qqmlinfo/qqmlinfo.pro b/tests/auto/qml/qqmlinfo/qqmlinfo.pro index 050bad68a1..891e698aeb 100644 --- a/tests/auto/qml/qqmlinfo/qqmlinfo.pro +++ b/tests/auto/qml/qqmlinfo/qqmlinfo.pro @@ -9,4 +9,4 @@ include (../../shared/util.pri) TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private qml-private widgets testlib +QT += core-private gui-private qml-private testlib diff --git a/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro b/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro index 7c781dd9db..d723907024 100644 --- a/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro +++ b/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro @@ -4,4 +4,4 @@ SOURCES += tst_qqmlmetatype.cpp macx:CONFIG -= app_bundle CONFIG += parallel_test -QT += core-private gui-private qml-private widgets testlib +QT += core-private gui-private qml-private testlib diff --git a/tests/auto/qml/qqmlproperty/qqmlproperty.pro b/tests/auto/qml/qqmlproperty/qqmlproperty.pro index 6d878902ff..c32545dc77 100644 --- a/tests/auto/qml/qqmlproperty/qqmlproperty.pro +++ b/tests/auto/qml/qqmlproperty/qqmlproperty.pro @@ -10,4 +10,4 @@ TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private widgets testlib +QT += core-private gui-private v8-private qml-private testlib diff --git a/tests/auto/qml/qquickconnection/qquickconnection.pro b/tests/auto/qml/qquickconnection/qquickconnection.pro index baef334459..46f7971df1 100644 --- a/tests/auto/qml/qquickconnection/qquickconnection.pro +++ b/tests/auto/qml/qquickconnection/qquickconnection.pro @@ -10,4 +10,4 @@ TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/qml/qquicklistmodel/qquicklistmodel.pro b/tests/auto/qml/qquicklistmodel/qquicklistmodel.pro index 25b28bbe4c..6f558a7e51 100644 --- a/tests/auto/qml/qquicklistmodel/qquicklistmodel.pro +++ b/tests/auto/qml/qquicklistmodel/qquicklistmodel.pro @@ -10,4 +10,4 @@ TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/quick/examples/examples.pro b/tests/auto/quick/examples/examples.pro index 5907ba291c..c320fdad9e 100644 --- a/tests/auto/quick/examples/examples.pro +++ b/tests/auto/quick/examples/examples.pro @@ -7,6 +7,6 @@ DEFINES += SRCDIR=\\\"$$PWD\\\" CONFIG += parallel_test #temporary -QT += core-private gui-private qml-private quick-private widgets-private v8-private testlib +QT += core-private gui-private qml-private quick-private v8-private testlib cross_compile: DEFINES += QTEST_CROSS_COMPILED diff --git a/tests/auto/quick/geometry/geometry.pro b/tests/auto/quick/geometry/geometry.pro index 41fcab7c8f..0b7e64d038 100644 --- a/tests/auto/quick/geometry/geometry.pro +++ b/tests/auto/quick/geometry/geometry.pro @@ -6,4 +6,4 @@ SOURCES += tst_geometry.cpp CONFIG+=parallel_test -QT += core-private gui-private qml-private quick-private opengl testlib +QT += core-private gui-private qml-private quick-private testlib diff --git a/tests/auto/quick/qquickanimations/qquickanimations.pro b/tests/auto/quick/qquickanimations/qquickanimations.pro index d9c3ea28c1..5c0bd3a2d4 100644 --- a/tests/auto/quick/qquickanimations/qquickanimations.pro +++ b/tests/auto/quick/qquickanimations/qquickanimations.pro @@ -10,7 +10,7 @@ TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib widgets # QTBUG-23385 - color mixing tests failing on Ubuntu 11.10 x64 linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):DEFINES+=UBUNTU_ONEIRIC diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp index dd010999b4..d71100d120 100644 --- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp +++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp @@ -190,9 +190,6 @@ void tst_qquickanimations::simpleColor() QVERIFY(animation.isPaused()); animation.setCurrentTime(125); QVERIFY(animation.currentTime() == 125); -#if defined(UBUNTU_ONEIRIC) && defined(__x86_64__) - QEXPECT_FAIL("", "Fails on this platform - QTBUG-23385", Abort); -#endif QCOMPARE(rect.color(), QColor::fromRgbF(0.498039, 0, 0.498039, 1)); rect.setColor(QColor("green")); @@ -746,9 +743,6 @@ void tst_qquickanimations::mixedTypes() //rather inexact -- is there a better way? QVERIFY(myRect->x() > 100 && myRect->x() < 200); -#if defined(UBUNTU_ONEIRIC) && defined(__x86_64__) - QEXPECT_FAIL("", "Fails on this platform - QTBUG-23385", Continue); -#endif QVERIFY(myRect->color() != QColor("red") && myRect->color() != QColor("blue")); } } diff --git a/tests/auto/quick/qquickbehaviors/qquickbehaviors.pro b/tests/auto/quick/qquickbehaviors/qquickbehaviors.pro index dcffad6cd9..e8165c271c 100644 --- a/tests/auto/quick/qquickbehaviors/qquickbehaviors.pro +++ b/tests/auto/quick/qquickbehaviors/qquickbehaviors.pro @@ -10,4 +10,4 @@ TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/quick/qquickborderimage/qquickborderimage.pro b/tests/auto/quick/qquickborderimage/qquickborderimage.pro index c967d579e5..998b66f89b 100644 --- a/tests/auto/quick/qquickborderimage/qquickborderimage.pro +++ b/tests/auto/quick/qquickborderimage/qquickborderimage.pro @@ -12,4 +12,4 @@ TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private qml-private quick-private network widgets testlib +QT += core-private gui-private qml-private quick-private network testlib diff --git a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp index 13b12f6020..173f230203 100644 --- a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp +++ b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp @@ -43,7 +43,6 @@ #include #include #include -#include #include #include diff --git a/tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro b/tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro index b0122f997a..6d5706b9f7 100644 --- a/tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro +++ b/tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro @@ -1,4 +1,4 @@ -QT += core-private gui-private qml-private widgets +QT += core-private gui-private qml-private TEMPLATE=app TARGET=tst_qquickcanvasitem diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index e46659e6d0..a2ecadf33a 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -50,7 +50,6 @@ #include "../../shared/util.h" #include "../shared/viewtestutil.h" #include "../shared/visualtestutil.h" -#include using namespace QQuickViewTestUtil; using namespace QQuickVisualTestUtil; diff --git a/tests/auto/quick/qquickflipable/tst_qquickflipable.cpp b/tests/auto/quick/qquickflipable/tst_qquickflipable.cpp index 2f399359ef..4fe155168a 100644 --- a/tests/auto/quick/qquickflipable/tst_qquickflipable.cpp +++ b/tests/auto/quick/qquickflipable/tst_qquickflipable.cpp @@ -47,7 +47,6 @@ #include #include #include -#include #include "../../shared/util.h" class tst_qquickflipable : public QQmlDataTest diff --git a/tests/auto/quick/qquickgridview/qquickgridview.pro b/tests/auto/quick/qquickgridview/qquickgridview.pro index b4a234e35a..ed2007d734 100644 --- a/tests/auto/quick/qquickgridview/qquickgridview.pro +++ b/tests/auto/quick/qquickgridview/qquickgridview.pro @@ -10,4 +10,4 @@ include (../shared/util.pri) TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib widgets +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/quick/qquickitem/qquickitem.pro b/tests/auto/quick/qquickitem/qquickitem.pro index cbbd6e586b..ee40be6a2e 100644 --- a/tests/auto/quick/qquickitem/qquickitem.pro +++ b/tests/auto/quick/qquickitem/qquickitem.pro @@ -9,4 +9,4 @@ macx:CONFIG -= app_bundle TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private quick-private widgets testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/quick/qquickitem2/qquickitem2.pro b/tests/auto/quick/qquickitem2/qquickitem2.pro index 887c8796a8..589d1bd568 100644 --- a/tests/auto/quick/qquickitem2/qquickitem2.pro +++ b/tests/auto/quick/qquickitem2/qquickitem2.pro @@ -10,4 +10,4 @@ TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/quick/qquicklistview/qquicklistview.pro b/tests/auto/quick/qquicklistview/qquicklistview.pro index d4d97e2106..c1b24baed4 100644 --- a/tests/auto/quick/qquicklistview/qquicklistview.pro +++ b/tests/auto/quick/qquicklistview/qquicklistview.pro @@ -11,4 +11,4 @@ include (../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private qml-private quick-private widgets widgets-private v8-private opengl-private testlib +QT += core-private gui-private qml-private quick-private v8-private testlib diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index 82563b07f9..a4b04bb88a 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -47,7 +47,6 @@ #include #include #include -#include #include "../../shared/util.h" //#define OLDWAY diff --git a/tests/auto/quick/qquickpositioners/qquickpositioners.pro b/tests/auto/quick/qquickpositioners/qquickpositioners.pro index 243d03484a..dbbfae0ebf 100644 --- a/tests/auto/quick/qquickpositioners/qquickpositioners.pro +++ b/tests/auto/quick/qquickpositioners/qquickpositioners.pro @@ -10,4 +10,4 @@ macx:CONFIG -= app_bundle TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/quick/qquickshadereffect/qquickshadereffect.pro b/tests/auto/quick/qquickshadereffect/qquickshadereffect.pro index 6ff50a0553..142d368aed 100644 --- a/tests/auto/quick/qquickshadereffect/qquickshadereffect.pro +++ b/tests/auto/quick/qquickshadereffect/qquickshadereffect.pro @@ -5,4 +5,4 @@ SOURCES += tst_qquickshadereffect.cpp macx:CONFIG -= app_bundle CONFIG += parallel_test -QT += core-private gui-private qml-private quick-private widgets testlib +QT += core-private gui-private qml-private quick-private testlib diff --git a/tests/auto/quick/qquickstates/qquickstates.pro b/tests/auto/quick/qquickstates/qquickstates.pro index 5f2b8cd2de..783e1097dd 100644 --- a/tests/auto/quick/qquickstates/qquickstates.pro +++ b/tests/auto/quick/qquickstates/qquickstates.pro @@ -9,4 +9,4 @@ include (../../shared/util.pri) TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/quick/qquicktext/qquicktext.pro b/tests/auto/quick/qquicktext/qquicktext.pro index 53e170a115..8932664fa3 100644 --- a/tests/auto/quick/qquicktext/qquicktext.pro +++ b/tests/auto/quick/qquicktext/qquicktext.pro @@ -14,4 +14,4 @@ TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private quick-private widgets-private opengl-private network testlib +QT += core-private gui-private v8-private qml-private quick-private network testlib diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index 54b5a04466..92e8528a0d 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -47,10 +47,9 @@ #include #include #include -#include #include #include -#include +#include #include #include #include "../../shared/util.h" diff --git a/tests/auto/quick/qquicktextedit/qquicktextedit.pro b/tests/auto/quick/qquicktextedit/qquicktextedit.pro index 23459f2a91..83250030de 100644 --- a/tests/auto/quick/qquicktextedit/qquicktextedit.pro +++ b/tests/auto/quick/qquicktextedit/qquicktextedit.pro @@ -11,4 +11,4 @@ include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private network widgets-private testlib +QT += core-private gui-private v8-private qml-private quick-private network-private testlib diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index c98e5ebf8e..a90b23dfd7 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -55,7 +55,6 @@ #include #include #include -#include #include #include #include diff --git a/tests/auto/quick/qquicktextinput/qquicktextinput.pro b/tests/auto/quick/qquicktextinput/qquicktextinput.pro index 046e6abcad..13b087eef5 100644 --- a/tests/auto/quick/qquicktextinput/qquicktextinput.pro +++ b/tests/auto/quick/qquicktextinput/qquicktextinput.pro @@ -8,4 +8,4 @@ include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index bdd18d620e..c5db92af45 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -53,8 +53,6 @@ #include #include #include -#include -#include #include #ifdef Q_OS_MAC -- cgit v1.2.3 From 6b87a9cfe51f7ad4e12aca59fdcb0ed242e47e90 Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Thu, 19 Jan 2012 08:02:09 +0100 Subject: Accessibility: childAt_helper descends too far. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Recursive hit-testing using childAt_helper must stop when it hits a leaf accessibility item. This leaf item might not be a leaf item in Qt Quick - a button contains text and mouse area items not visible to the accessibility system for example. Get the accessible interface and check if it has children before recursing to the child items. Change-Id: I2cc286cde4bce6b4ca340e8a1819edc5f84006a5 Reviewed-by: Jan-Arve Sæther Reviewed-by: Frederik Gladhorn --- src/plugins/accessible/quick/qaccessiblequickview.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/accessible/quick/qaccessiblequickview.cpp b/src/plugins/accessible/quick/qaccessiblequickview.cpp index 042d8dcf06..1823dfea42 100644 --- a/src/plugins/accessible/quick/qaccessiblequickview.cpp +++ b/src/plugins/accessible/quick/qaccessiblequickview.cpp @@ -119,6 +119,11 @@ static QQuickItem *childAt_helper(QQuickItem *item, int x, int y) return 0; } + QScopedPointer accessibleInterface(QAccessible::queryAccessibleInterface(item)); + if (accessibleInterface->childCount() == 0) { + return (itemScreenRect(item).contains(x, y)) ? item : 0; + } + QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item); QList children = itemPrivate->paintOrderChildItems(); -- cgit v1.2.3 From cf3a32ff28c8004b39658ec181b0c7d9ca27aaa8 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Mon, 12 Mar 2012 10:01:56 +1000 Subject: tests: enable headersclean also for cross_compile builds This test is no longer a host-only test. Enable it everywhere. Change-Id: Id7e65ad4d6f468b6b65d0f6035934fbd20fcb5e0 Reviewed-by: Toby Tomkins --- tests/auto/auto.pro | 3 +-- tests/auto/host.pro | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) delete mode 100644 tests/auto/host.pro diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 5012b5cdec..15d88785de 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -2,9 +2,8 @@ TEMPLATE=subdirs SUBDIRS=\ qml \ quick \ + headersclean \ particles \ qmldevtools contains(QT_CONFIG, qmltest): SUBDIRS += qmltest - -!cross_compile: SUBDIRS += host.pro diff --git a/tests/auto/host.pro b/tests/auto/host.pro deleted file mode 100644 index eab6de2981..0000000000 --- a/tests/auto/host.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE=subdirs - -SUBDIRS=\ - headersclean \ - -- cgit v1.2.3 From 6d9b52b12e83cbb52683bea89fe160c1bd8e9541 Mon Sep 17 00:00:00 2001 From: Matthew Vogt Date: Mon, 12 Mar 2012 16:53:24 +1000 Subject: Prefer \b word boundary markers /usr/bin/sed on mac does not process '\<' and '\>' boundary markers correctly. Change-Id: I750f7c69579ddcbe39a6246a3d3321cab714fc27 Reviewed-by: Rohan McGovern --- bin/rename-qtdeclarative-symbols.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/bin/rename-qtdeclarative-symbols.sh b/bin/rename-qtdeclarative-symbols.sh index 0d521dd5a8..96633af2d8 100755 --- a/bin/rename-qtdeclarative-symbols.sh +++ b/bin/rename-qtdeclarative-symbols.sh @@ -598,42 +598,43 @@ replaceMatch() for QML_SYMBOL in $QML_SYMBOLS do QML_REPLACEMENT="QQml${QML_SYMBOL#QDeclarative}" - replaceMatch "\" "QtQml/$QML_REPLACEMENT" - replaceMatch "\<$QML_SYMBOL\>" "$QML_REPLACEMENT" + replaceMatch "\bQtDeclarative/$QML_SYMBOL\b" "QtQml/$QML_REPLACEMENT" + replaceMatch "\b$QML_SYMBOL\b" "$QML_REPLACEMENT" done for QUICK_SYMBOL in $QUICK_SYMBOLS do QUICK_REPLACEMENT="QQuick${QUICK_SYMBOL#QDeclarative}" - replaceMatch "\" "QtQuick/$QUICK_REPLACEMENT" - replaceMatch "\<$QUICK_SYMBOL\>" "$QUICK_REPLACEMENT" + replaceMatch "\bQtDeclarative/$QUICK_SYMBOL\b" "QtQuick/$QUICK_REPLACEMENT" + replaceMatch "\b$QUICK_SYMBOL\b" "$QUICK_REPLACEMENT" done for QML_INCLUDE_FILE in $QML_INCLUDE_FILES do QML_INCLUDE_REPLACEMENT="qqml${QML_INCLUDE_FILE#qdeclarative}" - replaceMatch "\<$QML_INCLUDE_FILE\>" "$QML_INCLUDE_REPLACEMENT" + replaceMatch "\b$QML_INCLUDE_FILE\b" "$QML_INCLUDE_REPLACEMENT" done for QUICK_INCLUDE_FILE in $QUICK_INCLUDE_FILES do QUICK_INCLUDE_REPLACEMENT="qquick${QUICK_INCLUDE_FILE#qdeclarative}" - replaceMatch "\<$QUICK_INCLUDE_FILE\>" "$QUICK_INCLUDE_REPLACEMENT" + replaceMatch "\b$QUICK_INCLUDE_FILE\b" "$QUICK_INCLUDE_REPLACEMENT" done # Various one-off replacements -replaceMatch "\" "QtQml" -replaceMatch "\") +CONTAINERS=$(find "$MODIFY_DIR" \( -name \*\.pro -o -name \*\.pri \) | xargs grep -l -I "\bdeclarative\b") for CONTAINER in $CONTAINERS do echo " $CONTAINER" TMP_FILE="$CONTAINER.tmp" - sed 's|\|qml|g' <"$CONTAINER" >"$TMP_FILE" + sed 's|\bdeclarative\b|qml|g' <"$CONTAINER" >"$TMP_FILE" mv "$TMP_FILE" "$CONTAINER" done echo -- cgit v1.2.3 From 368e2340bafc3d17c22e67ac8bb8bb797614a610 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 6 Mar 2012 11:25:59 +0100 Subject: Check that canvas is valid. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During creation the canvas might not have been set. Change-Id: I7ea8922413e3b6fb4ffd2ed9758c57eea1de02db Reviewed-by: Jan-Arve Sæther --- src/plugins/accessible/quick/qaccessiblequickitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/accessible/quick/qaccessiblequickitem.cpp b/src/plugins/accessible/quick/qaccessiblequickitem.cpp index 6c13377b3f..45db9fa795 100644 --- a/src/plugins/accessible/quick/qaccessiblequickitem.cpp +++ b/src/plugins/accessible/quick/qaccessiblequickitem.cpp @@ -95,7 +95,7 @@ QAccessibleInterface *QAccessibleQuickItem::parent() const // QQuickView::declarativeRoot. The former is the true root item, // but is not a part of the accessibility tree. Check if we hit // it here and return an interface for the scene instead. - if (parent == canvas->rootItem()) { + if (canvas && (parent == canvas->rootItem())) { return QAccessible::queryAccessibleInterface(canvas); } else { return QAccessible::queryAccessibleInterface(parent); -- cgit v1.2.3 From 3eeba70a199de4d2ba85553a32a07c81d81664c9 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 8 Mar 2012 09:16:07 +1000 Subject: Add Math.ceil and Math.abs support to v4. Change-Id: I23e7c8294abf80914d4529740af6e9124f66c5bf Reviewed-by: Roberto Raggi --- src/qml/qml/v4/qv4bindings.cpp | 18 ++++++++++++++++++ src/qml/qml/v4/qv4compiler.cpp | 12 ++++++++++++ src/qml/qml/v4/qv4instruction.cpp | 6 ++++++ src/qml/qml/v4/qv4instruction_p.h | 2 ++ src/qml/qml/v4/qv4ir.cpp | 6 ++++++ src/qml/qml/v4/qv4ir_p.h | 2 ++ 6 files changed, 46 insertions(+) diff --git a/src/qml/qml/v4/qv4bindings.cpp b/src/qml/qml/v4/qv4bindings.cpp index 4fd84945fc..3f3b66633a 100644 --- a/src/qml/qml/v4/qv4bindings.cpp +++ b/src/qml/qml/v4/qv4bindings.cpp @@ -1172,6 +1172,15 @@ void QV4Bindings::run(int instrIndex, quint32 &executedBlocks, } QML_V4_END_INSTR(MathCosReal, unaryop) + QML_V4_BEGIN_INSTR(MathAbsReal, unaryop) + { + const Register &src = registers[instr->unaryop.src]; + Register &output = registers[instr->unaryop.output]; + if (src.isUndefined()) output.setUndefined(); + else output.setqreal(qAbs(src.getqreal())); + } + QML_V4_END_INSTR(MathAbsReal, unaryop) + QML_V4_BEGIN_INSTR(MathRoundReal, unaryop) { const Register &src = registers[instr->unaryop.src]; @@ -1190,6 +1199,15 @@ void QV4Bindings::run(int instrIndex, quint32 &executedBlocks, } QML_V4_END_INSTR(MathFloorReal, unaryop) + QML_V4_BEGIN_INSTR(MathCeilReal, unaryop) + { + const Register &src = registers[instr->unaryop.src]; + Register &output = registers[instr->unaryop.output]; + if (src.isUndefined()) output.setUndefined(); + else output.setint(qCeil(src.getqreal())); + } + QML_V4_END_INSTR(MathCeilReal, unaryop) + QML_V4_BEGIN_INSTR(MathPIReal, unaryop) { static const qreal qmlPI = 2.0 * qAsin(1.0); diff --git a/src/qml/qml/v4/qv4compiler.cpp b/src/qml/qml/v4/qv4compiler.cpp index 608368afc2..ce83c2d2a7 100644 --- a/src/qml/qml/v4/qv4compiler.cpp +++ b/src/qml/qml/v4/qv4compiler.cpp @@ -803,6 +803,12 @@ void QV4CompilerPrivate::visitCall(IR::Call *call) gen(i); } return; + case IR::MathAbsBuiltinFunction: { + Instr::MathAbsReal i; + i.output = i.src = currentReg; + gen(i); + } return; + case IR::MathRoundBultinFunction: { Instr::MathRoundReal i; i.output = i.src = currentReg; @@ -815,6 +821,12 @@ void QV4CompilerPrivate::visitCall(IR::Call *call) gen(i); } return; + case IR::MathCeilBuiltinFunction: { + Instr::MathCeilReal i; + i.output = i.src = currentReg; + gen(i); + } return; + case IR::MathPIBuiltinConstant: break; } // switch diff --git a/src/qml/qml/v4/qv4instruction.cpp b/src/qml/qml/v4/qv4instruction.cpp index efbd2b2c1c..309ae90696 100644 --- a/src/qml/qml/v4/qv4instruction.cpp +++ b/src/qml/qml/v4/qv4instruction.cpp @@ -195,12 +195,18 @@ void Bytecode::dump(const V4Instr *i, int address) const case V4Instr::MathCosReal: INSTR_DUMP << "\t" << "MathCosReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; break; + case V4Instr::MathAbsReal: + INSTR_DUMP << "\t" << "MathAbsReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; + break; case V4Instr::MathRoundReal: INSTR_DUMP << "\t" << "MathRoundReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; break; case V4Instr::MathFloorReal: INSTR_DUMP << "\t" << "MathFloorReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; break; + case V4Instr::MathCeilReal: + INSTR_DUMP << "\t" << "MathCeilReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; + break; case V4Instr::MathPIReal: INSTR_DUMP << "\t" << "MathPIReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; break; diff --git a/src/qml/qml/v4/qv4instruction_p.h b/src/qml/qml/v4/qv4instruction_p.h index 964c95513f..fef856585e 100644 --- a/src/qml/qml/v4/qv4instruction_p.h +++ b/src/qml/qml/v4/qv4instruction_p.h @@ -100,8 +100,10 @@ QT_BEGIN_NAMESPACE F(ResolveUrl, unaryop) \ F(MathSinReal, unaryop) \ F(MathCosReal, unaryop) \ + F(MathAbsReal, unaryop) \ F(MathRoundReal, unaryop) \ F(MathFloorReal, unaryop) \ + F(MathCeilReal, unaryop) \ F(MathPIReal, unaryop) \ F(LoadReal, real_value) \ F(LoadInt, int_value) \ diff --git a/src/qml/qml/v4/qv4ir.cpp b/src/qml/qml/v4/qv4ir.cpp index 68175d3bf4..051df567db 100644 --- a/src/qml/qml/v4/qv4ir.cpp +++ b/src/qml/qml/v4/qv4ir.cpp @@ -219,10 +219,14 @@ void Name::init(Name *base, Type type, const QString *id, Symbol symbol, quint32 builtin = MathSinBultinFunction; } else if (id->length() == 8 && *id == QLatin1String("Math.cos")) { builtin = MathCosBultinFunction; + } else if (id->length() == 8 && *id == QLatin1String("Math.abs")) { + builtin = MathAbsBuiltinFunction; } else if (id->length() == 10 && *id == QLatin1String("Math.round")) { builtin = MathRoundBultinFunction; } else if (id->length() == 10 && *id == QLatin1String("Math.floor")) { builtin = MathFloorBultinFunction; + } else if (id->length() == 9 && *id == QLatin1String("Math.ceil")) { + builtin = MathCeilBuiltinFunction; } else if (id->length() == 7 && *id == QLatin1String("Math.PI")) { builtin = MathPIBuiltinConstant; this->type = RealType; @@ -353,10 +357,12 @@ Type Call::typeForFunction(Expr *base) switch (name->builtin) { case MathSinBultinFunction: case MathCosBultinFunction: + case MathAbsBuiltinFunction: //### type could also be Int if input was Int return RealType; case MathRoundBultinFunction: case MathFloorBultinFunction: + case MathCeilBuiltinFunction: return IntType; case NoBuiltinSymbol: diff --git a/src/qml/qml/v4/qv4ir_p.h b/src/qml/qml/v4/qv4ir_p.h index 3d3288b65f..6520131760 100644 --- a/src/qml/qml/v4/qv4ir_p.h +++ b/src/qml/qml/v4/qv4ir_p.h @@ -239,6 +239,8 @@ enum BuiltinSymbol { MathCosBultinFunction, MathRoundBultinFunction, MathFloorBultinFunction, + MathCeilBuiltinFunction, + MathAbsBuiltinFunction, MathPIBuiltinConstant }; -- cgit v1.2.3 From 5f1ebe4df09a4899aa32a1c19c368e5260b5b246 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 8 Mar 2012 10:36:51 +1000 Subject: Add two argument Math.min and Math.max support to v4. Change-Id: I26a4812b76571bf0ae6a0b4bd5d1e2afd64051df Reviewed-by: Roberto Raggi --- src/qml/qml/v4/qv4bindings.cpp | 20 ++++++++++++++++++++ src/qml/qml/v4/qv4compiler.cpp | 34 ++++++++++++++++++++++++++++++++++ src/qml/qml/v4/qv4instruction.cpp | 6 ++++++ src/qml/qml/v4/qv4instruction_p.h | 2 ++ src/qml/qml/v4/qv4ir.cpp | 6 ++++++ src/qml/qml/v4/qv4ir_p.h | 2 ++ 6 files changed, 70 insertions(+) diff --git a/src/qml/qml/v4/qv4bindings.cpp b/src/qml/qml/v4/qv4bindings.cpp index 3f3b66633a..93c7820ca2 100644 --- a/src/qml/qml/v4/qv4bindings.cpp +++ b/src/qml/qml/v4/qv4bindings.cpp @@ -1498,6 +1498,26 @@ void QV4Bindings::run(int instrIndex, quint32 &executedBlocks, } QML_V4_END_INSTR(StrictNotEqualString, binaryop) + QML_V4_BEGIN_INSTR(MathMaxReal, binaryop) + { + const Register &left = registers[instr->binaryop.left]; + const Register &right = registers[instr->binaryop.right]; + Register &output = registers[instr->binaryop.output]; + if (left.isUndefined() || right.isUndefined()) output.setUndefined(); + else output.setqreal(qMax(left.getqreal(), right.getqreal())); + } + QML_V4_END_INSTR(MathMaxReal, binaryop) + + QML_V4_BEGIN_INSTR(MathMinReal, binaryop) + { + const Register &left = registers[instr->binaryop.left]; + const Register &right = registers[instr->binaryop.right]; + Register &output = registers[instr->binaryop.output]; + if (left.isUndefined() || right.isUndefined()) output.setUndefined(); + else output.setqreal(qMin(left.getqreal(), right.getqreal())); + } + QML_V4_END_INSTR(MathMinReal, binaryop) + QML_V4_BEGIN_INSTR(NewString, construct) { Register &output = registers[instr->construct.reg]; diff --git a/src/qml/qml/v4/qv4compiler.cpp b/src/qml/qml/v4/qv4compiler.cpp index ce83c2d2a7..620d260053 100644 --- a/src/qml/qml/v4/qv4compiler.cpp +++ b/src/qml/qml/v4/qv4compiler.cpp @@ -828,8 +828,42 @@ void QV4CompilerPrivate::visitCall(IR::Call *call) } return; case IR::MathPIBuiltinConstant: + default: break; } // switch + } else { + if (name->builtin == IR::MathMaxBuiltinFunction || + name->builtin == IR::MathMinBuiltinFunction) { + + //only handles the most common case of exactly two arguments + if (call->args && call->args->next && !call->args->next->next) { + IR::Expr *arg1 = call->args->expr; + IR::Expr *arg2 = call->args->next->expr; + + if (arg1 != 0 && arg1->type == IR::RealType && + arg2 != 0 && arg2->type == IR::RealType) { + + traceExpression(arg1, currentReg); + traceExpression(arg2, currentReg + 1); + + if (name->builtin == IR::MathMaxBuiltinFunction) { + Instr::MathMaxReal i; + i.left = currentReg; + i.right = currentReg + 1; + i.output = currentReg; + gen(i); + return; + } else if (name->builtin == IR::MathMinBuiltinFunction) { + Instr::MathMinReal i; + i.left = currentReg; + i.right = currentReg + 1; + i.output = currentReg; + gen(i); + return; + } + } + } + } } } diff --git a/src/qml/qml/v4/qv4instruction.cpp b/src/qml/qml/v4/qv4instruction.cpp index 309ae90696..a392c9392c 100644 --- a/src/qml/qml/v4/qv4instruction.cpp +++ b/src/qml/qml/v4/qv4instruction.cpp @@ -312,6 +312,12 @@ void Bytecode::dump(const V4Instr *i, int address) const case V4Instr::StrictNotEqualString: INSTR_DUMP << "\t" << "StrictNotEqualString" << "\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")"; break; + case V4Instr::MathMaxReal: + INSTR_DUMP << "\t" << "MathMaxReal" << "\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")"; + break; + case V4Instr::MathMinReal: + INSTR_DUMP << "\t" << "MathMinReal" << "\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")"; + break; case V4Instr::NewString: INSTR_DUMP << "\t" << "NewString" << "\t\t" << "Register(" << i->construct.reg << ")"; break; diff --git a/src/qml/qml/v4/qv4instruction_p.h b/src/qml/qml/v4/qv4instruction_p.h index fef856585e..9727c23959 100644 --- a/src/qml/qml/v4/qv4instruction_p.h +++ b/src/qml/qml/v4/qv4instruction_p.h @@ -139,6 +139,8 @@ QT_BEGIN_NAMESPACE F(NotEqualString, binaryop) \ F(StrictEqualString, binaryop) \ F(StrictNotEqualString, binaryop) \ + F(MathMaxReal, binaryop) \ + F(MathMinReal, binaryop) \ F(NewString, construct) \ F(NewUrl, construct) \ F(CleanupRegister, cleanup) \ diff --git a/src/qml/qml/v4/qv4ir.cpp b/src/qml/qml/v4/qv4ir.cpp index 051df567db..54679c3d8c 100644 --- a/src/qml/qml/v4/qv4ir.cpp +++ b/src/qml/qml/v4/qv4ir.cpp @@ -227,6 +227,10 @@ void Name::init(Name *base, Type type, const QString *id, Symbol symbol, quint32 builtin = MathFloorBultinFunction; } else if (id->length() == 9 && *id == QLatin1String("Math.ceil")) { builtin = MathCeilBuiltinFunction; + } else if (id->length() == 8 && *id == QLatin1String("Math.max")) { + builtin = MathMaxBuiltinFunction; + } else if (id->length() == 8 && *id == QLatin1String("Math.min")) { + builtin = MathMinBuiltinFunction; } else if (id->length() == 7 && *id == QLatin1String("Math.PI")) { builtin = MathPIBuiltinConstant; this->type = RealType; @@ -358,6 +362,8 @@ Type Call::typeForFunction(Expr *base) case MathSinBultinFunction: case MathCosBultinFunction: case MathAbsBuiltinFunction: //### type could also be Int if input was Int + case MathMaxBuiltinFunction: + case MathMinBuiltinFunction: return RealType; case MathRoundBultinFunction: diff --git a/src/qml/qml/v4/qv4ir_p.h b/src/qml/qml/v4/qv4ir_p.h index 6520131760..79f50cd6c9 100644 --- a/src/qml/qml/v4/qv4ir_p.h +++ b/src/qml/qml/v4/qv4ir_p.h @@ -241,6 +241,8 @@ enum BuiltinSymbol { MathFloorBultinFunction, MathCeilBuiltinFunction, MathAbsBuiltinFunction, + MathMaxBuiltinFunction, + MathMinBuiltinFunction, MathPIBuiltinConstant }; -- cgit v1.2.3 From 31aa6012bfb575dd85a5083353fd10487dcbcdaa Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 9 Mar 2012 13:09:07 +1000 Subject: Add additional v4 tests. Change-Id: Id33eb50e4a01f3450515f6e666e18cb018f1706e Reviewed-by: Roberto Raggi --- tests/auto/qml/v4/data/mathAbs.qml | 42 +++++++++++++++++ tests/auto/qml/v4/data/mathCeil.qml | 37 +++++++++++++++ tests/auto/qml/v4/data/mathMax.qml | 41 ++++++++++++++++ tests/auto/qml/v4/data/mathMin.qml | 41 ++++++++++++++++ tests/auto/qml/v4/tst_v4.cpp | 93 +++++++++++++++++++++++++++++++++++++ 5 files changed, 254 insertions(+) create mode 100644 tests/auto/qml/v4/data/mathAbs.qml create mode 100644 tests/auto/qml/v4/data/mathCeil.qml create mode 100644 tests/auto/qml/v4/data/mathMax.qml create mode 100644 tests/auto/qml/v4/data/mathMin.qml diff --git a/tests/auto/qml/v4/data/mathAbs.qml b/tests/auto/qml/v4/data/mathAbs.qml new file mode 100644 index 0000000000..eb504ae4d8 --- /dev/null +++ b/tests/auto/qml/v4/data/mathAbs.qml @@ -0,0 +1,42 @@ +import QtQuick 2.0 + +Item { + property real test1: Math.abs(i1.p1) + property real test2: Math.abs(i1.p2) + + property int test3: Math.abs(i1.p3) + property int test4: Math.abs(i1.p4) + + property real subtest5: Math.abs() + property real subtest6: Math.abs(i1.p6) + property bool test5: isNaN(subtest5) + property bool test6: isNaN(subtest6) + + property real subtest7: Math.abs(i1.p7) + property bool test7: isNaN(subtest7) + property int test8: Math.abs(i1.p8) + + property real subtest9: Math.abs(i1.p9) + property real subtest10: Math.abs(i1.p10) + property bool test9: subtest9 === Number.POSITIVE_INFINITY + property bool test10: subtest10 === Number.POSITIVE_INFINITY + + property int test11: Math.abs(i1.p11) + property real subtest12: Math.abs(i1.p12) + property bool test12: subtest12 === 0 && (1/subtest12) === Infinity + + QtObject { + id: i1 + property real p1: -3.7 + property real p2: 4.5 + property int p3: 18 + property int p4: -72 + property real p6: Number.NaN + property string p7: "hello world" + property string p8: "82" + property real p9: Number.NEGATIVE_INFINITY + property real p10: Number.POSITIVE_INFINITY + property real p11: 0 + property real p12: -0 + } + } diff --git a/tests/auto/qml/v4/data/mathCeil.qml b/tests/auto/qml/v4/data/mathCeil.qml new file mode 100644 index 0000000000..f67838a445 --- /dev/null +++ b/tests/auto/qml/v4/data/mathCeil.qml @@ -0,0 +1,37 @@ +import QtQuick 2.0 + +Item { + property real test1: Math.ceil(i1.p1) + property real test2: Math.ceil(i1.p2) + + property real subtest3: Math.ceil() + property real subtest4: Math.ceil(i1.p4) + property bool test3: isNaN(subtest3) + property bool test4: isNaN(subtest4) + + property real subtest5: Math.ceil(i1.p5) + property bool test5: isNaN(subtest5) + property real test6: Math.ceil(i1.p6) + + property real subtest7: Math.ceil(i1.p7) + property real subtest8: Math.ceil(i1.p8) + property bool test7: subtest7 === Number.NEGATIVE_INFINITY + property bool test8: subtest8 === Number.POSITIVE_INFINITY + + property real test9: Math.ceil(i1.p9) + property real subtest10: Math.ceil(i1.p10) + property bool test10: subtest10 === 0 && (1/subtest10) === -Infinity + + QtObject { + id: i1 + property real p1: -3.7 + property real p2: 4.4 + property real p4: Number.NaN + property string p5: "hello world" + property string p6: "82.6" + property real p7: Number.NEGATIVE_INFINITY + property real p8: Number.POSITIVE_INFINITY + property real p9: 0 + property real p10: -0 + } + } diff --git a/tests/auto/qml/v4/data/mathMax.qml b/tests/auto/qml/v4/data/mathMax.qml new file mode 100644 index 0000000000..543b4994aa --- /dev/null +++ b/tests/auto/qml/v4/data/mathMax.qml @@ -0,0 +1,41 @@ +import QtQuick 2.0 + +Item { + property real test1: Math.max(i1.p1, i1.p2) + property real test2: Math.max(i1.p2, i1.p3) + + property real subtest3: Math.max() + property real subtest4: Math.max(i1.p4) + property bool test3: subtest3 === -Infinity + property bool test4: isNaN(subtest4) + + property real subtest5: Math.max(i1.p5, i1.p1) + property bool test5: isNaN(subtest5) + property real test6: Math.max(i1.p6, i1.p3) + + property real test7: Math.max(i1.p7, i1.p2) + property real subtest8: Math.max(i1.p8, i1.p2) + property bool test8: subtest8 === Number.POSITIVE_INFINITY + + property real subtest9: Math.max(i1.p10, i1.p9) + property bool test9: subtest9 === 0 && (1/subtest9) === Infinity + + property real test10: Math.max(i1.p11, i1.p1) + property real test11: Math.max(i1.p11, i1.p2) + property real test12: Math.max(i1.p1, i1.p2, i1.p3) + + QtObject { + id: i1 + property real p1: -3.7 + property real p2: 4.4 + property int p3: 7 + property real p4: Number.NaN + property string p5: "hello world" + property string p6: "82.6" + property real p7: Number.NEGATIVE_INFINITY + property real p8: Number.POSITIVE_INFINITY + property real p9: 0 + property real p10: -0 + property var p11: null + } + } diff --git a/tests/auto/qml/v4/data/mathMin.qml b/tests/auto/qml/v4/data/mathMin.qml new file mode 100644 index 0000000000..7d2a561623 --- /dev/null +++ b/tests/auto/qml/v4/data/mathMin.qml @@ -0,0 +1,41 @@ +import QtQuick 2.0 + +Item { + property real test1: Math.min(i1.p1, i1.p2) + property real test2: Math.min(i1.p2, i1.p3) + + property real subtest3: Math.min() + property real subtest4: Math.min(i1.p4) + property bool test3: subtest3 === Infinity + property bool test4: isNaN(subtest4) + + property real subtest5: Math.min(i1.p5, i1.p1) + property bool test5: isNaN(subtest5) + property real test6: Math.min(i1.p6, i1.p3) + + property real subtest7: Math.min(i1.p7, i1.p2) + property bool test7: subtest7 === Number.NEGATIVE_INFINITY + property real test8: Math.min(i1.p8, i1.p2) + + property real subtest9: Math.min(i1.p10, i1.p9) + property bool test9: subtest9 === 0 && (1/subtest9) === -Infinity + + property real test10: Math.min(i1.p11, i1.p1) + property real test11: Math.min(i1.p11, i1.p2) + property real test12: Math.min(i1.p1, i1.p2, i1.p3) + + QtObject { + id: i1 + property real p1: -3.7 + property real p2: 4.4 + property int p3: 95 + property real p4: Number.NaN + property string p5: "hello world" + property string p6: "82.6" + property real p7: Number.NEGATIVE_INFINITY + property real p8: Number.POSITIVE_INFINITY + property real p9: 0 + property real p10: -0 + property var p11: null + } + } diff --git a/tests/auto/qml/v4/tst_v4.cpp b/tests/auto/qml/v4/tst_v4.cpp index 041d9ab8e6..f8422ac73c 100644 --- a/tests/auto/qml/v4/tst_v4.cpp +++ b/tests/auto/qml/v4/tst_v4.cpp @@ -75,6 +75,10 @@ private slots: void unaryMinus(); void unaryPlus(); void colorType(); + void mathAbs(); + void mathCeil(); + void mathMax(); + void mathMin(); private: QQmlEngine engine; @@ -383,6 +387,95 @@ void tst_v4::colorType() delete o; } +void tst_v4::mathAbs() +{ + QQmlComponent component(&engine, testFileUrl("mathAbs.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test1").toReal(), qreal(3.7)); + QCOMPARE(o->property("test2").toReal(), qreal(4.5)); + QCOMPARE(o->property("test3").toInt(), 18); + QCOMPARE(o->property("test4").toInt(), 72); + QCOMPARE(o->property("test5").toBool(), true); + QCOMPARE(o->property("test6").toBool(), true); + QCOMPARE(o->property("test7").toBool(), true); + QCOMPARE(o->property("test8").toInt(), 82); + QCOMPARE(o->property("test9").toBool(), true); + QCOMPARE(o->property("test10").toBool(), true); + QCOMPARE(o->property("test11").toInt(), 0); + //QCOMPARE(o->property("test12").toBool(), true); //QTBUG-24706 + + delete o; +} + +void tst_v4::mathCeil() +{ + QQmlComponent component(&engine, testFileUrl("mathCeil.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test1").toReal(), qreal(-3)); + QCOMPARE(o->property("test2").toReal(), qreal(5)); + QCOMPARE(o->property("test3").toBool(), true); + //QCOMPARE(o->property("test4").toBool(), true); //QTBUG-24706 + QCOMPARE(o->property("test5").toBool(), true); + QCOMPARE(o->property("test6").toReal(), qreal(83)); + //QCOMPARE(o->property("test7").toBool(), true); //QTBUG-24706 + //QCOMPARE(o->property("test8").toBool(), true); //QTBUG-24706 + QCOMPARE(o->property("test9").toInt(), 0); + //QCOMPARE(o->property("test10").toBool(), true); //QTBUG-24706 + + delete o; +} + +void tst_v4::mathMax() +{ + QQmlComponent component(&engine, testFileUrl("mathMax.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test1").toReal(), qreal(4.4)); + QCOMPARE(o->property("test2").toReal(), qreal(7)); + QCOMPARE(o->property("test3").toBool(), true); + QCOMPARE(o->property("test4").toBool(), true); + QCOMPARE(o->property("test5").toBool(), true); + QCOMPARE(o->property("test6").toReal(), qreal(82.6)); + QCOMPARE(o->property("test7").toReal(), qreal(4.4)); + QCOMPARE(o->property("test8").toBool(), true); + //QCOMPARE(o->property("test9").toBool(), true); //QTBUG-24706 + QCOMPARE(o->property("test10").toReal(), qreal(0)); + QCOMPARE(o->property("test11").toReal(), qreal(4.4)); + QCOMPARE(o->property("test12").toReal(), qreal(7)); + + delete o; +} + +void tst_v4::mathMin() +{ + QQmlComponent component(&engine, testFileUrl("mathMin.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test1").toReal(), qreal(-3.7)); + QCOMPARE(o->property("test2").toReal(), qreal(4.4)); + QCOMPARE(o->property("test3").toBool(), true); + QCOMPARE(o->property("test4").toBool(), true); + QCOMPARE(o->property("test5").toBool(), true); + QCOMPARE(o->property("test6").toReal(), qreal(82.6)); + QCOMPARE(o->property("test7").toBool(), true); + QCOMPARE(o->property("test8").toReal(), qreal(4.4)); + //QCOMPARE(o->property("test9").toBool(), true); //QTBUG-24706 + QCOMPARE(o->property("test10").toReal(), qreal(-3.7)); + QCOMPARE(o->property("test11").toReal(), qreal(0)); + QCOMPARE(o->property("test12").toReal(), qreal(-3.7)); + delete o; +} + QTEST_MAIN(tst_v4) #include "tst_v4.moc" -- cgit v1.2.3 From b0215058436a39953d8702c1671561175af91a6c Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 12 Mar 2012 15:27:09 +1000 Subject: Fix v4 nested object access bug. Use the correct type to look up the sub property. Task-number: QTBUG-24606 Change-Id: Iab372ca7440249241bf855d2875a947ad8fe4527 Reviewed-by: Chris Adams Reviewed-by: Roberto Raggi --- src/qml/qml/v4/qv4irbuilder.cpp | 7 ++++--- tests/auto/qml/v4/tst_v4.cpp | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qml/qml/v4/qv4irbuilder.cpp b/src/qml/qml/v4/qv4irbuilder.cpp index 36e88e5276..06f4024423 100644 --- a/src/qml/qml/v4/qv4irbuilder.cpp +++ b/src/qml/qml/v4/qv4irbuilder.cpp @@ -628,7 +628,8 @@ bool QV4IRBuilder::visit(AST::FieldMemberExpression *ast) case IR::Name::Property: if (baseName->type == IR::ObjectType && baseName->meta && baseName->property->isFinal()) { - QQmlPropertyCache *cache = m_engine->cache(baseName->meta); + const QMetaObject *meta = m_engine->metaObjectForType(baseName->property->propType); + QQmlPropertyCache *cache = m_engine->cache(meta); if (!cache) return false; @@ -640,9 +641,9 @@ bool QV4IRBuilder::visit(AST::FieldMemberExpression *ast) return false; // We don't know enough about this property } - IR::Type irType = irTypeFromVariantType(data->propType, m_engine, baseName->meta); + IR::Type irType = irTypeFromVariantType(data->propType, m_engine, meta); _expr.code = _block->SYMBOL(baseName, irType, name, - baseName->meta, data, line, column); + meta, data, line, column); } } break; diff --git a/tests/auto/qml/v4/tst_v4.cpp b/tests/auto/qml/v4/tst_v4.cpp index f8422ac73c..91a32268cf 100644 --- a/tests/auto/qml/v4/tst_v4.cpp +++ b/tests/auto/qml/v4/tst_v4.cpp @@ -252,7 +252,6 @@ void tst_v4::nestedObjectAccess() ResultObject *ro = qobject_cast(o); QVERIFY(ro != 0); - QEXPECT_FAIL("","QTBUG-24606", Continue); QCOMPARE(ro->result(), 37); delete o; -- cgit v1.2.3 From 1914a723a7bbd2b68b104eb0917b7082846b781a Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Tue, 14 Feb 2012 19:04:12 +0100 Subject: Fix for QTBUG-22777. Removed unnecessary check. Change-Id: I82de9e1d6eb4b8bdb8c90c69e686b700a02f40aa Reviewed-by: Martin Jones --- src/quick/items/qquickflickable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index f75ca14989..d0721f3283 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -1838,7 +1838,7 @@ bool QQuickFlickable::sendMouseEvent(QMouseEvent *event) bool QQuickFlickable::childMouseEventFilter(QQuickItem *i, QEvent *e) { Q_D(QQuickFlickable); - if (!isVisible() || !d->interactive || !isEnabled()) + if (!isVisible() || !isEnabled()) return QQuickItem::childMouseEventFilter(i, e); switch (e->type()) { case QEvent::MouseButtonPress: -- cgit v1.2.3 From 07160d02c3b6e2840621544b19dd79a201a06201 Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Wed, 7 Mar 2012 23:12:19 +1000 Subject: include header correctly Change-Id: I462fbcdd2954979fbff92965cc813551773b4118 Reviewed-by: Michael Brasser --- src/qml/qml/qqmlcomponent_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qml/qml/qqmlcomponent_p.h b/src/qml/qml/qqmlcomponent_p.h index b03dd68936..dda5bd0b71 100644 --- a/src/qml/qml/qqmlcomponent_p.h +++ b/src/qml/qml/qqmlcomponent_p.h @@ -62,7 +62,7 @@ #include "qqmlvme_p.h" #include "qqmlerror.h" #include "qqml.h" -#include "../debugger/qqmlprofilerservice_p.h" +#include #include #include -- cgit v1.2.3 From 5f018216f680e8226b46aa3939abec52047eaee7 Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Thu, 8 Mar 2012 14:04:25 +1000 Subject: Remove the rest of qtquick 1.0 code from qmltest Change-Id: I0d20583faf1a75f287dcd866b11457254d250354 Reviewed-by: Matthew Vogt Reviewed-by: Michael Brasser --- src/qmltest/qmltest.pro | 3 +- src/qmltest/quicktest.cpp | 95 +++++++++++++++++------------------------- src/qmltest/quicktestevent.cpp | 35 ++-------------- 3 files changed, 43 insertions(+), 90 deletions(-) diff --git a/src/qmltest/qmltest.pro b/src/qmltest/qmltest.pro index d2e90c2b5d..b1c99d2739 100644 --- a/src/qmltest/qmltest.pro +++ b/src/qmltest/qmltest.pro @@ -7,7 +7,7 @@ CONFIG += module CONFIG += dll warn_on declarative_debug MODULE_PRI += ../../modules/qt_qmltest.pri -QT += testlib-private qml testlib quick widgets widgets-private gui +QT += testlib testlib-private qml quick gui DEFINES += QT_BUILD_QUICK_TEST_LIB QT_NO_URL_CAST_FROM_STRING load(qt_module_config) @@ -34,4 +34,3 @@ HEADERS += \ DEFINES += QT_BUILD_QUICK_TEST_LIB - diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp index e6c27eec00..2e32a60b2d 100644 --- a/src/qmltest/quicktest.cpp +++ b/src/qmltest/quicktest.cpp @@ -43,14 +43,10 @@ #include "quicktestresult_p.h" #include #include "qtestoptions_p.h" -#include #include #include #include -#if defined(QML_VERSION) && QML_VERSION >= 0x020000 #include -#define QUICK_TEST_SCENEGRAPH 1 -#endif #include #include #include @@ -160,12 +156,10 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport // Look for QML-specific command-line options. // -import dir Specify an import directory. // -input dir Specify the input directory for test cases. - // -qtquick1 Run with QtQuick 1 rather than QtQuick 2. // -translation file Specify the translation file. QStringList imports; QString testPath; QString translationFile; - bool qtQuick2 = true; int outargc = 1; int index = 1; while (index < argc) { @@ -177,9 +171,6 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport index += 2; } else if (strcmp(argv[index], "-opengl") == 0) { ++index; - } else if (strcmp(argv[index], "-qtquick1") == 0) { - qtQuick2 = false; - ++index; } else if (strcmp(argv[index], "-translation") == 0 && (index + 1) < argc) { translationFile = stripQuotes(QString::fromLocal8Bit(argv[index + 1])); index += 2; @@ -255,57 +246,49 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport // Scan through all of the "tst_*.qml" files and run each of them // in turn with a QQuickView. -#ifdef QUICK_TEST_SCENEGRAPH - if (qtQuick2) { - QQuickView view; - QTestRootObject rootobj; - QEventLoop eventLoop; - QObject::connect(view.engine(), SIGNAL(quit()), - &rootobj, SLOT(quit())); - QObject::connect(view.engine(), SIGNAL(quit()), - &eventLoop, SLOT(quit())); - view.rootContext()->setContextProperty - (QLatin1String("qtest"), &rootobj); - foreach (const QString &path, imports) - view.engine()->addImportPath(path); + QQuickView view; + QTestRootObject rootobj; + QEventLoop eventLoop; + QObject::connect(view.engine(), SIGNAL(quit()), + &rootobj, SLOT(quit())); + QObject::connect(view.engine(), SIGNAL(quit()), + &eventLoop, SLOT(quit())); + view.rootContext()->setContextProperty + (QLatin1String("qtest"), &rootobj); + foreach (const QString &path, imports) + view.engine()->addImportPath(path); - foreach (QString file, files) { - QFileInfo fi(file); - if (!fi.exists()) - continue; + foreach (QString file, files) { + QFileInfo fi(file); + if (!fi.exists()) + continue; - rootobj.setHasTestCase(false); - rootobj.setWindowShown(false); - rootobj.hasQuit = false; - QString path = fi.absoluteFilePath(); - if (path.startsWith(QLatin1String(":/"))) - view.setSource(QUrl(QLatin1String("qrc:") + path.mid(2))); - else - view.setSource(QUrl::fromLocalFile(path)); + rootobj.setHasTestCase(false); + rootobj.setWindowShown(false); + rootobj.hasQuit = false; + QString path = fi.absoluteFilePath(); + if (path.startsWith(QLatin1String(":/"))) + view.setSource(QUrl(QLatin1String("qrc:") + path.mid(2))); + else + view.setSource(QUrl::fromLocalFile(path)); - if (QTest::printAvailableFunctions) - continue; - if (view.status() == QQuickView::Error) { - handleCompileErrors(fi, view); - continue; - } - if (!rootobj.hasQuit) { - // If the test already quit, then it was performed - // synchronously during setSource(). Otherwise it is - // an asynchronous test and we need to show the window - // and wait for the quit indication. - view.show(); - QTest::qWaitForWindowShown(&view); - rootobj.setWindowShown(true); - if (!rootobj.hasQuit && rootobj.hasTestCase()) - eventLoop.exec(); - } + if (QTest::printAvailableFunctions) + continue; + if (view.status() == QQuickView::Error) { + handleCompileErrors(fi, view); + continue; + } + if (!rootobj.hasQuit) { + // If the test already quit, then it was performed + // synchronously during setSource(). Otherwise it is + // an asynchronous test and we need to show the window + // and wait for the quit indication. + view.show(); + QTest::qWaitForWindowShown(&view); + rootobj.setWindowShown(true); + if (!rootobj.hasQuit && rootobj.hasTestCase()) + eventLoop.exec(); } - } else -#endif - { - qWarning("No suitable QtQuick1 implementation is available!"); - return 1; } // Flush the current logging stream. diff --git a/src/qmltest/quicktestevent.cpp b/src/qmltest/quicktestevent.cpp index f996adbeca..94051711f1 100644 --- a/src/qmltest/quicktestevent.cpp +++ b/src/qmltest/quicktestevent.cpp @@ -42,12 +42,8 @@ #include "quicktestevent_p.h" #include #include -#if defined(QML_VERSION) && QML_VERSION >= 0x020000 #include #include -#define QUICK_TEST_SCENEGRAPH 1 -#endif -#include QT_BEGIN_NAMESPACE @@ -114,15 +110,9 @@ namespace QtQuickTest } QPoint pos; -#ifdef QUICK_TEST_SCENEGRAPH QQuickItem *sgitem = qobject_cast(item); - if (sgitem) { + if (sgitem) pos = sgitem->mapToScene(_pos).toPoint(); - } else -#endif - { - qWarning("No suitable QtQuick1 implementation is available!"); - } QTEST_ASSERT(button == Qt::NoButton || button & Qt::MouseButtonMask); QTEST_ASSERT(stateKey == 0 || stateKey & Qt::KeyboardModifierMask); @@ -168,15 +158,10 @@ namespace QtQuickTest QTest::qWait(delay); QPoint pos; -#ifdef QUICK_TEST_SCENEGRAPH QQuickItem *sgitem = qobject_cast(item); - if (sgitem) { + if (sgitem) pos = sgitem->mapToScene(_pos).toPoint(); - } else -#endif - { - qWarning("No suitable QtQuick1 implementation is available!"); - } + QTEST_ASSERT(buttons == Qt::NoButton || buttons & Qt::MouseButtonMask); QTEST_ASSERT(stateKey == 0 || stateKey & Qt::KeyboardModifierMask); @@ -272,24 +257,10 @@ bool QuickTestEvent::mouseMove QWindow *QuickTestEvent::eventWindow() { -#ifdef QUICK_TEST_SCENEGRAPH QQuickItem *sgitem = qobject_cast(parent()); if (sgitem) return sgitem->canvas(); -#endif return 0; - /* - QQuickItem *item = qobject_cast(parent()); - if (!item) - return 0; - QGraphicsScene *s = item->scene(); - if (!s) - return 0; - QList views = s->views(); - if (views.isEmpty()) - return 0; - return views.at(0)->windowHandle(); - */ } QT_END_NAMESPACE -- cgit v1.2.3 From fc5ddb181896d3a364c046ae21b61283412fc722 Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Wed, 7 Mar 2012 23:12:26 +1000 Subject: Fix SignalSpy disconnect issue Task-number:QTBUG-21083 Change-Id: Ic61472d886bf7c46eb37dc44b5e5ceb401917087 Reviewed-by: Michael Brasser --- src/imports/testlib/SignalSpy.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/imports/testlib/SignalSpy.qml b/src/imports/testlib/SignalSpy.qml index 8b74132806..539cb178f5 100644 --- a/src/imports/testlib/SignalSpy.qml +++ b/src/imports/testlib/SignalSpy.qml @@ -92,7 +92,9 @@ Item { function qtest_update() { if (qtest_prevTarget != null) { - qtest_prevTarget[qtest_prevSignalName].disconnect(spy, "qtest_activated") + var prevFunc = qtest_prevTarget[qtest_prevSignalName] + if (prevFunc) + prevFunc.disconnect(spy.qtest_activated) qtest_prevTarget = null qtest_prevSignalName = "" } -- cgit v1.2.3 From be8675ab01132ffb03b81cc81842775d6a8fa3f9 Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Mon, 12 Mar 2012 13:20:22 +1000 Subject: Change repeater item to handle model being deleted. The repeater item previously stored a raw QObject pointer in a variant. When this pointer was a dynamic list model element that was deleted, the variant would continue to hold a stale pointer. Change repeater to use a guard object to hold the model when it is a QObject. Continue to use a variant to hold models that are not based on QObject to maintain same semantics. Change-Id: Ie100947132923803263c725e86efa68206382f12 Reviewed-by: Martin Jones --- src/quick/items/qquickrepeater.cpp | 10 +++++++++- src/quick/items/qquickrepeater_p_p.h | 2 ++ .../quick/qquickrepeater/data/dynamicmodelcrash.qml | 20 ++++++++++++++++++++ .../auto/quick/qquickrepeater/tst_qquickrepeater.cpp | 15 +++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 tests/auto/quick/qquickrepeater/data/dynamicmodelcrash.qml diff --git a/src/quick/items/qquickrepeater.cpp b/src/quick/items/qquickrepeater.cpp index d26ebed85e..1f7578c583 100644 --- a/src/quick/items/qquickrepeater.cpp +++ b/src/quick/items/qquickrepeater.cpp @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE QQuickRepeaterPrivate::QQuickRepeaterPrivate() - : model(0), ownModel(false), inRequest(false), itemCount(0), createFrom(-1) + : model(0), ownModel(false), inRequest(false), dataSourceIsObject(false), itemCount(0), createFrom(-1) { } @@ -175,6 +175,12 @@ QQuickRepeater::~QQuickRepeater() QVariant QQuickRepeater::model() const { Q_D(const QQuickRepeater); + + if (d->dataSourceIsObject) { + QObject *o = d->dataSourceAsObject; + return QVariant::fromValue(o); + } + return d->dataSource; } @@ -194,6 +200,8 @@ void QQuickRepeater::setModel(const QVariant &model) } d->dataSource = model; QObject *object = qvariant_cast(model); + d->dataSourceAsObject = object; + d->dataSourceIsObject = object != 0; QQuickVisualModel *vim = 0; if (object && (vim = qobject_cast(object))) { if (d->ownModel) { diff --git a/src/quick/items/qquickrepeater_p_p.h b/src/quick/items/qquickrepeater_p_p.h index 88e0c94218..41d77ad977 100644 --- a/src/quick/items/qquickrepeater_p_p.h +++ b/src/quick/items/qquickrepeater_p_p.h @@ -75,8 +75,10 @@ private: QQuickVisualModel *model; QVariant dataSource; + QQmlGuard dataSourceAsObject; bool ownModel : 1; bool inRequest : 1; + bool dataSourceIsObject : 1; int itemCount; int createFrom; diff --git a/tests/auto/quick/qquickrepeater/data/dynamicmodelcrash.qml b/tests/auto/quick/qquickrepeater/data/dynamicmodelcrash.qml new file mode 100644 index 0000000000..0280df0620 --- /dev/null +++ b/tests/auto/quick/qquickrepeater/data/dynamicmodelcrash.qml @@ -0,0 +1,20 @@ +import QtQuick 2.0 + +Item { + ListModel { + id: lm; + } + + Component.onCompleted: { + lm.append({ subModel: [ {d:0} ] }); + rep.model = lm.get(0).subModel; + rep.model; + lm.remove(0); + rep.model; + } + + Repeater { + objectName: "rep" + id: rep + } +} diff --git a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp index 1b07a6e9f8..d9cbed093a 100644 --- a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp +++ b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp @@ -77,6 +77,7 @@ private slots: void properties(); void asynchronous(); void initParent(); + void dynamicModelCrash(); }; class TestObject : public QObject @@ -639,6 +640,20 @@ void tst_QQuickRepeater::initParent() QCOMPARE(qvariant_cast(rootObject->property("parentItem")), rootObject); } +void tst_QQuickRepeater::dynamicModelCrash() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("dynamicmodelcrash.qml")); + + // Don't crash + QQuickItem *rootObject = qobject_cast(component.create()); + QVERIFY(rootObject); + + QQuickRepeater *repeater = findItem(rootObject, "rep"); + QVERIFY(repeater); + QVERIFY(qvariant_cast(repeater->model()) == 0); +} + QTEST_MAIN(tst_QQuickRepeater) #include "tst_qquickrepeater.moc" -- cgit v1.2.3 From c4e25d2cf6fe49277a37e183504990535242037f Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Fri, 9 Mar 2012 11:02:03 +1000 Subject: Declare change set and compositor structs as movable primative types. Allows QVector to avoid invoking contructors for these types unnecessarily. Change-Id: Icc8670e4a033c943666f907c7e1b006a3d205597 Reviewed-by: Bea Lam --- src/quick/util/qquickchangeset_p.h | 5 +++++ src/quick/util/qquicklistcompositor_p.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/quick/util/qquickchangeset_p.h b/src/quick/util/qquickchangeset_p.h index 64179666c7..04a1e77c24 100644 --- a/src/quick/util/qquickchangeset_p.h +++ b/src/quick/util/qquickchangeset_p.h @@ -152,6 +152,11 @@ private: int m_difference; }; +Q_DECLARE_TYPEINFO(QQuickChangeSet::Change, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(QQuickChangeSet::Remove, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(QQuickChangeSet::Insert, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(QQuickChangeSet::MoveKey, Q_PRIMITIVE_TYPE); + inline uint qHash(const QQuickChangeSet::MoveKey &key) { return qHash(qMakePair(key.moveId, key.offset)); } inline bool operator ==(const QQuickChangeSet::MoveKey &l, const QQuickChangeSet::MoveKey &r) { return l.moveId == r.moveId && l.offset == r.offset; } diff --git a/src/quick/util/qquicklistcompositor_p.h b/src/quick/util/qquicklistcompositor_p.h index b12ee8025f..5c9d679fa4 100644 --- a/src/quick/util/qquicklistcompositor_p.h +++ b/src/quick/util/qquicklistcompositor_p.h @@ -317,6 +317,10 @@ private: friend Q_AUTOTEST_EXPORT QDebug operator <<(QDebug debug, const QQuickListCompositor &list); }; +Q_DECLARE_TYPEINFO(QQuickListCompositor::Change, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(QQuickListCompositor::Remove, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(QQuickListCompositor::Insert, Q_PRIMITIVE_TYPE); + inline QQuickListCompositor::iterator::iterator() : range(0), offset(0), group(Default), groupCount(0) {} inline QQuickListCompositor::iterator::iterator(const iterator &it) -- cgit v1.2.3 From fb1ce5ed0dc037ba6cd66b34321a43a82de6bd0e Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 9 Mar 2012 15:40:29 +1000 Subject: Improve interaction of nested Flickables and PathView Don't require a flick to come to a complete stop before allowing another flickable element to begin its gesture. Change-Id: I74c1998e01e04c70c76253cd09edc02f593123d0 Reviewed-by: Michael Brasser --- src/quick/items/qquickcanvas.cpp | 24 +++++++++++++++--------- src/quick/items/qquickflickable.cpp | 20 ++++++++++++++++---- src/quick/items/qquickitem.cpp | 10 +++++++--- src/quick/items/qquickpathview.cpp | 4 +++- src/quick/items/qquickpathview_p_p.h | 3 ++- 5 files changed, 43 insertions(+), 18 deletions(-) diff --git a/src/quick/items/qquickcanvas.cpp b/src/quick/items/qquickcanvas.cpp index 643887360a..26360229e9 100644 --- a/src/quick/items/qquickcanvas.cpp +++ b/src/quick/items/qquickcanvas.cpp @@ -376,10 +376,8 @@ void QQuickCanvasPrivate::translateTouchToMouse(QTouchEvent *event) { if (event->type() == QEvent::TouchCancel) { touchMouseId = -1; - if (!mouseGrabberItem) - return; - mouseGrabberItem->ungrabMouse(); - mouseGrabberItem = 0; + if (mouseGrabberItem) + mouseGrabberItem->ungrabMouse(); return; } for (int i = 0; i < event->touchPoints().count(); ++i) { @@ -447,7 +445,8 @@ void QQuickCanvasPrivate::translateTouchToMouse(QTouchEvent *event) me.setTimestamp(event->timestamp()); me.setCapabilities(event->device()->capabilities()); deliverMouseEvent(&me); - mouseGrabberItem = 0; + if (mouseGrabberItem) + mouseGrabberItem->ungrabMouse(); } break; } @@ -947,13 +946,13 @@ bool QQuickCanvasPrivate::deliverInitialMousePressEvent(QQuickItem *item, QMouse QMouseEvent me(event->type(), p, event->windowPos(), event->screenPos(), event->button(), event->buttons(), event->modifiers()); me.accept(); - mouseGrabberItem = item; + item->grabMouse(); q->sendEvent(item, &me); event->setAccepted(me.isAccepted()); if (me.isAccepted()) return true; - mouseGrabberItem->ungrabMouse(); - mouseGrabberItem = 0; + if (mouseGrabberItem) + mouseGrabberItem->ungrabMouse(); } } @@ -1023,7 +1022,8 @@ void QQuickCanvas::mouseReleaseEvent(QMouseEvent *event) } d->deliverMouseEvent(event); - d->mouseGrabberItem = 0; + if (d->mouseGrabberItem) + d->mouseGrabberItem->ungrabMouse(); } /*! \reimp */ @@ -1560,6 +1560,12 @@ bool QQuickCanvas::sendEvent(QQuickItem *item, QEvent *e) QQuickItemPrivate::get(item)->deliverMouseEvent(static_cast(e)); } break; + case QEvent::UngrabMouse: + if (!d->sendFilteredMouseEvent(item->parentItem(), item, e)) { + e->accept(); + item->mouseUngrabEvent(); + } + break; case QEvent::Wheel: QQuickItemPrivate::get(item)->deliverWheelEvent(static_cast(e)); break; diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index d0721f3283..82f674741f 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -107,7 +107,7 @@ static const int FlickThreshold = 20; // RetainGrabVelocity is the maxmimum instantaneous velocity that // will ensure the Flickable retains the grab on consecutive flicks. -static const int RetainGrabVelocity = 15; +static const int RetainGrabVelocity = 100; QQuickFlickableVisibleArea::QQuickFlickableVisibleArea(QQuickFlickable *parent) : QObject(parent), flickable(parent), m_xPosition(0.), m_widthRatio(0.) @@ -823,8 +823,8 @@ void QQuickFlickablePrivate::handleMousePressEvent(QMouseEvent *event) Q_Q(QQuickFlickable); QQuickItemPrivate::start(timer); if (interactive && timeline.isActive() - && (qAbs(hData.smoothVelocity.value()) > RetainGrabVelocity - || qAbs(vData.smoothVelocity.value()) > RetainGrabVelocity)) { + && ((qAbs(hData.smoothVelocity.value()) > RetainGrabVelocity && !hData.fixingUp && !hData.inOvershoot) + || (qAbs(vData.smoothVelocity.value()) > RetainGrabVelocity && !vData.fixingUp && !vData.inOvershoot))) { stealMouse = true; // If we've been flicked then steal the click. int flickTime = timeline.time(); if (flickTime > 600) { @@ -846,7 +846,10 @@ void QQuickFlickablePrivate::handleMousePressEvent(QMouseEvent *event) } q->setKeepMouseGrab(stealMouse); pressed = true; - timeline.clear(); + if (!hData.fixingUp) + timeline.reset(hData.move); + if (!vData.fixingUp) + timeline.reset(vData.move); hData.reset(); vData.reset(); hData.dragMinBound = q->minXExtent(); @@ -910,6 +913,7 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) } } if (!rejectY && stealMouse && dy != 0.0) { + timeline.clear(); vData.move.setValue(newY); vMoved = true; } @@ -942,6 +946,7 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) } } if (!rejectX && stealMouse && dx != 0.0) { + timeline.clear(); hData.move.setValue(newX); hMoved = true; } @@ -1753,6 +1758,7 @@ void QQuickFlickable::mouseUngrabEvent() if (d->pressed) { // if our mouse grab has been removed (probably by another Flickable), // fix our state + d->clearDelayedPress(); d->pressed = false; d->draggingEnding(); d->stealMouse = false; @@ -1845,6 +1851,12 @@ bool QQuickFlickable::childMouseEventFilter(QQuickItem *i, QEvent *e) case QEvent::MouseMove: case QEvent::MouseButtonRelease: return sendMouseEvent(static_cast(e)); + case QEvent::UngrabMouse: + if (d->canvas && d->canvas->mouseGrabberItem() && d->canvas->mouseGrabberItem() != this) { + // The grab has been taken away from a child and given to some other item. + mouseUngrabEvent(); + } + break; default: break; } diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 2b3bb55527..f2ec0d64cb 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -4743,8 +4743,10 @@ void QQuickItem::grabMouse() QQuickItem *oldGrabber = canvasPriv->mouseGrabberItem; canvasPriv->mouseGrabberItem = this; - if (oldGrabber) - oldGrabber->mouseUngrabEvent(); + if (oldGrabber) { + QEvent ev(QEvent::UngrabMouse); + d->canvas->sendEvent(oldGrabber, &ev); + } } void QQuickItem::ungrabMouse() @@ -4759,7 +4761,9 @@ void QQuickItem::ungrabMouse() } canvasPriv->mouseGrabberItem = 0; - mouseUngrabEvent(); + + QEvent ev(QEvent::UngrabMouse); + d->canvas->sendEvent(this, &ev); } bool QQuickItem::keepMouseGrab() const diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index f8098c8f65..0526187531 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -1224,7 +1224,8 @@ void QQuickPathViewPrivate::handleMousePressEvent(QMouseEvent *event) return; } - if (tl.isActive() && flicking) + + if (tl.isActive() && flicking && flickDuration && qreal(tl.time())/flickDuration < 0.8) stealMouse = true; // If we've been flicked then steal the click. else stealMouse = false; @@ -1335,6 +1336,7 @@ void QQuickPathViewPrivate::handleMouseReleaseEvent(QMouseEvent *) } else { dist = qMin(qreal(modelCount-1), qreal(v2 / (accel * 2.0))); } + flickDuration = static_cast(1000 * qAbs(velocity) / accel); offsetAdj = 0.0; moveOffset.setValue(offset); tl.accel(moveOffset, velocity, accel, dist); diff --git a/src/quick/items/qquickpathview_p_p.h b/src/quick/items/qquickpathview_p_p.h index a80c01f320..412caa6d2b 100644 --- a/src/quick/items/qquickpathview_p_p.h +++ b/src/quick/items/qquickpathview_p_p.h @@ -81,7 +81,7 @@ public: , autoHighlight(true), highlightUp(false), layoutScheduled(false) , moving(false), flicking(false), requestedOnPath(false), inRequest(false) , dragMargin(0), deceleration(100) - , moveOffset(this, &QQuickPathViewPrivate::setAdjustedOffset) + , moveOffset(this, &QQuickPathViewPrivate::setAdjustedOffset), flickDuration(0) , firstIndex(-1), pathItems(-1), requestedIndex(-1), requestedZ(0) , moveReason(Other), moveDirection(Shortest), attType(0), highlightComponent(0), highlightItem(0) , moveHighlight(this, &QQuickPathViewPrivate::setHighlightPosition) @@ -171,6 +171,7 @@ public: qreal deceleration; QQuickTimeLine tl; QQuickTimeLineValueProxy moveOffset; + int flickDuration; int firstIndex; int pathItems; int requestedIndex; -- cgit v1.2.3 From 52d3d361a0db4b0cfdf795b7998733f61ca3082d Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 5 Mar 2012 18:06:33 +1000 Subject: Displaced items were moving unnecessarily They should only move if they actually change from the last set position, and not if they are simply changing from their current item position, as that is wrong during an animation. This also cleans up some code for resetting the transition data. Task-number: QTBUG-24586 Change-Id: I0a6635903975ebc40d5cf8398b943a9de92d4493 Reviewed-by: Martin Jones --- src/quick/items/qquickitemviewtransition.cpp | 86 +++++++++++++++------- src/quick/items/qquickitemviewtransition_p.h | 8 +- .../qquickgridview/data/multipleDisplaced.qml | 81 ++++++++++++++++++++ .../quick/qquickgridview/tst_qquickgridview.cpp | 50 +++++++++++++ .../qquicklistview/data/multipleDisplaced.qml | 78 ++++++++++++++++++++ .../quick/qquicklistview/tst_qquicklistview.cpp | 51 +++++++++++++ 6 files changed, 326 insertions(+), 28 deletions(-) create mode 100644 tests/auto/quick/qquickgridview/data/multipleDisplaced.qml create mode 100644 tests/auto/quick/qquicklistview/data/multipleDisplaced.qml diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp index d9dce49349..823269bfc1 100644 --- a/src/quick/items/qquickitemviewtransition.cpp +++ b/src/quick/items/qquickitemviewtransition.cpp @@ -333,6 +333,8 @@ QQuickItemViewTransitionableItem::QQuickItemViewTransitionableItem(QQuickItem *i , nextTransitionType(QQuickItemViewTransitioner::NoTransition) , isTransitionTarget(false) , nextTransitionToSet(false) + , nextTransitionFromSet(false) + , lastMovedToSet(false) , prepared(false) { } @@ -367,12 +369,17 @@ qreal QQuickItemViewTransitionableItem::itemY() const void QQuickItemViewTransitionableItem::moveTo(const QPointF &pos, bool immediate) { + if (!nextTransitionFromSet && nextTransitionType != QQuickItemViewTransitioner::NoTransition) { + nextTransitionFrom = item->pos(); + nextTransitionFromSet = true; + } + + lastMovedTo = pos; + lastMovedToSet = true; + if (immediate || !transitionScheduledOrRunning()) { - if (immediate) { - if (transition) - transition->cancel(); - resetTransitionData(); - } + if (immediate) + stopTransition(); item->setPos(pos); } else { nextTransitionTo = pos; @@ -402,17 +409,27 @@ bool QQuickItemViewTransitionableItem::isPendingRemoval() const bool QQuickItemViewTransitionableItem::prepareTransition(QQuickItemViewTransitioner *transitioner, int index, const QRectF &viewBounds) { - bool doTransition = false; + if (nextTransitionType == QQuickItemViewTransitioner::NoTransition) + return false; + + if (isTransitionTarget) { + // If item is not already moving somewhere, set it to not move anywhere. + // This ensures that removed targets don't transition to the default (0,0) and that + // items set for other transition types only transition if they actually move somewhere. + if (!nextTransitionToSet) + moveTo(item->pos()); + } else { + // don't start displaced transitions that don't move anywhere + if (!nextTransitionToSet || (nextTransitionFromSet && nextTransitionFrom == nextTransitionTo)) { + clearCurrentScheduledTransition(); + return false; + } + } - // If item is not already moving somewhere, set it to not move anywhere. - // This ensures that removed targets don't transition to the default (0,0) and that - // items set for other transition types only transition if they actually move somewhere. - if (nextTransitionType != QQuickItemViewTransitioner::NoTransition && !nextTransitionToSet) - moveTo(item->pos()); + bool doTransition = false; // For move transitions (both target and displaced) and displaced transitions of other // types, only run the transition if the item is actually moving to another position. - switch (nextTransitionType) { case QQuickItemViewTransitioner::NoTransition: { @@ -465,10 +482,8 @@ bool QQuickItemViewTransitionableItem::prepareTransition(QQuickItemViewTransitio if (!doTransition) { // if transition type is not valid, the previous transition still has to be // canceled so that the item can move immediately to the right position - if (transition) - transition->cancel(); item->setPos(nextTransitionTo); - resetTransitionData(); + stopTransition(); } prepared = true; @@ -490,14 +505,8 @@ void QQuickItemViewTransitionableItem::startTransition(QQuickItemViewTransitione transition = new QQuickItemViewTransitionJob; } - // if item is not already moving somewhere, set it to not move anywhere - // so that removed items do not move to the default (0,0) - if (!nextTransitionToSet) - moveTo(item->pos()); - transition->startTransition(this, index, transitioner, nextTransitionType, nextTransitionTo, isTransitionTarget); - nextTransitionType = QQuickItemViewTransitioner::NoTransition; - prepared = false; + clearCurrentScheduledTransition(); } void QQuickItemViewTransitionableItem::setNextTransition(QQuickItemViewTransitioner::TransitionType type, bool isTargetItem) @@ -507,27 +516,50 @@ void QQuickItemViewTransitionableItem::setNextTransition(QQuickItemViewTransitio // to calculate positions for transitions for other items in the view. nextTransitionType = type; isTransitionTarget = isTargetItem; + + if (!nextTransitionFromSet && lastMovedToSet) { + nextTransitionFrom = lastMovedTo; + nextTransitionFromSet = true; + } } bool QQuickItemViewTransitionableItem::transitionWillChangePosition() const { if (transitionRunning() && transition->m_toPos != nextTransitionTo) return true; - return nextTransitionTo != item->pos(); + if (!nextTransitionFromSet) + return false; + return nextTransitionTo != nextTransitionFrom; } -void QQuickItemViewTransitionableItem::finishedTransition() +void QQuickItemViewTransitionableItem::resetNextTransitionPos() { nextTransitionToSet = false; nextTransitionTo = QPointF(); } -void QQuickItemViewTransitionableItem::resetTransitionData() +void QQuickItemViewTransitionableItem::finishedTransition() +{ + resetNextTransitionPos(); +} + +void QQuickItemViewTransitionableItem::clearCurrentScheduledTransition() { + // Just clear the current scheduled transition - don't touch the nextTransitionTo + // which may have already been set for a previously scheduled transition + nextTransitionType = QQuickItemViewTransitioner::NoTransition; isTransitionTarget = false; - nextTransitionTo = QPointF(); - nextTransitionToSet = false; + prepared = false; + nextTransitionFromSet = false; +} + +void QQuickItemViewTransitionableItem::stopTransition() +{ + if (transition) + transition->cancel(); + clearCurrentScheduledTransition(); + resetNextTransitionPos(); } diff --git a/src/quick/items/qquickitemviewtransition_p.h b/src/quick/items/qquickitemviewtransition_p.h index a4babdca05..9e17385c46 100644 --- a/src/quick/items/qquickitemviewtransition_p.h +++ b/src/quick/items/qquickitemviewtransition_p.h @@ -142,11 +142,15 @@ public: void startTransition(QQuickItemViewTransitioner *transitioner, int index); QPointF nextTransitionTo; + QPointF lastMovedTo; + QPointF nextTransitionFrom; QQuickItem *item; QQuickItemViewTransitionJob *transition; QQuickItemViewTransitioner::TransitionType nextTransitionType; bool isTransitionTarget; bool nextTransitionToSet; + bool nextTransitionFromSet; + bool lastMovedToSet; bool prepared; private: @@ -155,7 +159,9 @@ private: void setNextTransition(QQuickItemViewTransitioner::TransitionType, bool isTargetItem); bool transitionWillChangePosition() const; void finishedTransition(); - void resetTransitionData(); + void resetNextTransitionPos(); + void clearCurrentScheduledTransition(); + void stopTransition(); }; diff --git a/tests/auto/quick/qquickgridview/data/multipleDisplaced.qml b/tests/auto/quick/qquickgridview/data/multipleDisplaced.qml new file mode 100644 index 0000000000..7c48bf39ae --- /dev/null +++ b/tests/auto/quick/qquickgridview/data/multipleDisplaced.qml @@ -0,0 +1,81 @@ +import QtQuick 2.0 + +Rectangle { + id: root + width: 500 + height: 600 + + property int duration: 10 + property int count: grid.count + + Component { + id: myDelegate + Rectangle { + id: wrapper + + property string nameData: name + + objectName: "wrapper" + width: 80 + height: 60 + border.width: 1 + Column { + Text { text: index } + Text { + text: wrapper.x + ", " + wrapper.y + } + Text { + id: textName + objectName: "textName" + text: name + } + } + color: GridView.isCurrentItem ? "lightsteelblue" : "white" + } + } + + GridView { + id: grid + + property var displaceTransitionsStarted: new Object() + property bool displaceTransitionsDone: false + + objectName: "grid" + focus: true + anchors.centerIn: parent + width: 240 + height: 320 + cellWidth: 80 + cellHeight: 60 + model: testModel + delegate: myDelegate + + displaced: Transition { + id: transition + SequentialAnimation { + ScriptAction { + script: { + var name = transition.ViewTransition.item.nameData + if (grid.displaceTransitionsStarted[name] == undefined) + grid.displaceTransitionsStarted[name] = 0 + grid.displaceTransitionsStarted[name] += 1 + } + } + NumberAnimation { + properties: "x,y" + duration: root.duration + easing.type: Easing.OutBounce + easing.amplitude: 10.0 // longer-lasting bounce to trigger bug + } + PropertyAction { target: grid; property: "displaceTransitionsDone"; value: true } + } + } + } + + Rectangle { + anchors.fill: grid + color: "lightsteelblue" + opacity: 0.2 + } +} + diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index 04bdfc8ac3..f33883c8e3 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -142,6 +142,7 @@ private slots: void displacedTransitions_data(); void multipleTransitions(); void multipleTransitions_data(); + void multipleDisplaced(); private: QList toIntList(const QVariantList &list); @@ -4975,6 +4976,55 @@ void tst_QQuickGridView::multipleTransitions_data() << true << true << false << false; } +void tst_QQuickGridView::multipleDisplaced() +{ + // multiple move() operations should only restart displace transitions for items that + // moved from previously set positions, and not those that have moved from their current + // item positions (which may e.g. still be changing from easing bounces in the last transition) + + QmlListModel model; + for (int i = 0; i < 30; i++) + model.addItem("Original item" + QString::number(i), ""); + + QQuickView *canvas = createView(); + QQmlContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + canvas->setSource(testFileUrl("multipleDisplaced.qml")); + canvas->show(); + QTest::qWaitForWindowShown(canvas); + + QQuickGridView *gridview = findItem(canvas->rootObject(), "grid"); + QTRY_VERIFY(gridview != 0); + QQuickItem *contentItem = gridview->contentItem(); + QVERIFY(contentItem != 0); + QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); + + model.moveItems(12, 8, 1); + QTest::qWait(canvas->rootObject()->property("duration").toInt() / 2); + model.moveItems(8, 3, 1); + QTRY_VERIFY(gridview->property("displaceTransitionsDone").toBool()); + + QVariantMap transitionsStarted = gridview->property("displaceTransitionsStarted").toMap(); + foreach (const QString &name, transitionsStarted.keys()) { + QVERIFY2(transitionsStarted[name] == 1, + QTest::toString(QString("%1 was displaced %2 times").arg(name).arg(transitionsStarted[name].toInt()))); + } + + // verify all items moved to the correct final positions + QList items = findItems(contentItem, "wrapper"); + for (int i=0; i < model.count() && i < items.count(); ++i) { + QQuickItem *item = findItem(contentItem, "wrapper", i); + QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); + QTRY_COMPARE(item->x(), (i%3)*80.0); + QTRY_COMPARE(item->y(), (i/3)*60.0); + QQuickText *name = findItem(contentItem, "textName", i); + QVERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); + } + + delete canvas; +} + void tst_QQuickGridView::cacheBuffer() { QQuickView *canvas = createView(); diff --git a/tests/auto/quick/qquicklistview/data/multipleDisplaced.qml b/tests/auto/quick/qquicklistview/data/multipleDisplaced.qml new file mode 100644 index 0000000000..e315270360 --- /dev/null +++ b/tests/auto/quick/qquicklistview/data/multipleDisplaced.qml @@ -0,0 +1,78 @@ +import QtQuick 2.0 + +Rectangle { + id: root + width: 500 + height: 600 + + property int duration: 10 + property int count: list.count + + Component { + id: myDelegate + Rectangle { + id: wrapper + + property string nameData: name + + objectName: "wrapper" + height: 20 + width: 240 + Text { text: index } + Text { + x: 30 + id: textName + objectName: "textName" + text: name + } + Text { + x: 200 + text: wrapper.y + } + color: ListView.isCurrentItem ? "lightsteelblue" : "white" + } + } + + ListView { + id: list + + property var displaceTransitionsStarted: new Object() + property bool displaceTransitionsDone: false + + objectName: "list" + focus: true + anchors.centerIn: parent + width: 240 + height: 320 + model: testModel + delegate: myDelegate + + displaced: Transition { + id: transition + SequentialAnimation { + ScriptAction { + script: { + var name = transition.ViewTransition.item.nameData + if (list.displaceTransitionsStarted[name] == undefined) + list.displaceTransitionsStarted[name] = 0 + list.displaceTransitionsStarted[name] += 1 + } + } + NumberAnimation { + properties: "x,y" + duration: root.duration + easing.type: Easing.OutBounce + easing.amplitude: 10.0 // longer-lasting bounce to trigger bug + } + PropertyAction { target: list; property: "displaceTransitionsDone"; value: true } + } + } + } + + Rectangle { + anchors.fill: list + color: "lightsteelblue" + opacity: 0.2 + } +} + diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index c038faa0f1..037d9e9b7f 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -183,6 +183,7 @@ private slots: void displacedTransitions_data(); void multipleTransitions(); void multipleTransitions_data(); + void multipleDisplaced(); void flickBeyondBounds(); @@ -5977,6 +5978,56 @@ void tst_QQuickListView::multipleTransitions_data() << true << true << false << false; } +void tst_QQuickListView::multipleDisplaced() +{ + // multiple move() operations should only restart displace transitions for items that + // moved from previously set positions, and not those that have moved from their current + // item positions (which may e.g. still be changing from easing bounces in the last transition) + + QmlListModel model; + for (int i = 0; i < 30; i++) + model.addItem("Original item" + QString::number(i), ""); + + QQuickView *canvas = createView(); + QQmlContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testObject", new TestObject(canvas)); + canvas->setSource(testFileUrl("multipleDisplaced.qml")); + canvas->show(); + QTest::qWaitForWindowShown(canvas); + + QQuickListView *listview = findItem(canvas->rootObject(), "list"); + QTRY_VERIFY(listview != 0); + QQuickItem *contentItem = listview->contentItem(); + QVERIFY(contentItem != 0); + QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); + + model.moveItems(12, 8, 1); + QTest::qWait(canvas->rootObject()->property("duration").toInt() / 2); + model.moveItems(8, 3, 1); + QTRY_VERIFY(listview->property("displaceTransitionsDone").toBool()); + + QVariantMap transitionsStarted = listview->property("displaceTransitionsStarted").toMap(); + foreach (const QString &name, transitionsStarted.keys()) { + QVERIFY2(transitionsStarted[name] == 1, + QTest::toString(QString("%1 was displaced %2 times").arg(name).arg(transitionsStarted[name].toInt()))); + } + + // verify all items moved to the correct final positions + QList items = findItems(contentItem, "wrapper"); + for (int i=0; i < model.count() && i < items.count(); ++i) { + QQuickItem *item = findItem(contentItem, "wrapper", i); + QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); + QTRY_COMPARE(item->x(), 0.0); + QTRY_COMPARE(item->y(), i*20.0); + QQuickText *name = findItem(contentItem, "textName", i); + QVERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); + } + + delete canvas; +} + QList tst_QQuickListView::toIntList(const QVariantList &list) { QList ret; -- cgit v1.2.3 From c71db2cf825086e6de0735cfea19c5c7e851def4 Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Mon, 12 Mar 2012 13:39:45 +1000 Subject: Fix leak in tst_qquicklistmodel unit test Change-Id: I6883f263648d425240503f6abbd358b744d68506 Reviewed-by: Glenn Watson --- tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp b/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp index 8d6237679f..bf26452f0e 100644 --- a/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp +++ b/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp @@ -990,6 +990,8 @@ void tst_qquicklistmodel::get_worker() QCOMPARE(spyResult.at(0).toInt(), index); QCOMPARE(spyResult.at(1).toInt(), 1); // only 1 item is modified at a time QVERIFY(spyResult.at(2).value >().contains(role)); + + delete item; } void tst_qquicklistmodel::get_worker_data() -- cgit v1.2.3 From a4d22cbb388f0d304f68997b4e071b88f93fdbdf Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 12 Mar 2012 17:55:38 +1000 Subject: ListView.contentHeight does not include header and footer item heights Task-number: QTBUG-24664 Change-Id: I2a2fe144835e61665b8693d58ca4fb9ba506e8a8 Reviewed-by: Bea Lam --- src/quick/items/qquickitemview.cpp | 5 +++-- tests/auto/quick/qquickgridview/tst_qquickgridview.cpp | 10 ++++++++++ tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | 10 ++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp index c6f45aaf0b..501b206ef6 100644 --- a/src/quick/items/qquickitemview.cpp +++ b/src/quick/items/qquickitemview.cpp @@ -1658,10 +1658,11 @@ void QQuickItemViewPrivate::updateViewport() { Q_Q(QQuickItemView); if (isValid()) { + qreal extra = headerSize() + footerSize(); if (layoutOrientation() == Qt::Vertical) - q->setContentHeight(endPosition() - startPosition()); + q->setContentHeight(endPosition() - startPosition() + extra); else - q->setContentWidth(endPosition() - startPosition()); + q->setContentWidth(endPosition() - startPosition() + extra); } } diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index f33883c8e3..fe534e4565 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -2810,6 +2810,11 @@ void tst_QQuickGridView::footer() QCOMPARE(footer->height(), 30.); QCOMPARE(QPointF(gridview->contentX(), gridview->contentY()), initialContentPos); + if (flow == QQuickGridView::LeftToRight) + QCOMPARE(gridview->contentHeight(), (model.count()+2) / 3 * 60. + footer->height()); + else + QCOMPARE(gridview->contentWidth(), (model.count()+3) / 5 * 80. + footer->width()); + QQuickItem *item = findItem(contentItem, "wrapper", 0); QVERIFY(item); QCOMPARE(item->pos(), firstDelegatePos); @@ -2971,6 +2976,11 @@ void tst_QQuickGridView::header() QCOMPARE(header->height(), 30.); QCOMPARE(QPointF(gridview->contentX(), gridview->contentY()), initialContentPos); + if (flow == QQuickGridView::LeftToRight) + QCOMPARE(gridview->contentHeight(), (model.count()+2) / 3 * 60. + header->height()); + else + QCOMPARE(gridview->contentWidth(), (model.count()+3) / 5 * 80. + header->width()); + QQuickItem *item = findItem(contentItem, "wrapper", 0); QVERIFY(item); QCOMPARE(item->pos(), firstDelegatePos); diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 037d9e9b7f..1584bc34b1 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -3057,6 +3057,11 @@ void tst_QQuickListView::header() QCOMPARE(header->pos(), initialHeaderPos); QCOMPARE(QPointF(listview->contentX(), listview->contentY()), initialContentPos); + if (orientation == QQuickListView::Vertical) + QCOMPARE(listview->contentHeight(), model.count() * 30. + header->height()); + else + QCOMPARE(listview->contentWidth(), model.count() * 240. + header->width()); + QQuickItem *item = findItem(contentItem, "wrapper", 0); QVERIFY(item); QCOMPARE(item->pos(), firstDelegatePos); @@ -3241,6 +3246,11 @@ void tst_QQuickListView::footer() QCOMPARE(footer->height(), 30.); QCOMPARE(QPointF(listview->contentX(), listview->contentY()), initialContentPos); + if (orientation == QQuickListView::Vertical) + QCOMPARE(listview->contentHeight(), model.count() * 20. + footer->height()); + else + QCOMPARE(listview->contentWidth(), model.count() * 40. + footer->width()); + QQuickItem *item = findItem(contentItem, "wrapper", 0); QVERIFY(item); QCOMPARE(item->pos(), firstDelegatePos); -- cgit v1.2.3 From c53f6093a7f0f463aad88d5c8527474f164fab20 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 29 Feb 2012 15:36:21 +1000 Subject: testlib: Improve verbose and XPASS output Call only the eight-argument version of QTestResult::compare(), as the four-argument version will soon be removed from the API. Change-Id: I9e7b95a30b01fb5e084f2954aeb380b492760484 Reviewed-by: Rohan McGovern --- src/qmltest/quicktestresult.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/qmltest/quicktestresult.cpp b/src/qmltest/quicktestresult.cpp index 33c5fef96a..d33eab4943 100644 --- a/src/qmltest/quicktestresult.cpp +++ b/src/qmltest/quicktestresult.cpp @@ -379,18 +379,12 @@ bool QuickTestResult::compare const QString &val1, const QString &val2, const QUrl &location, int line) { - if (success) { - return QTestResult::compare - (success, message.toLocal8Bit().constData(), - qtestFixUrl(location).toLatin1().constData(), line); - } else { - return QTestResult::compare - (success, message.toLocal8Bit().constData(), - QTest::toString(val1.toLatin1().constData()), - QTest::toString(val2.toLatin1().constData()), - "", "", - qtestFixUrl(location).toLatin1().constData(), line); - } + return QTestResult::compare + (success, message.toLocal8Bit().constData(), + QTest::toString(val1.toLatin1().constData()), + QTest::toString(val2.toLatin1().constData()), + "", "", + qtestFixUrl(location).toLatin1().constData(), line); } void QuickTestResult::skip -- cgit v1.2.3 From 648c80c4c0759efb6e35fac7acc8daad5aab13e2 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 13 Mar 2012 10:32:48 +1000 Subject: Speed up view flick tests. Change-Id: I98b0a45b5afd0150bfacef2c1c1e814f70ae042f Reviewed-by: Bea Lam --- .../auto/quick/qquickgridview/data/snapOneRow.qml | 2 +- tests/auto/quick/qquickgridview/data/snapToRow.qml | 2 +- .../quick/qquickgridview/tst_qquickgridview.cpp | 35 +++++++++++----------- .../auto/quick/qquicklistview/data/snapToItem.qml | 2 +- .../quick/qquicklistview/tst_qquicklistview.cpp | 14 ++++----- 5 files changed, 26 insertions(+), 29 deletions(-) diff --git a/tests/auto/quick/qquickgridview/data/snapOneRow.qml b/tests/auto/quick/qquickgridview/data/snapOneRow.qml index 3d32d75c45..597c5efa9c 100644 --- a/tests/auto/quick/qquickgridview/data/snapOneRow.qml +++ b/tests/auto/quick/qquickgridview/data/snapOneRow.qml @@ -37,7 +37,7 @@ Rectangle { flow: GridView.TopToBottom highlightRangeMode: GridView.StrictlyEnforceRange highlight: Rectangle { width: 120; height: 120; color: "yellow" } - model: 10 + model: 8 delegate: myDelegate } diff --git a/tests/auto/quick/qquickgridview/data/snapToRow.qml b/tests/auto/quick/qquickgridview/data/snapToRow.qml index f079a048f0..e3963b0c4a 100644 --- a/tests/auto/quick/qquickgridview/data/snapToRow.qml +++ b/tests/auto/quick/qquickgridview/data/snapToRow.qml @@ -37,7 +37,7 @@ Rectangle { flow: GridView.TopToBottom highlightRangeMode: GridView.StrictlyEnforceRange highlight: Rectangle { width: 80; height: 80; color: "yellow" } - model: 54 + model: 39 delegate: myDelegate } diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index fe534e4565..7d004915a6 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -694,8 +694,7 @@ void tst_QQuickGridView::removed() QTRY_VERIFY(gridview->currentItem() != oldCurrent); gridview->setContentY(0); - // let transitions settle. - QTest::qWait(300); + QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); // Confirm items positioned correctly itemCount = findItems(contentItem, "wrapper").count(); @@ -969,7 +968,7 @@ void tst_QQuickGridView::addOrRemoveBeforeVisible() QTRY_COMPARE(gridview->currentIndex(), 24); QTRY_COMPARE(gridview->contentY(), 220.0); - QTest::qWait(100); // wait for refill to complete + QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QTRY_VERIFY(!findItem(contentItem, "wrapper", 0)); // 0 shouldn't be visible if (doAdd) { @@ -3574,22 +3573,22 @@ void tst_QQuickGridView::snapToRow_data() QTest::addColumn("startExtent"); QTest::newRow("vertical, left to right") << QQuickGridView::LeftToRight << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange) - << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 1200.0 << 0.0; + << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 800.0 << 0.0; QTest::newRow("horizontal, left to right") << QQuickGridView::TopToBottom << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange) - << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 1200.0 << 0.0; + << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 800.0 << 0.0; QTest::newRow("horizontal, right to left") << QQuickGridView::TopToBottom << Qt::RightToLeft << int(QQuickItemView::NoHighlightRange) - << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -1200.0 - 240.0 << -240.0; + << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -800.0 - 240.0 << -240.0; QTest::newRow("vertical, left to right, enforce range") << QQuickGridView::LeftToRight << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 1340.0 << -20.0; + << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 940.0 << -20.0; QTest::newRow("horizontal, left to right, enforce range") << QQuickGridView::TopToBottom << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 1340.0 << -20.0; + << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 940.0 << -20.0; QTest::newRow("horizontal, right to left, enforce range") << QQuickGridView::TopToBottom << Qt::RightToLeft << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -1200.0 - 240.0 - 140.0 << -220.0; + << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -800.0 - 240.0 - 140.0 << -220.0; } void tst_QQuickGridView::snapToRow() @@ -3669,22 +3668,22 @@ void tst_QQuickGridView::snapOneRow_data() QTest::addColumn("startExtent"); QTest::newRow("vertical, left to right") << QQuickGridView::LeftToRight << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange) - << QPoint(20, 200) << QPoint(20, 20) << 100.0 << 360.0 << 0.0; + << QPoint(20, 200) << QPoint(20, 20) << 100.0 << 240.0 << 0.0; QTest::newRow("horizontal, left to right") << QQuickGridView::TopToBottom << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange) - << QPoint(200, 20) << QPoint(20, 20) << 100.0 << 360.0 << 0.0; + << QPoint(200, 20) << QPoint(20, 20) << 100.0 << 240.0 << 0.0; QTest::newRow("horizontal, right to left") << QQuickGridView::TopToBottom << Qt::RightToLeft << int(QQuickItemView::NoHighlightRange) - << QPoint(20, 20) << QPoint(200, 20) << -340.0 << -360.0 - 240.0 << -240.0; + << QPoint(20, 20) << QPoint(200, 20) << -340.0 << -240.0 - 240.0 << -240.0; QTest::newRow("vertical, left to right, enforce range") << QQuickGridView::LeftToRight << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(20, 200) << QPoint(20, 20) << 100.0 << 460.0 << -20.0; + << QPoint(20, 200) << QPoint(20, 20) << 100.0 << 340.0 << -20.0; QTest::newRow("horizontal, left to right, enforce range") << QQuickGridView::TopToBottom << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(200, 20) << QPoint(20, 20) << 100.0 << 460.0 << -20.0; + << QPoint(200, 20) << QPoint(20, 20) << 100.0 << 340.0 << -20.0; QTest::newRow("horizontal, right to left, enforce range") << QQuickGridView::TopToBottom << Qt::RightToLeft << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(20, 20) << QPoint(200, 20) << -340.0 << -360.0 - 240.0 - 100.0 << -220.0; + << QPoint(20, 20) << QPoint(200, 20) << -340.0 << -240.0 - 240.0 - 100.0 << -220.0; } void tst_QQuickGridView::snapOneRow() @@ -3739,8 +3738,8 @@ void tst_QQuickGridView::snapOneRow() : layoutDirection == Qt::LeftToRight ? !gridview->isAtXEnd() : !gridview->isAtXBeginning()); if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) { - QCOMPARE(gridview->currentIndex(), 8); - QCOMPARE(currentIndexSpy.count(), 4); + QCOMPARE(gridview->currentIndex(), 6); + QCOMPARE(currentIndexSpy.count(), 3); } if (flow == QQuickGridView::LeftToRight) @@ -3763,7 +3762,7 @@ void tst_QQuickGridView::snapOneRow() if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) { QCOMPARE(gridview->currentIndex(), 0); - QCOMPARE(currentIndexSpy.count(), 8); + QCOMPARE(currentIndexSpy.count(), 6); } delete canvas; diff --git a/tests/auto/quick/qquicklistview/data/snapToItem.qml b/tests/auto/quick/qquicklistview/data/snapToItem.qml index 6f201072f0..91d31adfc7 100644 --- a/tests/auto/quick/qquicklistview/data/snapToItem.qml +++ b/tests/auto/quick/qquicklistview/data/snapToItem.qml @@ -37,7 +37,7 @@ Rectangle { layoutDirection: Qt.RightToLeft highlightRangeMode: ListView.StrictlyEnforceRange highlight: Rectangle { width: 80; height: 80; color: "yellow" } - model: 18 + model: 10 delegate: myDelegate } diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 1584bc34b1..1a494183a8 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -827,7 +827,6 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) listview->setContentY(20); // That's the top now // let transitions settle. QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); - QTest::qWait(300); // Confirm items positioned correctly itemCount = findItems(contentItem, "wrapper").count(); @@ -858,7 +857,6 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) listview->setContentY(80); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); - QTest::qWait(300); // remove all visible items model.removeItems(1, 18); @@ -4251,22 +4249,22 @@ void tst_QQuickListView::snapToItem_data() QTest::addColumn("startExtent"); QTest::newRow("vertical, left to right") << QQuickListView::Vertical << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange) - << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 1200.0 << 0.0; + << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 560.0 << 0.0; QTest::newRow("horizontal, left to right") << QQuickListView::Horizontal << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange) - << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 1200.0 << 0.0; + << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 560.0 << 0.0; QTest::newRow("horizontal, right to left") << QQuickListView::Horizontal << Qt::RightToLeft << int(QQuickItemView::NoHighlightRange) - << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -1200.0 - 240.0 << -240.0; + << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -560.0 - 240.0 << -240.0; QTest::newRow("vertical, left to right, enforce range") << QQuickListView::Vertical << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 1340.0 << -20.0; + << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 700.0 << -20.0; QTest::newRow("horizontal, left to right, enforce range") << QQuickListView::Horizontal << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 1340.0 << -20.0; + << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 700.0 << -20.0; QTest::newRow("horizontal, right to left, enforce range") << QQuickListView::Horizontal << Qt::RightToLeft << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -1200.0 - 240.0 - 140.0 << -220.0; + << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -560.0 - 240.0 - 140.0 << -220.0; } void tst_QQuickListView::snapToItem() -- cgit v1.2.3