diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2020-02-19 12:56:20 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2020-02-20 10:00:04 +0100 |
commit | c1420ee5423dfa104d5ff87bc529b4530dc998d6 (patch) | |
tree | d0713520ab4a35e1143c4fd4702e18309e6271d0 /tests/auto/controls/data/tst_tooltip.qml | |
parent | e7a9691481e4a0112138f442c53107aa9fbcb90a (diff) |
ToolTip: fix timeout not activating if opened during exit transition
When a tooltip with an exit transition and a timeout is made visible
during its exit transition, it would end up not timing out. This is
because the change in the tooltip's visibility is what usually
kicks off the timeout timer, but if there is no change in visibility
(because the exit transition hadn't finished, so the tooltip was
still visible), this won't happen.
Fix the issue by calling startTimeout() in
QQuickToolTip::setVisible().
Change-Id: I5f95a698e48f376c7597558572ac91625a276e53
Fixes: QTBUG-81935
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'tests/auto/controls/data/tst_tooltip.qml')
-rw-r--r-- | tests/auto/controls/data/tst_tooltip.qml | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/auto/controls/data/tst_tooltip.qml b/tests/auto/controls/data/tst_tooltip.qml index d98a7cc8..adea23ef 100644 --- a/tests/auto/controls/data/tst_tooltip.qml +++ b/tests/auto/controls/data/tst_tooltip.qml @@ -227,15 +227,39 @@ TestCase { id: toolTipWithExitTransition ToolTip { + Component.onCompleted: contentItem.objectName = "contentItem" + enter: Transition { NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 100 } } exit: Transition { - NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 1000 } + NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 500 } } } } + function test_openDuringExitTransitionWithTimeout() { + let control = createTemporaryObject(toolTipWithExitTransition, testCase, { timeout: 250 }) + verify(control) + control.open() + verify(control.visible) + // Can't be fully open yet because the enter transition has only just started. + compare(control.opened, false) + compare(control.enter.running, true) + tryCompare(control, "opened", true) + + // Let it timeout and begin the exit transition. + tryCompare(control, "opened", false) + verify(control.visible) + tryCompare(control.exit, "running", true) + verify(control.visible) + + // Quickly open it again; it should still timeout eventually. + control.open() + tryCompare(control, "opened", true) + tryCompare(control.exit, "running", true) + } + function test_makeVisibleWhileExitTransitionRunning_data() { return [ { tag: "imperative", imperative: true }, |