1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/style/test/test_system_font_serialization.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,62 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=475214 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 475214</title> 1.11 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.13 +</head> 1.14 +<body> 1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=475214">Mozilla Bug 475214</a> 1.16 +<p id="display"></p> 1.17 +<div id="content"> 1.18 + 1.19 +</div> 1.20 +<pre id="test"> 1.21 +<script type="application/javascript"> 1.22 + 1.23 +/** Test for Bug 475214 **/ 1.24 + 1.25 +var e = document.getElementById("content"); 1.26 +var s = e.style; 1.27 + 1.28 +e.style.font = "menu"; 1.29 +is(e.style.cssText, "font: menu;", "serialize system font alone"); 1.30 +is(e.style.font, "menu", "font getter returns value"); 1.31 + 1.32 +e.style.fontFamily = "inherit"; 1.33 +is(e.style.cssText, "font: menu; font-family: inherit;", "serialize system font and font-family"); 1.34 +is(e.style.font, "", "font getter should be empty"); 1.35 + 1.36 +e.style.font = "message-box"; 1.37 +is(e.style.cssText, "font: message-box;", "serialize system font alone"); 1.38 +is(e.style.font, "message-box", "font getter returns value"); 1.39 + 1.40 +e.setAttribute("style", "font-weight:bold;font:caption;line-height:3;"); 1.41 +is(e.style.cssText, "font: caption; line-height: 3;", "serialize system font and font-family"); 1.42 +is(e.style.font, "", "font getter should be empty"); 1.43 + 1.44 +e.setAttribute("style", "font: menu; font-weight: -moz-use-system-font"); 1.45 +is(e.style.cssText, "font: menu;", "serialize system font alone"); 1.46 +is(e.style.font, "menu", "font getter returns value"); 1.47 + 1.48 +e.setAttribute("style", "font: menu; font-weight: -moz-use-system-font ! important"); 1.49 +is(e.style.cssText, "font: menu; font-weight: -moz-use-system-font ! important;", "serialize system font and subproperty that is important"); 1.50 +is(e.style.font, "", "font getter returns nothing"); 1.51 + 1.52 +e.setAttribute("style", "font: inherit; font-family: Helvetica;"); 1.53 + 1.54 +var cssTextStr = "font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit; -moz-font-feature-settings: inherit; -moz-font-language-override: inherit;"; 1.55 +if (SpecialPowers.getBoolPref("layout.css.font-features.enabled")) { 1.56 + cssTextStr += " font-kerning: inherit; font-synthesis: inherit; font-variant-alternates: inherit; font-variant-caps: inherit; font-variant-east-asian: inherit; font-variant-ligatures: inherit; font-variant-numeric: inherit; font-variant-position: inherit;" 1.57 +} 1.58 + 1.59 +is(e.style.cssText, cssTextStr + " font-family: Helvetica;", "don't serialize system font for font:inherit"); 1.60 +is(e.style.font, "", "font getter returns nothing"); 1.61 + 1.62 +</script> 1.63 +</pre> 1.64 +</body> 1.65 +</html>