2 * Copyright (C) 2014 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20import Ubuntu.Components 1.1
37 property var styles: [
39 { "foreground-color": "red", "background-color": "black", "page-header": { "logo": "/foo/bar" },
40 "preview-button-color": "red"},
41 { "foreground-color": "green", "background-color": "white",
42 "page-header": { "foreground-color": "black",
43 "divider-color": "blue" } },
44 { "foreground-color": "blue", "background-color": "darkgrey",
45 "page-header": { "background": "gradient:///white/blue",
46 "navigation-background": "gradient:///white/blue" } },
50 testCase.color = "transparent";
53 function test_foreground_data() {
55 { tag: "default", index: 0, foreground: UbuntuColors.darkGrey, luminance: 0.3647 },
56 { tag: "red on black", index: 1, foreground: "red", luminance: 0.2126 },
57 { tag: "green on white", index: 2, foreground: "green", luminance: 0.3590 },
58 { tag: "blue on darkgrey", index: 3, foreground: "blue", luminance: 0.0722 },
62 function test_foreground(data) {
63 tool.style = testCase.styles[data.index];
64 verify(Qt.colorEqual(tool.foreground, data.foreground),
65 "Foreground color not equal: %1 != %2".arg(tool.foreground).arg(data.foreground));
66 compare(tool.foregroundLuminance.toFixed(4), data.luminance.toFixed(4));
69 function test_background_data() {
71 { tag: "default", index: 0, background: "#00f5f5f5", luminance: 0.9608 },
72 { tag: "red on black", index: 1, background: "black", luminance: 0 },
73 { tag: "green on white", index: 2, background: "white", luminance: 1 },
74 { tag: "blue on darkgrey", index: 3, background: "darkgrey", luminance: 0.6627 },
78 function test_background(data) {
79 tool.style = testCase.styles[data.index];
80 verify(Qt.colorEqual(tool.background, data.background),
81 "Background color not equal: %1 != %2".arg(tool.background).arg(data.background));
82 compare(tool.backgroundLuminance.toFixed(4), data.luminance.toFixed(4));
85 function test_getTextColor_data() {
87 { tag: "default on black", background: "black", index: 0, textColor: "white" },
88 { tag: "default on lightgrey", background: "lightgrey", index: 0, textColor: UbuntuColors.darkGrey },
89 { tag: "default on white", background: "white", index: 0, textColor: UbuntuColors.darkGrey },
90 { tag: "default on yellow", background: "yellow", index: 0, textColor: UbuntuColors.darkGrey },
91 { tag: "red/black on black", background: "black", index: 1, textColor: "red" },
92 { tag: "red/black on lightgrey", background: "lightgrey", index: 1, textColor: "black" },
93 { tag: "red/black on white", background: "white", index: 1, textColor: "black" },
94 { tag: "red/black on yellow", background: "yellow", index: 1, textColor: "black" },
95 { tag: "green/white on black", background: "black", index: 2, textColor: "white" },
96 { tag: "green/white on lightgrey", background: "lightgrey", index: 2, textColor: "green" },
97 { tag: "green/white on white", background: "white", index: 2, textColor: "green" },
98 { tag: "green/white on yellow", background: "yellow", index: 2, textColor: "green" },
99 { tag: "blue/darkgrey on black", background: "black", index: 3, textColor: "darkgrey" },
100 { tag: "blue/darkgrey on lightgrey", background: "lightgrey", index: 3, textColor: "blue" },
101 { tag: "blue/darkgrey on white", background: "white", index: 3, textColor: "blue" },
102 { tag: "blue/darkgrey on yellow", background: "yellow", index: 3, textColor: "blue" },
106 function test_getTextColor(data) {
107 tool.style = testCase.styles[data.index];
108 var textColor = tool.getTextColor(Style.luminance(data.background));
109 verify(Qt.colorEqual(textColor, data.textColor),
110 "TextColor not equal: %1 != %2".arg(textColor).arg(data.textColor));
113 function test_headerLogo_data() {
115 { tag: "default", index: 0, headerLogo: "" },
116 { tag: "with logo", index: 1, headerLogo: "file:///foo/bar" },
120 function test_headerLogo(data) {
121 tool.style = testCase.styles[data.index];
122 compare(tool.headerLogo, data.headerLogo, "Header logo was incorrect.");
125 function test_headerForeground_data() {
127 { tag: "default", index: 0, headerForeground: UbuntuColors.darkGrey },
128 { tag: "black", index: 2, headerForeground: "black" },
132 function test_headerForeground(data) {
133 tool.style = testCase.styles[data.index];
134 verify(Qt.colorEqual(tool.headerForeground, data.headerForeground),
135 "Header foreground not equal: %1 != %2".arg(tool.headerForeground).arg(data.headerForeground));
138 function test_headerBackground_data() {
140 { tag: "default", index: 0, headerBackground: "color:///#f5f5f5" },
141 { tag: "black", index: 3, headerBackground: "gradient:///white/blue" },
145 function test_headerBackground(data) {
146 tool.style = testCase.styles[data.index];
147 compare(tool.headerBackground, data.headerBackground, "Header background was incorrect.");
150 function test_headerDividerColor_data() {
152 { tag: "default", index: 0, headerDividerColor: "#e0e0e0" },
153 { tag: "blue", index: 2, headerDividerColor: "blue" },
157 function test_headerDividerColor(data) {
158 tool.style = testCase.styles[data.index];
159 verify(Qt.colorEqual(tool.headerDividerColor, data.headerDividerColor),
160 "Header divider color not equal: %1 != %2".arg(tool.headerDividerColor).arg(data.headerDividerColor));
163 function test_navigationBackground_data() {
165 { tag: "default", index: 0, navigationBackground: "color:///#f5f5f5" },
166 { tag: "black", index: 3, navigationBackground: "gradient:///white/blue" },
170 function test_navigationBackground(data) {
171 tool.style = testCase.styles[data.index];
172 compare(tool.navigationBackground, data.navigationBackground, "Navigation background was incorrect.");
175 function test_previewButtonColor_data() {
177 { tag: "default", index: 0, previewButtonColor: UbuntuColors.orange },
178 { tag: "red", index: 1, previewButtonColor: "red" },
182 function test_previewButtonColor(data) {
183 tool.style = testCase.styles[data.index];
184 verify(Qt.colorEqual(tool.previewButtonColor, data.previewButtonColor),
185 "Preview button color not equal: %1 != %2".arg(tool.previewButtonColor).arg(data.previewButtonColor));
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list