From 7aee63b8a5db7721e079e1a3402a3ca6b4b1d06e Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 20 Dec 2016 10:06:53 +0100 Subject: tst_scrollindicator: 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: If25a058a6855e747ef3b5f253f486188593493a9 Reviewed-by: J-P Nurmi --- tests/auto/controls/data/tst_scrollindicator.qml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/auto/controls/data/tst_scrollindicator.qml b/tests/auto/controls/data/tst_scrollindicator.qml index 1ec03b15..23579426 100644 --- a/tests/auto/controls/data/tst_scrollindicator.qml +++ b/tests/auto/controls/data/tst_scrollindicator.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. @@ -68,11 +68,11 @@ TestCase { } function test_attach() { - var container = flickable.createObject(testCase) + var container = createTemporaryObject(flickable, testCase) verify(container) waitForRendering(container) - var vertical = scrollIndicator.createObject() + var vertical = createTemporaryObject(scrollIndicator, null) verify(!vertical.parent) compare(vertical.size, 0.0) compare(vertical.position, 0.0) @@ -100,7 +100,7 @@ TestCase { container.width += 10 compare(vertical.x, 123) - var horizontal = scrollIndicator.createObject() + var horizontal = createTemporaryObject(scrollIndicator, null) verify(!horizontal.parent) compare(horizontal.size, 0.0) compare(horizontal.position, 0.0) @@ -165,8 +165,6 @@ TestCase { container.width += 10 compare(horizontal.x, oldX - 10) compare(horizontal.width, oldWidth) - - container.destroy() } function test_warning() { @@ -175,7 +173,7 @@ TestCase { } function test_overshoot() { - var container = flickable.createObject(testCase) + var container = createTemporaryObject(flickable, testCase) verify(container) waitForRendering(container) @@ -204,7 +202,5 @@ TestCase { horizontal.position = 0.8 compare(horizontal.contentItem.x, horizontal.leftPadding + 0.8 * horizontal.availableWidth) compare(horizontal.contentItem.width, 0.2 * horizontal.availableWidth) - - container.destroy() } } -- cgit v1.2.3