From: Dan Vanderkam Date: Sat, 26 Oct 2013 23:49:20 +0000 (-0500) Subject: range selector tests pass X-Git-Tag: v1.1.0~76 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=32ddef6e835e69c59fdbfdce8a68a38981995e44;p=dygraphs.git range selector tests pass --- diff --git a/auto_tests/tests/CanvasAssertions.js b/auto_tests/tests/CanvasAssertions.js index 9550912..97279cf 100644 --- a/auto_tests/tests/CanvasAssertions.js +++ b/auto_tests/tests/CanvasAssertions.js @@ -183,15 +183,20 @@ CanvasAssertions.assertBalancedSaveRestore = function(proxy) { CanvasAssertions.numLinesDrawn = function(proxy, color) { CanvasAssertions.cleanPathAttrs_(proxy.calls__); var num_lines = 0; + var num_potential_calls = 0; for (var i = 0; i < proxy.calls__.length; i++) { var call = proxy.calls__[i]; - - // note: Don't simplify these two conditionals into one. The - // separation simplifies debugging tricky tests. - if (call.name == "lineTo") { + if (call.name == "beginPath") { + num_potential_calls = 0; + } else if (call.name == "lineTo") { + num_potential_calls++; + } else if (call.name == "stroke") { + // note: Don't simplify these two conditionals into one. The + // separation simplifies debugging tricky tests. if (call.properties.strokeStyle == color) { - num_lines++; + num_lines += num_potential_calls; } + num_potential_calls = 0; } } return num_lines;