1 require File.dirname(__FILE__) + "/gruff_test_case"
3 class TestGruffAccumulatorBar < GruffTestCase
5 # TODO Delete old output files once when starting tests
9 (1..20).to_a.map { rand(10) }
14 g = Gruff::AccumulatorBar.new 500
15 g.title = "Your Savings"
18 # g.font = File.expand_path(File.dirname(__FILE__) + "/../assets/fonts/ATMA____.TTF")
20 g.marker_font_size = 18
23 :colors => ['#aedaa9', '#12a702'], # 3077a9 blue, aedaa9 light green
24 :marker_color => '#dddddd',
25 :font_color => 'black',
26 :background_colors => "white"
27 # :background_image => File.expand_path(File.dirname(__FILE__) + "/../assets/backgrounds/43things.png")
30 # Attempt at negative numbers
31 # g.data 'Savings', (1..20).to_a.map { rand(10) * (rand(2) > 0 ? 1 : -1) }
32 g.data 'Savings', (1..12).to_a.map { rand(100) }
33 g.labels = (0..11).to_a.inject({}) {|memo, index| {index => '12-26'}.merge(memo)}
35 g.maximum_value = 1000
38 g.write("test/output/accum_bar.png")
41 def test_too_many_args
42 assert_raise(Gruff::IncorrectNumberOfDatasetsException) {
43 g = Gruff::AccumulatorBar.new
44 g.data 'First', [1,1,1]
45 g.data 'Too Many', [1,1,1]
46 g.write("test/output/_SHOULD_NOT_ACTUALLY_BE_WRITTEN.png")