diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /layout/style/test/test_style_struct_copy_constructors.html | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/style/test/test_style_struct_copy_constructors.html')
-rw-r--r-- | layout/style/test/test_style_struct_copy_constructors.html | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/layout/style/test/test_style_struct_copy_constructors.html b/layout/style/test/test_style_struct_copy_constructors.html new file mode 100644 index 0000000000..95f727a58d --- /dev/null +++ b/layout/style/test/test_style_struct_copy_constructors.html @@ -0,0 +1,93 @@ +<!DOCTYPE HTML> +<html> +<!-- +--> +<head> + <title>Test for style struct copy constructors</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <script type="text/javascript" src="property_database.js"></script> + <style type="text/css" id="stylesheet"></style> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<p id="display"><span id="one"></span><span id="two"></span><span id="parent"><span id="child"></span></span></p> +<div id="content" style="display: none"> + +<div id="testnode"><span id="element"></span></div> + + +</div> +<pre id="test"> +<script class="testbody" type="text/javascript"> + +/** Test for style struct copy constructors **/ + +/** + * XXX Why doesn't putting a bug in the nsStyleFont copy-constructor for + * font-weight (initializing to normal) trigger a failure of this test? + * It works for leaving -moz-image-region uninitialized (both halves), + * overwriting text-decoration (only the first half, since it's not + * inherited), and leaving visibility uninitialized (only the second + * half; passes the first half ok). + */ + +var gElementOne = document.getElementById("one"); +var gElementTwo = document.getElementById("two"); +var gElementParent = document.getElementById("parent"); +var gElementChild = document.getElementById("child"); +var gStyleSheet = document.getElementById("stylesheet").sheet; +var gRule1 = gStyleSheet.cssRules[gStyleSheet.insertRule("#one, #two, #parent {}", gStyleSheet.cssRules.length)]; +var gRule2 = gStyleSheet.cssRules[gStyleSheet.insertRule("#two, #child {}", gStyleSheet.cssRules.length)]; + +/** Test using aStartStruct **/ + +for (var prop in gCSSProperties) { + var info = gCSSProperties[prop]; + if (!("subproperties" in info)) { + gRule1.style.setProperty(prop, info.other_values[0], ""); + gRule2.style.setProperty(prop, info.other_values[0], ""); + } +} + +for (var prop in gCSSProperties) { + var info = gCSSProperties[prop]; + if (!("subproperties" in info)) { + gRule2.style.removeProperty(prop); + + var one = getComputedStyle(gElementOne, "").getPropertyValue(prop); + var two = getComputedStyle(gElementTwo, "").getPropertyValue(prop); + is(two, one, + "property '" + prop + "' was copy-constructed correctly (aStartStruct)"); + + gRule2.style.setProperty(prop, info.other_values[0], ""); + } +} + +/** Test using inheritance **/ +for (var prop in gCSSProperties) { + var info = gCSSProperties[prop]; + if (info.inherited && !("subproperties" in info)) { + gRule2.style.removeProperty(prop); + + var parent = getComputedStyle(gElementParent, "").getPropertyValue(prop); + var child = getComputedStyle(gElementChild, "").getPropertyValue(prop); + + is(child, parent, + "property '" + prop + "' was copy-constructed correctly (inheritance)"); + + gRule2.style.setProperty(prop, info.other_values[0], ""); + } +} + +for (var prop in gCSSProperties) { + var info = gCSSProperties[prop]; + if (!("subproperties" in info)) { + gRule1.style.removeProperty(prop); + gRule2.style.removeProperty(prop); + } +} + +</script> +</pre> +</body> +</html> |