diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2016-12-20 12:48:27 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2016-12-20 11:58:41 +0000 |
commit | 377d11bd65268667a7f593b7844b331afbd06989 (patch) | |
tree | 019e9edb3a89d36f1fab6abce2236423eb6c11da /tests/auto | |
parent | 95bc6a1f3e33c5ee2dfe157e3927171e98fe4f2d (diff) |
tst_toolbutton: 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: Ie6e050fdd77b1711350ecc00f05d2e6bcd979fc5
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/controls/data/tst_toolbutton.qml | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/tests/auto/controls/data/tst_toolbutton.qml b/tests/auto/controls/data/tst_toolbutton.qml index a59cff07..b017e606 100644 --- a/tests/auto/controls/data/tst_toolbutton.qml +++ b/tests/auto/controls/data/tst_toolbutton.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. @@ -61,7 +61,7 @@ TestCase { } function test_text() { - var control = toolButton.createObject(testCase) + var control = createTemporaryObject(toolButton, testCase) verify(control) compare(control.text, "") @@ -69,12 +69,10 @@ TestCase { compare(control.text, "ToolButton") control.text = "" compare(control.text, "") - - control.destroy() } function test_mouse() { - var control = toolButton.createObject(testCase) + var control = createTemporaryObject(toolButton, testCase) verify(control) var pressedSpy = signalSpy.createObject(control, {target: control, signalName: "pressedChanged"}) @@ -140,12 +138,10 @@ TestCase { compare(downSpy.count, 6) compare(control.pressed, false) compare(control.down, false) - - control.destroy() } function test_keys() { - var control = toolButton.createObject(testCase) + var control = createTemporaryObject(toolButton, testCase) verify(control) var clickedSpy = signalSpy.createObject(control, {target: control, signalName: "clicked"}) @@ -168,14 +164,11 @@ TestCase { keyClick(keys[i]) compare(clickedSpy.count, 2) } - - control.destroy() } function test_baseline() { - var control = toolButton.createObject(testCase) + var control = createTemporaryObject(toolButton, testCase) verify(control) compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset) - control.destroy() } } |