2 * @fileoverview Tests for the smooth (bezier curve) plotter.
4 * @author danvdk@gmail.com (Dan Vanderkam)
6 var smoothPlotterTestCase
= TestCase("smooth-plotter");
8 var getControlPoints
= smoothPlotter
._getControlPoints
;
10 smoothPlotterTestCase
.prototype.setUp
= function() {
13 smoothPlotterTestCase
.prototype.tearDown
= function() {
16 smoothPlotterTestCase
.prototype.testNoSmoothing
= function() {
17 var lastPt
= {x
: 10, y
: 0},
19 nextPt
= {x
: 12, y
: 0},
22 assertEquals([11, 1, 11, 1], getControlPoints(lastPt
, pt
, nextPt
, alpha
));
25 smoothPlotterTestCase
.prototype.testHalfSmoothing
= function() {
26 var lastPt
= {x
: 10, y
: 0},
28 nextPt
= {x
: 12, y
: 0},
31 assertEquals([10.5, 1, 11.5, 1], getControlPoints(lastPt
, pt
, nextPt
, alpha
));
34 smoothPlotterTestCase
.prototype.testExtrema
= function() {
35 var lastPt
= {x
: 10, y
: 0},
37 nextPt
= {x
: 12, y
: 1},
40 assertEquals([10.5, 0.75, 11.5, 1.25],
41 getControlPoints(lastPt
, pt
, nextPt
, alpha
, true));
43 assertEquals([10.5, 1, 11.5, 1],
44 getControlPoints(lastPt
, pt
, nextPt
, alpha
, false));