layout/reftests/image-rect/dom-api.html

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

     1 <!DOCTYPE html>
     2 <!--
     3     Any copyright is dedicated to the Public Domain.
     4     http://creativecommons.org/licenses/publicdomain/
     6     Tests if the DOM interface of -moz-image-rect() works and formats the
     7     output correctly.
     8 -->
     9 <html>
    10   <head>
    11     <title>Testcases: -moz-image-rect() [bug 113577]</title>
    12     <style>
    13       div.wrapper {
    14         width: 32px;
    15         height: 32px;
    16         margin: 10px;
    17         background-color: red;
    18       }
    19       div.wrapper div {
    20         width: 32px;
    21         height: 32px;
    22         background: no-repeat;
    23       }
    24     </style>
    25     <script>
    26       // Tests a common usage
    27       var test1    = "-moz-image-rect(url(green-16x16-in-blue-32x32.png), 0, 16, 16, 0)";
    28       var testRef1 = "-moz-image-rect(url(\"green-16x16-in-blue-32x32.png\"), 0, 16, 16, 0)";
    29       // Tests an irregular but valid usage
    30       var test2    = "-moz-image-rect( 'green-16x16-in-blue-32x32.png' , 0.0% , 50.5% , 49.5% , 0.0% )";
    31       var testRef2 = "-moz-image-rect(url(\"green-16x16-in-blue-32x32.png\"), 0%, 50.5%, 49.5%, 0%)";
    32       // Tests a wrong syntax (negative value)
    33       var test3    = "-moz-image-rect(url(green-16x16-in-blue-32x32.png), 0%, -50%, 50%, 0%)";
    34       var testRef3 = "";
    35       // Checks if I didn't break the default url() notation.
    36       var test4    = "url(  green-16x16-in-blue-32x32.png  )";
    37       var testRef4 = "url(\"green-16x16-in-blue-32x32.png\")";
    39       function equalDOMIO(domInput, domOutputRef, targetId) {
    40         var targetObj = document.getElementById(targetId);
    41         targetObj.style.backgroundImage = domInput;
    42         var domOutput = targetObj.style.backgroundImage;
    43         document.write(domOutput == domOutputRef ? "SUCCESS" : ("FAIL: " + domOutput));
    44       }
    45     </script>
    46   </head>
    47   <body>
    48     <div class="wrapper"><div id="test1"></div></div>
    49     <script>
    50       equalDOMIO(test1, testRef1, "test1");
    51     </script>
    52     <div class="wrapper"><div id="test2"></div></div>
    53     <script>
    54       equalDOMIO(test2, testRef2, "test2");
    55     </script>
    56     <div class="wrapper"><div id="test3"></div></div>
    57     <script>
    58       equalDOMIO(test3, testRef3, "test3");
    59     </script>
    60     <div class="wrapper"><div id="test4"></div></div>
    61     <script>
    62       equalDOMIO(test4, testRef4, "test4");
    63     </script>
    64   </body>
    65 </html>

mercurial