layout/style/test/test_font_feature_values_parsing.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <meta charset=utf-8>
michael@0 5 <title>@font-feature-values rule parsing tests</title>
michael@0 6 <link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
michael@0 7 <link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-feature-values" />
michael@0 8 <meta name="assert" content="tests that valid @font-feature-values rules parse and invalid ones don't" />
michael@0 9 <!-- https://bugzilla.mozilla.org/show_bug.cgi?id=549861 -->
michael@0 10 <script type="text/javascript" src="/resources/testharness.js"></script>
michael@0 11 <script type="text/javascript" src="/resources/testharnessreport.js"></script>
michael@0 12 <style type="text/css">
michael@0 13 </style>
michael@0 14 </head>
michael@0 15 <body>
michael@0 16 <div id="log"></div>
michael@0 17 <pre id="display"></pre>
michael@0 18 <style type="text/css" id="testbox"></style>
michael@0 19
michael@0 20 <script type="text/javascript">
michael@0 21 var gPrefix = "";
michael@0 22 var kFontFeatureValuesRuleType = 14;
michael@0 23
michael@0 24 function ruleName() { return "@" + gPrefix + "font-feature-values"; }
michael@0 25 function makeRule(f, v) {
michael@0 26 return ruleName() + " " + f + " { " + v + " }";
michael@0 27 }
michael@0 28
michael@0 29 function _()
michael@0 30 {
michael@0 31 var i, decl = [];
michael@0 32 for (i = 0; i < arguments.length; i++) {
michael@0 33 decl.push(arguments[i]);
michael@0 34 }
michael@0 35 return makeRule("bongo", decl.join(" "));
michael@0 36 }
michael@0 37
michael@0 38 // note: because of bugs in the way family names are serialized,
michael@0 39 // 'serializationSame' only implies that the value definition block
michael@0 40 // is the same (i.e. not including the family name list)
michael@0 41
michael@0 42 var testrules = [
michael@0 43
michael@0 44 /* basic syntax */
michael@0 45 { rule: ruleName() + ";", invalid: true },
michael@0 46 { rule: ruleName() + " bongo;", invalid: true },
michael@0 47 { rule: ruleName().replace("values", "value") + " {;}", invalid: true },
michael@0 48 { rule: ruleName().replace("feature", "features") + " {;}", invalid: true },
michael@0 49 { rule: makeRule("bongo", ""), serializationNoValueDefn: true },
michael@0 50 { rule: makeRule("bongo", ";"), serializationNoValueDefn: true },
michael@0 51 { rule: makeRule("bongo", ",;"), serializationNoValueDefn: true },
michael@0 52 { rule: makeRule("bongo", ";,"), serializationNoValueDefn: true },
michael@0 53 { rule: makeRule("bongo", ",;,"), serializationNoValueDefn: true },
michael@0 54 { rule: makeRule("bongo", "@styleset;"), serializationNoValueDefn: true },
michael@0 55 { rule: makeRule("bongo", "@styleset,;"), serializationNoValueDefn: true },
michael@0 56 { rule: makeRule("bongo", "@styleset abc;"), serializationNoValueDefn: true },
michael@0 57 { rule: makeRule("bongo", "@styleset { abc }"), serializationNoValueDefn: true },
michael@0 58 { rule: makeRule("bongo", "@styleset { ;;abc }"), serializationNoValueDefn: true },
michael@0 59 { rule: makeRule("bongo", "@styleset { abc;; }"), serializationNoValueDefn: true },
michael@0 60 { rule: makeRule("bongo", "@styleset { abc: }"), serializationNoValueDefn: true },
michael@0 61 { rule: makeRule("bongo", "@styleset { abc,: }"), serializationNoValueDefn: true },
michael@0 62 { rule: makeRule("bongo", "@styleset { abc:, }"), serializationNoValueDefn: true },
michael@0 63 { rule: makeRule("bongo", "@styleset { abc:,; }"), serializationNoValueDefn: true },
michael@0 64 { rule: makeRule("bongo", "@styleset { a,b }"), serializationNoValueDefn: true },
michael@0 65 { rule: makeRule("bongo", "@styleset { a;b }"), serializationNoValueDefn: true },
michael@0 66 { rule: makeRule("bongo", "@styleset { a:;b: }"), serializationNoValueDefn: true },
michael@0 67 { rule: makeRule("bongo", "@styleset { a:,;b: }"), serializationNoValueDefn: true },
michael@0 68 { rule: makeRule("bongo", "@styleset { a:1,;b: }"), serializationNoValueDefn: true },
michael@0 69 { rule: makeRule("bongo", "@styleset { abc 1 2 3 }"), serializationNoValueDefn: true },
michael@0 70 { rule: makeRule("bongo", "@styleset { abc:, 1 2 3 }"), serializationNoValueDefn: true },
michael@0 71 { rule: makeRule("bongo", "@styleset { abc:; 1 2 3 }"), serializationNoValueDefn: true },
michael@0 72 { rule: makeRule("bongo", "@styleset { abc:; 1 2 3 }"), serializationNoValueDefn: true },
michael@0 73 { rule: makeRule("bongo", "@styleset { abc: 1 2 3a }"), serializationNoValueDefn: true },
michael@0 74 { rule: makeRule("bongo", "@styleset { abc: 1 2 3, def: 1; }"), serializationNoValueDefn: true },
michael@0 75 { rule: makeRule("bongo", "@blah @styleset { abc: 1 2 3; }"), serializationNoValueDefn: true },
michael@0 76 { rule: makeRule("bongo", "@blah } @styleset { abc: 1 2 3; }"), serializationNoValueDefn: true },
michael@0 77 { rule: makeRule("bongo", "@blah , @styleset { abc: 1 2 3; }"), serializationNoValueDefn: true },
michael@0 78 { rule: ruleName() + " bongo { @styleset { abc: 1 2 3; }", serialization: _("@styleset { abc: 1 2 3; }") },
michael@0 79 { rule: ruleName() + " bongo { @styleset { abc: 1 2 3 }", serialization: _("@styleset { abc: 1 2 3; }") },
michael@0 80 { rule: ruleName() + " bongo { @styleset { abc: 1 2 3;", serialization: _("@styleset { abc: 1 2 3; }") },
michael@0 81 { rule: ruleName() + " bongo { @styleset { abc: 1 2 3", serialization: _("@styleset { abc: 1 2 3; }") },
michael@0 82 { rule: _("@styleset { ok-1: 1; }"), serializationSame: true },
michael@0 83 { rule: _("@annotation { ok-1: 3; }"), serializationSame: true },
michael@0 84 { rule: _("@stylistic { blah: 3; }"), serializationSame: true },
michael@0 85 { rule: makeRule("bongo", "\n@styleset\n { blah: 3; super-blah: 4 5;\n more-blah: 5 6 7;\n }"), serializationSame: true },
michael@0 86 { rule: makeRule("bongo", "\n@styleset\n {\n blah:\n 3\n;\n super-blah:\n 4\n 5\n;\n more-blah:\n 5 6\n 7;\n }"), serializationSame: true },
michael@0 87
michael@0 88 /* limits on number of values */
michael@0 89 { rule: _("@stylistic { blah: 1; }"), serializationSame: true },
michael@0 90 { rule: _("@styleset { blah: 1 2 3 4; }"), serializationSame: true },
michael@0 91 { rule: _("@character-variant { blah: 1 2; }"), serializationSame: true },
michael@0 92 { rule: _("@swash { blah: 1; }"), serializationSame: true },
michael@0 93 { rule: _("@ornaments { blah: 1; }"), serializationSame: true },
michael@0 94 { rule: _("@annotation { blah: 1; }"), serializationSame: true },
michael@0 95
michael@0 96 /* values ignored when used */
michael@0 97 { rule: _("@styleset { blah: 0; }"), serializationSame: true },
michael@0 98 { rule: _("@styleset { blah: 120 124; }"), serializationSame: true },
michael@0 99 { rule: _("@character-variant { blah: 0; }"), serializationSame: true },
michael@0 100 { rule: _("@character-variant { blah: 111; }"), serializationSame: true },
michael@0 101 { rule: _("@character-variant { blah: 111 13; }"), serializationSame: true },
michael@0 102
michael@0 103 /* invalid value name */
michael@0 104 { rulesrc: ["styleset { blah: 1 }"], serializationNoValueDefn: true },
michael@0 105 { rulesrc: ["stylistic { blah: 1 }"], serializationNoValueDefn: true },
michael@0 106 { rulesrc: ["character-variant { blah: 1 }"], serializationNoValueDefn: true },
michael@0 107 { rulesrc: ["swash { blah: 1 }"], serializationNoValueDefn: true },
michael@0 108 { rulesrc: ["ornaments { blah: 1 }"], serializationNoValueDefn: true },
michael@0 109 { rulesrc: ["annotation { blah: 1 }"], serializationNoValueDefn: true },
michael@0 110 { rulesrc: ["@bongo { blah: 1 }"], serializationNoValueDefn: true },
michael@0 111 { rulesrc: ["@bongo { blah: 1 2 3 }"], serializationNoValueDefn: true },
michael@0 112 { rulesrc: ["@bongo { blah: 1 2 3; burp: 1;;; }"], serializationNoValueDefn: true },
michael@0 113
michael@0 114 /* values */
michael@0 115 { rulesrc: ["@styleset { blah: -1 }"], serializationNoValueDefn: true },
michael@0 116 { rulesrc: ["@styleset { blah: 1 -1 }"], serializationNoValueDefn: true },
michael@0 117 { rulesrc: ["@styleset { blah: 1.5 }"], serializationNoValueDefn: true },
michael@0 118 { rulesrc: ["@styleset { blah: 15px }"], serializationNoValueDefn: true },
michael@0 119 { rulesrc: ["@styleset { blah: red }"], serializationNoValueDefn: true },
michael@0 120 { rulesrc: ["@styleset { blah: (1) }"], serializationNoValueDefn: true },
michael@0 121 { rulesrc: ["@styleset { blah:(1) }"], serializationNoValueDefn: true },
michael@0 122 { rulesrc: ["@styleset { blah:, 1 }"], serializationNoValueDefn: true },
michael@0 123 { rulesrc: ["@styleset { blah: <1> }"], serializationNoValueDefn: true },
michael@0 124 { rulesrc: ["@styleset { blah: 1! }"], serializationNoValueDefn: true },
michael@0 125 { rulesrc: ["@styleset { blah: 1,, }"], serializationNoValueDefn: true },
michael@0 126 { rulesrc: ["@styleset { blah: 1 1 1 1; }"], serializationSame: true },
michael@0 127
michael@0 128 /* limits on number of values */
michael@0 129 { rulesrc: ["@stylistic { blah: 1 2 }"], serializationNoValueDefn: true },
michael@0 130 { rulesrc: ["@character-variant { blah: 1 2 3 }"], serializationNoValueDefn: true },
michael@0 131 { rulesrc: ["@swash { blah: 1 2 }"], serializationNoValueDefn: true },
michael@0 132 { rulesrc: ["@ornaments { blah: 1 2 }"], serializationNoValueDefn: true },
michael@0 133 { rulesrc: ["@annotation { blah: 1 2 }"], serializationNoValueDefn: true },
michael@0 134 { rulesrc: ["@styleset { blah: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19; }"], serializationSame: true },
michael@0 135
michael@0 136 /* family names */
michael@0 137 { rule: makeRule("bongo", "@styleset { blah: 1; }"), serializationSame: true },
michael@0 138 { rule: makeRule("\"bongo\"", "@styleset { blah: 1; }"), serializationSame: true },
michael@0 139 { rule: makeRule("'bongo'", "@styleset { blah: 1; }"), serializationSame: true },
michael@0 140 { rule: makeRule("\\62 ongo", "@styleset { blah: 1; }"), serializationSame: true },
michael@0 141 { rule: makeRule("bongo, super bongo, bongo the supreme", "@styleset { blah: 1; }"), serializationSame: true },
michael@0 142 { rule: makeRule("bongo,, super bongo", "@styleset { blah: 1; }"), invalid: true },
michael@0 143 { rule: makeRule("bongo,*", "@styleset { blah: 1; }"), invalid: true },
michael@0 144 { rule: makeRule("bongo, sans-serif", "@styleset { blah: 1; }"), invalid: true },
michael@0 145 { rule: makeRule("serif, sans-serif", "@styleset { blah: 1; }"), invalid: true },
michael@0 146 { rule: makeRule("'serif', 'sans-serif'", "@styleset { blah: 1; }"), serializationSame: true },
michael@0 147 { rule: makeRule("bongo, \"super bongo\", 'bongo the supreme'", "@styleset { blah: 1; }"), serializationSame: true },
michael@0 148 { rule: makeRule("毎日カレーを食べたい!", "@styleset { blah: 1; }"), serializationSame: true },
michael@0 149 { rule: makeRule("毎日カレーを食べたい!, 納豆嫌い", "@styleset { blah: 1; }"), serializationSame: true },
michael@0 150
michael@0 151 { rule: makeRule("bongo, \"super\" bongo, bongo the supreme", "@styleset { blah: 1; }"), invalid: true },
michael@0 152 { rule: makeRule("--bongo", "@styleset { blah: 1; }"), invalid: true },
michael@0 153
michael@0 154 /* ident tests */
michael@0 155 { rule: _("@styleset { blah: 1; blah: 1; }"), serializationSame: true },
michael@0 156 { rule: _("@styleset { blah: 1; de-blah: 1; blah: 2; }"), serializationSame: true },
michael@0 157 { rule: _("@styleset { \\tra-la: 1; }"), serialization: _("@styleset { tra-la: 1; }") },
michael@0 158 { rule: _("@styleset { b\\lah: 1; }"), serialization: _("@styleset { blah: 1; }") },
michael@0 159 { rule: _("@styleset { \\62 lah: 1; }"), serialization: _("@styleset { blah: 1; }") },
michael@0 160 { rule: _("@styleset { \\:blah: 1; }"), serialization: _("@styleset { \\:blah: 1; }") },
michael@0 161 { rule: _("@styleset { \\;blah: 1; }"), serialization: _("@styleset { \\;blah: 1; }") },
michael@0 162 { rule: _("@styleset { complex\\20 blah: 1; }"), serialization: _("@styleset { complex\\ blah: 1; }") },
michael@0 163 { rule: _("@styleset { complex\\ blah: 1; }"), serializationSame: true },
michael@0 164 { rule: _("@styleset { Håkon: 1; }"), serializationSame: true },
michael@0 165 { rule: _("@styleset { Åквариум: 1; }"), serializationSame: true },
michael@0 166 { rule: _("@styleset { \\1f449\\1f4a9\\1f448: 1; }"), serialization: _("@styleset { 👉💩👈: 1; }") },
michael@0 167 { rule: _("@styleset { 魅力: 1; }"), serializationSame: true },
michael@0 168 { rule: _("@styleset { 毎日カレーを食べたい!: 1; }"), serializationSame: true },
michael@0 169 /* from http://en.wikipedia.org/wiki/Metal_umlaut */
michael@0 170 { rule: _("@styleset { TECHNICIÄNS\\ ÖF\\ SPÅCE\\ SHIP\\ EÅRTH\\ THIS\\ IS\\ YÖÜR\\ CÄPTÅIN\\ SPEÄKING\\ YÖÜR\\ ØÅPTÅIN\\ IS\\ DEA̋D: 1; }"), serializationSame: true },
michael@0 171
michael@0 172 { rulesrc: ["@styleset { 123blah: 1; }"], serializationNoValueDefn: true },
michael@0 173 { rulesrc: ["@styleset { :123blah 1; }"], serializationNoValueDefn: true },
michael@0 174 { rulesrc: ["@styleset { :123blah: 1; }"], serializationNoValueDefn: true },
michael@0 175 { rulesrc: ["@styleset { ?123blah: 1; }"], serializationNoValueDefn: true },
michael@0 176 { rulesrc: ["@styleset { \"blah\": 1; }"], serializationNoValueDefn: true },
michael@0 177 { rulesrc: ["@styleset { complex blah: 1; }"], serializationNoValueDefn: true },
michael@0 178 { rulesrc: ["@styleset { complex\\ blah: 1; }"], serializationNoValueDefn: true }
michael@0 179
michael@0 180 ];
michael@0 181
michael@0 182 // test that invalid value declarations don't affect the parsing of surrounding
michael@0 183 // declarations. So before + invalid + after should match the serialization
michael@0 184 // given in s.
michael@0 185
michael@0 186 var gSurroundingTests = [
michael@0 187 // -- invalid, valid ==> valid
michael@0 188 { before: "", after: "@ornaments { whatchamacallit-1: 23; thingy-dingy: 3; }", s: _("@ornaments { whatchamacallit-1: 23; thingy-dingy: 3; }") },
michael@0 189
michael@0 190 // -- valid, invalid ==> valid
michael@0 191 { before: "@ornaments { whatchamacallit-1: 23; thingy-dingy: 7; }", after: "", s: _("@ornaments { whatchamacallit-1: 23; thingy-dingy: 7; }") },
michael@0 192
michael@0 193 // -- valid, invalid, valid ==> valid, valid
michael@0 194 { before: "@ornaments { whatchamacallit-1: 23; thingy-dingy: 3; }", after: "@character-variant { whatchamacallit-2: 23 4; }", s: _("@ornaments { whatchamacallit-1: 23; thingy-dingy: 3; } @character-variant { whatchamacallit-2: 23 4; }") },
michael@0 195
michael@0 196 // -- invalid, valid, invalid ==> valid
michael@0 197 { between: "@ornaments { whatchamacallit-1: 23; thingy-dingy: 4; }", s: _("@ornaments { whatchamacallit-1: 23; thingy-dingy: 4; }") }
michael@0 198 ];
michael@0 199
michael@0 200 /* strip out just values, along with empty value blocks (e.g. @swash { })*/
michael@0 201 function valuesText(ruletext)
michael@0 202 {
michael@0 203 var t = ruletext.replace(/@[a-zA-Z0-9\-]+[ \n]*{[ \n]*}/g, "");
michael@0 204 t = t.replace(/[ \n]+/g, " ");
michael@0 205 t = t.replace(/^[^{]+{[ \n]*/, "");
michael@0 206 t = t.replace(/[ \n]*}[^}]*$/, "");
michael@0 207 t = t.replace(/[ \n]*;/g, ";");
michael@0 208 return t;
michael@0 209 }
michael@0 210
michael@0 211 function testParse(rulesrc)
michael@0 212 {
michael@0 213 var sheet = document.styleSheets[1];
michael@0 214 var rule = _.apply(this, rulesrc);
michael@0 215
michael@0 216 while(sheet.cssRules.length > 0)
michael@0 217 sheet.deleteRule(0);
michael@0 218 try {
michael@0 219 sheet.insertRule(rule, 0);
michael@0 220 } catch (e) {
michael@0 221 return e.toString();
michael@0 222 }
michael@0 223
michael@0 224 if (sheet.cssRules.length == 1 && sheet.cssRules[0].type == kFontFeatureValuesRuleType) {
michael@0 225 return sheet.cssRules[0].cssText.replace(/[ \n]+/g, " ");
michael@0 226 }
michael@0 227
michael@0 228 return "";
michael@0 229 }
michael@0 230
michael@0 231 function testOneRule(testrule) {
michael@0 232 var sheet = document.styleSheets[1];
michael@0 233 var rule;
michael@0 234
michael@0 235 if ("rulesrc" in testrule) {
michael@0 236 rule = _.apply(this, testrule.rulesrc);
michael@0 237 } else {
michael@0 238 rule = testrule.rule;
michael@0 239 }
michael@0 240
michael@0 241 var parseErr = false;
michael@0 242 var expectedErr = false;
michael@0 243 var invalid = false;
michael@0 244 if ("invalid" in testrule && testrule.invalid) invalid = true;
michael@0 245
michael@0 246 while(sheet.cssRules.length > 0)
michael@0 247 sheet.deleteRule(0);
michael@0 248 try {
michael@0 249 sheet.insertRule(rule, 0);
michael@0 250 } catch (e) {
michael@0 251 expectedErr = (e.name == "SyntaxError"
michael@0 252 && e instanceof DOMException
michael@0 253 && e.code == DOMException.SYNTAX_ERR
michael@0 254 && invalid);
michael@0 255 parseErr = true;
michael@0 256 }
michael@0 257
michael@0 258 test(function() {
michael@0 259 assert_true(!parseErr || expectedErr, "unexpected syntax error");
michael@0 260 if (!parseErr) {
michael@0 261 assert_equals(sheet.cssRules.length, 1, "bad rule count");
michael@0 262 assert_equals(sheet.cssRules[0].type, kFontFeatureValuesRuleType, "bad rule type");
michael@0 263 }
michael@0 264 }, "basic parse tests - " + rule);
michael@0 265
michael@0 266 var sanitizedRule = rule.replace(/[ \n]+/g, " ");
michael@0 267 if (parseErr) {
michael@0 268 return;
michael@0 269 }
michael@0 270
michael@0 271 // should result in one @font-feature-values rule constructed
michael@0 272
michael@0 273 // serialization matches expectation
michael@0 274 // -- note: due to inconsistent font family serialization problems,
michael@0 275 // only the serialization of the values is tested currently
michael@0 276
michael@0 277 var ruleValues = valuesText(rule);
michael@0 278 var serialized = sheet.cssRules[0].cssText;
michael@0 279 var serializedValues = valuesText(serialized);
michael@0 280 var haveSerialization = true;
michael@0 281
michael@0 282 if (testrule.serializationSame) {
michael@0 283 test(function() {
michael@0 284 assert_equals(serializedValues, ruleValues, "canonical cssText serialization doesn't match");
michael@0 285 }, "serialization check - " + rule);
michael@0 286 } else if ("serialization" in testrule) {
michael@0 287 var s = valuesText(testrule.serialization);
michael@0 288 test(function() {
michael@0 289 assert_equals(serializedValues, s, "non-canonical cssText serialization doesn't match - ");
michael@0 290 }, "serialization check - " + rule);
michael@0 291 } else if (testrule.serializationNoValueDefn) {
michael@0 292 test(function() {
michael@0 293 assert_equals(serializedValues, "", "cssText serialization should have no value defintions - ");
michael@0 294 }, "no value definitions in serialization - " + rule);
michael@0 295
michael@0 296 haveSerialization = false;
michael@0 297
michael@0 298 if ("rulesrc" in testrule) {
michael@0 299 test(function() {
michael@0 300 var j, rulesrc = testrule.rulesrc;
michael@0 301
michael@0 302 // invalid value definitions shouldn't affect the parsing of valid
michael@0 303 // definitions before or after an invalid one
michael@0 304 for (var j = 0; j < gSurroundingTests.length; j++) {
michael@0 305 var t = gSurroundingTests[j];
michael@0 306 var srulesrc = [];
michael@0 307
michael@0 308 if ("between" in t) {
michael@0 309 srulesrc = srulesrc.concat(rulesrc);
michael@0 310 srulesrc = srulesrc.concat(t.between);
michael@0 311 srulesrc = srulesrc.concat(rulesrc);
michael@0 312 } else {
michael@0 313 if (t.before != "")
michael@0 314 srulesrc = srulesrc.concat(t.before);
michael@0 315 srulesrc = srulesrc.concat(rulesrc);
michael@0 316 if (t.after != "")
michael@0 317 srulesrc = srulesrc.concat(t.after);
michael@0 318 }
michael@0 319
michael@0 320 var result = testParse(srulesrc);
michael@0 321 assert_equals(valuesText(result), valuesText(t.s), "invalid declarations should not affect valid ones - ");
michael@0 322 }
michael@0 323 }, "invalid declarations don't affect valid ones - " + rule);
michael@0 324 }
michael@0 325 }
michael@0 326
michael@0 327 // if serialization non-empty, serialization should round-trip to itself
michael@0 328 if (haveSerialization) {
michael@0 329 var roundTripText = testParse([serializedValues]);
michael@0 330 test(function() {
michael@0 331 assert_equals(valuesText(roundTripText), serializedValues,
michael@0 332 "serialization should round-trip to itself - ");
michael@0 333 }, "serialization round-trip - " + rule);
michael@0 334 }
michael@0 335 }
michael@0 336
michael@0 337 function testFontFeatureValuesRuleParsing() {
michael@0 338 // Gecko-specific check - if pref not set, skip these tests
michael@0 339 if (window.SpecialPowers && !window.SpecialPowers.getBoolPref("layout.css.font-features.enabled")) {
michael@0 340 return;
michael@0 341 }
michael@0 342 var i;
michael@0 343 for (i = 0; i < testrules.length; i++) {
michael@0 344 var testrule = testrules[i];
michael@0 345 var rule;
michael@0 346
michael@0 347 if ("rulesrc" in testrule) {
michael@0 348 rule = _.apply(this, testrule.rulesrc);
michael@0 349 } else {
michael@0 350 rule = testrule.rule;
michael@0 351 }
michael@0 352
michael@0 353 testOneRule(testrule);
michael@0 354 //test(function() { testOneRule(testrule); }, "parsing " + rule);
michael@0 355 }
michael@0 356 }
michael@0 357
michael@0 358 testFontFeatureValuesRuleParsing();
michael@0 359 </script>
michael@0 360 </body></html>

mercurial