diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-10-08 22:27:16 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-10-09 13:18:52 +0000 |
commit | 2f902694656d67d671d9a8616060d598a478e7b7 (patch) | |
tree | e0cf7e891247d736ebd6737c2d6d9db96c2949cd /tests | |
parent | 5e7d7dfc07ea00b53873a6ad5399f2400781f8b9 (diff) |
Fix crash in theme code when loading engines in succession
Store global engine specific themes as dynamic properties on the
engines themselves. This avoids the problem that storing engines
and their themes to a hash map had that destroyed engines and themes
were not cleaned up from the hash map.
Change-Id: I7330995339c263d456f74d33f6535d5ac7d9d5d4
Task-number: QTBUG-48651
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/auto.pro | 3 | ||||
-rw-r--r-- | tests/auto/theme/data/tst_theme.qml (renamed from tests/auto/controls/data/tst_theme.qml) | 0 | ||||
-rw-r--r-- | tests/auto/theme/theme.pro | 12 | ||||
-rw-r--r-- | tests/auto/theme/tst_theme.cpp | 57 |
4 files changed, 71 insertions, 1 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 2d12e08c..ff3d32e1 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -6,4 +6,5 @@ SUBDIRS += \ calendar \ controls \ sanity \ - snippets + snippets \ + theme diff --git a/tests/auto/controls/data/tst_theme.qml b/tests/auto/theme/data/tst_theme.qml index 4f94f2f5..4f94f2f5 100644 --- a/tests/auto/controls/data/tst_theme.qml +++ b/tests/auto/theme/data/tst_theme.qml diff --git a/tests/auto/theme/theme.pro b/tests/auto/theme/theme.pro new file mode 100644 index 00000000..e8d1133a --- /dev/null +++ b/tests/auto/theme/theme.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +TARGET = tst_theme +CONFIG += qmltestcase + +SOURCES += \ + $$PWD/tst_theme.cpp + +OTHER_FILES += \ + $$PWD/data/* + +TESTDATA += \ + $$PWD/data/tst_* diff --git a/tests/auto/theme/tst_theme.cpp b/tests/auto/theme/tst_theme.cpp new file mode 100644 index 00000000..daa1b1fe --- /dev/null +++ b/tests/auto/theme/tst_theme.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/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 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later 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 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtQuickTest/quicktest.h> +#include <QtGui/qguiapplication.h> +#include <QtQml/qqmlapplicationengine.h> + +// based on QUICK_TEST_MAIN() defined in quicktest.h +int main(int argc, char **argv) +{ + QTEST_ADD_GPU_BLACKLIST_SUPPORT + QTEST_SET_MAIN_SOURCE_PATH + + { + // QTBUG-48651 + QGuiApplication app(argc, argv); + QQmlApplicationEngine engine; + engine.loadData("import Qt.labs.controls 1.0; Slider { } "); + if (engine.rootObjects().isEmpty()) + return -1; + } + + return quick_test_main(argc, argv, "tst_theme", QUICK_TEST_SOURCE_DIR); +} |