aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/gifs
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@theqtcompany.com>2016-03-30 16:34:15 +0200
committerMitch Curtis <mitch.curtis@theqtcompany.com>2016-04-01 12:23:03 +0000
commit335b1fff26ef0c13e1cd1fe697c70d7b8f1a8139 (patch)
tree3f890be1b88ff1ca4383a3fcd6472cf985d61df0 /tests/manual/gifs
parentcb3b2d7dab2f99a559c8dd6d89d43bb81978805d (diff)
Improve documentation for delegate controls
- Add "Delegate Controls" doc page. This will list future delegate controls, such as CheckDelegate, RadioDelegate and SwitchDelegate. - Add GIF for ItemDelegate. Change-Id: If8c66ab2178185f96d190f29ef7815beaa6e8d68 Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com> Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'tests/manual/gifs')
-rw-r--r--tests/manual/gifs/data/qtquickcontrols-itemdelegate.qml64
-rw-r--r--tests/manual/gifs/tst_gifs.cpp35
2 files changed, 99 insertions, 0 deletions
diff --git a/tests/manual/gifs/data/qtquickcontrols-itemdelegate.qml b/tests/manual/gifs/data/qtquickcontrols-itemdelegate.qml
new file mode 100644
index 00000000..413cd085
--- /dev/null
+++ b/tests/manual/gifs/data/qtquickcontrols-itemdelegate.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Window 2.0
+import Qt.labs.controls 1.0
+
+Window {
+ width: column.implicitWidth
+ height: column.implicitHeight
+ visible: true
+
+ property var delegate: repeater.count > 0 ? repeater.itemAt(0) : null
+
+ Column {
+ id: column
+
+ Repeater {
+ id: repeater
+ model: ["Option 1", "Option 2", "Option 3"]
+ delegate: ItemDelegate {
+ checkable: true
+ text: modelData
+ }
+ }
+ }
+}
diff --git a/tests/manual/gifs/tst_gifs.cpp b/tests/manual/gifs/tst_gifs.cpp
index ed5d2956..bc096ccb 100644
--- a/tests/manual/gifs/tst_gifs.cpp
+++ b/tests/manual/gifs/tst_gifs.cpp
@@ -60,6 +60,8 @@ private slots:
void swipeDelegate_data();
void swipeDelegate();
void swipeDelegateBehind();
+ void delegates_data();
+ void delegates();
private:
void moveSmoothly(QQuickWindow *window, const QPoint &from, const QPoint &to, int movements,
@@ -466,6 +468,39 @@ void tst_Gifs::swipeDelegateBehind()
gifRecorder.waitForFinish();
}
+void tst_Gifs::delegates_data()
+{
+ QTest::addColumn<QString>("name");
+ QTest::newRow("ItemDelegate") << "itemdelegate";
+}
+
+void tst_Gifs::delegates()
+{
+ QFETCH(QString, name);
+
+ GifRecorder gifRecorder;
+ gifRecorder.setDataDirPath(dataDirPath);
+ gifRecorder.setOutputDir(outputDir);
+ gifRecorder.setRecordingDuration(5);
+ gifRecorder.setQmlFileName(QString::fromLatin1("qtquickcontrols-%1.qml").arg(name));
+ gifRecorder.setHighQuality(true);
+
+ gifRecorder.start();
+
+ QQuickWindow *window = gifRecorder.window();
+ QQuickItem *delegate = window->property("delegate").value<QQuickItem*>();
+ QVERIFY(delegate);
+
+ const QPoint delegateCenter(delegate->mapToScene(QPointF(delegate->width() / 2, delegate->height() / 2)).toPoint());
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, delegateCenter, 200);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, delegateCenter, 400);
+
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, delegateCenter, 1000);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, delegateCenter, 400);
+
+ gifRecorder.waitForFinish();
+}
+
QTEST_MAIN(tst_Gifs)
#include "tst_gifs.moc"