aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2016-10-06 12:29:41 +0200
committerMitch Curtis <mitch.curtis@qt.io>2016-10-06 11:59:35 +0000
commit9e454f556b73c06d935a8059b4374d67655db047 (patch)
tree353572c7e0d2575e8dbacad8e1aac46249242dea /tests
parent7417cd314165144d3eff5cc6fdf87bd2f1acd84e (diff)
ScrollBar: replace PNGs with GIFs
Change-Id: I0c0f23b88c0ce36d43bc31321371508ec63c2903 Task-number: QTBUG-55904 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-scrollbar.qml70
-rw-r--r--tests/manual/gifs/tst_gifs.cpp34
2 files changed, 104 insertions, 0 deletions
diff --git a/tests/manual/gifs/data/qtquickcontrols2-scrollbar.qml b/tests/manual/gifs/data/qtquickcontrols2-scrollbar.qml
new file mode 100644
index 00000000..ce198685
--- /dev/null
+++ b/tests/manual/gifs/data/qtquickcontrols2-scrollbar.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+Window {
+ width: 100
+ height: 120
+ visible: true
+ color: "#eeeeee"
+
+ property alias scrollBar: scrollBar
+
+ ListView {
+ anchors.fill: parent
+
+ ScrollBar.vertical: ScrollBar {
+ id: scrollBar
+ active: true
+ }
+
+ model: 10
+ delegate: Label {
+ text: qsTr("Item %1").arg(index + 1)
+ width: 100
+ height: 40
+ leftPadding: 10
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+}
diff --git a/tests/manual/gifs/tst_gifs.cpp b/tests/manual/gifs/tst_gifs.cpp
index 27234e63..e6fa9d61 100644
--- a/tests/manual/gifs/tst_gifs.cpp
+++ b/tests/manual/gifs/tst_gifs.cpp
@@ -67,6 +67,7 @@ private slots:
void dial();
void checkBox();
void checkBoxTriState();
+ void scrollBar();
private:
void moveSmoothly(QQuickWindow *window, const QPoint &from, const QPoint &to, int movements,
@@ -665,6 +666,39 @@ void tst_Gifs::checkBoxTriState()
gifRecorder.waitForFinish();
}
+void tst_Gifs::scrollBar()
+{
+ GifRecorder gifRecorder;
+ gifRecorder.setDataDirPath(dataDirPath);
+ gifRecorder.setOutputDir(outputDir);
+ gifRecorder.setRecordingDuration(6);
+ gifRecorder.setQmlFileName("qtquickcontrols2-scrollbar.qml");
+
+ gifRecorder.start();
+
+ QQuickWindow *window = gifRecorder.window();
+ QQuickItem *scrollBar = window->property("scrollBar").value<QQuickItem*>();
+ QVERIFY(scrollBar);
+
+ // Flick in the center of the screen to show that there's a scroll bar.
+ const QPoint lhsWindowBottom = QPoint(0, window->height() - 1);
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, lhsWindowBottom, 100);
+ QTest::mouseMove(window, lhsWindowBottom - QPoint(0, 10), 30);
+ QTest::mouseMove(window, lhsWindowBottom - QPoint(0, 30), 30);
+ QTest::mouseMove(window, lhsWindowBottom - QPoint(0, 60), 30);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, lhsWindowBottom - QPoint(0, 100), 30);
+
+ // Scroll with the scroll bar.
+ const QPoint rhsWindowBottom = QPoint(window->width() - 1, window->height() - 1);
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, rhsWindowBottom, 2000);
+ const QPoint rhsWindowTop = QPoint(window->width() - 1, 1);
+ moveSmoothly(window, rhsWindowBottom, rhsWindowTop,
+ qAbs(rhsWindowTop.y() - rhsWindowBottom.y()), QEasingCurve::InCubic, 10);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, rhsWindowTop, 20);
+
+ gifRecorder.waitForFinish();
+}
+
QTEST_MAIN(tst_Gifs)
#include "tst_gifs.moc"