aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-07-06 13:41:37 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-07-06 12:55:52 +0000
commit4387fb424ef3df9a324bb5dbc90e313625723cf5 (patch)
tree149e3e6c8ac45201984c3b3cab8332d5e2f4688f /tests
parent11ac8a8b598fc79e38339519e52d4fe1a56ddaeb (diff)
Drawer: reposition when closed
A drawer must be repositioned even when closed, or else it will peek out when anchored to the right or bottom edge and the window is resized. Change-Id: Idf86ec1d841cfcc333eb6c69d07b3e4b2b4015da Task-number: QTBUG-54578 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/drawer/tst_drawer.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/drawer/tst_drawer.cpp b/tests/auto/drawer/tst_drawer.cpp
index 6a19af91..062b430a 100644
--- a/tests/auto/drawer/tst_drawer.cpp
+++ b/tests/auto/drawer/tst_drawer.cpp
@@ -56,6 +56,8 @@ private slots:
void dragMargin_data();
void dragMargin();
+
+ void reposition();
};
void tst_Drawer::position_data()
@@ -150,6 +152,29 @@ void tst_Drawer::dragMargin()
QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(window->width() - drawer->width() * 0.75, drawer->height() / 2));
}
+void tst_Drawer::reposition()
+{
+ QQuickApplicationHelper helper(this, QStringLiteral("applicationwindow.qml"));
+
+ QQuickApplicationWindow *window = helper.window;
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+
+ QQuickDrawer *drawer = helper.window->property("drawer").value<QQuickDrawer*>();
+ QVERIFY(drawer);
+ drawer->setEdge(Qt::RightEdge);
+
+ drawer->open();
+ QTRY_COMPARE(drawer->popupItem()->x(), window->width() - drawer->width());
+
+ drawer->close();
+ QTRY_COMPARE(drawer->popupItem()->x(), static_cast<qreal>(window->width()));
+
+ window->setWidth(window->width() + 100);
+ QTRY_COMPARE(drawer->popupItem()->x(), static_cast<qreal>(window->width()));
+}
+
QTEST_MAIN(tst_Drawer)
#include "tst_drawer.moc"