layout/style/test/test_style_struct_copy_constructors.html

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 -->
michael@0 5 <head>
michael@0 6 <title>Test for style struct copy constructors</title>
michael@0 7 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 8 <script type="text/javascript" src="property_database.js"></script>
michael@0 9 <style type="text/css" id="stylesheet"></style>
michael@0 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 11 </head>
michael@0 12 <body>
michael@0 13 <p id="display"><span id="one"></span><span id="two"></span><span id="parent"><span id="child"></span></span></p>
michael@0 14 <div id="content" style="display: none">
michael@0 15
michael@0 16 <div id="testnode"><span id="element"></span></div>
michael@0 17
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 style struct copy constructors **/
michael@0 24
michael@0 25 /**
michael@0 26 * XXX Why doesn't putting a bug in the nsStyleFont copy-constructor for
michael@0 27 * font-weight (initializing to normal) trigger a failure of this test?
michael@0 28 * It works for leaving -moz-image-region uninitialized (both halves),
michael@0 29 * overwriting text-decoration (only the first half, since it's not
michael@0 30 * inherited), and leaving visibility uninitialized (only the second
michael@0 31 * half; passes the first half ok).
michael@0 32 */
michael@0 33
michael@0 34 var gElementOne = document.getElementById("one");
michael@0 35 var gElementTwo = document.getElementById("two");
michael@0 36 var gElementParent = document.getElementById("parent");
michael@0 37 var gElementChild = document.getElementById("child");
michael@0 38 var gStyleSheet = document.getElementById("stylesheet").sheet;
michael@0 39 var gRule1 = gStyleSheet.cssRules[gStyleSheet.insertRule("#one, #two, #parent {}", gStyleSheet.cssRules.length)];
michael@0 40 var gRule2 = gStyleSheet.cssRules[gStyleSheet.insertRule("#two, #child {}", gStyleSheet.cssRules.length)];
michael@0 41
michael@0 42 /** Test using aStartStruct **/
michael@0 43
michael@0 44 for (var prop in gCSSProperties) {
michael@0 45 var info = gCSSProperties[prop];
michael@0 46 if (!("subproperties" in info)) {
michael@0 47 gRule1.style.setProperty(prop, info.other_values[0], "");
michael@0 48 gRule2.style.setProperty(prop, info.other_values[0], "");
michael@0 49 }
michael@0 50 }
michael@0 51
michael@0 52 for (var prop in gCSSProperties) {
michael@0 53 var info = gCSSProperties[prop];
michael@0 54 if (!("subproperties" in info)) {
michael@0 55 gRule2.style.removeProperty(prop);
michael@0 56
michael@0 57 var one = getComputedStyle(gElementOne, "").getPropertyValue(prop);
michael@0 58 var two = getComputedStyle(gElementTwo, "").getPropertyValue(prop);
michael@0 59 is(two, one,
michael@0 60 "property '" + prop + "' was copy-constructed correctly (aStartStruct)");
michael@0 61
michael@0 62 gRule2.style.setProperty(prop, info.other_values[0], "");
michael@0 63 }
michael@0 64 }
michael@0 65
michael@0 66 /** Test using inheritance **/
michael@0 67 for (var prop in gCSSProperties) {
michael@0 68 var info = gCSSProperties[prop];
michael@0 69 if (info.inherited && !("subproperties" in info)) {
michael@0 70 gRule2.style.removeProperty(prop);
michael@0 71
michael@0 72 var parent = getComputedStyle(gElementParent, "").getPropertyValue(prop);
michael@0 73 var child = getComputedStyle(gElementChild, "").getPropertyValue(prop);
michael@0 74
michael@0 75 is(child, parent,
michael@0 76 "property '" + prop + "' was copy-constructed correctly (inheritance)");
michael@0 77
michael@0 78 gRule2.style.setProperty(prop, info.other_values[0], "");
michael@0 79 }
michael@0 80 }
michael@0 81
michael@0 82 for (var prop in gCSSProperties) {
michael@0 83 var info = gCSSProperties[prop];
michael@0 84 if (!("subproperties" in info)) {
michael@0 85 gRule1.style.removeProperty(prop);
michael@0 86 gRule2.style.removeProperty(prop);
michael@0 87 }
michael@0 88 }
michael@0 89
michael@0 90 </script>
michael@0 91 </pre>
michael@0 92 </body>
michael@0 93 </html>

mercurial