From: Robert Konigsberg Date: Wed, 27 Apr 2011 20:32:19 +0000 (-0400) Subject: Updated auto tests per danvk's comments. X-Git-Tag: v1.0.0~514 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=7165f97b1928305555fd96616f20743859368822;p=dygraphs.git Updated auto tests per danvk's comments. --- diff --git a/auto_tests/README.html b/auto_tests/README.html index 0484e61..d5826b9 100644 --- a/auto_tests/README.html +++ b/auto_tests/README.html @@ -17,16 +17,14 @@ To run tests:
  • From there, you start the test server and capture at least one slave browser.
      -
    1. Run java -jar ./auto_tests/lib/JsTestDriver.jar --port +
    2. Run java -jar ./auto_tests/lib/JsTestDriver-1.3.2.jar --port 9876
    3. Open http://localhost:9876/capture in the browser you want to use for your test.
  • -
  • Run generate-combined.sh before every run since it's required (can we fix - this?
  • -
  • Run the tests with java -jar ./auto_tests/lib/JsTestDriver.jar +
  • Run the tests with java -jar ./auto_tests/lib/JsTestDriver-1.3.2.jar --tests all
  • diff --git a/auto_tests/misc/local.html b/auto_tests/misc/local.html index b156589..1b1fecd 100644 --- a/auto_tests/misc/local.html +++ b/auto_tests/misc/local.html @@ -1,16 +1,24 @@ - + - - - - - - - - - - + + + + + + + + + + + + + + + +
    diff --git a/auto_tests/tests/CanvasAssertions.js b/auto_tests/tests/CanvasAssertions.js index cd9994d..851b7dd 100644 --- a/auto_tests/tests/CanvasAssertions.js +++ b/auto_tests/tests/CanvasAssertions.js @@ -42,8 +42,8 @@ CanvasAssertions.assertLineDrawn = function(proxy, p1, p2, attrs) { // found = 1 when prior loop found p1. // found = 2 when prior loop found p2. var priorFound = 0; - for (var callNum in proxy.calls__) { - var call = proxy.calls__[callNum]; + for (var i = 0; i < proxy.calls__.length; i++) { + var call = proxy.calls__[i]; // This disables lineTo -> moveTo pairs. if (call.name == "moveTo" && priorFound > 0) { diff --git a/auto_tests/tests/sanity.js b/auto_tests/tests/sanity.js index 2468c83..cbe07b4 100644 --- a/auto_tests/tests/sanity.js +++ b/auto_tests/tests/sanity.js @@ -24,8 +24,8 @@ * * @author konigsberg@google.com (Robert Konigsberg) */ -var DEAD_SIMPLE_DATA = [[ 20061010, 2100 ]]; -var ZERO_TO_FIFTY = [[ 20061010, 0 ] , [ 20061011, 50 ]]; +var DEAD_SIMPLE_DATA = [[ 10, 2100 ]]; +var ZERO_TO_FIFTY = [[ 10, 0 ] , [ 20, 50 ]]; var SanityTestCase = TestCase("dygraphs-sanity"); @@ -48,6 +48,9 @@ SanityTestCase.prototype.testGraphExists = function() { assertNotNull(graph); }; +// TODO(konigsberg): Move the following tests to a new package that +// tests all kinds of toDomCoords, toDataCoords, toPercent, et cetera. + /** * A sanity test of sorts, by ensuring the dygraph is created, and * isn't just some piece of junk object. @@ -79,6 +82,11 @@ SanityTestCase.prototype.testYAxisRange_custom = function() { assertEquals([0, 50], g.yAxisRange(0)); }; +/** + * Test when the expected and actual values are within a certain + * range (delta). If they're exactly apart by delta, that is considered + * acceptable. + */ function assertEqualsDelta(msg, expected, actual, delta) { var args = this.argsWithOptionalMsg_(arguments, 4); diff --git a/auto_tests/tests/simple_drawing.js b/auto_tests/tests/simple_drawing.js index 46fb5f8..0b8f34e 100644 --- a/auto_tests/tests/simple_drawing.js +++ b/auto_tests/tests/simple_drawing.js @@ -23,7 +23,7 @@ * * @author konigsberg@google.com (Robert Konigsberg) */ -var ZERO_TO_FIFTY = [[ 20061010, 0 ] , [ 20061011, 50 ]]; +var ZERO_TO_FIFTY = [[ 10, 0 ] , [ 20, 50 ]]; var SimpleDrawingTestCase = TestCase("simple-drawing"); @@ -39,16 +39,6 @@ SimpleDrawingTestCase.prototype.tearDown = function() { Dygraph.getContext = _origFunc; }; -SimpleDrawingTestCase.prototype.testDrawSimple = function() { - var graph = document.getElementById("graph"); - var g = new Dygraph(graph, ZERO_TO_FIFTY, {}); -} - -SimpleDrawingTestCase.prototype.testDrawSimpleRangeEquals = function() { - var graph = document.getElementById("graph"); - var g = new Dygraph(graph, ZERO_TO_FIFTY, {valueRange: [0,50]}); -} - SimpleDrawingTestCase.prototype.testDrawSimpleRangePlusOne = function() { var opts = { drawXGrid: false, diff --git a/jsTestDriver.conf b/jsTestDriver.conf index d8f950a..a566e8f 100644 --- a/jsTestDriver.conf +++ b/jsTestDriver.conf @@ -1,7 +1,8 @@ server: http://localhost:9876 load: - - dygraph-combined.js - dygraph.js - dygraph-canvas.js + - rgbcolor/rgbcolor.js + - strftime/strftime-min.js - auto_tests/tests/*.js