X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fsimple_drawing.js;h=5ffe5320e83be9e2a8c565856505654edb5b6c76;hb=bfb3e0a44ba7eb76704389cd1515db9995944d41;hp=75a6e879f2460375348ef47f580aabe0d67d35c7;hpb=5d93f811018b7c7ef41cc0da7e1793ee228e0ed9;p=dygraphs.git diff --git a/auto_tests/tests/simple_drawing.js b/auto_tests/tests/simple_drawing.js index 75a6e87..5ffe532 100644 --- a/auto_tests/tests/simple_drawing.js +++ b/auto_tests/tests/simple_drawing.js @@ -41,10 +41,16 @@ SimpleDrawingTestCase.prototype.tearDown = function() { SimpleDrawingTestCase.prototype.testDrawSimpleRangePlusOne = function() { var opts = { - drawXGrid: false, - drawYGrid: false, - drawXAxis: false, - drawYAxis: false, + axes : { + x : { + drawGrid: false, + drawAxis: false, + }, + y : { + drawGrid: false, + drawAxis: false, + } + }, valueRange: [0,51] } var graph = document.getElementById("graph"); @@ -55,16 +61,23 @@ SimpleDrawingTestCase.prototype.testDrawSimpleRangePlusOne = function() { strokeStyle: "#008080", lineWidth: 1 }); + g.destroy(); // to balance context saves and destroys. CanvasAssertions.assertBalancedSaveRestore(htx); }; // See http://code.google.com/p/dygraphs/issues/detail?id=185 SimpleDrawingTestCase.prototype.testDrawSimpleRangeZeroToFifty = function() { var opts = { - drawXGrid: false, - drawYGrid: false, - drawXAxis: false, - drawYAxis: false, + axes : { + x : { + drawGrid: false, + drawAxis: false, + }, + y : { + drawGrid: false, + drawAxis: false, + } + }, valueRange: [0,50] } var graph = document.getElementById("graph"); @@ -76,6 +89,7 @@ SimpleDrawingTestCase.prototype.testDrawSimpleRangeZeroToFifty = function() { lineWidth: 1 }); assertEquals(1, lines.length); + g.destroy(); // to balance context saves and destroys. CanvasAssertions.assertBalancedSaveRestore(htx); }; @@ -84,6 +98,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); }; @@ -93,12 +108,20 @@ SimpleDrawingTestCase.prototype.testDrawWithAxis = function() { */ SimpleDrawingTestCase.prototype.testDrawSimpleDash = function() { var opts = { - drawXGrid: false, - drawYGrid: false, - drawXAxis: false, - drawYAxis: false, + axes: { + x: { + drawGrid: false, + drawAxis: false + }, + y: { + drawGrid: false, + drawAxis: false + } + }, + series: { 'Y1': {strokePattern: [25, 7, 7, 7]}, - colors: ['#ff0000'] + }, + colors: ['#ff0000'] }; var graph = document.getElementById("graph"); @@ -110,6 +133,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); }; @@ -119,10 +143,16 @@ SimpleDrawingTestCase.prototype.testDrawSimpleDash = function() { */ SimpleDrawingTestCase.prototype.testDrawThickLine = function() { var opts = { - drawXGrid: false, - drawYGrid: false, - drawXAxis: false, - drawYAxis: false, + axes : { + x : { + drawGrid: false, + drawAxis: false, + }, + y : { + drawGrid: false, + drawAxis: false, + } + }, strokeWidth: 15, colors: ['#ff0000'] }; @@ -146,5 +176,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); };