aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorCaroline Chao <caroline.chao@digia.com>2013-04-10 11:32:10 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-11 16:09:10 +0200
commit7fe2b4a4d9b2c082d08c9380bbcce46ed7527585 (patch)
treefe6d4dd9c6ec513fa6dca50e935629ef3c5cee73 /tests
parent818b6af3a643dcbfc7bb2c5a40eae8f5cb6900b6 (diff)
Testlib: Fix qml objects not deleted in TestCase
After destroy() been called in the test function. wait(0) is used to call processEvents(). Task-number: QTBUG-30523 Change-Id: I208f213e2de6b530dd0965b301d046aee0182d9b Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qmltest/selftests/tst_destroy.qml62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/auto/qmltest/selftests/tst_destroy.qml b/tests/auto/qmltest/selftests/tst_destroy.qml
new file mode 100644
index 0000000000..b2a473dfca
--- /dev/null
+++ b/tests/auto/qmltest/selftests/tst_destroy.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtTest 1.0
+
+TestCase {
+ id: testCase
+ width: 100
+ height: 100
+ name: "SelfTests_Destroy"
+
+ function test_a_QTBUG_30523() {
+ compare(testCase.children.length, 0)
+ var tmp = Qt.createQmlObject('import QtQuick 2.1; Rectangle {width: 20; height: 20;}', testCase, '')
+ compare(testCase.children.length, 1)
+ tmp.destroy()
+ }
+
+ function test_b_QTBUG_30523() {
+ // The object created in test above should be deleted
+ compare(testCase.children.length, 0)
+ }
+}