aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/gifs
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-11-01 14:40:50 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2016-11-01 20:19:04 +0000
commit6f10ef6e167f4af68439f473842da3b5ea87e4a4 (patch)
tree277166dc185882959fad16dd6113bb19338a5170 /tests/manual/gifs
parent154c5e32af4d59cd04ac907d3f66cb0807ff14e9 (diff)
Doc: add GIF animation for Drawer
Change-Id: Ib4c8b5f80e63a322c20caa837632739a3bfee3ee Task-number: QTBUG-55904 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/manual/gifs')
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-drawer.qml89
-rw-r--r--tests/manual/gifs/tst_gifs.cpp26
2 files changed, 115 insertions, 0 deletions
diff --git a/tests/manual/gifs/data/qtquickcontrols2-drawer.qml b/tests/manual/gifs/data/qtquickcontrols2-drawer.qml
new file mode 100644
index 00000000..49f2cf50
--- /dev/null
+++ b/tests/manual/gifs/data/qtquickcontrols2-drawer.qml
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** 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.Controls 2.0
+import QtQuick.Window 2.0
+
+ApplicationWindow {
+ id: window
+ width: 300
+ height: 300
+ visible: true
+
+ property alias drawer: drawer
+
+ Drawer {
+ id: drawer
+ width: window.width * 0.66
+ height: window.height
+ rightPadding: 0
+
+ Rectangle {
+ border.width: 1
+ anchors.fill: parent
+
+ Label {
+ text: "Drawer"
+ font.pixelSize: 32
+ anchors.centerIn: parent
+ }
+ }
+ }
+
+ Rectangle {
+ border.width: 1
+ anchors.fill: parent
+
+ Label {
+ text: "Content"
+ font.pixelSize: 32
+ anchors.centerIn: parent
+ }
+ }
+
+ Rectangle {
+ z: 1
+ color: "black"
+ width: 1
+ height: parent.height
+ parent: window.overlay
+ }
+}
diff --git a/tests/manual/gifs/tst_gifs.cpp b/tests/manual/gifs/tst_gifs.cpp
index be436b52..c27c522b 100644
--- a/tests/manual/gifs/tst_gifs.cpp
+++ b/tests/manual/gifs/tst_gifs.cpp
@@ -78,6 +78,7 @@ private slots:
void comboBox();
void stackView_data();
void stackView();
+ void drawer();
private:
void moveSmoothly(QQuickWindow *window, const QPoint &from, const QPoint &to, int movements,
@@ -911,6 +912,31 @@ void tst_Gifs::stackView()
gifRecorder.waitForFinish();
}
+void tst_Gifs::drawer()
+{
+ GifRecorder gifRecorder;
+ gifRecorder.setDataDirPath(dataDirPath);
+ gifRecorder.setOutputDir(outputDir);
+ gifRecorder.setRecordingDuration(4);
+ gifRecorder.setHighQuality(true);
+ gifRecorder.setQmlFileName("qtquickcontrols2-drawer.qml");
+
+ gifRecorder.start();
+
+ QQuickWindow *window = gifRecorder.window();
+ QObject *drawer = window->property("drawer").value<QObject*>();
+ qreal width = drawer->property("width").toReal();
+
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(1, 1), 100);
+ moveSmoothly(window, QPoint(1, 1), QPoint(width, 1), width, QEasingCurve::InOutBack, 1);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(width, 1), 30);
+
+ QTest::qWait(1000);
+ QMetaObject::invokeMethod(drawer, "close");
+
+ gifRecorder.waitForFinish();
+}
+
QTEST_MAIN(tst_Gifs)
#include "tst_gifs.moc"