Bug 1422225: Test updates. r?xidorn
MozReview-Commit-ID: J2tag9ulUon
--- a/layout/style/test/test_media_queries.html
+++ b/layout/style/test/test_media_queries.html
@@ -178,24 +178,36 @@ function run() {
"Media query '" + q + "' should " + (should_apply ? "" : "NOT ") +
"apply after cloning");
}
});
}
// The no-type syntax doesn't mix with the not and only keywords.
query_should_be_parseable("(orientation)");
- query_should_not_be_parseable("not (orientation)");
+ query_should_be_parseable("not (orientation)");
query_should_not_be_parseable("only (orientation)");
query_should_be_parseable("all and (orientation)");
query_should_be_parseable("not all and (orientation)");
query_should_be_parseable("only all and (orientation)");
+ query_should_not_be_parseable("not not (orientation)");
+ query_should_be_parseable("(orientation) and (orientation)");
+ query_should_be_parseable("(orientation) or (orientation)");
+ query_should_be_parseable("(orientation) or ((orientation) and ((orientation) or (orientation) or (not (orientation))))");
+
+ query_should_not_be_parseable("all and (orientation) or (orientation)");
+ query_should_be_parseable("all and (orientation) and (orientation)");
+
+ query_should_not_be_parseable("(orientation) and (orientation) or (orientation)");
+ query_should_not_be_parseable("(orientation) and not (orientation)");
+
+
query_should_be_parseable("(-moz-device-orientation)");
- query_should_not_be_parseable("not (-moz-device-orientation)");
+ query_should_be_parseable("not (-moz-device-orientation)");
query_should_not_be_parseable("only (-moz-device-orientation)");
query_should_be_parseable("all and (-moz-device-orientation)");
query_should_be_parseable("not all and (-moz-device-orientation)");
query_should_be_parseable("only all and (-moz-device-orientation)");
// Test that the 'not', 'only', 'and', and 'or' keywords are not
// allowed as media types.
query_should_not_be_parseable("not");
@@ -225,38 +237,47 @@ function run() {
query_should_be_parseable("not unknowntype and (width)");
query_should_not_be_parseable("only not and (width)");
query_should_not_be_parseable("only and and (width)");
query_should_not_be_parseable("only or and (width)");
query_should_not_be_parseable("only only and (width)");
query_should_be_parseable("only unknowntype and (width)");
var features = [ "width", "height", "device-width", "device-height" ];
+ var separators = [ ":", ">", ">=", "=", "<=", "<" ];
+
var feature;
var i;
for (i in features) {
feature = features[i];
expression_should_be_parseable(feature);
- expression_should_be_parseable(feature + ": 0");
- expression_should_be_parseable(feature + ": 0px");
- expression_should_be_parseable(feature + ": 0em");
- expression_should_be_parseable(feature + ": -0");
- expression_should_be_parseable("min-" + feature + ": -0");
- expression_should_be_parseable("max-" + feature + ": -0");
- expression_should_be_parseable(feature + ": -0cm");
- expression_should_be_parseable(feature + ": 1px");
- expression_should_be_parseable(feature + ": 0.001mm");
- expression_should_be_parseable(feature + ": 100000px");
- expression_should_not_be_parseable(feature + ": -1px");
- expression_should_not_be_parseable("min-" + feature + ": -1px");
- expression_should_not_be_parseable("max-" + feature + ": -1px");
- expression_should_not_be_parseable(feature + ": -0.00001mm");
- expression_should_not_be_parseable(feature + ": -100000em");
expression_should_not_be_parseable("min-" + feature);
expression_should_not_be_parseable("max-" + feature);
+ for (let separator of separators) {
+ expression_should_be_parseable(feature + " " + separator + " 0");
+ expression_should_be_parseable(feature + " " + separator + " 0px");
+ expression_should_be_parseable(feature + " " + separator + " 0em");
+ expression_should_be_parseable(feature + " " + separator + " -0");
+ expression_should_be_parseable(feature + " " + separator + " -0cm");
+ expression_should_be_parseable(feature + " " + separator + " 1px");
+ expression_should_be_parseable(feature + " " + separator + " 0.001mm");
+ expression_should_be_parseable(feature + " " + separator + " 100000px");
+ if (separator == ":") {
+ expression_should_be_parseable("min-" + feature + " " + separator + " -0");
+ expression_should_be_parseable("max-" + feature + " " + separator + " -0");
+ } else {
+ expression_should_not_be_parseable("min-" + feature + " " + separator + " -0");
+ expression_should_not_be_parseable("max-" + feature + " " + separator + " -0");
+ }
+ expression_should_not_be_parseable(feature + " " + separator + " -1px");
+ expression_should_not_be_parseable("min-" + feature + " " + separator + " -1px");
+ expression_should_not_be_parseable("max-" + feature + " " + separator + " -1px");
+ expression_should_not_be_parseable(feature + " " + separator + " -0.00001mm");
+ expression_should_not_be_parseable(feature + " " + separator + " -100000em");
+ }
}
var mediatypes = ["browser", "minimal-ui", "standalone", "fullscreen"];
mediatypes.forEach(function(type) {
expression_should_be_parseable("display-mode: " + type);
});
@@ -271,25 +292,31 @@ function run() {
var width_val = 117; // pick two not-too-round numbers
var height_val = 76;
change_state(function() {
iframe_style.width = width_val + "px";
iframe_style.height = height_val + "px";
});
var device_width = window.screen.width;
var device_height = window.screen.height;
- features = { "width": width_val,
- "height": height_val,
- "device-width": device_width,
- "device-height": device_height };
+ features = {
+ "width": width_val,
+ "height": height_val,
+ "device-width": device_width,
+ "device-height": device_height
+ };
for (feature in features) {
var value = features[feature];
should_apply("all and (" + feature + ": " + value + "px)");
+ should_apply("all and (" + feature + " = " + value + "px)");
should_not_apply("all and (" + feature + ": " + (value + 1) + "px)");
should_not_apply("all and (" + feature + ": " + (value - 1) + "px)");
+ should_not_apply("all and (" + feature + " = " + (value + 1) + "px)");
+ should_not_apply("all and (" + feature + " = " + (value - 1) + "px)");
+
should_apply("all and (min-" + feature + ": " + value + "px)");
should_not_apply("all and (min-" + feature + ": " + (value + 1) + "px)");
should_apply("all and (min-" + feature + ": " + (value - 1) + "px)");
should_apply("all and (max-" + feature + ": " + value + "px)");
should_apply("all and (max-" + feature + ": " + (value + 1) + "px)");
should_not_apply("all and (max-" + feature + ": " + (value - 1) + "px)");
should_not_apply("all and (min-" + feature + ": " +
(Math.ceil(value/em_size) + 1) + "em)");
@@ -302,16 +329,31 @@ function run() {
should_not_apply("all and (min-" + feature + ": " +
(Math.ceil(value/em_size) + 1) + "rem)");
should_apply("all and (min-" + feature + ": " +
(Math.floor(value/em_size) - 1) + "rem)");
should_apply("all and (max-" + feature + ": " +
(Math.ceil(value/em_size) + 1) + "rem)");
should_not_apply("all and (max-" + feature + ": " +
(Math.floor(value/em_size) - 1) + "rem)");
+
+ should_apply("(" + feature + " <= " + value + "px)");
+ should_apply("(" + feature + " >= " + value + "px)");
+ should_not_apply("(" + feature + " < " + value + "px)");
+ should_not_apply("(" + feature + " > " + value + "px)");
+
+ should_apply("(" + feature + " < " + (value + 1) + "px)");
+ should_apply("(" + feature + " <= " + (value + 1) + "px)");
+ should_not_apply("(" + feature + " > " + (value + 1) + "px)");
+ should_not_apply("(" + feature + " >= " + (value + 1) + "px)");
+
+ should_apply("(" + feature + " > " + (value - 1) + "px)");
+ should_apply("(" + feature + " >= " + (value - 1) + "px)");
+ should_not_apply("(" + feature + " < " + (value - 1) + "px)");
+ should_not_apply("(" + feature + " <= " + (value - 1) + "px)");
}
change_state(function() {
iframe_style.width = "0";
});
should_apply("all and (height)");
should_not_apply("all and (width)");
change_state(function() {
--- a/testing/web-platform/meta/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute.html.ini
+++ b/testing/web-platform/meta/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute.html.ini
@@ -1,15 +1,12 @@
[parse-a-sizes-attribute.html]
[<img srcset="/images/green-1x1.png?e38 50w, /images/green-16x16.png?e38 51w" sizes="(min-width:calc(0)) 1px"> ref sizes="1px" (standards mode)]
expected: FAIL
- [<img srcset="/images/green-1x1.png?e57 50w, /images/green-16x16.png?e57 51w" sizes="(min-width:0) or (min-width:0) 1px"> ref sizes="1px" (standards mode)]
- expected: FAIL
-
[<img srcset="/images/green-1x1.png?e58 50w, /images/green-16x16.png?e58 51w" sizes="(min-width:0) or (unknown-mf-name) 1px"> ref sizes="1px" (standards mode)]
expected: FAIL
[<img srcset="/images/green-1x1.png?e59 50w, /images/green-16x16.png?e59 51w" sizes="(min-width:0) or (min-width:unknown-mf-value) 1px"> ref sizes="1px" (standards mode)]
expected: FAIL
[<img srcset="/images/green-1x1.png?e60 50w, /images/green-16x16.png?e60 51w" sizes="(min-width:0) or (min-width:-1px) 1px"> ref sizes="1px" (standards mode)]
expected: FAIL
@@ -27,19 +24,16 @@
expected: FAIL
[<img srcset="/images/green-1x1.png?f49 50w, /images/green-16x16.png?f49 51w" sizes="(min-width:0) calc(1px"> ref sizes="100vw" (standards mode)]
expected: FAIL
[<img srcset="/images/green-1x1.png?e38 50w, /images/green-16x16.png?e38 51w" sizes="(min-width:calc(0)) 1px"> ref sizes="1px" (quirks mode)]
expected: FAIL
- [<img srcset="/images/green-1x1.png?e57 50w, /images/green-16x16.png?e57 51w" sizes="(min-width:0) or (min-width:0) 1px"> ref sizes="1px" (quirks mode)]
- expected: FAIL
-
[<img srcset="/images/green-1x1.png?e58 50w, /images/green-16x16.png?e58 51w" sizes="(min-width:0) or (unknown-mf-name) 1px"> ref sizes="1px" (quirks mode)]
expected: FAIL
[<img srcset="/images/green-1x1.png?e59 50w, /images/green-16x16.png?e59 51w" sizes="(min-width:0) or (min-width:unknown-mf-value) 1px"> ref sizes="1px" (quirks mode)]
expected: FAIL
[<img srcset="/images/green-1x1.png?e60 50w, /images/green-16x16.png?e60 51w" sizes="(min-width:0) or (min-width:-1px) 1px"> ref sizes="1px" (quirks mode)]
expected: FAIL
@@ -57,19 +51,16 @@
expected: FAIL
[<img srcset="/images/green-1x1.png?f49 50w, /images/green-16x16.png?f49 51w" sizes="(min-width:0) calc(1px"> ref sizes="100vw" (quirks mode)]
expected: FAIL
[<img srcset="/images/green-1x1.png?e38 50w, /images/green-16x16.png?e38 51w" sizes="(min-width:calc(0)) 1px"> ref sizes="1px" (display:none)]
expected: FAIL
- [<img srcset="/images/green-1x1.png?e57 50w, /images/green-16x16.png?e57 51w" sizes="(min-width:0) or (min-width:0) 1px"> ref sizes="1px" (display:none)]
- expected: FAIL
-
[<img srcset="/images/green-1x1.png?e58 50w, /images/green-16x16.png?e58 51w" sizes="(min-width:0) or (unknown-mf-name) 1px"> ref sizes="1px" (display:none)]
expected: FAIL
[<img srcset="/images/green-1x1.png?e59 50w, /images/green-16x16.png?e59 51w" sizes="(min-width:0) or (min-width:unknown-mf-value) 1px"> ref sizes="1px" (display:none)]
expected: FAIL
[<img srcset="/images/green-1x1.png?e60 50w, /images/green-16x16.png?e60 51w" sizes="(min-width:0) or (min-width:-1px) 1px"> ref sizes="1px" (display:none)]
expected: FAIL
@@ -87,19 +78,16 @@
expected: FAIL
[<img srcset="/images/green-1x1.png?f49 50w, /images/green-16x16.png?f49 51w" sizes="(min-width:0) calc(1px"> ref sizes="100vw" (display:none)]
expected: FAIL
[<img srcset="/images/green-1x1.png?e38 50w, /images/green-16x16.png?e38 51w" sizes="(min-width:calc(0)) 1px"> ref sizes="1px" (width:1000px)]
expected: FAIL
- [<img srcset="/images/green-1x1.png?e57 50w, /images/green-16x16.png?e57 51w" sizes="(min-width:0) or (min-width:0) 1px"> ref sizes="1px" (width:1000px)]
- expected: FAIL
-
[<img srcset="/images/green-1x1.png?e58 50w, /images/green-16x16.png?e58 51w" sizes="(min-width:0) or (unknown-mf-name) 1px"> ref sizes="1px" (width:1000px)]
expected: FAIL
[<img srcset="/images/green-1x1.png?e59 50w, /images/green-16x16.png?e59 51w" sizes="(min-width:0) or (min-width:unknown-mf-value) 1px"> ref sizes="1px" (width:1000px)]
expected: FAIL
[<img srcset="/images/green-1x1.png?e60 50w, /images/green-16x16.png?e60 51w" sizes="(min-width:0) or (min-width:-1px) 1px"> ref sizes="1px" (width:1000px)]
expected: FAIL
--- a/testing/web-platform/tests/css/mediaqueries/test_media_queries.html
+++ b/testing/web-platform/tests/css/mediaqueries/test_media_queries.html
@@ -94,82 +94,123 @@ function run() {
function expression_should_not_be_parseable(e) {
test(function() {
assert_false(expression_is_parseable(e));
}, "subtest_" + ++testNum, {assert: "expression " + e + " should not be parseable"});
}
// The no-type syntax doesn't mix with the not and only keywords.
query_should_be_parseable("(orientation)");
- query_should_not_be_parseable("not (orientation)");
+ query_should_be_parseable("not (orientation)");
query_should_not_be_parseable("only (orientation)");
query_should_be_parseable("all and (orientation)");
query_should_be_parseable("not all and (orientation)");
query_should_be_parseable("only all and (orientation)");
+ query_should_not_be_parseable("not not (orientation)");
+ query_should_be_parseable("(orientation) and (orientation)");
+ query_should_be_parseable("(orientation) or (orientation)");
+ query_should_be_parseable("(orientation) or ((orientation) and ((orientation) or (orientation) or (not (orientation))))");
+
+ query_should_not_be_parseable("all and (orientation) or (orientation)");
+ query_should_be_parseable("all and (orientation) and (orientation)");
+
+ query_should_not_be_parseable("(orientation) and (orientation) or (orientation)");
+ query_should_not_be_parseable("(orientation) and not (orientation)");
+
+
var features = [ "width", "height", "device-width", "device-height" ];
+ var separators = [ ":", ">", ">=", "=", "<=", "<" ];
var feature;
var i;
for (i in features) {
feature = features[i];
expression_should_be_parseable(feature);
- expression_should_be_parseable(feature + ": 0");
- expression_should_be_parseable(feature + ": 0px");
- expression_should_be_parseable(feature + ": 0em");
- expression_should_be_parseable(feature + ": -0");
- expression_should_be_parseable("min-" + feature + ": -0");
- expression_should_be_parseable("max-" + feature + ": -0");
- expression_should_be_parseable(feature + ": -0cm");
- expression_should_be_parseable(feature + ": 1px");
- expression_should_be_parseable(feature + ": 0.001mm");
- expression_should_be_parseable(feature + ": 100000px");
- expression_should_not_be_parseable(feature + ": -1px");
- expression_should_not_be_parseable("min-" + feature + ": -1px");
- expression_should_not_be_parseable("max-" + feature + ": -1px");
- expression_should_not_be_parseable(feature + ": -0.00001mm");
- expression_should_not_be_parseable(feature + ": -100000em");
expression_should_not_be_parseable("min-" + feature);
expression_should_not_be_parseable("max-" + feature);
+ for (let separator of separators) {
+ expression_should_be_parseable(feature + " " + separator + " 0");
+ expression_should_be_parseable(feature + " " + separator + " 0px");
+ expression_should_be_parseable(feature + " " + separator + " 0em");
+ expression_should_be_parseable(feature + " " + separator + " -0");
+ expression_should_be_parseable(feature + " " + separator + " -0cm");
+ expression_should_be_parseable(feature + " " + separator + " 1px");
+ expression_should_be_parseable(feature + " " + separator + " 0.001mm");
+ expression_should_be_parseable(feature + " " + separator + " 100000px");
+ if (separator == ":") {
+ expression_should_be_parseable("min-" + feature + " " + separator + " -0");
+ expression_should_be_parseable("max-" + feature + " " + separator + " -0");
+ } else {
+ expression_should_not_be_parseable("min-" + feature + " " + separator + " -0");
+ expression_should_not_be_parseable("max-" + feature + " " + separator + " -0");
+ }
+ expression_should_not_be_parseable(feature + " " + separator + " -1px");
+ expression_should_not_be_parseable("min-" + feature + " " + separator + " -1px");
+ expression_should_not_be_parseable("max-" + feature + " " + separator + " -1px");
+ expression_should_not_be_parseable(feature + " " + separator + " -0.00001mm");
+ expression_should_not_be_parseable(feature + " " + separator + " -100000em");
+ }
}
var content_div = document.getElementById("content");
content_div.style.font = "medium sans-serif";
var em_size =
getComputedStyle(content_div, "").fontSize.match(/^(\d+)px$/)[1];
// in this test, assume the common underlying implementation is correct
var width_val = 117; // pick two not-too-round numbers
var height_val = 76;
iframe_style.width = width_val + "px";
iframe_style.height = height_val + "px";
var device_width = window.screen.width;
var device_height = window.screen.height;
- features = { "width": width_val,
- "height": height_val,
- "device-width": device_width,
- "device-height": device_height };
+ features = {
+ "width": width_val,
+ "height": height_val,
+ "device-width": device_width,
+ "device-height": device_height
+ };
for (feature in features) {
var value = features[feature];
should_apply("all and (" + feature + ": " + value + "px)");
+ should_apply("all and (" + feature + " = " + value + "px)");
should_not_apply("all and (" + feature + ": " + (value + 1) + "px)");
should_not_apply("all and (" + feature + ": " + (value - 1) + "px)");
+ should_not_apply("all and (" + feature + " = " + (value + 1) + "px)");
+ should_not_apply("all and (" + feature + " = " + (value - 1) + "px)");
+
should_apply("all and (min-" + feature + ": " + value + "px)");
should_not_apply("all and (min-" + feature + ": " + (value + 1) + "px)");
should_apply("all and (min-" + feature + ": " + (value - 1) + "px)");
should_apply("all and (max-" + feature + ": " + value + "px)");
should_apply("all and (max-" + feature + ": " + (value + 1) + "px)");
should_not_apply("all and (max-" + feature + ": " + (value - 1) + "px)");
should_not_apply("all and (min-" + feature + ": " +
(Math.ceil(value/em_size) + 1) + "em)");
should_apply("all and (min-" + feature + ": " +
(Math.floor(value/em_size) - 1) + "em)");
should_apply("all and (max-" + feature + ": " +
(Math.ceil(value/em_size) + 1) + "em)");
should_not_apply("all and (max-" + feature + ": " +
(Math.floor(value/em_size) - 1) + "em)");
+
+ should_apply("(" + feature + " <= " + value + "px)");
+ should_apply("(" + feature + " >= " + value + "px)");
+ should_not_apply("(" + feature + " < " + value + "px)");
+ should_not_apply("(" + feature + " > " + value + "px)");
+
+ should_apply("(" + feature + " < " + (value + 1) + "px)");
+ should_apply("(" + feature + " <= " + (value + 1) + "px)");
+ should_not_apply("(" + feature + " > " + (value + 1) + "px)");
+ should_not_apply("(" + feature + " >= " + (value + 1) + "px)");
+
+ should_apply("(" + feature + " > " + (value - 1) + "px)");
+ should_apply("(" + feature + " >= " + (value - 1) + "px)");
+ should_not_apply("(" + feature + " < " + (value - 1) + "px)");
+ should_not_apply("(" + feature + " <= " + (value - 1) + "px)");
}
iframe_style.width = "0";
should_apply("all and (height)");
should_not_apply("all and (width)");
iframe_style.height = "0";
should_not_apply("all and (height)");
should_not_apply("all and (width)");