aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--src/quicktemplates2/qquickapplicationwindow.cpp20
-rw-r--r--src/quicktemplates2/qquickpopup.cpp13
-rw-r--r--src/quicktemplates2/qquickpopupitem.cpp2
-rw-r--r--tests/auto/auto.pro3
-rw-r--r--tests/auto/font/data/font-appwindow-custom.qml62
-rw-r--r--tests/auto/font/data/font-appwindow-default.qml55
-rw-r--r--tests/auto/font/data/font-control-custom.qml62
-rw-r--r--tests/auto/font/data/font-control-default.qml55
-rw-r--r--tests/auto/font/data/font-popup-custom.qml62
-rw-r--r--tests/auto/font/data/font-popup-default.qml55
-rw-r--r--tests/auto/font/data/inheritance-childcontrol.qml76
-rw-r--r--tests/auto/font/data/inheritance-childpopup.qml76
-rw-r--r--tests/auto/font/data/inheritance-control.qml74
-rw-r--r--tests/auto/font/data/inheritance-dynamicchildcontrol.qml75
-rw-r--r--tests/auto/font/data/inheritance-dynamicchildpopup.qml80
-rw-r--r--tests/auto/font/data/inheritance-dynamiccontrol.qml71
-rw-r--r--tests/auto/font/data/inheritance-dynamicpopup.qml76
-rw-r--r--tests/auto/font/data/inheritance-popup.qml74
-rw-r--r--tests/auto/font/font.pro14
-rw-r--r--tests/auto/font/tst_font.cpp289
21 files changed, 1285 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore
index 3d119373..7c3a004b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,6 +35,7 @@
/tests/auto/cursor/tst_cursor
/tests/auto/drawer/tst_drawer
/tests/auto/focus/tst_focus
+/tests/auto/font/tst_font
/tests/auto/menu/tst_menu
/tests/auto/platform/tst_platform
/tests/auto/popup/tst_popup
diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp
index 0cd78502..e3f16d55 100644
--- a/src/quicktemplates2/qquickapplicationwindow.cpp
+++ b/src/quicktemplates2/qquickapplicationwindow.cpp
@@ -36,7 +36,7 @@
#include "qquickapplicationwindow_p.h"
#include "qquickoverlay_p.h"
-#include "qquickpopup_p.h"
+#include "qquickpopup_p_p.h"
#include "qquickcontrol_p_p.h"
#include "qquicktextarea_p.h"
#include "qquicktextfield_p.h"
@@ -171,6 +171,8 @@ public:
void _q_updateActiveFocus();
void setActiveFocusControl(QQuickItem *item);
+ static void contentData_append(QQmlListProperty<QObject> *prop, QObject *obj);
+
bool complete;
QQuickItem *background;
QQuickItem *contentItem;
@@ -284,6 +286,15 @@ void QQuickApplicationWindowPrivate::setActiveFocusControl(QQuickItem *control)
}
}
+void QQuickApplicationWindowPrivate::contentData_append(QQmlListProperty<QObject> *prop, QObject *obj)
+{
+ QQuickItemPrivate::data_append(prop, obj);
+
+ // associate "top-level" popups with the window as soon as they are added to the default property
+ if (QQuickPopup *popup = qobject_cast<QQuickPopup *>(obj))
+ QQuickPopupPrivate::get(popup)->setWindow(static_cast<QQuickApplicationWindow *>(prop->data));
+}
+
QQuickApplicationWindow::QQuickApplicationWindow(QWindow *parent)
: QQuickWindowQmlImpl(parent), d_ptr(new QQuickApplicationWindowPrivate)
{
@@ -483,7 +494,11 @@ void QQuickApplicationWindow::setFooter(QQuickItem *footer)
*/
QQmlListProperty<QObject> QQuickApplicationWindow::contentData()
{
- return QQuickItemPrivate::get(contentItem())->data();
+ return QQmlListProperty<QObject>(contentItem(), this,
+ QQuickApplicationWindowPrivate::contentData_append,
+ QQuickItemPrivate::data_count,
+ QQuickItemPrivate::data_at,
+ QQuickItemPrivate::data_clear);
}
/*!
@@ -628,7 +643,6 @@ void QQuickApplicationWindowPrivate::updateFont(const QFont &f)
QQuickControlPrivate::updateFontRecur(q->QQuickWindow::contentItem(), f);
- // TODO: internal QQuickPopupManager that provides reliable access to all QQuickPopup instances
const QList<QQuickPopup *> popups = q->findChildren<QQuickPopup *>();
for (QQuickPopup *popup : popups)
QQuickControlPrivate::get(static_cast<QQuickControl *>(popup->popupItem()))->inheritFont(f);
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index a3db2484..54f45767 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -568,13 +568,19 @@ void QQuickPopupPrivate::setWindow(QQuickWindow *newWindow)
QQuickOverlayPrivate::get(overlay)->removePopup(q);
}
+ window = newWindow;
+
if (newWindow) {
QQuickOverlay *overlay = QQuickOverlay::overlay(newWindow);
if (overlay)
QQuickOverlayPrivate::get(overlay)->addPopup(q);
+
+ QQuickControlPrivate *p = QQuickControlPrivate::get(popupItem);
+ p->resolveFont();
+ if (QQuickApplicationWindow *appWindow = qobject_cast<QQuickApplicationWindow *>(newWindow))
+ p->updateLocale(appWindow->locale(), false); // explicit=false
}
- window = newWindow;
emit q->windowChanged(newWindow);
if (complete && visible && window)
@@ -1394,11 +1400,6 @@ void QQuickPopup::setParentItem(QQuickItem *parent)
if (parent) {
QObjectPrivate::connect(parent, &QQuickItem::windowChanged, d, &QQuickPopupPrivate::setWindow);
QQuickItemPrivate::get(d->parentItem)->addItemChangeListener(d, QQuickItemPrivate::Destroyed);
-
- QQuickControlPrivate *p = QQuickControlPrivate::get(d->popupItem);
- p->resolveFont();
- if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(parent->window()))
- p->updateLocale(window->locale(), false); // explicit=false
} else {
close();
}
diff --git a/src/quicktemplates2/qquickpopupitem.cpp b/src/quicktemplates2/qquickpopupitem.cpp
index 6ccfd6ab..952c2db6 100644
--- a/src/quicktemplates2/qquickpopupitem.cpp
+++ b/src/quicktemplates2/qquickpopupitem.cpp
@@ -88,6 +88,8 @@ void QQuickPopupItemPrivate::resolveFont()
{
if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(popup->window()))
inheritFont(window->font());
+ else
+ inheritFont(themeFont(QPlatformTheme::SystemFont));
}
QQuickItem *QQuickPopupItemPrivate::getContentItem()
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index ebc0b337..048eabed 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -7,6 +7,7 @@ SUBDIRS += \
cursor \
drawer \
focus \
+ font \
menu \
platform \
popup \
@@ -23,6 +24,6 @@ SUBDIRS += \
# QTBUG-60268
boot2qt: SUBDIRS -= applicationwindow calendar controls cursor \
- drawer focus menu platform popup qquickmaterialstyle \
+ drawer focus font menu platform popup qquickmaterialstyle \
qquickmaterialstyleconf qquickuniversalstyle \
qquickuniversalstyleconf snippets
diff --git a/tests/auto/font/data/font-appwindow-custom.qml b/tests/auto/font/data/font-appwindow-custom.qml
new file mode 100644
index 00000000..3d06f64a
--- /dev/null
+++ b/tests/auto/font/data/font-appwindow-custom.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, 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.9
+import QtQuick.Controls 2.2
+
+ApplicationWindow {
+ font.capitalization: Font.AllUppercase
+ font.family: "Courier"
+ font.italic: true
+ font.pixelSize: 60
+ font.strikeout: true
+ font.underline: true
+ font.weight: Font.DemiBold
+}
diff --git a/tests/auto/font/data/font-appwindow-default.qml b/tests/auto/font/data/font-appwindow-default.qml
new file mode 100644
index 00000000..02643c77
--- /dev/null
+++ b/tests/auto/font/data/font-appwindow-default.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, 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.9
+import QtQuick.Controls 2.2
+
+ApplicationWindow {
+}
diff --git a/tests/auto/font/data/font-control-custom.qml b/tests/auto/font/data/font-control-custom.qml
new file mode 100644
index 00000000..92136e86
--- /dev/null
+++ b/tests/auto/font/data/font-control-custom.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, 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.9
+import QtQuick.Controls 2.2
+
+Control {
+ font.capitalization: Font.AllUppercase
+ font.family: "Courier"
+ font.italic: true
+ font.pixelSize: 60
+ font.strikeout: true
+ font.underline: true
+ font.weight: Font.DemiBold
+}
diff --git a/tests/auto/font/data/font-control-default.qml b/tests/auto/font/data/font-control-default.qml
new file mode 100644
index 00000000..552c77d8
--- /dev/null
+++ b/tests/auto/font/data/font-control-default.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, 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.9
+import QtQuick.Controls 2.2
+
+Control {
+}
diff --git a/tests/auto/font/data/font-popup-custom.qml b/tests/auto/font/data/font-popup-custom.qml
new file mode 100644
index 00000000..e8363a81
--- /dev/null
+++ b/tests/auto/font/data/font-popup-custom.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, 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.9
+import QtQuick.Controls 2.2
+
+Popup {
+ font.capitalization: Font.AllUppercase
+ font.family: "Courier"
+ font.italic: true
+ font.pixelSize: 60
+ font.strikeout: true
+ font.underline: true
+ font.weight: Font.DemiBold
+}
diff --git a/tests/auto/font/data/font-popup-default.qml b/tests/auto/font/data/font-popup-default.qml
new file mode 100644
index 00000000..26c522c1
--- /dev/null
+++ b/tests/auto/font/data/font-popup-default.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, 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.9
+import QtQuick.Controls 2.2
+
+Popup {
+}
diff --git a/tests/auto/font/data/inheritance-childcontrol.qml b/tests/auto/font/data/inheritance-childcontrol.qml
new file mode 100644
index 00000000..8a04dd52
--- /dev/null
+++ b/tests/auto/font/data/inheritance-childcontrol.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, 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.9
+import QtQuick.Controls 2.2
+
+ApplicationWindow {
+ id: window
+
+ property alias control: control
+ property alias child: child
+ property alias grandChild: grandChild
+
+ Item {
+ Control {
+ id: control
+
+ Control {
+ id: child
+
+ Item {
+ Control {
+ id: grandChild
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/font/data/inheritance-childpopup.qml b/tests/auto/font/data/inheritance-childpopup.qml
new file mode 100644
index 00000000..ca5cdc82
--- /dev/null
+++ b/tests/auto/font/data/inheritance-childpopup.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, 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.9
+import QtQuick.Controls 2.2
+
+ApplicationWindow {
+ id: window
+
+ property alias control: control
+ property alias child: child
+ property alias grandChild: grandChild
+
+ Item {
+ Popup {
+ id: control
+
+ Control {
+ id: child
+
+ Item {
+ Control {
+ id: grandChild
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/font/data/inheritance-control.qml b/tests/auto/font/data/inheritance-control.qml
new file mode 100644
index 00000000..ac9c940a
--- /dev/null
+++ b/tests/auto/font/data/inheritance-control.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, 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.9
+import QtQuick.Controls 2.2
+
+ApplicationWindow {
+ id: window
+
+ property alias control: control
+ property alias child: child
+ property alias grandChild: grandChild
+
+ Control {
+ id: control
+
+ Control {
+ id: child
+
+ Item {
+ Control {
+ id: grandChild
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/font/data/inheritance-dynamicchildcontrol.qml b/tests/auto/font/data/inheritance-dynamicchildcontrol.qml
new file mode 100644
index 00000000..98c0f696
--- /dev/null
+++ b/tests/auto/font/data/inheritance-dynamicchildcontrol.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, 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.9
+import QtQuick.Controls 2.2
+
+ApplicationWindow {
+ id: window
+
+ property Control control
+ property Control child
+ property Control grandChild
+
+ Item {
+ id: childItem
+ }
+
+ Component {
+ id: component
+ Control { }
+ }
+
+ Component.onCompleted: {
+ control = component.createObject(childItem)
+ child = component.createObject(control)
+ grandChild = component.createObject(child)
+ }
+}
diff --git a/tests/auto/font/data/inheritance-dynamicchildpopup.qml b/tests/auto/font/data/inheritance-dynamicchildpopup.qml
new file mode 100644
index 00000000..ef4fe60c
--- /dev/null
+++ b/tests/auto/font/data/inheritance-dynamicchildpopup.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, 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.9
+import QtQuick.Controls 2.2
+
+ApplicationWindow {
+ id: window
+
+ property Popup control
+ property Control child
+ property Control grandChild
+
+ Item {
+ id: childItem
+ }
+
+ Component {
+ id: popupComponent
+ Popup { }
+ }
+
+ Component {
+ id: controlComponent
+ Control { }
+ }
+
+ Component.onCompleted: {
+ control = popupComponent.createObject(childItem)
+ child = controlComponent.createObject(control.contentItem)
+ grandChild = controlComponent.createObject(child)
+ }
+}
diff --git a/tests/auto/font/data/inheritance-dynamiccontrol.qml b/tests/auto/font/data/inheritance-dynamiccontrol.qml
new file mode 100644
index 00000000..a261d600
--- /dev/null
+++ b/tests/auto/font/data/inheritance-dynamiccontrol.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, 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.9
+import QtQuick.Controls 2.2
+
+ApplicationWindow {
+ id: window
+
+ property Control control
+ property Control child
+ property Control grandChild
+
+ Component {
+ id: component
+ Control { }
+ }
+
+ Component.onCompleted: {
+ control = component.createObject(contentItem)
+ child = component.createObject(control)
+ grandChild = component.createObject(child)
+ }
+}
diff --git a/tests/auto/font/data/inheritance-dynamicpopup.qml b/tests/auto/font/data/inheritance-dynamicpopup.qml
new file mode 100644
index 00000000..f0d567da
--- /dev/null
+++ b/tests/auto/font/data/inheritance-dynamicpopup.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, 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.9
+import QtQuick.Controls 2.2
+
+ApplicationWindow {
+ id: window
+
+ property Popup control
+ property Control child
+ property Control grandChild
+
+ Component {
+ id: popupComponent
+ Popup { }
+ }
+
+ Component {
+ id: controlComponent
+ Control { }
+ }
+
+ Component.onCompleted: {
+ control = popupComponent.createObject(window)
+ child = controlComponent.createObject(control.contentItem)
+ grandChild = controlComponent.createObject(child)
+ }
+}
diff --git a/tests/auto/font/data/inheritance-popup.qml b/tests/auto/font/data/inheritance-popup.qml
new file mode 100644
index 00000000..b8415e63
--- /dev/null
+++ b/tests/auto/font/data/inheritance-popup.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, 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.9
+import QtQuick.Controls 2.2
+
+ApplicationWindow {
+ id: window
+
+ property alias control: control
+ property alias child: child
+ property alias grandChild: grandChild
+
+ Popup {
+ id: control
+
+ Control {
+ id: child
+
+ Item {
+ Control {
+ id: grandChild
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/font/font.pro b/tests/auto/font/font.pro
new file mode 100644
index 00000000..f6ccefd3
--- /dev/null
+++ b/tests/auto/font/font.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_font
+SOURCES += tst_font.cpp
+
+macos:CONFIG -= app_bundle
+
+QT += core-private gui-private qml-private quick-private testlib quicktemplates2-private quickcontrols2-private
+
+include (../shared/util.pri)
+
+TESTDATA = data/*
+
+OTHER_FILES += \
+ data/*.qml
diff --git a/tests/auto/font/tst_font.cpp b/tests/auto/font/tst_font.cpp
new file mode 100644
index 00000000..6f04a8c0
--- /dev/null
+++ b/tests/auto/font/tst_font.cpp
@@ -0,0 +1,289 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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 <QtTest/qtest.h>
+#include "../shared/visualtestutil.h"
+
+#include <QtGui/qfont.h>
+#include <QtGui/qpa/qplatformtheme.h>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQuickTemplates2/private/qquickapplicationwindow_p.h>
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+#include <QtQuickTemplates2/private/qquickpopup_p.h>
+#include <QtQuickControls2/private/qquickproxytheme_p.h>
+
+using namespace QQuickVisualTestUtil;
+
+class tst_font : public QQmlDataTest
+{
+ Q_OBJECT
+
+private slots:
+ void font_data();
+ void font();
+
+ void inheritance_data();
+ void inheritance();
+
+ void defaultFont_data();
+ void defaultFont();
+};
+
+void tst_font::font_data()
+{
+ QTest::addColumn<QString>("testFile");
+ QTest::addColumn<QFont>("expectedFont");
+
+ QTest::newRow("Control") << "font-control-default.qml" << QFont();
+ QTest::newRow("AppWindow") << "font-appwindow-default.qml" << QFont();
+ QTest::newRow("Popup") << "font-popup-default.qml" << QFont();
+
+ QFont customFont;
+ customFont.setCapitalization(QFont::AllUppercase);
+ customFont.setFamily("Courier");
+ customFont.setItalic(true);
+ customFont.setPixelSize(60);
+ customFont.setStrikeOut(true);
+ customFont.setUnderline(true);
+ customFont.setWeight(QFont::DemiBold);
+
+ QTest::newRow("Control:custom") << "font-control-custom.qml" << customFont;
+ QTest::newRow("AppWindow:custom") << "font-appwindow-custom.qml" << customFont;
+ QTest::newRow("Popup:custom") << "font-popup-custom.qml" << customFont;
+}
+
+void tst_font::font()
+{
+ QFETCH(QString, testFile);
+ QFETCH(QFont, expectedFont);
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl(testFile));
+
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY2(!object.isNull(), qPrintable(component.errorString()));
+
+ QVariant var = object->property("font");
+ QVERIFY(var.isValid());
+
+ QFont actualFont = var.value<QFont>();
+ QCOMPARE(actualFont, expectedFont);
+}
+
+void tst_font::inheritance_data()
+{
+ QTest::addColumn<QString>("testFile");
+
+ QTest::newRow("Control") << "inheritance-control.qml";
+ QTest::newRow("Child Control") << "inheritance-childcontrol.qml";
+ QTest::newRow("Dynamic Control") << "inheritance-dynamiccontrol.qml";
+ QTest::newRow("Dynamic Child Control") << "inheritance-dynamicchildcontrol.qml";
+
+ QTest::newRow("Popup") << "inheritance-popup.qml";
+ QTest::newRow("Child Popup") << "inheritance-childpopup.qml";
+ QTest::newRow("Dynamic Popup") << "inheritance-dynamicpopup.qml";
+ QTest::newRow("Dynamic Child Popup") << "inheritance-dynamicchildpopup.qml";
+}
+
+void tst_font::inheritance()
+{
+ QFETCH(QString, testFile);
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl(testFile));
+
+ QScopedPointer<QQuickApplicationWindow> window(qobject_cast<QQuickApplicationWindow *>(component.create()));
+ QVERIFY2(!window.isNull(), qPrintable(component.errorString()));
+
+ QObject *control = window->property("control").value<QObject *>();
+ QObject *child = window->property("child").value<QObject *>();
+ QObject *grandChild = window->property("grandChild").value<QObject *>();
+ QVERIFY(control && child && grandChild);
+
+ QCOMPARE(window->font(), QFont());
+
+ QCOMPARE(control->property("font").value<QFont>(), QFont());
+ QCOMPARE(child->property("font").value<QFont>(), QFont());
+ QCOMPARE(grandChild->property("font").value<QFont>(), QFont());
+
+ QFont childFont;
+ childFont.setFamily("Arial");
+ childFont.setPixelSize(80);
+ childFont.setItalic(true);
+ child->setProperty("font", childFont);
+ QCOMPARE(child->property("font").value<QFont>(), childFont);
+ QCOMPARE(grandChild->property("font").value<QFont>(), childFont);
+
+ QFont grandChildFont(childFont);
+ grandChildFont.setFamily("Times New Roman");
+ grandChildFont.setUnderline(true);
+ grandChild->setProperty("font", grandChildFont);
+ QCOMPARE(child->property("font").value<QFont>(), childFont);
+ QCOMPARE(grandChild->property("font").value<QFont>(), grandChildFont);
+
+ QFont windowFont;
+ windowFont.setWeight(QFont::Thin);
+ window->setFont(windowFont);
+ QCOMPARE(window->font(), windowFont);
+ QCOMPARE(control->property("font").value<QFont>(), windowFont);
+
+ childFont.setWeight(QFont::Thin);
+ QCOMPARE(child->property("font").value<QFont>(), childFont);
+
+ grandChildFont.setWeight(QFont::Thin);
+ QCOMPARE(grandChild->property("font").value<QFont>(), grandChildFont);
+
+ child->setProperty("font", QVariant());
+ QCOMPARE(child->property("font").value<QFont>(), windowFont);
+ QCOMPARE(grandChild->property("font").value<QFont>(), grandChildFont);
+
+ grandChild->setProperty("font", QVariant());
+ QCOMPARE(grandChild->property("font").value<QFont>(), windowFont);
+}
+
+class TestFontTheme : public QQuickProxyTheme
+{
+public:
+ TestFontTheme(QPlatformTheme *theme) : QQuickProxyTheme(theme)
+ {
+ std::fill(fonts, fonts + QPlatformTheme::NFonts, static_cast<QFont *>(0));
+
+ for (int i = QPlatformTheme::SystemFont; i < QPlatformTheme::NFonts; ++i) {
+ QFont font = QFont();
+ font.setPixelSize(i + 10);
+ fonts[i] = new QFont(font);
+ }
+
+ QGuiApplicationPrivate::platform_theme = this;
+ }
+
+ const QFont *font(Font type = SystemFont) const override
+ {
+ return fonts[type];
+ }
+
+private:
+ QFont *fonts[QPlatformTheme::NFonts];
+};
+
+Q_DECLARE_METATYPE(QPlatformTheme::Font)
+
+void tst_font::defaultFont_data()
+{
+ QTest::addColumn<QString>("control");
+ QTest::addColumn<QPlatformTheme::Font>("fontType");
+
+ QTest::newRow("AbstractButton") << "AbstractButton" << QPlatformTheme::SystemFont;
+ QTest::newRow("ApplicationWindow") << "ApplicationWindow" << QPlatformTheme::SystemFont;
+ QTest::newRow("Button") << "Button" << QPlatformTheme::PushButtonFont;
+ QTest::newRow("CheckBox") << "CheckBox" << QPlatformTheme::CheckBoxFont;
+ QTest::newRow("CheckDelegate") << "CheckDelegate" << QPlatformTheme::ListViewFont;
+ QTest::newRow("ComboBox") << "ComboBox" << QPlatformTheme::ComboMenuItemFont;
+ QTest::newRow("Container") << "Container" << QPlatformTheme::SystemFont;
+ QTest::newRow("Control") << "Control" << QPlatformTheme::SystemFont;
+ QTest::newRow("Dial") << "Dial" << QPlatformTheme::SystemFont;
+ QTest::newRow("Dialog") << "Dialog" << QPlatformTheme::SystemFont;
+ QTest::newRow("DialogButtonBox") << "DialogButtonBox" << QPlatformTheme::SystemFont;
+ QTest::newRow("Drawer") << "Drawer" << QPlatformTheme::SystemFont;
+ QTest::newRow("Frame") << "Frame" << QPlatformTheme::SystemFont;
+ QTest::newRow("GroupBox") << "GroupBox" << QPlatformTheme::GroupBoxTitleFont;
+ QTest::newRow("ItemDelegate") << "ItemDelegate" << QPlatformTheme::ItemViewFont;
+ QTest::newRow("Label") << "Label" << QPlatformTheme::LabelFont;
+ QTest::newRow("Menu") << "Menu" << QPlatformTheme::MenuFont;
+ QTest::newRow("MenuItem") << "MenuItem" << QPlatformTheme::MenuItemFont;
+ QTest::newRow("MenuSeparator") << "MenuSeparator" << QPlatformTheme::SystemFont;
+ QTest::newRow("Page") << "Page" << QPlatformTheme::SystemFont;
+ QTest::newRow("Pane") << "Pane" << QPlatformTheme::SystemFont;
+ QTest::newRow("Popup") << "Popup" << QPlatformTheme::SystemFont;
+ QTest::newRow("ProgressBar") << "ProgressBar" << QPlatformTheme::SystemFont;
+ QTest::newRow("RadioButton") << "RadioButton" << QPlatformTheme::RadioButtonFont;
+ QTest::newRow("RadioDelegate") << "RadioDelegate" << QPlatformTheme::ListViewFont;
+ QTest::newRow("RangeSlider") << "RangeSlider" << QPlatformTheme::SystemFont;
+ QTest::newRow("RoundButton") << "RoundButton" << QPlatformTheme::PushButtonFont;
+ QTest::newRow("ScrollBar") << "ScrollBar" << QPlatformTheme::SystemFont;
+ QTest::newRow("ScrollIndicator") << "ScrollIndicator" << QPlatformTheme::SystemFont;
+ QTest::newRow("Slider") << "Slider" << QPlatformTheme::SystemFont;
+ QTest::newRow("SpinBox") << "SpinBox" << QPlatformTheme::EditorFont;
+ QTest::newRow("SwipeDelegate") << "SwipeDelegate" << QPlatformTheme::ListViewFont;
+ QTest::newRow("Switch") << "Switch" << QPlatformTheme::SystemFont; // ### TODO: add QPlatformTheme::SwitchFont
+ QTest::newRow("SwitchDelegate") << "SwitchDelegate" << QPlatformTheme::ListViewFont;
+ QTest::newRow("TabBar") << "TabBar" << QPlatformTheme::SystemFont;
+ QTest::newRow("TabButton") << "TabButton" << QPlatformTheme::TabButtonFont;
+ QTest::newRow("TextArea") << "TextArea" << QPlatformTheme::EditorFont;
+ QTest::newRow("TextField") << "TextField" << QPlatformTheme::EditorFont;
+ QTest::newRow("ToolBar") << "ToolBar" << QPlatformTheme::SystemFont;
+ QTest::newRow("ToolButton") << "ToolButton" << QPlatformTheme::ToolButtonFont;
+ QTest::newRow("ToolSeparator") << "ToolSeparator" << QPlatformTheme::SystemFont;
+ QTest::newRow("ToolTip") << "ToolTip" << QPlatformTheme::TipLabelFont;
+ QTest::newRow("Tumbler") << "Tumbler" << QPlatformTheme::SystemFont;
+}
+
+void tst_font::defaultFont()
+{
+ QFETCH(QString, control);
+ QFETCH(QPlatformTheme::Font, fontType);
+
+ TestFontTheme theme(QGuiApplicationPrivate::platform_theme);
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(QString("import QtQuick.Controls 2.2; %1 { }").arg(control).toUtf8(), QUrl());
+
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY2(!object.isNull(), qPrintable(component.errorString()));
+
+ QVariant var = object->property("font");
+ QVERIFY(var.isValid());
+
+ const QFont *expectedFont = theme.font(fontType);
+ QVERIFY(expectedFont);
+
+ QFont actualFont = var.value<QFont>();
+
+ if (actualFont != *expectedFont) {
+ qDebug() << QTest::currentDataTag() << actualFont << *expectedFont;
+ }
+
+ QCOMPARE(actualFont, *expectedFont);
+}
+
+QTEST_MAIN(tst_font)
+
+#include "tst_font.moc"