aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2016-12-15 16:18:25 +0100
committerMitch Curtis <mitch.curtis@qt.io>2016-12-19 15:08:54 +0000
commitdfa3a248f5db4e638a748186ca8f16f0fc11ae35 (patch)
tree53c883307a9fa754590f257b7e84988f16057700
parent324b7413b4d7fc7ba955583c4dd0834c96f2af75 (diff)
tst_button: use TestCase's new createTemporaryObject functions
This ensures that the appropriate objects are destroyed at the end of each test function. Change-Id: Ia486e46339068a3767910a4ba8c249a39e58d8ed Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
-rw-r--r--tests/auto/controls/data/tst_button.qml29
1 files changed, 8 insertions, 21 deletions
diff --git a/tests/auto/controls/data/tst_button.qml b/tests/auto/controls/data/tst_button.qml
index ddfd72b7..5dd4cb4a 100644
--- a/tests/auto/controls/data/tst_button.qml
+++ b/tests/auto/controls/data/tst_button.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -68,7 +68,7 @@ TestCase {
}
function test_text() {
- var control = button.createObject(testCase)
+ var control = createTemporaryObject(button, testCase)
verify(control)
compare(control.text, "")
@@ -76,12 +76,10 @@ TestCase {
compare(control.text, "Button")
control.text = ""
compare(control.text, "")
-
- control.destroy()
}
function test_mouse() {
- var control = button.createObject(testCase)
+ var control = createTemporaryObject(button, testCase)
verify(control)
var sequenceSpy = signalSequenceSpy.createObject(control, {target: control})
@@ -148,12 +146,10 @@ TestCase {
"clicked"]
mouseDoubleClickSequence(control, control.width / 2, control.height / 2, Qt.LeftButton)
verify(sequenceSpy.success)
-
- control.destroy()
}
function test_keys() {
- var control = button.createObject(testCase)
+ var control = createTemporaryObject(button, testCase)
verify(control)
control.forceActiveFocus()
@@ -180,8 +176,6 @@ TestCase {
keyClick(keys[i])
verify(sequenceSpy.success)
}
-
- control.destroy()
}
function eventErrorMessage(actual, expected) {
@@ -189,7 +183,7 @@ TestCase {
}
function test_autoRepeat() {
- var control = button.createObject(testCase)
+ var control = createTemporaryObject(button, testCase)
verify(control)
compare(control.autoRepeat, false)
@@ -270,19 +264,16 @@ TestCase {
compare(clickSpy.count, 0)
compare(pressSpy.count, 0)
compare(releaseSpy.count, 0)
-
- control.destroy()
}
function test_baseline() {
- var control = button.createObject(testCase)
+ var control = createTemporaryObject(button, testCase)
verify(control)
compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
- control.destroy()
}
function test_checkable() {
- var control = button.createObject(testCase)
+ var control = createTemporaryObject(button, testCase)
verify(control)
verify(control.hasOwnProperty("checkable"))
verify(!control.checkable)
@@ -326,18 +317,14 @@ TestCase {
mouseClick(control)
verify(!control.checked)
verify(sequenceSpy.success)
-
- control.destroy()
}
function test_highlighted() {
- var control = button.createObject(testCase)
+ var control = createTemporaryObject(button, testCase)
verify(control)
verify(!control.highlighted)
control.highlighted = true
verify(control.highlighted)
-
- control.destroy()
}
}