From: Robert Konigsberg Date: Mon, 3 Jun 2013 14:14:08 +0000 (-0400) Subject: Fix tests that accompany fixing bug 382. X-Git-Tag: v1.0.0~27^2~3^2~1 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=b941564d6f1d2791c6b9714bd089bd19f4ca67b3;p=dygraphs.git Fix tests that accompany fixing bug 382. --- diff --git a/auto_tests/tests/error_bars.js b/auto_tests/tests/error_bars.js index 7e50e42..1e9d0f4 100644 --- a/auto_tests/tests/error_bars.js +++ b/auto_tests/tests/error_bars.js @@ -86,6 +86,7 @@ errorBarsTestCase.prototype.testErrorBarsDrawn = function() { xy2 = g.toDomCoords(data[i + 1][0], data[i + 1][1][1]); CanvasAssertions.assertLineDrawn(htx, xy1, xy2, attrs); } + g.destroy(); // Restore balanced saves and restores. CanvasAssertions.assertBalancedSaveRestore(htx); }; diff --git a/auto_tests/tests/simple_drawing.js b/auto_tests/tests/simple_drawing.js index 75a6e87..27e9a1a 100644 --- a/auto_tests/tests/simple_drawing.js +++ b/auto_tests/tests/simple_drawing.js @@ -55,6 +55,7 @@ SimpleDrawingTestCase.prototype.testDrawSimpleRangePlusOne = function() { strokeStyle: "#008080", lineWidth: 1 }); + g.destroy(); // to balance context saves and destroys. CanvasAssertions.assertBalancedSaveRestore(htx); }; @@ -76,6 +77,7 @@ SimpleDrawingTestCase.prototype.testDrawSimpleRangeZeroToFifty = function() { lineWidth: 1 }); assertEquals(1, lines.length); + g.destroy(); // to balance context saves and destroys. CanvasAssertions.assertBalancedSaveRestore(htx); }; @@ -84,6 +86,7 @@ SimpleDrawingTestCase.prototype.testDrawWithAxis = function() { var g = new Dygraph(graph, ZERO_TO_FIFTY); var htx = g.hidden_ctx_; + g.destroy(); // to balance context saves and destroys. CanvasAssertions.assertBalancedSaveRestore(htx); }; @@ -110,6 +113,7 @@ SimpleDrawingTestCase.prototype.testDrawSimpleDash = function() { // TODO(danvk): figure out a good way to restore this test. // assertEquals(29, CanvasAssertions.numLinesDrawn(htx, "#ff0000")); + g.destroy(); // to balance context saves and destroys. CanvasAssertions.assertBalancedSaveRestore(htx); }; @@ -146,5 +150,6 @@ SimpleDrawingTestCase.prototype.testDrawThickLine = function() { // TODO(danvk): figure out a good way to restore this test. // assertEquals(29, CanvasAssertions.numLinesDrawn(htx, "#ff0000")); + g.destroy(); // to balance context saves and destroys. CanvasAssertions.assertBalancedSaveRestore(htx); };