summaryrefslogtreecommitdiffstats
path: root/dom/canvas/test/test_bug1485266.html
blob: da40ed7952841a1a397308f87fe0b27e33cc284e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=14852266
-->
<head>
  <title>Test for Bug 14852266</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=14852266">Mozilla Bug 14852266</a>
<!-- CSS system colors -->
<!--<table cellspacing=0 border=1>
<caption>CSS system colors</caption>-->
<script type="application/javascript">

/** Test for Bug 14852266 **/

function beginTest() {
	var colorNames = [
		[ "ActiveBorder", 0xB4, 0xB4, 0xB4 ],
		[ "ActiveCaption", 0x99, 0xB4, 0xD1 ],
		[ "AppWorkspace", 0xAB, 0xAB, 0xAB ],
		[ "Background", 0x00, 0x00, 0x00 ],
		[ "ButtonFace", 0xF0, 0xF0, 0xF0 ],
		[ "ButtonHighlight", 0xFF, 0xFF, 0xFF ],
		[ "ButtonShadow", 0xA0, 0xA0, 0xA0 ],
		[ "ButtonText", 0x00, 0x00, 0x00 ],
		[ "CaptionText", 0x00, 0x00, 0x00 ],
		[ "GrayText", 0x6D, 0x6D, 0x6D ],
		[ "Highlight", 0x33, 0x99, 0xFF ],
		[ "HighlightText", 0xFF, 0xFF, 0xFF ],
		[ "InactiveBorder", 0xF4, 0xF7, 0xFC ],
		[ "InactiveCaption", 0xBF, 0xCD, 0xDB ],
		[ "InactiveCaptionText", 0x43, 0x4E, 0x54 ],
		[ "InfoBackground", 0xFF, 0xFF, 0xE1 ],
		[ "InfoText", 0x00, 0x00, 0x00 ],
		[ "Menu", 0xF0, 0xF0, 0xF0 ],
		[ "MenuText", 0x00, 0x00, 0x00 ],
		[ "Scrollbar", 0xC8, 0xC8, 0xC8 ],
		[ "ThreeDDarkShadow", 0x69, 0x69, 0x69 ],
		[ "ThreeDFace", 0xF0, 0xF0, 0xF0 ],
		[ "ThreeDHighlight", 0xFF, 0xFF, 0xFF ],
		[ "ThreeDLightShadow", 0xE3, 0xE3, 0xE3 ],
		[ "ThreeDShadow", 0xA0, 0xA0, 0xA0 ],
		[ "Window", 0xFF, 0xFF, 0xFF ],
		[ "WindowFrame", 0x64, 0x64, 0x64 ],
		[ "WindowText", 0x00, 0x00, 0x00 ],
		[ "-moz-ButtonDefault", 0x69, 0x69, 0x69 ],
		[ "-moz-ButtonHoverFace", 0xF0, 0xF0, 0xF0 ],
    [ "-moz-ButtonHoverText", 0x00, 0x00, 0x00 ],
		[ "-moz-CellHighlight", 0xF0, 0xF0, 0xF0 ],
		[ "-moz-CellHighlightText", 0x00, 0x00, 0x00 ],
		[ "-moz-Combobox", 0xFF, 0xFF, 0xFF ],
		[ "-moz-ComboboxText", 0x00, 0x00, 0x00 ],
		[ "-moz-Dialog", 0xF0, 0xF0, 0xF0 ],
		[ "-moz-DialogText", 0x00, 0x00, 0x00 ],
		[ "-moz-DragTargetZone", 0xFF, 0xFF, 0xFF ],
		[ "-moz-EvenTreeRow", 0xFF, 0xFF, 0xFF ],
		[ "-moz-Field", 0xFF, 0xFF, 0xFF ],
		[ "-moz-FieldText", 0x00, 0x00, 0x00 ],
		[ "-moz-MenuHover", 0x33, 0x99, 0xFF ],
		[ "-moz-MenuHoverText", 0x00, 0x00, 0x00 ],
		[ "-moz-MenubarText", 0x00, 0x00, 0x00 ],
    [ "-moz-MenubarHoverText", 0x00, 0x00, 0x00 ],
		[ "-moz-NativeHyperlinkText", 0x00, 0x66, 0xCC ],
		[ "-moz-OddTreeRow", 0xFF, 0xFF, 0xFF ],
		[ "-moz-mac-chrome-active", 0xB2, 0xB2, 0xB2 ],
		[ "-moz-mac-chrome-inactive", 0xE1, 0xE1, 0xE1 ],
		[ "-moz-mac-focusring", 0x60, 0x9D, 0xD7 ],
		[ "-moz-mac-menuselect", 0x38, 0x75, 0xD7 ],
		[ "-moz-mac-menushadow", 0xA3, 0xA3, 0xA3 ],
		[ "-moz-mac-menutextdisable", 0x88, 0x88, 0x88 ],
		[ "-moz-mac-menutextselect", 0xFF, 0xFF, 0xFF ],
		[ "-moz-mac-DisabledToolbarText", 0x3F, 0x3F, 0x3F ],
		[ "-moz-mac-AlternatePrimaryHighlight", 0x3F, 0x3F, 0x3F ],
		[ "-moz-mac-SecondaryHighlight", 0xD4, 0xD4, 0xD4 ],
		[ "-moz-win-MediaText", 0xFF, 0xFF, 0xFF ],
		[ "-moz-win-CommunicationsText", 0xFF, 0xFF, 0xFF ],
		[ "-moz-html-CellHighlight", 0x33, 0x99, 0xFF ],
		[ "-moz-html-CellHighlightText", 0xFF, 0xFF, 0xFF ],

		// These five are configured via Tools -> Options -> Content -> Colors.
		//"-moz-ActiveHyperlinkText",
		//"-moz-HyperLinkText",
		//"-moz-VisitedHyperlinkText",
		//"-moz-default-background-color",
		//"-moz-default-color",
	];

	var colorTestDiv = document.createElement("div");
	document.body.appendChild(colorTestDiv); // ie

	for (var i in colorNames) {
		(function(colorName, r, g, b) {
      // test value
      var ctest = "rgb(" + r + ", " + g + ", " + b + ")";

      // computed value
      colorTestDiv.style.backgroundColor = "#FF00FE";
      try {
        colorTestDiv.style.backgroundColor = colorName;
      } catch (ex) {} // ie
      var c1;
      if (window.getComputedStyle) {
        c1 = getComputedStyle(colorTestDiv, null).backgroundColor;
      } else { // ie
        var range = document.body.createTextRange();
        range.moveToElementText(colorTestDiv);
        c1 = range.queryCommandValue("BackColor");
        c1 = "rgb(" + (c1 & 0xFF) + ", " + ((c1 >> 8) & 0xFF) + ", " + ((c1 >> 16) & 0xFF) + ")";
      }
      if (c1 != "rgb(255, 0, 254)") {
        is(c1, ctest, "Stand-in computed color: " + colorName + " is correct.");
      }

    })(colorNames[i][0], colorNames[i][1], colorNames[i][2], colorNames[i][3]);
  }
  SimpleTest.finish();
}

var prefs = [
  [ "privacy.resistFingerprinting", true ],
  [ "ui.use_standins_for_native_colors", false ],
  [ "ui.use_native_colors", true ],
];

SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({ "set" : prefs }, beginTest);

</script>
<!-- </table> -->
</body>
</html>