aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/gifs/tst_gifs.cpp
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@theqtcompany.com>2015-11-16 16:06:07 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-12-02 16:16:31 +0000
commitb185fc1ac02d4887d2b187a4043b1fdedb95305e (patch)
tree9650c29786a86d7272541702d59cfa285216f7f0 /tests/manual/gifs/tst_gifs.cpp
parent5823d6230f5b1fbbd27c3b00b334e062a21b3d65 (diff)
Add Menu
An item-based menu derived from QQuickPanel. Eventually we'd like to make Panel itself a QQuickItem, as it makes both the implementation and the actual usage of Menu a lot easier. Change-Id: Ic1bf2a05ab98d9e17824c402ed8326ef65d26c69 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.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/manual/gifs/tst_gifs.cpp b/tests/manual/gifs/tst_gifs.cpp
index 5ae15e79..bd0cc61f 100644
--- a/tests/manual/gifs/tst_gifs.cpp
+++ b/tests/manual/gifs/tst_gifs.cpp
@@ -56,6 +56,7 @@ private slots:
void switchGif();
void button();
void tabBar();
+ void menu();
private:
void moveSmoothly(QQuickWindow *window, const QPoint &from, const QPoint &to, int movements,
@@ -338,6 +339,39 @@ void tst_Gifs::tabBar()
gifRecorder.waitForFinish();
}
+void tst_Gifs::menu()
+{
+ const QString qmlFileName = QStringLiteral("qtlabscontrols-menu.qml");
+
+ GifRecorder gifRecorder;
+ gifRecorder.setDataDirPath(dataDirPath);
+ gifRecorder.setOutputDir(outputDir);
+ gifRecorder.setRecordingDuration(3);
+ gifRecorder.setQmlFileName(qmlFileName);
+ gifRecorder.setHighQuality(true);
+
+ gifRecorder.start();
+
+ QQuickWindow *window = gifRecorder.window();
+ const QQuickItem *fileButton = window->property("fileButton").value<QQuickItem*>();
+ QVERIFY(fileButton);
+
+ const QPoint fileButtonCenter = fileButton->mapToScene(QPointF(fileButton->width() / 2, fileButton->height() / 2)).toPoint();
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, fileButtonCenter, 0);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, fileButtonCenter, 200);
+
+ const QObject *menu = window->property("menu").value<QObject*>();
+ QVERIFY(menu);
+ const QQuickItem *menuContentItem = menu->property("contentItem").value<QQuickItem*>();
+ QVERIFY(menuContentItem);
+
+ const QPoint lastItemPos = menuContentItem->mapToScene(QPointF(menuContentItem->width() / 2, menuContentItem->height() - 10)).toPoint();
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, lastItemPos, 1000);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, lastItemPos, 300);
+
+ gifRecorder.waitForFinish();
+}
+
QTEST_MAIN(tst_Gifs)
#include "tst_gifs.moc"