diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2016-12-16 12:27:31 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2016-12-17 09:42:59 +0000 |
commit | e99d9190ca945435ddb4dcb3eeab7fd710089370 (patch) | |
tree | c07dd345893da689c31b77581501a4b105c87a83 /tests/auto/controls/data/tst_dialogbuttonbox.qml | |
parent | 453ea863792eb65849c44c08d2dc58e23eeec998 (diff) |
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 <jpnurmi@qt.io>
Diffstat (limited to 'tests/auto/controls/data/tst_dialogbuttonbox.qml')
-rw-r--r-- | tests/auto/controls/data/tst_dialogbuttonbox.qml | 21 |
1 files changed, 8 insertions, 13 deletions
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() } } |