@@ -82,48 +82,32 @@ Rectangle {
8282 compare(tool.backgroundLuminance.toFixed(4), data.luminance.toFixed(4));
8383 }
8484
85− function test_threshold_data() {
85+ function test_getTextColor_data() {
8686 return [
87− { tag: "default", index: 0, threshold: 0.6824 },
88− { tag: "red on black", index: 1, threshold: 0.1063 },
89− { tag: "green on white", index: 2, threshold: 0.6795 },
90− { tag: "blue on darkgrey", index: 3, threshold: 0.3675 },
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" },
91103 ];
92104 }
93105
94− function test_threshold(data) {
106+ function test_getTextColor(data) {
95107 tool.style = testCase.styles[data.index];
96− compare(tool.threshold.toFixed(4), data.threshold.toFixed(4), "Luminance threshold was incorrect.");
97− }
98−
99− function test_light_data() {
100− return [
101− { tag: "default", index: 0, light: "white" },
102− { tag: "red on black", index: 1, light: "red" },
103− { tag: "green on white", index: 2, light: "white" },
104− { tag: "blue on darkgrey", index: 3, light: "darkgrey" },
105− ];
106− }
107−
108− function test_light(data) {
109− tool.style = testCase.styles[data.index];
110− verify(Qt.colorEqual(tool.light, data.light),
111− "Light color not equal: %1 != %2".arg(tool.light).arg(data.light));
112− }
113−
114− function test_dark_data() {
115− return [
116− { tag: "default", index: 0, dark: UbuntuColors.darkGrey },
117− { tag: "red on black", index: 1, dark: "black" },
118− { tag: "green on white", index: 2, dark: "green" },
119− { tag: "blue on darkgrey", index: 3, dark: "blue" },
120− ];
121− }
122−
123− function test_dark(data) {
124− tool.style = testCase.styles[data.index];
125− verify(Qt.colorEqual(tool.dark, data.dark),
126− "Dark color not equal: %1 != %2".arg(tool.dark).arg(data.dark));
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));
127111 }
128112
129113 function test_headerLogo_data() {