layout/style/test/test_bug372770.html

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

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

mercurial