aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls/data/tst_checkbox.qml
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2016-12-16 11:48:45 +0100
committerMitch Curtis <mitch.curtis@qt.io>2016-12-16 13:26:04 +0000
commit26832afc970abaab4c382a0f7b5b65b5314e5528 (patch)
tree6e23dc90d6153b05a2b32b3f0026c8cd630aa395 /tests/auto/controls/data/tst_checkbox.qml
parent71061d0288ceea6af5a0136531ba2a1a223d0819 (diff)
tst_checkbox: use TestCase's new createTemporaryObject functions
This ensures that the appropriate objects are destroyed at the end of each test function, even if the test fails. Change-Id: Id70e4dbe5385e91bf2c2261a0e0a1071df2f09c2 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'tests/auto/controls/data/tst_checkbox.qml')
-rw-r--r--tests/auto/controls/data/tst_checkbox.qml37
1 files changed, 10 insertions, 27 deletions
diff --git a/tests/auto/controls/data/tst_checkbox.qml b/tests/auto/controls/data/tst_checkbox.qml
index 41187aca..14d921eb 100644
--- a/tests/auto/controls/data/tst_checkbox.qml
+++ b/tests/auto/controls/data/tst_checkbox.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.
@@ -63,7 +63,7 @@ TestCase {
}
function test_text() {
- var control = checkBox.createObject(testCase)
+ var control = createTemporaryObject(checkBox, testCase)
verify(control)
compare(control.text, "")
@@ -71,12 +71,10 @@ TestCase {
compare(control.text, "CheckBox")
control.text = ""
compare(control.text, "")
-
- control.destroy()
}
function test_checked() {
- var control = checkBox.createObject(testCase)
+ var control = createTemporaryObject(checkBox, testCase)
verify(control)
var sequenceSpy = signalSequenceSpy.createObject(control, {target: control})
@@ -99,12 +97,10 @@ TestCase {
compare(control.checked, false)
compare(control.checkState, Qt.Unchecked)
verify(sequenceSpy.success)
-
- control.destroy()
}
function test_checkState() {
- var control = checkBox.createObject(testCase)
+ var control = createTemporaryObject(checkBox, testCase)
verify(control)
var sequenceSpy = signalSequenceSpy.createObject(control, {target: control})
@@ -127,12 +123,10 @@ TestCase {
compare(control.checked, false)
compare(control.checkState, Qt.Unchecked)
verify(sequenceSpy.success)
-
- control.destroy()
}
function test_mouse() {
- var control = checkBox.createObject(testCase)
+ var control = createTemporaryObject(checkBox, testCase)
verify(control)
var sequenceSpy = signalSequenceSpy.createObject(control, {target: control})
@@ -200,12 +194,10 @@ TestCase {
compare(control.checkState, Qt.Unchecked)
compare(control.pressed, false)
verify(sequenceSpy.success)
-
- control.destroy()
}
function test_keys() {
- var control = checkBox.createObject(testCase)
+ var control = createTemporaryObject(checkBox, testCase)
verify(control)
var sequenceSpy = signalSequenceSpy.createObject(control, {target: control})
@@ -252,8 +244,6 @@ TestCase {
compare(control.checked, false)
verify(sequenceSpy.success)
}
-
- control.destroy()
}
Component {
@@ -265,7 +255,7 @@ TestCase {
}
function test_checked_binding() {
- var container = checkedBoundBoxes.createObject(testCase)
+ var container = createTemporaryObject(checkedBoundBoxes, testCase)
verify(container)
compare(container.cb1.checked, false)
@@ -284,8 +274,6 @@ TestCase {
compare(container.cb1.checkState, Qt.Unchecked)
compare(container.cb2.checked, false)
compare(container.cb2.checkState, Qt.Unchecked)
-
- container.destroy()
}
Component {
@@ -297,7 +285,7 @@ TestCase {
}
function test_checkState_binding() {
- var container = checkStateBoundBoxes.createObject(testCase)
+ var container = createTemporaryObject(checkStateBoundBoxes, testCase)
verify(container)
compare(container.cb1.checked, false)
@@ -328,12 +316,10 @@ TestCase {
compare(container.cb1.tristate, true)
compare(container.cb2.tristate, true)
-
- container.destroy()
}
function test_tristate() {
- var control = checkBox.createObject(testCase)
+ var control = createTemporaryObject(checkBox, testCase)
var sequenceSpy = signalSequenceSpy.createObject(control, {target: control})
@@ -428,14 +414,11 @@ TestCase {
compare(control.checked, true)
compare(control.checkState, Qt.PartiallyChecked)
verify(sequenceSpy.success)
-
- control.destroy()
}
function test_baseline() {
- var control = checkBox.createObject(testCase)
+ var control = createTemporaryObject(checkBox, testCase)
verify(control)
compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
- control.destroy()
}
}