on xenial help sign in
Add support for preview button color in ScopeStyle.qml
fcbcf9aMichał Sawicz
plugins/Dash/ScopeStyle.qml+3
@@ -89,6 +89,9 @@ QtObject {
89 /// Background style for the navigation
89 /// Background style for the navigation
90 readonly property url navigationBackground: "navigation-background" in d.headerStyle ? d.headerStyle["navigation-background"] : "color:///#e0e0e0"
90 readonly property url navigationBackground: "navigation-background" in d.headerStyle ? d.headerStyle["navigation-background"] : "color:///#e0e0e0"
91
91
92+ /// Color of the primary preview button
93+ readonly property color previewButtonColor: "preview-button-color" in style ? style["preview-button-color"] : Theme.palette.selected.foreground
94+
92 //! @cond
95 //! @cond
93 property var d: QtObject {
96 property var d: QtObject {
94 // FIXME: should be taken from the theme
97 // FIXME: should be taken from the theme
tests/plugins/Dash/tst_ScopeStyle.qml+15−1
@@ -35,7 +35,8 @@ Rectangle {
35 property color color
35 property color color
36 property var styles: [
36 property var styles: [
37 {},
37 {},
38− { "foreground-color": "red", "background-color": "black", "page-header": { "logo": "/foo/bar" } },
38+ { "foreground-color": "red", "background-color": "black", "page-header": { "logo": "/foo/bar" },
39+ "preview-button-color": "red"},
39 { "foreground-color": "green", "background-color": "white",
40 { "foreground-color": "green", "background-color": "white",
40 "page-header": { "foreground-color": "black",
41 "page-header": { "foreground-color": "black",
41 "divider-color": "blue" } },
42 "divider-color": "blue" } },
@@ -208,5 +209,18 @@ Rectangle {
208 tool.style = testCase.styles[data.index];
209 tool.style = testCase.styles[data.index];
209 compare(tool.navigationBackground, data.navigationBackground, "Navigation background was incorrect.");
210 compare(tool.navigationBackground, data.navigationBackground, "Navigation background was incorrect.");
210 }
211 }
212+
213+ function test_previewButtonColor_data() {
214+ return [
215+ { tag: "default", index: 0, previewButtonColor: Theme.palette.selected.foreground },
216+ { tag: "red", index: 1, previewButtonColor: "red" },
217+ ];
218+ }
219+
220+ function test_previewButtonColor(data) {
221+ tool.style = testCase.styles[data.index];
222+ verify(Qt.colorEqual(tool.previewButtonColor, data.previewButtonColor),
223+ "Preview button color not equal: %1 != %2".arg(tool.previewButtonColor).arg(data.previewButtonColor));
224+ }
211 }
225 }
212}
226}