From de0212e51e65b578bc941c1004914a0c33c06da7 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 30 Sep 2016 21:23:01 +0200 Subject: Fix style inheritance When unable to find a parent item style on window change, use the window style as a fallback to avoid a parentless style. Task-number: QTBUG-52631 Change-Id: I5d31dc72075f06f865f01c3ee2411de6a1485677 Reviewed-by: J-P Nurmi --- tests/auto/qquickmaterialstyle/data/tst_material.qml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'tests/auto/qquickmaterialstyle/data/tst_material.qml') diff --git a/tests/auto/qquickmaterialstyle/data/tst_material.qml b/tests/auto/qquickmaterialstyle/data/tst_material.qml index 5cfec8d3..e1e100d7 100644 --- a/tests/auto/qquickmaterialstyle/data/tst_material.qml +++ b/tests/auto/qquickmaterialstyle/data/tst_material.qml @@ -41,6 +41,7 @@ import QtQuick 2.2 import QtQuick.Window 2.2 import QtTest 1.0 +import QtQuick.Templates 2.0 as T import QtQuick.Controls 2.0 import QtQuick.Controls.Material 2.0 @@ -127,6 +128,7 @@ TestCase { visible: true property alias popup: popupInstance property alias label: labelInstance + property alias label2: labelInstance2 Popup { id: popupInstance Label { @@ -136,6 +138,14 @@ TestCase { } Component.onCompleted: open() } + T.Popup { + contentItem: Label { + id: labelInstance2 + text: "test" + color: Material.textSelectionColor + } + Component.onCompleted: open() + } } } @@ -291,16 +301,19 @@ TestCase { var popupObject = popupComponent.createObject(testCase) compare(popupObject.popup.Material.textSelectionColor.toString(), popupObject.Material.textSelectionColor.toString()) compare(popupObject.label.color.toString(), popupObject.Material.textSelectionColor.toString()) + compare(popupObject.label2.color.toString(), popupObject.Material.textSelectionColor.toString()) popupObject.Material[prop] = data.value1 compare(popupObject.Material[prop], data.value1) compare(popupObject.popup.Material.textSelectionColor.toString(), popupObject.Material.textSelectionColor.toString()) compare(popupObject.label.color.toString(), popupObject.Material.textSelectionColor.toString()) + compare(popupObject.label2.color.toString(), popupObject.Material.textSelectionColor.toString()) popupObject.Material[prop] = data.value2 compare(popupObject.Material[prop], data.value2) compare(popupObject.popup.Material.textSelectionColor.toString(), popupObject.Material.textSelectionColor.toString()) compare(popupObject.label.color.toString(), popupObject.Material.textSelectionColor.toString()) + compare(popupObject.label2.color.toString(), popupObject.Material.textSelectionColor.toString()) popupObject.destroy() } @@ -500,11 +513,11 @@ TestCase { compare(control.Material[prop], "#80808080") // unknown - ignoreWarning(Qt.resolvedUrl("tst_material.qml") + ":57:9: QML Button: unknown Material." + prop + " value: 123") + ignoreWarning(Qt.resolvedUrl("tst_material.qml") + ":58:9: QML Button: unknown Material." + prop + " value: 123") control.Material[prop] = 123 - ignoreWarning(Qt.resolvedUrl("tst_material.qml") + ":57:9: QML Button: unknown Material." + prop + " value: foo") + ignoreWarning(Qt.resolvedUrl("tst_material.qml") + ":58:9: QML Button: unknown Material." + prop + " value: foo") control.Material[prop] = "foo" - ignoreWarning(Qt.resolvedUrl("tst_material.qml") + ":57:9: QML Button: unknown Material." + prop + " value: #1") + ignoreWarning(Qt.resolvedUrl("tst_material.qml") + ":58:9: QML Button: unknown Material." + prop + " value: #1") control.Material[prop] = "#1" control.destroy() -- cgit v1.2.3