Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: LayoutTests/fast/css/zoom-media-queries.html

Issue 15841015: Fix a zooming bug with EM MQs (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Replaced previous tests with John Mellor's better ones Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/css/zoom-media-queries-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/css/zoom-media-queries.html
diff --git a/LayoutTests/fast/css/zoom-media-queries.html b/LayoutTests/fast/css/zoom-media-queries.html
new file mode 100644
index 0000000000000000000000000000000000000000..b29be484015326541f19dc7f99dd7ccac2ea2333
--- /dev/null
+++ b/LayoutTests/fast/css/zoom-media-queries.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<style>
+ html { font-size: 16px; }
+</style>
+<script src="../js/resources/js-test-pre.js"></script>
+<script>
+ if (!window.eventSender) {
+ document.write("This test does not work in manual mode.");
+ } else {
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ // These media queries should be equivalent, since the documentElement
+ // has font-size:16px, so 300px should equal 18.75em. They should both
+ // initially be false (as the layout test runner is 800px wide).
+ shouldBeFalse(
+ 'matchMedia("(max-width: 300px)").matches');
+ shouldBeFalse(
+ 'matchMedia("(max-width: 18.75em)").matches');
+ debug("");
+
+ // While zooming in, the two media queries should either
+ // both match or both not match.
+ var maxZoomLevel = 20;
+ var zoomLevel = 0;
+ while (zoomLevel < maxZoomLevel) {
+ debug("eventSender.zoomPageIn()");
+ eventSender.zoomPageIn();
+ zoomLevel++;
+
+ if (matchMedia("(max-width: 300px)").matches)
+ break;
+
+ shouldBe(
+ 'matchMedia("(max-width: 300px)").matches',
+ 'matchMedia("(max-width: 18.75em)").matches');
+ }
+ debug("");
+
+ // Once sufficiently zoomed in, both should match.
+ shouldBeTrue(
+ 'matchMedia("(max-width: 300px)").matches');
+ shouldBeTrue(
+ 'matchMedia("(max-width: 18.75em)").matches');
+ debug("");
+
+ // As soon as we zoom back out, both should stop matching
+ // and continue to not match.
+ while (zoomLevel > 0) {
+ debug("eventSender.zoomPageOut()");
+ eventSender.zoomPageOut();
+ zoomLevel--;
+
+ shouldBeFalse(
+ 'matchMedia("(max-width: 300px)").matches');
+ shouldBeFalse(
+ 'matchMedia("(max-width: 18.75em)").matches');
+ }
+ }
+</script>
« no previous file with comments | « no previous file | LayoutTests/fast/css/zoom-media-queries-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698