@@ -0,0 +1,59 @@
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/>.
20+import Ubuntu.Components 1.1
38+ testCase.color = "transparent";
41+ function test_luminance_data() {
43+ { tag: "#F00", luminance: 0.2126 },
44+ { tag: "#0F0", luminance: 0.7152 },
45+ { tag: "#00F", luminance: 0.0722 },
46+ { tag: "white", luminance: 1.0 },
47+ { tag: "black", luminance: 0.0 },
48+ { tag: "lightgrey", luminance: 0.8275 },
49+ { tag: "grey", luminance: 0.5020 },
50+ { tag: "darkgrey", luminance: 0.6627 },
54+ function test_luminance(data) {
55+ testCase.color = data.tag;
56+ compare(tool.luminance(testCase.color).toFixed(4), data.luminance.toFixed(4));