on xenial help sign in
Add tests for header foreground and background.
ab3984aMichał Sawicz
tests/plugins/Dash/tst_ScopeStyle.qml+27−2
@@ -36,8 +36,8 @@ Rectangle {
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− { "foreground-color": "green", "background-color": "white" },
39+ { "foreground-color": "green", "background-color": "white", "page-header": { "foreground-color": "black" } },
40− { "foreground-color": "blue", "background-color": "darkgrey" },
40+ { "foreground-color": "blue", "background-color": "darkgrey", "page-header": { "background": "gradient:///white/blue" } },
41 ]
41 ]
42
42
43 function cleanup() {
43 function cleanup() {
@@ -147,5 +147,30 @@ Rectangle {
147 tool.style = testCase.styles[data.index];
147 tool.style = testCase.styles[data.index];
148 compare(tool.headerLogo, data.headerLogo, "Header logo was incorrect.");
148 compare(tool.headerLogo, data.headerLogo, "Header logo was incorrect.");
149 }
149 }
150+
151+ function test_headerForeground_data() {
152+ return [
153+ { tag: "default", index: 0, headerForeground: "grey" },
154+ { tag: "black", index: 2, headerForeground: "black" },
155+ ];
156+ }
157+
158+ function test_headerForeground(data) {
159+ tool.style = testCase.styles[data.index];
160+ verify(Qt.colorEqual(tool.headerForeground, data.headerForeground),
161+ "Header foreground not equal: %1 != %2".arg(tool.headerForeground).arg(data.headerForeground));
162+ }
163+
164+ function test_headerBackground_data() {
165+ return [
166+ { tag: "default", index: 0, headerBackground: "" },
167+ { tag: "black", index: 3, headerBackground: "gradient:///white/blue" },
168+ ];
169+ }
170+
171+ function test_headerBackground(data) {
172+ tool.style = testCase.styles[data.index];
173+ compare(tool.headerBackground, data.headerBackground, "Header background was incorrect.");
174+ }
150 }
175 }
151}
176}