aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qquickpopup/data/invisibleToolTipOpen.qml28
-rw-r--r--tests/auto/qquickpopup/tst_qquickpopup.cpp28
2 files changed, 56 insertions, 0 deletions
diff --git a/tests/auto/qquickpopup/data/invisibleToolTipOpen.qml b/tests/auto/qquickpopup/data/invisibleToolTipOpen.qml
new file mode 100644
index 00000000..2e58bb97
--- /dev/null
+++ b/tests/auto/qquickpopup/data/invisibleToolTipOpen.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.13
+import QtQuick.Window 2.13
+import QtQuick.Controls 2.13
+
+Window {
+ width: 400
+ height: 400
+ property alias mouseArea: mouseArea
+ property alias loader: loader
+ MouseArea {
+ id: mouseArea
+ property bool isToolTipVisible: false
+ width: 200
+ height: 200
+ hoverEnabled: true
+ ToolTip.text: "static tooltip"
+ ToolTip.visible: containsMouse
+ ToolTip.onVisibleChanged: isToolTipVisible = ToolTip.visible
+ }
+ Loader {
+ id: loader
+ active: false
+ sourceComponent: Rectangle {
+ ToolTip.text: "dynamic tooltip"
+ ToolTip.visible: false
+ }
+ }
+}
diff --git a/tests/auto/qquickpopup/tst_qquickpopup.cpp b/tests/auto/qquickpopup/tst_qquickpopup.cpp
index e852a61e..f55d42bc 100644
--- a/tests/auto/qquickpopup/tst_qquickpopup.cpp
+++ b/tests/auto/qquickpopup/tst_qquickpopup.cpp
@@ -93,6 +93,7 @@ private slots:
void countChanged();
void toolTipCrashOnClose();
void setOverlayParentToNull();
+ void invisibleToolTipOpen();
};
void tst_QQuickPopup::initTestCase()
@@ -1299,6 +1300,33 @@ void tst_QQuickPopup::setOverlayParentToNull()
// While nullifying the overlay parent doesn't make much sense, it shouldn't crash.
}
+void tst_QQuickPopup::invisibleToolTipOpen()
+{
+ QQuickApplicationHelper helper(this, "invisibleToolTipOpen.qml");
+
+ QQuickWindow *window = helper.window;
+ centerOnScreen(window);
+ moveMouseAway(window);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+
+ QQuickItem *mouseArea = qvariant_cast<QQuickItem *>(window->property("mouseArea"));
+ QVERIFY(mouseArea);
+ QObject *loader = qvariant_cast<QObject *>(window->property("loader"));
+ QVERIFY(loader);
+
+ QTest::mouseMove(window, QPoint(mouseArea->width() / 2, mouseArea->height() / 2));
+ QTRY_VERIFY(mouseArea->property("isToolTipVisible").toBool());
+
+ QSignalSpy componentLoadedSpy(loader, SIGNAL(loaded()));
+ QVERIFY(componentLoadedSpy.isValid());
+
+ loader->setProperty("active", true);
+ QTRY_COMPARE(componentLoadedSpy.count(), 1);
+
+ QTRY_VERIFY(mouseArea->property("isToolTipVisible").toBool());
+}
+
QTEST_QUICKCONTROLS_MAIN(tst_QQuickPopup)
#include "tst_qquickpopup.moc"