Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=156716 |
michael@0 | 5 | --> |
michael@0 | 6 | <!-- |
michael@0 | 7 | |
michael@0 | 8 | This is test 46 from the Acid3 test, http://acid3.acidtests.org/ |
michael@0 | 9 | extracted from the test framework there and put into Mochitest. |
michael@0 | 10 | |
michael@0 | 11 | (from irc.mozilla.org, developers) |
michael@0 | 12 | [2008-05-14 18:07:38] <Hixie> dbaron: I hereby grant all files available from the server http://acid3.acidtests.org/ under the following license: (c) copyright 2008 Ian Hickson. These documents may be used under the terms of any of the following licenses: MPL. GPL. LGPL. BSD. |
michael@0 | 13 | |
michael@0 | 14 | --> |
michael@0 | 15 | <head> |
michael@0 | 16 | <title>Test for Bug 156716</title> |
michael@0 | 17 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 18 | <style type="text/css"> |
michael@0 | 19 | iframe#selectors { width: 0; height: 0; } |
michael@0 | 20 | </style> |
michael@0 | 21 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 22 | </head> |
michael@0 | 23 | <body> |
michael@0 | 24 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=156716">Mozilla Bug 156716</a> |
michael@0 | 25 | <div id="content" style="display: none"> |
michael@0 | 26 | |
michael@0 | 27 | </div> |
michael@0 | 28 | <pre id="test"> |
michael@0 | 29 | <script class="testbody" type="text/javascript"> |
michael@0 | 30 | |
michael@0 | 31 | /** Test for Bug 156716 **/ |
michael@0 | 32 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 33 | function runTest() { |
michael@0 | 34 | |
michael@0 | 35 | function getTestDocument() { |
michael@0 | 36 | var iframe = document.getElementById("selectors"); |
michael@0 | 37 | var doc = iframe.contentDocument; |
michael@0 | 38 | for (var i = doc.documentElement.childNodes.length-1; i >= 0; i -= 1) |
michael@0 | 39 | doc.documentElement.removeChild(doc.documentElement.childNodes[i]); |
michael@0 | 40 | doc.documentElement.appendChild(doc.createElement('head')); |
michael@0 | 41 | doc.documentElement.firstChild.appendChild(doc.createElement('title')); |
michael@0 | 42 | doc.documentElement.appendChild(doc.createElement('body')); |
michael@0 | 43 | return doc; |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | // test 46: media queries |
michael@0 | 47 | var doc = getTestDocument(); |
michael@0 | 48 | var style = doc.createElement('style'); |
michael@0 | 49 | style.setAttribute('type', 'text/css'); |
michael@0 | 50 | style.appendChild(doc.createTextNode('@media all and (min-color: 0) { #a { text-transform: uppercase; } }')); // matches |
michael@0 | 51 | style.appendChild(doc.createTextNode('@media not all and (min-color: 0) { #b { text-transform: uppercase; } }')); |
michael@0 | 52 | style.appendChild(doc.createTextNode('@media only all and (min-color: 0) { #c { text-transform: uppercase; } }')); // matches |
michael@0 | 53 | style.appendChild(doc.createTextNode('@media (bogus) { #d { text-transform: uppercase; } }')); |
michael@0 | 54 | style.appendChild(doc.createTextNode('@media all and (bogus) { #e { text-transform: uppercase; } }')); |
michael@0 | 55 | style.appendChild(doc.createTextNode('@media not all and (bogus) { #f { text-transform: uppercase; } }')); // matches |
michael@0 | 56 | style.appendChild(doc.createTextNode('@media only all and (bogus) { #g { text-transform: uppercase; } }')); |
michael@0 | 57 | style.appendChild(doc.createTextNode('@media (bogus), all { #h { text-transform: uppercase; } }')); // matches |
michael@0 | 58 | style.appendChild(doc.createTextNode('@media all and (bogus), all { #i { text-transform: uppercase; } }')); // matches |
michael@0 | 59 | style.appendChild(doc.createTextNode('@media not all and (bogus), all { #j { text-transform: uppercase; } }')); // matches |
michael@0 | 60 | style.appendChild(doc.createTextNode('@media only all and (bogus), all { #k { text-transform: uppercase; } }')); // matches |
michael@0 | 61 | style.appendChild(doc.createTextNode('@media all, (bogus) { #l { text-transform: uppercase; } }')); // matches |
michael@0 | 62 | style.appendChild(doc.createTextNode('@media all, all and (bogus) { #m { text-transform: uppercase; } }')); // matches |
michael@0 | 63 | style.appendChild(doc.createTextNode('@media all, not all and (bogus) { #n { text-transform: uppercase; } }')); // matches |
michael@0 | 64 | style.appendChild(doc.createTextNode('@media all, only all and (bogus) { #o { text-transform: uppercase; } }')); // matches |
michael@0 | 65 | style.appendChild(doc.createTextNode('@media all and color { #p { text-transform: uppercase; } }')); |
michael@0 | 66 | style.appendChild(doc.createTextNode('@media all and min-color: 0 { #q { text-transform: uppercase; } }')); |
michael@0 | 67 | style.appendChild(doc.createTextNode('@media all, all and color { #r { text-transform: uppercase; } }')); |
michael@0 | 68 | style.appendChild(doc.createTextNode('@media all, all and min-color: 0 { #s { text-transform: uppercase; } }')); |
michael@0 | 69 | style.appendChild(doc.createTextNode('@media all and min-color: 0, all { #t { text-transform: uppercase; } }')); |
michael@0 | 70 | style.appendChild(doc.createTextNode('@media (max-color: 0) and (max-monochrome: 0) { #u { text-transform: uppercase; } }')); |
michael@0 | 71 | style.appendChild(doc.createTextNode('@media (min-color: 1), (min-monochrome: 1) { #v { text-transform: uppercase; } }')); // matches |
michael@0 | 72 | style.appendChild(doc.createTextNode('@media all and (min-color: 0) and (min-monochrome: 0) { #w { text-transform: uppercase; } }')); // matches |
michael@0 | 73 | style.appendChild(doc.createTextNode('@media not all and (min-color: 1), not all and (min-monochrome: 1) { #x { text-transform: uppercase; } }')); // matches |
michael@0 | 74 | style.appendChild(doc.createTextNode('@media all and (min-height: 1em) and (min-width: 1em) { #y1 { text-transform: uppercase; } }')); |
michael@0 | 75 | style.appendChild(doc.createTextNode('@media all and (max-height: 1em) and (min-width: 1em) { #y2 { text-transform: uppercase; } }')); |
michael@0 | 76 | style.appendChild(doc.createTextNode('@media all and (min-height: 1em) and (max-width: 1em) { #y3 { text-transform: uppercase; } }')); |
michael@0 | 77 | style.appendChild(doc.createTextNode('@media all and (max-height: 1em) and (max-width: 1em) { #y4 { text-transform: uppercase; } }')); // matches |
michael@0 | 78 | doc.getElementsByTagName('head')[0].appendChild(style); |
michael@0 | 79 | var names = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y1', 'y2', 'y3', 'y4']; |
michael@0 | 80 | for (var i in names) { |
michael@0 | 81 | var p = doc.createElement('p'); |
michael@0 | 82 | p.id = names[i]; |
michael@0 | 83 | doc.body.appendChild(p); |
michael@0 | 84 | } |
michael@0 | 85 | var count = 0; |
michael@0 | 86 | var check = function (c, e) { |
michael@0 | 87 | count += 1; |
michael@0 | 88 | var p = doc.getElementById(c); |
michael@0 | 89 | is(doc.defaultView.getComputedStyle(p, '').textTransform, e ? 'uppercase' : 'none', "case " + c + " failed (index " + count + ")"); |
michael@0 | 90 | } |
michael@0 | 91 | check('a', true); // 1 |
michael@0 | 92 | check('b', false); |
michael@0 | 93 | check('c', true); |
michael@0 | 94 | check('d', false); |
michael@0 | 95 | check('e', false); |
michael@0 | 96 | check('f', false); // true in old spec; commented out in real Acid3 |
michael@0 | 97 | check('g', false); |
michael@0 | 98 | check('h', true); |
michael@0 | 99 | check('i', true); |
michael@0 | 100 | check('j', true); // 10 |
michael@0 | 101 | check('k', true); |
michael@0 | 102 | check('l', true); |
michael@0 | 103 | check('m', true); |
michael@0 | 104 | check('n', true); |
michael@0 | 105 | check('o', true); |
michael@0 | 106 | check('p', false); |
michael@0 | 107 | check('q', false); |
michael@0 | 108 | check('r', true); // false in old spec |
michael@0 | 109 | check('s', true); // false in old spec |
michael@0 | 110 | check('t', true); // 20 - false in old spec |
michael@0 | 111 | check('u', false); |
michael@0 | 112 | check('v', true); |
michael@0 | 113 | check('w', true); |
michael@0 | 114 | check('x', true); |
michael@0 | 115 | // here the viewport is 0x0 |
michael@0 | 116 | check('y1', false); // 25 |
michael@0 | 117 | check('y2', false); |
michael@0 | 118 | check('y3', false); |
michael@0 | 119 | check('y4', true); |
michael@0 | 120 | document.getElementById("selectors").setAttribute("style", "height: 100px; width: 100px"); |
michael@0 | 121 | // now the viewport is more than 1em by 1em |
michael@0 | 122 | check('y1', true); // 29 |
michael@0 | 123 | check('y2', false); |
michael@0 | 124 | check('y3', false); |
michael@0 | 125 | check('y4', false); |
michael@0 | 126 | document.getElementById("selectors").removeAttribute("style"); |
michael@0 | 127 | // here the viewport is 0x0 again |
michael@0 | 128 | check('y1', false); // 33 |
michael@0 | 129 | check('y2', false); |
michael@0 | 130 | check('y3', false); |
michael@0 | 131 | check('y4', true); |
michael@0 | 132 | SimpleTest.finish(); |
michael@0 | 133 | } |
michael@0 | 134 | </script> |
michael@0 | 135 | </pre> |
michael@0 | 136 | <p id="display"> |
michael@0 | 137 | <iframe src="empty.html" id="selectors" onload="runTest()"></iframe> |
michael@0 | 138 | </p> |
michael@0 | 139 | </body> |
michael@0 | 140 | </html> |
michael@0 | 141 |