From e99d9190ca945435ddb4dcb3eeab7fd710089370 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 16 Dec 2016 12:27:31 +0100 Subject: tst_dialogbuttonbox: 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: Idcd59bfd851b307fdb9621f01ad90c41523d6049 Reviewed-by: J-P Nurmi --- tests/auto/controls/data/tst_dialogbuttonbox.qml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/controls/data/tst_dialogbuttonbox.qml b/tests/auto/controls/data/tst_dialogbuttonbox.qml index 8474e89b..bc281b63 100644 --- a/tests/auto/controls/data/tst_dialogbuttonbox.qml +++ b/tests/auto/controls/data/tst_dialogbuttonbox.qml @@ -66,17 +66,16 @@ TestCase { } function test_defaults() { - var control = buttonBox.createObject(testCase) + var control = createTemporaryObject(buttonBox, testCase) verify(control) compare(control.count, 0) verify(control.delegate) compare(control.standardButtons, 0) - control.destroy() } function test_standardButtons() { - var control = buttonBox.createObject(testCase) - + var control = createTemporaryObject(buttonBox, testCase) + verify(control) compare(control.count, 0) control.standardButtons = DialogButtonBox.Ok @@ -107,12 +106,11 @@ TestCase { control.standardButtons = 0 compare(control.count, 0) - - control.destroy() } function test_attached() { - var control = buttonBox.createObject(testCase) + var control = createTemporaryObject(buttonBox, testCase) + verify(control) control.standardButtons = DialogButtonBox.Ok var okButton = control.itemAt(0) @@ -125,7 +123,7 @@ TestCase { saveButton.DialogButtonBox.buttonRole = DialogButtonBox.AcceptRole compare(saveButton.DialogButtonBox.buttonRole, DialogButtonBox.AcceptRole) - var closeButton = button.createObject(null, {text: "Save"}) + var closeButton = createTemporaryObject(button, null, {text: "Save"}) compare(closeButton.DialogButtonBox.buttonBox, null) compare(closeButton.DialogButtonBox.buttonRole, DialogButtonBox.InvalidRole) closeButton.DialogButtonBox.buttonRole = DialogButtonBox.DestructiveRole @@ -137,8 +135,6 @@ TestCase { compare(okButton.DialogButtonBox.buttonBox, null) compare(saveButton.DialogButtonBox.buttonBox, null) compare(closeButton.DialogButtonBox.buttonBox, null) - - control.destroy() } function test_signals_data() { @@ -165,7 +161,8 @@ TestCase { } function test_signals(data) { - var control = buttonBox.createObject(testCase) + var control = createTemporaryObject(buttonBox, testCase) + verify(control) control.standardButtons = data.standardButton compare(control.count, 1) @@ -182,7 +179,5 @@ TestCase { compare(clickedSpy.count, 1) compare(clickedSpy.signalArguments[0][0], button) compare(roleSpy.count, !!data.signalName ? 1 : 0) - - control.destroy() } } -- cgit v1.2.3