summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-11-10 06:20:10 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-11-10 06:20:10 (GMT)
commitc1cc01cecc2a3d1589bc3b33f3e369903388b5ac (patch)
tree85c64855d8d1c1e4509d672f76b55d7c39f6bbc7
parent3193b8262f09e6fba602e839cce7ff7fbbbfd1d3 (diff)
parentef4f11f84fcf0108c675a0007b3d59720f261dce (diff)
downloadQt-c1cc01cecc2a3d1589bc3b33f3e369903388b5ac.zip
Qt-c1cc01cecc2a3d1589bc3b33f3e369903388b5ac.tar.gz
Qt-c1cc01cecc2a3d1589bc3b33f3e369903388b5ac.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
-rw-r--r--src/declarative/util/qmltimer.cpp2
-rw-r--r--tests/auto/declarative/declarative.pro1
-rw-r--r--tests/auto/declarative/qmlgraphicsflickable/data/flickable01.qml4
-rw-r--r--tests/auto/declarative/qmlgraphicsflickable/data/flickable02.qml14
-rw-r--r--tests/auto/declarative/qmlgraphicsflickable/data/flickable03.qml14
-rw-r--r--tests/auto/declarative/qmlgraphicsflickable/data/flickable04.qml16
-rw-r--r--tests/auto/declarative/qmlgraphicsflickable/qmlgraphicsflickable.pro8
-rw-r--r--tests/auto/declarative/qmlgraphicsflickable/tst_qmlgraphicsflickable.cpp145
8 files changed, 203 insertions, 1 deletions
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) {
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 <qtest.h>
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <private/qmlgraphicsflickable_p.h>
+#include <private/qmlvaluetype_p.h>
+#include <math.h>
+
+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<QmlGraphicsFlickable*>(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<QmlGraphicsFlickable*>(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<QmlGraphicsFlickable*>(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<QmlGraphicsFlickable*>(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"