diff options
author | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2016-03-31 16:58:08 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-04-11 19:26:11 +0000 |
commit | b663020c9a60704dc53014522a3faa23892280a0 (patch) | |
tree | 80dd4f47910ce2313491d19167f3dfb94ea9d9e5 /tests/manual/gifs/tst_gifs.cpp | |
parent | 1acb34a40ea0fbc0c0730cdc81dcfd46bdeb4ef7 (diff) |
Add RadioDelegate
RadioDelegate is an item delegate that is used in lists, and can be
checked and unchecked. It derives from QQuickItemDelegate and hence has
background press effects. The order of the indicator and text is
reversed (compared to RadioButton) to reflect what is most commonly
seen on mobile.
Change-Id: I143ee9a30cd8ce1d624354f4cb981c41dfddc2d2
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'tests/manual/gifs/tst_gifs.cpp')
-rw-r--r-- | tests/manual/gifs/tst_gifs.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/tests/manual/gifs/tst_gifs.cpp b/tests/manual/gifs/tst_gifs.cpp index 6c0ef288..3b9cad02 100644 --- a/tests/manual/gifs/tst_gifs.cpp +++ b/tests/manual/gifs/tst_gifs.cpp @@ -471,18 +471,24 @@ void tst_Gifs::swipeDelegateBehind() void tst_Gifs::delegates_data() { QTest::addColumn<QString>("name"); - QTest::newRow("ItemDelegate") << "itemdelegate"; - QTest::newRow("CheckDelegate") << "checkdelegate"; + QTest::addColumn<QVector<int> >("pressIndices"); + QTest::addColumn<int>("duration"); + + QTest::newRow("ItemDelegate") << "itemdelegate" << (QVector<int>() << 0 << 0) << 5; + QTest::newRow("CheckDelegate") << "checkdelegate" << (QVector<int>() << 0 << 0) << 5; + QTest::newRow("RadioDelegate") << "radiodelegate" << (QVector<int>() << 1 << 0) << 5; } void tst_Gifs::delegates() { QFETCH(QString, name); + QFETCH(QVector<int>, pressIndices); + QFETCH(int, duration); GifRecorder gifRecorder; gifRecorder.setDataDirPath(dataDirPath); gifRecorder.setOutputDir(outputDir); - gifRecorder.setRecordingDuration(5); + gifRecorder.setRecordingDuration(duration); gifRecorder.setQmlFileName(QString::fromLatin1("qtquickcontrols-%1.qml").arg(name)); gifRecorder.setHighQuality(true); @@ -492,12 +498,13 @@ void tst_Gifs::delegates() 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); + for (int i = 0; i < pressIndices.size(); ++i) { + const int pressIndex = pressIndices.at(i); + const QPoint delegateCenter(delegate->mapToScene(QPointF( + delegate->width() / 2, delegate->height() / 2 + delegate->height() * pressIndex)).toPoint()); + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, delegateCenter, i == 0 ? 200 : 1000); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, delegateCenter, 400); + } gifRecorder.waitForFinish(); } |