From 22e4431c8267bb6c035d61875d6844982a8f53bf Mon Sep 17 00:00:00 2001 From: Will Charczuk Date: Fri, 5 Aug 2016 21:31:41 -0700 Subject: [PATCH] tests catching bugs. --- bar_chart_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bar_chart_test.go b/bar_chart_test.go index aea719c..3085f4d 100644 --- a/bar_chart_test.go +++ b/bar_chart_test.go @@ -235,6 +235,8 @@ func TestBarChartCalculateEffectiveBarWidth(t *testing.T) { }, } + cb := bc.box() + spacing := bc.calculateEffectiveBarSpacing(bc.box()) assert.NotZero(spacing) @@ -243,8 +245,15 @@ func TestBarChartCalculateEffectiveBarWidth(t *testing.T) { bc.BarWidth = 250 spacing = bc.calculateEffectiveBarSpacing(bc.box()) + assert.Zero(spacing) barWidth = bc.calculateEffectiveBarWidth(bc.box(), spacing) assert.Equal(199, barWidth) - assert.Equal(1024, bc.calculateTotalBarWidth(barWidth, spacing)) + assert.Equal(cb.Width()+1, bc.calculateTotalBarWidth(barWidth, spacing)) + + bw, bs, total := bc.calculateScaledTotalWidth(cb) + assert.Equal(spacing, bs) + assert.Equal(barWidth, bw) + assert.Equal(cb.Width()+1, total) + }