summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2017-08-21 13:05:20 (GMT)
committerLiang Qi <liang.qi@qt.io>2017-08-22 05:53:45 (GMT)
commit633c5642611234cf204569471598c3d3c083b84c (patch)
treec47552746a62ef4d90d1804c99e70423be428a54
parenta77494140324c3ede1f7c16086593c070d81e2b3 (diff)
downloadqtquickcontrols-633c5642611234cf204569471598c3d3c083b84c.tar.gz
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 <simon.hausmann@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io>
-rw-r--r--tests/auto/controls/data/tst_menubar.qml16
1 files changed, 5 insertions, 11 deletions
diff --git a/tests/auto/controls/data/tst_menubar.qml b/tests/auto/controls/data/tst_menubar.qml
index e011746..ca60847 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()
}
}