Index: LayoutTests/fast/dom/Window/window-scaled-viewport-properties.html |
diff --git a/LayoutTests/fast/dom/Window/window-scaled-viewport-properties.html b/LayoutTests/fast/dom/Window/window-scaled-viewport-properties.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..32b07763bd350f3480b1d9d75f45742100f5c40b |
--- /dev/null |
+++ b/LayoutTests/fast/dom/Window/window-scaled-viewport-properties.html |
@@ -0,0 +1,124 @@ |
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
+<html> |
Rick Byers
2014/11/18 20:53:31
nit: omit html, head and body tags: http://www.chr
bokan
2014/11/18 23:21:50
Done.
|
+<head> |
+ <script src="../../../resources/js-test.js"></script> |
+ <style> |
+ body { |
+ padding: 0px; |
+ margin: 0px; |
+ } |
+ |
+ .spacer { |
+ position: absolute; |
+ left: 0px; |
+ top: 0px; |
+ margin: 0px; |
+ padding: 0px; |
+ width: 2000px; |
+ height: 1500px; |
+ } |
+ </style> |
+</head> |
+<body> |
+<script language="JavaScript" type="text/javascript"> |
+ if (window.testRunner && window.internals) { |
+ window.jsTestIsAsync = true; |
+ window.eventSender.setPageScaleFactorLimits(0.25, 4.0); |
+ testRunner.dumpAsText(); |
+ testRunner.waitUntilDone(); |
+ } |
+ |
+ description("This test makes sure the window properties related to the\ |
+ viewport remain correct under pinch-to-zoom."); |
+ |
+ debug('===Unscaled==='); |
+ shouldBe('window.innerWidth', '800'); |
+ shouldBe('window.innerHeight', '600'); |
+ |
+ function testPinchedIn() { |
+ debug(''); |
+ debug('===Pinch Zoom in to 2X==='); |
+ debug(''); |
+ window.eventSender.setPageScaleFactor(2.0, 0, 0); |
+ shouldBe('window.innerWidth', '400'); |
+ shouldBe('window.innerHeight', '300'); |
+ shouldBe('window.scrollX', '0'); |
+ shouldBe('window.scrollY', '0'); |
+ |
+ window.scrollBy(10, 20); |
+ shouldBe('window.scrollX', '10'); |
+ shouldBe('window.scrollY', '20'); |
+ window.scrollBy(1590, 1180); |
+ shouldBe('window.scrollX', '1600'); |
+ shouldBe('window.scrollY', '1200'); |
+ window.scrollBy(-1600, -1200); |
+ shouldBe('window.scrollX', '0'); |
+ shouldBe('window.scrollY', '0'); |
+ window.scrollTo(1600, 1200); |
+ shouldBe('window.scrollX', '1600'); |
+ shouldBe('window.scrollY', '1200'); |
+ window.scrollTo(0, 0); |
+ shouldBe('window.scrollX', '0'); |
+ shouldBe('window.scrollY', '0'); |
+ } |
+ |
+ function testPinchedOut() { |
+ debug(''); |
+ debug('===Pinch Out to 0.5X==='); |
+ debug(''); |
+ window.eventSender.setPageScaleFactor(0.5, 0, 0); |
+ shouldBe('window.innerWidth', '1600'); |
+ shouldBe('window.innerHeight', '1200'); |
+ shouldBe('window.scrollX', '0'); |
+ shouldBe('window.scrollY', '0'); |
+ |
+ window.scrollBy(10, 20); |
+ shouldBe('window.scrollX', '10'); |
+ shouldBe('window.scrollY', '20'); |
+ window.scrollBy(390, 280); |
+ shouldBe('window.scrollX', '400'); |
+ shouldBe('window.scrollY', '300'); |
+ window.scrollBy(-400, -300); |
+ shouldBe('window.scrollX', '0'); |
+ shouldBe('window.scrollY', '0'); |
+ window.scrollTo(400, 300); |
+ shouldBe('window.scrollX', '400'); |
+ shouldBe('window.scrollY', '300'); |
+ window.scrollTo(0, 0); |
+ shouldBe('window.scrollX', '0'); |
+ shouldBe('window.scrollY', '0'); |
+ } |
+ |
+ function testMaximallyPinchedOut() { |
+ debug(''); |
+ debug('===Pinch Out to 0.4X (Minimum Scale)==='); |
+ debug(''); |
+ window.eventSender.setPageScaleFactor(0.4, 0, 0); |
+ shouldBe('window.innerWidth', '2000'); |
+ shouldBe('window.innerHeight', '1500'); |
+ shouldBe('window.scrollX', '0'); |
+ shouldBe('window.scrollY', '0'); |
+ |
+ window.scrollBy(10000, 10000); |
+ shouldBe('window.scrollX', '0'); |
+ shouldBe('window.scrollY', '0'); |
+ window.scrollTo(10000, 10000); |
+ shouldBe('window.scrollX', '0'); |
+ shouldBe('window.scrollY', '0'); |
+ } |
+ |
+ function runTests() { |
+ if (window.testRunner && window.internals) { |
+ testPinchedIn(); |
+ testPinchedOut(); |
+ testMaximallyPinchedOut(); |
+ testRunner.notifyDone(); |
+ } |
+ } |
+ |
+ setTimeout(runTests, 100); |
Rick Byers
2014/11/18 20:53:31
where does this 100 come from? You should be able
bokan
2014/11/18 23:21:50
Yah, I was worried about flakiness but there's som
Rick Byers
2014/11/20 19:23:30
Great. Note that there are lots of tests that exp
|
+ |
+</script> |
Rick Byers
2014/11/18 20:53:31
you also fixed a bug with firing missing 'scroll'
bokan
2014/11/18 23:21:50
Right, thanks, added. The only issue is that scrol
Rick Byers
2014/11/20 19:23:30
I'm a little worried about this being flaky - eg.
bokan
2014/11/20 20:30:41
That worked perfectly. Thanks for keeping us hones
|
+<div class="spacer"></div> |
+</body> |
+</html> |