diff options
author | Caroline Chao <caroline.chao@digia.com> | 2013-04-11 08:35:57 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-12 19:43:23 +0200 |
commit | 87344633111b86e77567378c07783367fb57a26e (patch) | |
tree | fdfb0b5e1f59e1421c68487c587184b65b36f650 /tests/auto/applicationwindow | |
parent | a0cc1951b30282a367db8fd9933101a6c851c15b (diff) | |
download | qtquickcontrols-87344633111b86e77567378c07783367fb57a26e.tar.gz |
Tests: Remove tst_applicationwindow.qml
And replace it by a c++ test.
quick_test_main from QtQuickTest uses QQuickView as a
top level window. The fact the ApplicationWindow is a Window
itself leads to problems when for example the ApplicationWindow
is set to visible.
Change-Id: Iee8a8dffe52912aaa7e1000a91177f6dd7e3d8cb
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Reviewed-by: Liang Qi <liang.qi@digia.com>
Diffstat (limited to 'tests/auto/applicationwindow')
3 files changed, 148 insertions, 0 deletions
diff --git a/tests/auto/applicationwindow/applicationwindow.pro b/tests/auto/applicationwindow/applicationwindow.pro new file mode 100644 index 00000000..1e4dcf9e --- /dev/null +++ b/tests/auto/applicationwindow/applicationwindow.pro @@ -0,0 +1,15 @@ +CONFIG += testcase +TARGET = tst_applicationwindow +SOURCES += tst_applicationwindow.cpp + +macx:CONFIG -= app_bundle + +QT += widgets core-private gui-private qml-private quick-private v8-private testlib + +include (../shared/util.pri) + +TESTDATA = data/* + +OTHER_FILES += \ + data/basicapplicationwindow.qml + diff --git a/tests/auto/applicationwindow/data/basicapplicationwindow.qml b/tests/auto/applicationwindow/data/basicapplicationwindow.qml new file mode 100644 index 00000000..e19648ae --- /dev/null +++ b/tests/auto/applicationwindow/data/basicapplicationwindow.qml @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** 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 QtQuick.Controls 1.0 + +ApplicationWindow { + title: "Test Application Window" +} diff --git a/tests/auto/applicationwindow/tst_applicationwindow.cpp b/tests/auto/applicationwindow/tst_applicationwindow.cpp new file mode 100644 index 00000000..cc81dbe5 --- /dev/null +++ b/tests/auto/applicationwindow/tst_applicationwindow.cpp @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include <qtest.h> +#include <QtTest/QSignalSpy> +#include <QtQml/qqmlengine.h> +#include <QtQml/qqmlcomponent.h> +#include <QtQml/qqmlcontext.h> +#include <QtQuick/qquickview.h> +#include <QtQuick/private/qquickitem_p.h> +#include "../shared/util.h" + +class tst_applicationwindow : public QQmlDataTest +{ + Q_OBJECT +public: + +private slots: + void qmlCreation(); +}; + +void tst_applicationwindow::qmlCreation() +{ + QQmlEngine engine; + QQmlComponent component(&engine); + component.loadUrl(testFileUrl("basicapplicationwindow.qml")); + QObject* created = component.create(); + QScopedPointer<QObject> cleanup(created); + QVERIFY(created); + + QQuickWindow* window = qobject_cast<QQuickWindow*>(created); + QVERIFY(window); + QVERIFY(!window->isVisible()); + + QCOMPARE(created->property("title"), QVariant("Test Application Window")); + + QQuickItem* statusBar = qvariant_cast<QQuickItem*>(created->property("statusBar")); + QVERIFY(!statusBar); + + QQuickItem* menuBar = qvariant_cast<QQuickItem*>(created->property("menuBar")); + QVERIFY(!menuBar); + + QQuickItem* toolBar = qvariant_cast<QQuickItem*>(created->property("toolBar")); + QVERIFY(!toolBar); +} + +QTEST_MAIN(tst_applicationwindow) + +#include "tst_applicationwindow.moc" |