From 633c5642611234cf204569471598c3d3c083b84c Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 21 Aug 2017 15:05:20 +0200 Subject: tst_menubar: use createTemporaryObject() This seems to help get rid of the ApplicationWindows that would otherwise stick around until the end of the controls tests. Change-Id: I0f5cc81e07c727070c3f80654d46881c696eebe7 Reviewed-by: Simon Hausmann Reviewed-by: Liang Qi --- tests/auto/controls/data/tst_menubar.qml | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/tests/auto/controls/data/tst_menubar.qml b/tests/auto/controls/data/tst_menubar.qml index e011746e..ca608475 100644 --- a/tests/auto/controls/data/tst_menubar.qml +++ b/tests/auto/controls/data/tst_menubar.qml @@ -91,15 +91,14 @@ TestCase { } function test_createMenuBar() { - var menuBar = Qt.createQmlObject('import QtQuick.Controls 1.2; MenuBar {}', testCase, ''); - menuBar.destroy() + createTemporaryQmlObject('import QtQuick.Controls 1.2; MenuBar {}', testCase, ''); } function test_clickMenuBar() { if (Qt.platform.os === "osx") skip("MenuBar cannot be reliably tested on OS X") - var window = windowComponent.createObject() + var window = createTemporaryObject(windowComponent) waitForRendering(window.contentItem) var fileMenu = findChild(window, "fileMenu") compare(fileMenu !== null, true) @@ -116,14 +115,13 @@ TestCase { // to a a negative coordinate mouseClick(fileMenu.__contentItem, 20, -13) tryCompare(fileMenu, "__popupVisible", false) - window.destroy() } function test_closeOnEscapePressed() { if (Qt.platform.os === "osx") skip("MenuBar cannot be reliably tested on OS X") - var window = windowComponent.createObject() + var window = createTemporaryObject(windowComponent) waitForRendering(window.contentItem) var fileMenu = findChild(window, "fileMenu") verify(fileMenu) @@ -144,7 +142,7 @@ TestCase { if (Qt.platform.os === "osx") skip("MenuBar cannot be reliably tested on OS X") - var window = windowComponent.createObject() + var window = createTemporaryObject(windowComponent) waitForRendering(window.contentItem) var fileMenu = findChild(window, "fileMenu") verify(fileMenu) @@ -157,15 +155,13 @@ TestCase { mouseRelease(fileMenu.__contentItem, 0, -10) tryCompare(fileMenu, "__popupVisible", true) wait(waitTime) - - window.destroy(); } function test_keyNavigation() { if (Qt.platform.os === "osx") skip("MenuBar cannot be reliably tested on OS X") - var window = windowComponent.createObject() + var window = createTemporaryObject(windowComponent) waitForRendering(window.contentItem) var fileMenu = findChild(window, "fileMenu") verify(fileMenu) @@ -247,7 +243,5 @@ TestCase { keyRelease(Qt.Key_Left, Qt.NoModifier, waitTime) tryCompare(recentFilesSubMenu, "__popupVisible", false) tryCompare(recentFilesSubMenu, "__currentIndex", -1) - - window.destroy() } } -- cgit v1.2.1