diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2018-02-12 19:55:13 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2018-02-13 18:17:09 +0000 |
commit | e8f29483a4415e17fa999b2234f142a3304b7a75 (patch) | |
tree | 52c4235030cf022b9cb65286103d09f2a2b5053f /tests/auto/qquickdrawer | |
parent | eddd9d24ff1528ed84619725b37b55c7c90efff5 (diff) |
Merge tst_drawer.qml to tst_QQuickDrawer
Change-Id: I837f6991f5a3b66e3ded9e1408656013a0803d8f
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/qquickdrawer')
-rw-r--r-- | tests/auto/qquickdrawer/tst_qquickdrawer.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/qquickdrawer/tst_qquickdrawer.cpp b/tests/auto/qquickdrawer/tst_qquickdrawer.cpp index c89ecb62..60c5b189 100644 --- a/tests/auto/qquickdrawer/tst_qquickdrawer.cpp +++ b/tests/auto/qquickdrawer/tst_qquickdrawer.cpp @@ -62,6 +62,9 @@ class tst_QQuickDrawer : public QQmlDataTest private slots: void initTestCase(); + void defaults(); + void invalidEdge(); + void visible_data(); void visible(); @@ -127,6 +130,40 @@ void tst_QQuickDrawer::initTestCase() QWindowSystemInterface::registerTouchDevice(touchDevice.data()); } +void tst_QQuickDrawer::defaults() +{ + QQmlEngine engine; + QQmlComponent component(&engine); + component.loadUrl(testFileUrl("window.qml")); + + QScopedPointer<QObject> root(component.create()); + QVERIFY2(!root.isNull(), qPrintable(component.errorString())); + + QQuickDrawer *drawer = root->property("drawer").value<QQuickDrawer *>(); + QVERIFY(drawer); + QCOMPARE(drawer->edge(), Qt::LeftEdge); + QCOMPARE(drawer->position(), 0.0); + QCOMPARE(drawer->dragMargin(), qGuiApp->styleHints()->startDragDistance()); +} + +void tst_QQuickDrawer::invalidEdge() +{ + QQmlEngine engine; + QQmlComponent component(&engine); + component.loadUrl(testFileUrl("window.qml")); + + QScopedPointer<QObject> root(component.create()); + QVERIFY2(!root.isNull(), qPrintable(component.errorString())); + + QQuickDrawer *drawer = root->property("drawer").value<QQuickDrawer *>(); + QVERIFY(drawer); + + // Test an invalid value - it should warn and ignore it. + QTest::ignoreMessage(QtWarningMsg, qUtf8Printable(testFileUrl("window.qml").toString() + ":61:5: QML Drawer: invalid edge value - valid values are: Qt.TopEdge, Qt.LeftEdge, Qt.RightEdge, Qt.BottomEdge")); + drawer->setEdge(static_cast<Qt::Edge>(QQuickDrawer::Right)); + QCOMPARE(drawer->edge(), Qt::LeftEdge); +} + void tst_QQuickDrawer::visible_data() { QTest::addColumn<QString>("source"); |