on xenial help sign in
Add support for preview button color in ScopeStyle.qml
commit3e23c33c6fd05a780642a0b10d6e7068cc3900db authorMichał Sawicz <michal.sawicz@canonical.com> dateWed 13 Aug 2014, 13:18 (12 years ago) parent4726493
2 files changed+18−1
plugins/Dash/ScopeStyle.qml+3 tests/plugins/Dash/tst_ScopeStyle.qml+15−1
plugins/Dash/ScopeStyle.qml+3
@@ -89,6 +89,9 @@ QtObject {
8989 /// Background style for the navigation
9090 readonly property url navigationBackground: "navigation-background" in d.headerStyle ? d.headerStyle["navigation-background"] : "color:///#e0e0e0"
9191
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+
9295 //! @cond
9396 property var d: QtObject {
9497 // FIXME: should be taken from the theme
tests/plugins/Dash/tst_ScopeStyle.qml+15−1
@@ -35,7 +35,8 @@ Rectangle {
3535 property color color
3636 property var styles: [
3737 {},
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"},
3940 { "foreground-color": "green", "background-color": "white",
4041 "page-header": { "foreground-color": "black",
4142 "divider-color": "blue" } },
@@ -208,5 +209,18 @@ Rectangle {
208209 tool.style = testCase.styles[data.index];
209210 compare(tool.navigationBackground, data.navigationBackground, "Navigation background was incorrect.");
210211 }
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+ }
211225 }
212226}