Bug 1399941 Part 2: Add more aspect-ratios to a test of media queries, testing for overflow. draft
authorBrad Werth <bwerth@mozilla.com>
Fri, 15 Sep 2017 10:29:45 -0700
changeset 665756 10931fe3fc4995dfb9c47a7c4c875cabcb430d4d
parent 665390 893fe1549e1e7342a66514b65960f08d40810a34
child 731870 92f7168106bab9d2d780f900df77210410ce620b
push id80160
push userbwerth@mozilla.com
push dateFri, 15 Sep 2017 22:24:06 +0000
bugs1399941
milestone57.0a1
Bug 1399941 Part 2: Add more aspect-ratios to a test of media queries, testing for overflow. MozReview-Commit-ID: 6NLYkLUNP8d
layout/style/test/test_media_queries.html
--- a/layout/style/test/test_media_queries.html
+++ b/layout/style/test/test_media_queries.html
@@ -386,16 +386,29 @@ function run() {
   should_apply("(aspect-ratio: 413/560)");
   should_apply("(aspect-ratio: 5900/8000)");
   should_not_apply("(aspect-ratio: 5901/8000)");
   should_not_apply("(aspect-ratio: 5899/8000)");
   should_not_apply("(aspect-ratio: 5900/8001)");
   should_not_apply("(aspect-ratio: 5900/7999)");
   should_apply("(aspect-ratio)");
 
+  // Test "unreasonable", but still valid aspect ratios, such as aspect ratios with negative numbers,
+  // and zeros, and with numbers near 2^32 and 2^64 (to check overflow).
+  should_not_apply("(aspect-ratio: 0/1)");
+  should_not_apply("(aspect-ratio: 1/0)");
+  should_not_apply("(aspect-ratio: -1/1)");
+  should_not_apply("(aspect-ratio: 1/-1)");
+  should_not_apply("(aspect-ratio: -1/-1)");
+  should_not_apply("(aspect-ratio: -59/-80)");
+  should_not_apply("(aspect-ratio: 4294967295/4294967295)");
+  should_not_apply("(aspect-ratio: 4294967297/4294967297)");
+  should_not_apply("(aspect-ratio: 18446744073709560000/18446744073709560000)");
+
+  // Test min and max aspect ratios.
   should_apply("(min-aspect-ratio: 59/80)");
   should_apply("(min-aspect-ratio: 58/80)");
   should_apply("(min-aspect-ratio: 59/81)");
   should_not_apply("(min-aspect-ratio: 60/80)");
   should_not_apply("(min-aspect-ratio: 59/79)");
   expression_should_not_be_parseable("min-aspect-ratio");
 
   should_apply("(max-aspect-ratio: 59/80)");