Added the Gruff library to the lib/ directory of the the rails folder, and the
[selectricity] / lib / gruff-0.2.8 / test / test_legend.rb
1 require File.dirname(__FILE__) + "/gruff_test_case"
2
3 class TestGruffLegend < GruffTestCase
4
5   def setup
6     @datasets = [
7       [:Jimmy, [25, 36, 86, 39, 25, 31, 79, 88]],
8       [:Charles, [80, 54, 67, 54, 68, 70, 90, 95]],
9       [:Julie, [22, 29, 35, 38, 36, 40, 46, 57]],
10       [:Jane, [95, 95, 95, 90, 85, 80, 88, 100]],
11       [:Philip, [90, 34, 23, 12, 78, 89, 98, 88]],
12       ["Arthur", [5, 10, 13, 11, 6, 16, 22, 32]],
13       ["Vincent", [5, 10, 13, 11, 6, 16, 22, 32]],
14       ["Jake", [5, 10, 13, 11, 6, 16, 22, 32]],
15       ["Stephen", [5, 10, 13, 11, 6, 16, 22, 32]],
16       ]
17
18     @sample_labels = {
19         0 => '5/6', 
20         1 => '5/15', 
21         2 => '5/24', 
22         3 => '5/30', 
23         4 => '6/4', 
24         5 => '6/12', 
25         6 => '6/21', 
26         7 => '6/28', 
27       }      
28   end
29
30   ## TODO Fix implementation
31
32   # def test_bar_legend_wrap
33   #   [800, 400].each do |width|
34   #     [nil, 4, 16, 30].each do |font_size|
35   #       g = Gruff::Bar.new(width)
36   #       g.title = "Wrapped Legend Bar Test #{font_size}pts #{width}px"
37   #       g.labels = @sample_labels
38   #       0xEFD250.step(0xFF0000, 60) do |num|
39   #         g.colors << "#%x" % num
40   #       end
41   # 
42   #       @datasets.each do |data|
43   #         g.data(data[0], data[1])
44   #       end
45   # 
46   #       g.legend_font_size = font_size unless font_size.nil?
47   #       g.write("test/output/bar_wrapped_legend_#{font_size}_#{width}.png")
48   #     end
49   #   end
50   # end
51   # 
52   # def test_pie_legend_wrap    
53   #   [800, 400].each do |width|
54   #     [nil, 4, 16, 30].each do |font_size|
55   #       g = Gruff::Pie.new(width)
56   #       g.title = "Wrapped Legend Pie Test #{font_size}pts #{width}px"
57   #       g.labels = @sample_labels
58   #       0xEFD250.step(0xFF0000, 60) do |num|
59   #         g.colors << "#%x" % num
60   #       end
61   # 
62   #       @datasets.each do |data|
63   #         g.data(data[0], data[1])
64   #       end
65   # 
66   #       g.legend_font_size = font_size unless font_size.nil?
67   #       g.write("test/output/pie_wrapped_legend_#{font_size}_#{width}.png")
68   #     end
69   #   end
70   # end
71 end

Benjamin Mako Hill || Want to submit a patch?