X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fsanity.js;h=528b7a14dc4e5ec14822e5d04e29a66ac305acf0;hb=758a629f806fa73483f730fb343013acd0ace078;hp=cbe07b42bc917fd73a5df73712f28d3b12a09e8d;hpb=7165f97b1928305555fd96616f20743859368822;p=dygraphs.git diff --git a/auto_tests/tests/sanity.js b/auto_tests/tests/sanity.js index cbe07b4..528b7a1 100644 --- a/auto_tests/tests/sanity.js +++ b/auto_tests/tests/sanity.js @@ -1,4 +1,4 @@ -// Copyright (c) 2011 Google, Inc. +// Copyright (c) 2011 Google, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -83,24 +83,6 @@ SanityTestCase.prototype.testYAxisRange_custom = function() { }; /** - * 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); - - var message = args[0]; - var exp = args[1]; - var act = args[2]; - var d = args[3]; - if (Math.abs(exp - act) > d) { - fail(message + - " Expected to be within " + d + " of " + exp + ", got " + act); - } -} - -/** * Test that valueRange matches the y-axis range specifically. * * This is based on the assumption that 20 pixels are dedicated to the @@ -118,3 +100,29 @@ SanityTestCase.prototype.testToDomYCoord = function() { assertEqualsDelta(50 - x, g.toDomYCoord(x), 0.00001); } }; + +/** + * Test that the two-argument form of the constructor (no options) works. + */ +SanityTestCase.prototype.testTwoArgumentConstructor = function() { + var graph = document.getElementById("graph"); + new Dygraph(graph, ZERO_TO_FIFTY); +}; + +// Here is the first of a series of tests that just ensure the graph is drawn +// without exception. +//TODO(konigsberg): Move to its own test case. +SanityTestCase.prototype.testFillStack1 = function() { + var graph = document.getElementById("graph"); + new Dygraph(graph, ZERO_TO_FIFTY, { stackedGraph: true }); +} + +SanityTestCase.prototype.testFillStack2 = function() { + var graph = document.getElementById("graph"); + new Dygraph(graph, ZERO_TO_FIFTY, { stackedGraph: true, fillGraph: true }); +} + +SanityTestCase.prototype.testFillStack3 = function() { + var graph = document.getElementById("graph"); + new Dygraph(graph, ZERO_TO_FIFTY, { fillGraph: true }); +}