layout/style/test/test_bug372770.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=372770
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 372770</title>
michael@0 8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 10 <style id="testStyle">
michael@0 11 #content {}
michael@0 12 </style>
michael@0 13 </head>
michael@0 14 <body>
michael@0 15 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=372770">Mozilla Bug 372770</a>
michael@0 16 <p id="display"></p>
michael@0 17 <div id="content" style="display: none">
michael@0 18
michael@0 19 </div>
michael@0 20 <pre id="test">
michael@0 21 <script class="testbody" type="text/javascript">
michael@0 22
michael@0 23 /** Test for Bug 372770 **/
michael@0 24 var style1 = $("content").style;
michael@0 25 var style2 = $("testStyle").sheet.cssRules[0].style;
michael@0 26
michael@0 27 var colors = [ "rgb(128, 128, 128)", "transparent" ]
michael@0 28 var i;
michael@0 29
michael@0 30 for (i = 0; i < colors.length; ++i) {
michael@0 31 var color = colors[i];
michael@0 32 style1.color = color;
michael@0 33 style2.color = color;
michael@0 34 is(style1.color, color, "Inline style color roundtripping failed at color " + i);
michael@0 35 is(style2.color, color, "Rule style color roundtripping failed at color " + i);
michael@0 36 }
michael@0 37
michael@0 38 // This code is only here because of bug 372783. Once that's fixed, this test
michael@0 39 // for "rgba(0, 0, 0, 0)" will fail.
michael@0 40 style1.color = "rgba(0, 0, 0, 0)";
michael@0 41 style2.color = "rgba(0, 0, 0, 0)";
michael@0 42 is(style1.color, "transparent",
michael@0 43 "Inline style should give transparent for rgba(0,0,0,0)");
michael@0 44 is(style2.color, "transparent",
michael@0 45 "Rule style should give transparent for rgba(0,0,0,0)");
michael@0 46 todo(style1.color == "rgba(0, 0, 0, 0)",
michael@0 47 "Inline style should round-trip black transparent color correctly");
michael@0 48 todo(style2.color == "rgba(0, 0, 0, 0)",
michael@0 49 "Rule style should round-trip black transparent color correctly");
michael@0 50
michael@0 51 for (var i = 0; i <= 100; ++i) {
michael@0 52 if (i == 70 || i == 90) {
michael@0 53 // Tinderbox unhappy for some reason... just skip these for now?
michael@0 54 continue;
michael@0 55 }
michael@0 56 var color1 = "rgba(128, 128, 128, " + i/100 + ")";
michael@0 57 var color2 = "rgba(175, 63, 27, " + i/100 + ")";
michael@0 58 style1.color = color1;
michael@0 59 style1.backgroundColor = color2;
michael@0 60 style2.color = color2;
michael@0 61 style2.background = color1;
michael@0 62
michael@0 63 if (i == 100) {
michael@0 64 // Bug 372783 means this doesn't round-trip quite right
michael@0 65 todo(style1.color == color1,
michael@0 66 "Inline style color roundtripping failed at opacity " + i);
michael@0 67 todo(style1.backgroundColor == color2,
michael@0 68 "Inline style background roundtripping failed at opacity " + i);
michael@0 69 todo(style2.color == color2,
michael@0 70 "Rule style color roundtripping failed at opacity " + i);
michael@0 71 todo(style2.backgroundColor == color1,
michael@0 72 "Rule style background roundtripping failed at opacity " + i);
michael@0 73 color1 = "rgb(128, 128, 128)";
michael@0 74 color2 = "rgb(175, 63, 27)";
michael@0 75 }
michael@0 76
michael@0 77 is(style1.color, color1,
michael@0 78 "Inline style color roundtripping failed at opacity " + i);
michael@0 79 is(style1.backgroundColor, color2,
michael@0 80 "Inline style background roundtripping failed at opacity " + i);
michael@0 81 is(style2.color, color2,
michael@0 82 "Rule style color roundtripping failed at opacity " + i);
michael@0 83 is(style2.backgroundColor, color1,
michael@0 84 "Rule style background roundtripping failed at opacity " + i);
michael@0 85
michael@0 86 }
michael@0 87 </script>
michael@0 88 </pre>
michael@0 89 </body>
michael@0 90 </html>
michael@0 91

mercurial