From 07317b5c3767eb4fc2ca560bb11158be21772686 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 10 Nov 2009 16:00:54 +1000 Subject: Fix QmlTimer to be in line with animation API changes --- src/declarative/util/qmltimer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/util/qmltimer.cpp b/src/declarative/util/qmltimer.cpp index 8ee9059..c1b3504 100644 --- a/src/declarative/util/qmltimer.cpp +++ b/src/declarative/util/qmltimer.cpp @@ -271,7 +271,7 @@ void QmlTimer::ticked() emit triggered(); } -void QmlTimer::stateChanged(QAbstractAnimation::State, QAbstractAnimation::State state) +void QmlTimer::stateChanged(QAbstractAnimation::State state, QAbstractAnimation::State) { Q_D(QmlTimer); if (d->running && state != QAbstractAnimation::Running) { -- cgit v0.12 From 0a2103fee15312b0959cf33849a199b3de67d995 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Tue, 10 Nov 2009 16:19:42 +1000 Subject: Flickable autotests --- tests/auto/declarative/declarative.pro | 1 + .../qmlgraphicsflickable/data/flickable01.qml | 4 + .../qmlgraphicsflickable/data/flickable02.qml | 14 ++ .../qmlgraphicsflickable/data/flickable03.qml | 14 ++ .../qmlgraphicsflickable/data/flickable04.qml | 16 +++ .../qmlgraphicsflickable/qmlgraphicsflickable.pro | 8 ++ .../tst_qmlgraphicsflickable.cpp | 145 +++++++++++++++++++++ 7 files changed, 202 insertions(+) create mode 100644 tests/auto/declarative/qmlgraphicsflickable/data/flickable01.qml create mode 100644 tests/auto/declarative/qmlgraphicsflickable/data/flickable02.qml create mode 100644 tests/auto/declarative/qmlgraphicsflickable/data/flickable03.qml create mode 100644 tests/auto/declarative/qmlgraphicsflickable/data/flickable04.qml create mode 100644 tests/auto/declarative/qmlgraphicsflickable/qmlgraphicsflickable.pro create mode 100644 tests/auto/declarative/qmlgraphicsflickable/tst_qmlgraphicsflickable.cpp diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 6e975de..930eb09 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -24,6 +24,7 @@ SUBDIRS += \ qmlfontloader \ # Cover qmlgraphicsitem \ # Cover qmlgraphicsborderimage \ # Cover + qmlgraphicsflickable \ # Cover qmlgraphicsflipable \ # Cover qmlgraphicsparticles \ # Cover qmlgraphicspositioners \ # Cover diff --git a/tests/auto/declarative/qmlgraphicsflickable/data/flickable01.qml b/tests/auto/declarative/qmlgraphicsflickable/data/flickable01.qml new file mode 100644 index 0000000..8a1843c --- /dev/null +++ b/tests/auto/declarative/qmlgraphicsflickable/data/flickable01.qml @@ -0,0 +1,4 @@ +import Qt 4.6 + +Flickable { +} diff --git a/tests/auto/declarative/qmlgraphicsflickable/data/flickable02.qml b/tests/auto/declarative/qmlgraphicsflickable/data/flickable02.qml new file mode 100644 index 0000000..cf98dd9 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicsflickable/data/flickable02.qml @@ -0,0 +1,14 @@ +import Qt 4.6 + +Flickable { + width: 100; height: 100 + viewportWidth: row.width; viewportHeight: row.height + + Row { + id: row + Repeater { + model: 4 + Rectangle { width: 200; height: 300; color: dayColor } + } + } +} diff --git a/tests/auto/declarative/qmlgraphicsflickable/data/flickable03.qml b/tests/auto/declarative/qmlgraphicsflickable/data/flickable03.qml new file mode 100644 index 0000000..001bf2f --- /dev/null +++ b/tests/auto/declarative/qmlgraphicsflickable/data/flickable03.qml @@ -0,0 +1,14 @@ +import Qt 4.6 + +Flickable { + width: 100; height: 100 + viewportWidth: column.width; viewportHeight: column.height + + Column { + id: column + Repeater { + model: 4 + Rectangle { width: 200; height: 300; color: dayColor } + } + } +} diff --git a/tests/auto/declarative/qmlgraphicsflickable/data/flickable04.qml b/tests/auto/declarative/qmlgraphicsflickable/data/flickable04.qml new file mode 100644 index 0000000..5a27869 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicsflickable/data/flickable04.qml @@ -0,0 +1,16 @@ +import Qt 4.6 + +Flickable { + width: 100; height: 100 + viewportWidth: column.width; viewportHeight: column.height + pressDelay: 200; overShoot: false; interactive: false + maximumFlickVelocity: 2000 + + Column { + id: column + Repeater { + model: 4 + Rectangle { width: 200; height: 300; color: dayColor } + } + } +} diff --git a/tests/auto/declarative/qmlgraphicsflickable/qmlgraphicsflickable.pro b/tests/auto/declarative/qmlgraphicsflickable/qmlgraphicsflickable.pro new file mode 100644 index 0000000..7c4c959 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicsflickable/qmlgraphicsflickable.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_qmlgraphicsflickable.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicsflickable/tst_qmlgraphicsflickable.cpp b/tests/auto/declarative/qmlgraphicsflickable/tst_qmlgraphicsflickable.cpp new file mode 100644 index 0000000..b11de80 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicsflickable/tst_qmlgraphicsflickable.cpp @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#include +#include +#include +#include + +class tst_qmlgraphicsflickable : public QObject +{ + Q_OBJECT +public: + tst_qmlgraphicsflickable(); + +private slots: + void create(); + void horizontalViewportSize(); + void verticalViewportSize(); + void properties(); + +private: + QmlEngine engine; +}; + +tst_qmlgraphicsflickable::tst_qmlgraphicsflickable() +{ +} + +void tst_qmlgraphicsflickable::create() +{ + QmlEngine engine; + QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/flickable01.qml")); + QmlGraphicsFlickable *obj = qobject_cast(c.create()); + + QVERIFY(obj != 0); + QCOMPARE(obj->isAtXBeginning(), true); + QCOMPARE(obj->isAtXEnd(), false); + QCOMPARE(obj->isAtYBeginning(), true); + QCOMPARE(obj->isAtYEnd(), false); + QCOMPARE(obj->viewportX(), 0.); + QCOMPARE(obj->viewportY(), 0.); + + QCOMPARE(obj->horizontalVelocity(), 0.); + QCOMPARE(obj->verticalVelocity(), 0.); + QCOMPARE(obj->reportedVelocitySmoothing(), 100.); + + QCOMPARE(obj->isInteractive(), true); + QCOMPARE(obj->overShoot(), true); + QCOMPARE(obj->pressDelay(), 0); + QCOMPARE(obj->maximumFlickVelocity(), 5000.); + + delete obj; +} + +void tst_qmlgraphicsflickable::horizontalViewportSize() +{ + QmlEngine engine; + QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/flickable02.qml")); + QmlGraphicsFlickable *obj = qobject_cast(c.create()); + + QVERIFY(obj != 0); + QCOMPARE(obj->viewportWidth(), 800.); + QCOMPARE(obj->viewportHeight(), 300.); + QCOMPARE(obj->isAtXBeginning(), true); + QCOMPARE(obj->isAtXEnd(), false); + QCOMPARE(obj->isAtYBeginning(), true); + QCOMPARE(obj->isAtYEnd(), false); + + delete obj; +} + +void tst_qmlgraphicsflickable::verticalViewportSize() +{ + QmlEngine engine; + QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/flickable03.qml")); + QmlGraphicsFlickable *obj = qobject_cast(c.create()); + + QVERIFY(obj != 0); + QCOMPARE(obj->viewportWidth(), 200.); + QCOMPARE(obj->viewportHeight(), 1200.); + QCOMPARE(obj->isAtXBeginning(), true); + QCOMPARE(obj->isAtXEnd(), false); + QCOMPARE(obj->isAtYBeginning(), true); + QCOMPARE(obj->isAtYEnd(), false); + + delete obj; +} + +void tst_qmlgraphicsflickable::properties() +{ + QmlEngine engine; + QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/flickable04.qml")); + QmlGraphicsFlickable *obj = qobject_cast(c.create()); + + QVERIFY(obj != 0); + QCOMPARE(obj->isInteractive(), false); + QCOMPARE(obj->overShoot(), false); + QCOMPARE(obj->pressDelay(), 200); + QCOMPARE(obj->maximumFlickVelocity(), 2000.); + + delete obj; +} + +QTEST_MAIN(tst_qmlgraphicsflickable) + +#include "tst_qmlgraphicsflickable.moc" -- cgit v0.12