From b4fc245ae6f6611dce48fb9575d48e6eeca430f9 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Sun, 24 Aug 2014 21:58:19 -0400 Subject: [PATCH] Update the hidpi test to work on a wider variety of platforms (e.g. when running the tests via `java -jar ./auto_tests/lib/JsTestDriver-1.3.3c.jar --tests all`) --- auto_tests/tests/hidpi.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/auto_tests/tests/hidpi.js b/auto_tests/tests/hidpi.js index 17a75a0..c595065 100644 --- a/auto_tests/tests/hidpi.js +++ b/auto_tests/tests/hidpi.js @@ -17,7 +17,10 @@ hidpiTestCase.prototype.tearDown = function() { window.devicePixelRatio = savePixelRatio; }; -hidpiTestCase.prototype.testNameGoesHere = function() { +hidpiTestCase.prototype.testDoesntCreateScrollbars = function() { + var sw = document.body.scrollWidth; + var cw = document.body.clientWidth; + var graph = document.getElementById("graph"); graph.style.width = "70%"; // more than half. graph.style.height = "200px"; @@ -32,8 +35,10 @@ hidpiTestCase.prototype.testNameGoesHere = function() { var g = new Dygraph(graph, data, opts); + // Adding the graph shouldn't cause the width of the page to change. + // (essentially, we're checking that we don't end up with a scrollbar) // See http://stackoverflow.com/a/2146905/388951 - var hasHorizontalScrollbar = (document.body.scrollWidth > document.body.clientWidth); - assertEquals(false, hasHorizontalScrollbar); + assertEquals(cw, document.body.clientWidth); + assertEquals(sw, document.body.scrollWidth); }; -- 2.7.4