test/bar_test.rb in gruff-0.0.7 vs test/bar_test.rb in gruff-0.0.8

- old
+ new

@@ -59,40 +59,59 @@ g.write("test/output/bar_keynote_small.png") end def test_bar_image_bg - g = Gruff::Bar.new - g.title = "Bar Graph With Image Background" - g.labels = { - 0 => '5/6', - 1 => '5/15', - 2 => '5/24', - 3 => '5/30', - } - @datasets.each do |data| - g.data(data[0], data[1]) - end - + g = setup_basic_graph() + g.title = "With Image Background" g.theme_image_based g.write("test/output/bar_image.png") - g = Gruff::Bar.new(400) - g.title = "Bar Graph With Image Background Small" + g = setup_basic_graph(400) + g.title = "With Image Background Small" + g.theme_image_based + g.write("test/output/bar_image_small.png") + + g = setup_basic_graph('800x400') + g.title = "With Image Background Small" + g.theme_image_based + g.write("test/output/bar_image_wide.png") + end + + def test_no_line_markers + g = setup_basic_graph(400) + g.title = "No Line Markers" + g.hide_line_markers = true + g.write("test/output/bar_no_line_markers.png") + end + + def test_wide_graph + g = setup_basic_graph('800x400') + g.title = "Wide Graph" + g.write("test/output/bar_wide_graph.png") + + g = setup_basic_graph('400x200') + g.title = "Wide Graph Small" + g.write("test/output/bar_wide_graph_small.png") + end + + +protected + + def setup_basic_graph(size=800) + g = Gruff::Bar.new(size) + g.title = "My Bar Graph" g.labels = { 0 => '5/6', 1 => '5/15', 2 => '5/24', 3 => '5/30', } @datasets.each do |data| g.data(data[0], data[1]) end - - g.theme_image_based - g.write("test/output/bar_image_small.png") - + g end end @@ -110,8 +129,8 @@ @black = 'black' @colors = [@green, @grey, @orange, @red, @white, @light_grey, @black] @marker_color = 'white' - @base_image = render_image_background('assets/bubble.png') + @base_image = render_image_background('assets/pc306715.jpg') end end