X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;ds=inline;f=auto_tests%2Ftests%2Fresize.js;h=3ce99ad58136393a40a44961c33ce58bb022e481;hb=c1c42651dd140ecb0460cfcff736aceb117f9cc6;hp=5d68b1bb8abef6492e958ee7088a72ea4cae9a95;hpb=b5157325c87df7eb1d210e27e98fe45362f0c693;p=dygraphs.git diff --git a/auto_tests/tests/resize.js b/auto_tests/tests/resize.js index 5d68b1b..3ce99ad 100644 --- a/auto_tests/tests/resize.js +++ b/auto_tests/tests/resize.js @@ -6,13 +6,13 @@ var ResizeTestCase = TestCase("resize"); ResizeTestCase.data = - "Date,Y\n" + - "2010/01/01,100\n" + - "2010/02/01,200\n" + - "2010/03/01,300\n" + - "2010/04/01,400\n" + - "2010/05/01,300\n" + - "2010/06/01,100\n"; + "X,Y\n" + + "1,100\n" + + "2,200\n" + + "3,300\n" + + "4,400\n" + + "5,300\n" + + "6,100\n"; ResizeTestCase.prototype.setUp = function() { document.body.innerHTML = "
"; @@ -83,11 +83,20 @@ ResizeTestCase.prototype.testHiddenDivWithResize = function() { div.style.width = '400px'; div.style.height = '300px'; - var g = new Dygraph(div, ResizeTestCase.data, {}); + // Setting strokeWidth 3 removes any ambiguitiy from the pixel sampling + // request, below. + var g = new Dygraph(div, ResizeTestCase.data, {strokeWidth: 3}); div.style.display = ''; g.resize(); area = g.getArea(); assertTrue(area.w > 0); assertTrue(area.h > 0); + + // Regression test: check that graph remains visible after no-op resize. + g.resize(); + var x = Math.floor(g.toDomXCoord(2)); + var y = Math.floor(g.toDomYCoord(200)); + assertEquals("Unexpected grid color found at pixel: x: " + x + " y: " + y, + [0, 128, 128, 255], Util.samplePixel(g.hidden_, x, y)); };