From b0b11a6d4ae8a03998a5c84b91d9cb0b75387059 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 15 Sep 2020 08:49:29 +0200 Subject: Allow the preparation of the exit transition even if it did have focus This amends 1a5a0a591c35dcf498a232a802087683f2244ecb so that it only sets the hadActiveFocusBeforeExitTransition variable if it is false, ensuring that it is correctly handled later on if it is true from before. This handles a case of closing, opening and then closing again in one function call. Pick-to: 5.15 Task-number: QTBUG-85884 Change-Id: Ied4ca33045b005f5f666e63d85fb603e9350d982 Reviewed-by: Mitch Curtis --- tests/auto/controls/data/tst_dialog.qml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/controls/data/tst_dialog.qml b/tests/auto/controls/data/tst_dialog.qml index f8bf5bb5..90f36659 100644 --- a/tests/auto/controls/data/tst_dialog.qml +++ b/tests/auto/controls/data/tst_dialog.qml @@ -440,6 +440,11 @@ TestCase { ApplicationWindow { property alias focusItemActiveFocus: item.activeFocus property alias focusDialogVisible: dialog.visible + function closeAndOpen() { + dialog.close() + dialog.open() + dialog.close() + } visible: true Item { id: item @@ -453,6 +458,12 @@ TestCase { if (!activeFocus) visible = false } + enter: Transition { + NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 10 } + } + exit: Transition { + NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 10 } + } } } } @@ -469,5 +480,12 @@ TestCase { window.focusDialogVisible = false tryCompare(window, "focusDialogVisible", false) tryCompare(window, "focusItemActiveFocus", true) + + window.focusDialogVisible = true + tryCompare(window, "focusDialogVisible", true) + tryCompare(window, "focusItemActiveFocus", false) + window.closeAndOpen() + tryCompare(window, "focusDialogVisible", false) + tryCompare(window, "focusItemActiveFocus", true) } } -- cgit v1.2.3