diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2016-10-06 13:42:59 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2016-10-06 14:43:16 +0000 |
commit | ba4698af31a0e15658f1068ed25dfeae88255c8d (patch) | |
tree | 18087ce5373a782da3a7729fb947848d628e2e11 /tests | |
parent | 563c2b9e3a515818484451b7752b3c4ef7ac3b71 (diff) |
Delegates: update GIFs and add CheckDelegate tri-state GIF
There have been some styling improvements since the last GIFs were
taken.
Change-Id: I84db1a588f42eb5ceb8899b959150b009d2269ed
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/manual/gifs/data/qtquickcontrols2-checkdelegate-tristate.qml | 81 | ||||
-rw-r--r-- | tests/manual/gifs/tst_gifs.cpp | 40 |
2 files changed, 110 insertions, 11 deletions
diff --git a/tests/manual/gifs/data/qtquickcontrols2-checkdelegate-tristate.qml b/tests/manual/gifs/data/qtquickcontrols2-checkdelegate-tristate.qml new file mode 100644 index 00000000..eddb71d5 --- /dev/null +++ b/tests/manual/gifs/data/qtquickcontrols2-checkdelegate-tristate.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** 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.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.0 + +Window { + id: window + width: 170 + height: column.implicitHeight + visible: true + + property alias english: english + property alias norwegian: norwegian + + ColumnLayout { + id: column + anchors.fill: parent + + CheckDelegate { + text: qsTr("Languages") + checkState: english.checked && norwegian.checked + ? Qt.Checked : (english.checked || norwegian.checked) ? Qt.PartiallyChecked : Qt.Unchecked + tristate: true + Layout.fillWidth: true + } + CheckDelegate { + id: english + text: qsTr("English") + checked: true + leftPadding: indicator.width + 14 + Layout.fillWidth: true + } + CheckDelegate { + id: norwegian + text: qsTr("Norwegian") + checked: true + leftPadding: indicator.width + 14 + Layout.fillWidth: true + } + } +} diff --git a/tests/manual/gifs/tst_gifs.cpp b/tests/manual/gifs/tst_gifs.cpp index a788ff0a..8da12347 100644 --- a/tests/manual/gifs/tst_gifs.cpp +++ b/tests/manual/gifs/tst_gifs.cpp @@ -66,10 +66,11 @@ private slots: void dial_data(); void dial(); void checkBox(); - void checkBoxTriState(); void scrollBar(); void progressBar_data(); void progressBar(); + void triState_data(); + void triState(); private: void moveSmoothly(QQuickWindow *window, const QPoint &from, const QPoint &to, int movements, @@ -640,13 +641,23 @@ void tst_Gifs::checkBox() gifRecorder.waitForFinish(); } -void tst_Gifs::checkBoxTriState() +void tst_Gifs::triState_data() { + QTest::addColumn<QString>("name"); + + QTest::newRow("checkbox-tristate") << "checkbox-tristate"; + QTest::newRow("checkdelegate-tristate") << "checkdelegate-tristate"; +} + +void tst_Gifs::triState() +{ + QFETCH(QString, name); + GifRecorder gifRecorder; gifRecorder.setDataDirPath(dataDirPath); gifRecorder.setOutputDir(outputDir); gifRecorder.setRecordingDuration(6); - gifRecorder.setQmlFileName("qtquickcontrols2-checkbox-tristate.qml"); + gifRecorder.setQmlFileName(QString::fromLatin1("qtquickcontrols2-%1.qml").arg(name)); gifRecorder.start(); @@ -656,14 +667,21 @@ void tst_Gifs::checkBoxTriState() QQuickItem *norwegian = window->property("norwegian").value<QQuickItem*>(); QVERIFY(norwegian); - QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, - english->mapToScene(QPointF(english->width() / 2, english->height() / 2)).toPoint(), 1000); - QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, - norwegian->mapToScene(QPointF(norwegian->width() / 2, norwegian->height() / 2)).toPoint(), 1000); - QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, - norwegian->mapToScene(QPointF(norwegian->width() / 2, norwegian->height() / 2)).toPoint(), 1000); - QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, - english->mapToScene(QPointF(english->width() / 2, english->height() / 2)).toPoint(), 1000); + const QPoint englishCenter = english->mapToScene( + QPointF(english->width() / 2, english->height() / 2)).toPoint(); + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, englishCenter, 1000); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, englishCenter, 300); + + const QPoint norwegianCenter = norwegian->mapToScene( + QPointF(norwegian->width() / 2, norwegian->height() / 2)).toPoint(); + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, norwegianCenter, 1000); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, norwegianCenter, 300); + + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, norwegianCenter, 1000); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, norwegianCenter, 300); + + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, englishCenter, 1000); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, englishCenter, 300); gifRecorder.waitForFinish(); } |