on xenial help sign in
Add support for header divider color and navigation background in ScopeStyle.qml
commit4726493e8136ebb2e7e3714dfdaaa3d0513d0684 authorMichał Sawicz <michal.sawicz@canonical.com> dateWed 13 Aug 2014, 13:11 (12 years ago) parent2b472c3
2 files changed+37−2
plugins/Dash/ScopeStyle.qml+6 tests/plugins/Dash/tst_ScopeStyle.qml+31−2
plugins/Dash/ScopeStyle.qml+6
@@ -83,6 +83,12 @@ QtObject {
8383 /// Foreground color for the header
8484 readonly property color headerForeground: "foreground-color" in d.headerStyle ? d.headerStyle["foreground-color"] : foreground
8585
86+ /// Color of the header divider
87+ readonly property color headerDividerColor: "divider-color" in d.headerStyle ? d.headerStyle["divider-color"] : "#e0e0e0"
88+
89+ /// Background style for the navigation
90+ readonly property url navigationBackground: "navigation-background" in d.headerStyle ? d.headerStyle["navigation-background"] : "color:///#e0e0e0"
91+
8692 //! @cond
8793 property var d: QtObject {
8894 // FIXME: should be taken from the theme
tests/plugins/Dash/tst_ScopeStyle.qml+31−2
@@ -36,8 +36,12 @@ Rectangle {
3636 property var styles: [
3737 {},
3838 { "foreground-color": "red", "background-color": "black", "page-header": { "logo": "/foo/bar" } },
39− { "foreground-color": "green", "background-color": "white", "page-header": { "foreground-color": "black" } },
40− { "foreground-color": "blue", "background-color": "darkgrey", "page-header": { "background": "gradient:///white/blue" } },
39+ { "foreground-color": "green", "background-color": "white",
40+ "page-header": { "foreground-color": "black",
41+ "divider-color": "blue" } },
42+ { "foreground-color": "blue", "background-color": "darkgrey",
43+ "page-header": { "background": "gradient:///white/blue",
44+ "navigation-background": "gradient:///white/blue" } },
4145 ]
4246
4347 function cleanup() {
@@ -179,5 +183,30 @@ Rectangle {
179183 tool.style = testCase.styles[data.index];
180184 compare(tool.headerBackground, data.headerBackground, "Header background was incorrect.");
181185 }
186+
187+ function test_headerDividerColor_data() {
188+ return [
189+ { tag: "default", index: 0, headerDividerColor: "#e0e0e0" },
190+ { tag: "blue", index: 2, headerDividerColor: "blue" },
191+ ];
192+ }
193+
194+ function test_headerDividerColor(data) {
195+ tool.style = testCase.styles[data.index];
196+ verify(Qt.colorEqual(tool.headerDividerColor, data.headerDividerColor),
197+ "Header divider color not equal: %1 != %2".arg(tool.headerDividerColor).arg(data.headerDividerColor));
198+ }
199+
200+ function test_navigationBackground_data() {
201+ return [
202+ { tag: "default", index: 0, navigationBackground: "color:///#e0e0e0" },
203+ { tag: "black", index: 3, navigationBackground: "gradient:///white/blue" },
204+ ];
205+ }
206+
207+ function test_navigationBackground(data) {
208+ tool.style = testCase.styles[data.index];
209+ compare(tool.navigationBackground, data.navigationBackground, "Navigation background was incorrect.");
210+ }
182211 }
183212}