#!/usr/bin/ruby $:.unshift(File.dirname(__FILE__) + "/../lib/") #$:.unshift File.dirname(__FILE__) + "/fixtures/helpers" require 'test/unit' require 'gruff' class TestGruffBar < Test::Unit::TestCase # TODO Delete old output files once when starting tests def setup @datasets = [ [:Jimmy, [25, 36, 86, 39]], [:Charles, [80, 54, 67, 54]], [:Julie, [22, 29, 35, 38]], #[:Jane, [95, 95, 95, 90, 85, 80, 88, 100]], #[:Philip, [90, 34, 23, 12, 78, 89, 98, 88]], #["Arthur", [5, 10, 13, 11, 6, 16, 22, 32]], ] end def test_bar_graph g = Gruff::Bar.new g.title = "Visual Multi-Line Bar Graph Test" g.labels = { 0 => '5/6', 2 => '5/15', 4 => '5/24', 6 => '5/30', } @datasets.each do |data| g.data(data[0], data[1]) end g.write("test/output/bar_keynote.png") g.theme_37signals g.write("test/output/bar_37signals.png") g.theme_rails_keynote g.write("test/output/bar_rails_keynote.png") g.theme_odeo g.write("test/output/bar_odeo.png") end def test_bar_graph_small g = Gruff::Bar.new(400) g.title = "Visual Multi-Line Bar Graph Test" g.labels = { 0 => '5/6', 2 => '5/15', 4 => '5/24', 6 => '5/30', } @datasets.each do |data| g.data(data[0], data[1]) end g.write("test/output/bar_keynote_small.png") g.theme_37signals g.write("test/output/bar_37signals_small.png") g.theme_rails_keynote g.write("test/output/bar_rails_keynote_small.png") g.theme_odeo g.write("test/output/bar_odeo_small.png") end end