on xenial help sign in
Add support for background color in StyleTool.
commit983e0753b615aaa24d3eab07fae34b81ed08abcd authorMichał Sawicz <michal.sawicz@canonical.com> dateSun 6 Jul 2014, 02:39 (12 years ago) parent2998644
2 files changed+22−3
plugins/Dash/StyleTool.qml+3 tests/plugins/Dash/tst_StyleTool.qml+19−3
plugins/Dash/StyleTool.qml+3
@@ -35,4 +35,7 @@ QtObject {
3535 /// Color used for text and symbolic icons
3636 // FIXME: should be taken from the theme
3737 readonly property color foreground: style && "foreground-color" in style ? style["foreground-color"] : "grey"
38+
39+ /// Color used for text and symbolic icons
40+ readonly property color background: style && "background-color" in style ? style["background-color"] : "transparent"
3841}
tests/plugins/Dash/tst_StyleTool.qml+19−3
@@ -35,9 +35,9 @@ Rectangle {
3535 property color color
3636 property var styles: [
3737 {},
38− { "foreground-color": "red" },
39− { "foreground-color": "green" },
40− { "foreground-color": "blue" },
38+ { "foreground-color": "red", "background-color": "black" },
39+ { "foreground-color": "green", "background-color": "white" },
40+ { "foreground-color": "blue", "background-color": "darkgrey" },
4141 ]
4242
4343 function cleanup() {
@@ -76,5 +76,21 @@ Rectangle {
7676 verify(Qt.colorEqual(tool.foreground, data.foreground),
7777 "Foreground color not equal: %1 != %2".arg(tool.foreground).arg(data.foreground));
7878 }
79+
80+ function test_background_data() {
81+ return [
82+ { tag: "default", index: 0, background: "transparent" },
83+ { tag: "black", index: 1, background: "black" },
84+ { tag: "white", index: 2, background: "white" },
85+ { tag: "darkgrey", index: 3, background: "darkgrey" },
86+ ];
87+ }
88+
89+ function test_background(data) {
90+ tool.style = testCase.styles[data.index];
91+ verify(Qt.colorEqual(tool.background, data.background),
92+ "Background color not equal: %1 != %2".arg(tool.background).arg(data.background));
93+ }
94+
7995 }
8096}