aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/applicationwindow
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-08-09 14:08:24 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-08-09 14:08:24 +0200
commit6a6eaec0e8c2d4cd1ffbe2fe154a3a3caad54dc9 (patch)
tree5d8352f302bc979332eed01e250554b69961311e /tests/auto/applicationwindow
parentc02d23360186b43fcd570e1c7fc666cb14b487d6 (diff)
parentb172b30368bafc839b92f767324496a509267fc7 (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: src/quicktemplates2/qquickpage.cpp Change-Id: I4c8b62fb1d7c20c6d3c870eb47e0402a20051098
Diffstat (limited to 'tests/auto/applicationwindow')
-rw-r--r--tests/auto/applicationwindow/data/layout.qml51
-rw-r--r--tests/auto/applicationwindow/tst_applicationwindow.cpp48
2 files changed, 99 insertions, 0 deletions
diff --git a/tests/auto/applicationwindow/data/layout.qml b/tests/auto/applicationwindow/data/layout.qml
new file mode 100644
index 00000000..2174b78e
--- /dev/null
+++ b/tests/auto/applicationwindow/data/layout.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 The Qt Company Ltd 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.6
+import QtQuick.Controls 2.0
+
+ApplicationWindow {
+ width: 200
+ height: 200
+ visible: true
+
+ header: ToolBar { }
+ footer: ToolBar { }
+}
diff --git a/tests/auto/applicationwindow/tst_applicationwindow.cpp b/tests/auto/applicationwindow/tst_applicationwindow.cpp
index 97fa767f..b712075f 100644
--- a/tests/auto/applicationwindow/tst_applicationwindow.cpp
+++ b/tests/auto/applicationwindow/tst_applicationwindow.cpp
@@ -72,6 +72,7 @@ private slots:
void activeFocusControl_data();
void activeFocusControl();
void focusAfterPopupClosed();
+ void layout();
};
void tst_applicationwindow::qmlCreation()
@@ -684,6 +685,53 @@ void tst_applicationwindow::focusAfterPopupClosed()
QCOMPARE(spy.count(), 2);
}
+void tst_applicationwindow::layout()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("layout.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
+
+ QQuickApplicationWindow* window = qobject_cast<QQuickApplicationWindow*>(object.data());
+ QVERIFY(window);
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickItem *content = window->contentItem();
+ QVERIFY(content);
+ QQuickItem *header = window->header();
+ QVERIFY(header);
+ QQuickItem *footer = window->footer();
+ QVERIFY(footer);
+
+ QCOMPARE(header->x(), 0.0);
+ QCOMPARE(header->y(), -header->height());
+ QCOMPARE(header->width(), qreal(window->width()));
+ QVERIFY(header->height() > 0);
+
+ QCOMPARE(footer->x(), 0.0);
+ QCOMPARE(footer->y(), content->height());
+ QCOMPARE(footer->width(), qreal(window->width()));
+ QVERIFY(footer->height() > 0.0);
+
+ QCOMPARE(content->x(), 0.0);
+ QCOMPARE(content->y(), header->height());
+ QCOMPARE(content->width(), qreal(window->width()));
+ QCOMPARE(content->height(), window->height() - header->height() - footer->height());
+
+ header->setVisible(false);
+ QCOMPARE(content->x(), 0.0);
+ QCOMPARE(content->y(), 0.0);
+ QCOMPARE(content->width(), qreal(window->width()));
+ QCOMPARE(content->height(), window->height() - footer->height());
+
+ footer->setVisible(false);
+ QCOMPARE(content->x(), 0.0);
+ QCOMPARE(content->y(), 0.0);
+ QCOMPARE(content->width(), qreal(window->width()));
+ QCOMPARE(content->height(), qreal(window->height()));
+}
+
QTEST_MAIN(tst_applicationwindow)
#include "tst_applicationwindow.moc"