aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2016-12-20 11:35:46 +0100
committerMitch Curtis <mitch.curtis@qt.io>2016-12-20 11:59:12 +0000
commit4d17371fa9a82b331681754b237e4cee2a62496d (patch)
treeffcdadff913fcf6aa39fe135fce6b7c4bb991eec /tests
parent3b186a15bddb80933c4a69eec0547d579c8144f0 (diff)
tst_switchdelegate: 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: I9907dbc49607a39452a18c5ad68c8acc8748b9da Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_switchdelegate.qml22
1 files changed, 6 insertions, 16 deletions
diff --git a/tests/auto/controls/data/tst_switchdelegate.qml b/tests/auto/controls/data/tst_switchdelegate.qml
index b1c6c82d..1907b643 100644
--- a/tests/auto/controls/data/tst_switchdelegate.qml
+++ b/tests/auto/controls/data/tst_switchdelegate.qml
@@ -65,14 +65,13 @@ TestCase {
// TODO: data-fy tst_checkbox (rename to tst_check?) so we don't duplicate its tests here?
function test_defaults() {
- var control = switchDelegate.createObject(testCase);
+ var control = createTemporaryObject(switchDelegate, testCase);
verify(control);
verify(!control.checked);
- control.destroy();
}
function test_checked() {
- var control = switchDelegate.createObject(testCase);
+ var control = createTemporaryObject(switchDelegate, testCase);
verify(control);
mouseClick(control);
@@ -80,15 +79,12 @@ TestCase {
mouseClick(control);
verify(!control.checked);
-
- control.destroy();
}
function test_baseline() {
- var control = switchDelegate.createObject(testCase);
+ var control = createTemporaryObject(switchDelegate, testCase);
verify(control);
compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset);
- control.destroy();
}
function test_pressed_data() {
@@ -99,7 +95,7 @@ TestCase {
}
function test_pressed(data) {
- var control = switchDelegate.createObject(testCase, {padding: 10})
+ var control = createTemporaryObject(switchDelegate, testCase, {padding: 10})
verify(control)
// stays pressed when dragged outside
@@ -110,12 +106,10 @@ TestCase {
compare(control.pressed, true)
mouseRelease(control, -1, control.height / 2, Qt.LeftButton)
compare(control.pressed, false)
-
- control.destroy()
}
function test_mouse() {
- var control = switchDelegate.createObject(testCase)
+ var control = createTemporaryObject(switchDelegate, testCase)
verify(control)
// check
@@ -196,12 +190,10 @@ TestCase {
compare(control.checked, false)
compare(control.pressed, false)
verify(spy.success)
-
- control.destroy()
}
function test_drag() {
- var control = switchDelegate.createObject(testCase, {leftPadding: 100, rightPadding: 100})
+ var control = createTemporaryObject(switchDelegate, testCase, {leftPadding: 100, rightPadding: 100})
verify(control)
var spy = signalSequenceSpy.createObject(control, {target: control})
@@ -303,7 +295,5 @@ TestCase {
compare(control.checked, true)
compare(control.pressed, false)
verify(spy.success)
-
- control.destroy()
}
}