diff options
-rw-r--r-- | tests/auto/applicationwindow/applicationwindow.pro | 15 | ||||
-rw-r--r-- | tests/auto/applicationwindow/data/basicapplicationwindow.qml | 46 | ||||
-rw-r--r-- | tests/auto/applicationwindow/tst_applicationwindow.cpp | 87 | ||||
-rw-r--r-- | tests/auto/auto.pro | 2 | ||||
-rw-r--r-- | tests/auto/controls/controls.pro | 1 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_applicationwindow.qml | 58 |
6 files changed, 149 insertions, 60 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" diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 927b7cca..0b3cfd2b 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -1,3 +1,3 @@ TEMPLATE = subdirs -SUBDIRS += testplugin controls activeFocusOnTab +SUBDIRS += testplugin controls activeFocusOnTab applicationwindow CONFIG += ordered diff --git a/tests/auto/controls/controls.pro b/tests/auto/controls/controls.pro index 5e7bd135..3286e9eb 100644 --- a/tests/auto/controls/controls.pro +++ b/tests/auto/controls/controls.pro @@ -22,7 +22,6 @@ OTHER_FILES += \ $$PWD/data/tst_menu.qml \ $$PWD/data/tst_textfield.qml \ $$PWD/data/tst_textarea.qml \ - $$PWD/data/tst_applicationwindow.qml \ $$PWD/data/tst_combobox.qml \ $$PWD/data/tst_progressbar.qml \ $$PWD/data/tst_radiobutton.qml \ diff --git a/tests/auto/controls/data/tst_applicationwindow.qml b/tests/auto/controls/data/tst_applicationwindow.qml deleted file mode 100644 index e465d47d..00000000 --- a/tests/auto/controls/data/tst_applicationwindow.qml +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.1 -import QtTest 1.0 - -TestCase { - id: testCase - name: "Tests_ApplicationWindow" - when:windowShown - width:400 - height:400 - - function test_window() { - var tmp = Qt.createQmlObject('import QtQuick.Controls 1.0; ApplicationWindow {id: window}', testCase, ''); - tmp.statusBar = Qt.createQmlObject('import QtQuick.Controls 1.0; StatusBar {}', testCase, ''); - tmp.toolBar = Qt.createQmlObject('import QtQuick.Controls 1.0; ToolBar {}', testCase, ''); - verify(tmp.statusBar !== undefined) - verify(tmp.toolBar !== undefined) - } -} |