From caa2abc72ef55f901282ee36dd750b4ac3da2d27 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 16 Dec 2016 15:16:26 +0100 Subject: tst_menuitem: 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: I5da1e875099cd134a69ac5f6d2593d930e0702b5 Reviewed-by: J-P Nurmi --- tests/auto/controls/data/tst_menuitem.qml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/controls/data/tst_menuitem.qml b/tests/auto/controls/data/tst_menuitem.qml index b5e08866..533ad242 100644 --- a/tests/auto/controls/data/tst_menuitem.qml +++ b/tests/auto/controls/data/tst_menuitem.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. @@ -56,14 +56,13 @@ TestCase { } function test_baseline() { - var control = menuItem.createObject(testCase) + var control = createTemporaryObject(menuItem, testCase) verify(control) compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset) - control.destroy() } function test_checkable() { - var control = menuItem.createObject(testCase) + var control = createTemporaryObject(menuItem, testCase) verify(control) verify(control.hasOwnProperty("checkable")) verify(!control.checkable) @@ -77,18 +76,14 @@ TestCase { mouseClick(control) verify(!control.checked) - - control.destroy() } function test_highlighted() { - var control = menuItem.createObject(testCase) + var control = createTemporaryObject(menuItem, testCase) verify(control) verify(!control.highlighted) control.highlighted = true verify(control.highlighted) - - control.destroy() } } -- cgit v1.2.3