gruff 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +9 -1
- data/Rakefile +11 -1
- data/lib/gruff.rb +4 -0
- data/lib/gruff/bar.rb +0 -1
- data/lib/gruff/base.rb +162 -12
- data/lib/gruff/line.rb +3 -4
- data/lib/gruff/net.rb +133 -0
- data/lib/gruff/pie.rb +8 -46
- data/lib/gruff/scene.rb +196 -0
- data/lib/gruff/spider.rb +130 -0
- data/test/area_test.rb +2 -6
- data/test/bar_test.rb +61 -41
- data/test/base_test.rb +8 -0
- data/test/gruff_test_case.rb +13 -0
- data/test/legend_test.rb +71 -0
- data/test/line_test.rb +13 -54
- data/test/net_test.rb +230 -0
- data/test/photo_test.rb +2 -5
- data/test/pie_test.rb +2 -6
- data/test/scene_test.rb +94 -0
- data/test/sidestacked_bar_test.rb +2 -6
- data/test/spider_test.rb +216 -0
- data/test/stacked_bar_test.rb +2 -6
- metadata +54 -37
    
        data/test/base_test.rb
    ADDED
    
    
    
        data/test/legend_test.rb
    ADDED
    
    | @@ -0,0 +1,71 @@ | |
| 1 | 
            +
            #!/usr/bin/ruby
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require File.dirname(__FILE__) + "/gruff_test_case"
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            class TestGruffLegend < GruffTestCase
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              def setup
         | 
| 8 | 
            +
                @datasets = [
         | 
| 9 | 
            +
                  [:Jimmy, [25, 36, 86, 39, 25, 31, 79, 88]],
         | 
| 10 | 
            +
                  [:Charles, [80, 54, 67, 54, 68, 70, 90, 95]],
         | 
| 11 | 
            +
                  [:Julie, [22, 29, 35, 38, 36, 40, 46, 57]],
         | 
| 12 | 
            +
                  [:Jane, [95, 95, 95, 90, 85, 80, 88, 100]],
         | 
| 13 | 
            +
                  [:Philip, [90, 34, 23, 12, 78, 89, 98, 88]],
         | 
| 14 | 
            +
                  ["Arthur", [5, 10, 13, 11, 6, 16, 22, 32]],
         | 
| 15 | 
            +
                  ["Vincent", [5, 10, 13, 11, 6, 16, 22, 32]],
         | 
| 16 | 
            +
                  ["Jake", [5, 10, 13, 11, 6, 16, 22, 32]],
         | 
| 17 | 
            +
                  ["Stephen", [5, 10, 13, 11, 6, 16, 22, 32]],
         | 
| 18 | 
            +
                  ]
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                @sample_labels = {
         | 
| 21 | 
            +
                    0 => '5/6', 
         | 
| 22 | 
            +
                    1 => '5/15', 
         | 
| 23 | 
            +
                    2 => '5/24', 
         | 
| 24 | 
            +
                    3 => '5/30', 
         | 
| 25 | 
            +
                    4 => '6/4', 
         | 
| 26 | 
            +
                    5 => '6/12', 
         | 
| 27 | 
            +
                    6 => '6/21', 
         | 
| 28 | 
            +
                    7 => '6/28', 
         | 
| 29 | 
            +
                  }      
         | 
| 30 | 
            +
              end
         | 
| 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
         | 
    
        data/test/line_test.rb
    CHANGED
    
    | @@ -1,12 +1,8 @@ | |
| 1 1 | 
             
            #!/usr/bin/ruby
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 4 | 
            -
            #$:.unshift File.dirname(__FILE__) + "/fixtures/helpers"
         | 
| 3 | 
            +
            require File.dirname(__FILE__) + "/gruff_test_case"
         | 
| 5 4 |  | 
| 6 | 
            -
             | 
| 7 | 
            -
            require 'gruff'
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            class TestGruffLine < Test::Unit::TestCase
         | 
| 5 | 
            +
            class TestGruffLine < GruffTestCase
         | 
| 10 6 |  | 
| 11 7 | 
             
              # TODO Delete old output files once when starting tests
         | 
| 12 8 |  | 
| @@ -135,48 +131,13 @@ class TestGruffLine < Test::Unit::TestCase | |
| 135 131 | 
             
                g = Gruff::Line.new
         | 
| 136 132 | 
             
                g.title = "Similar High End Values Test"
         | 
| 137 133 | 
             
                g.data('similar points', %w(29.43 29.459 29.498 29.53 29.548 29.589 29.619 29.66 29.689 29.849 29.878 29.74 29.769 29.79 29.808 29.828).collect {|i| i.to_f} )
         | 
| 138 | 
            -
             | 
| 139 | 
            -
                 | 
| 140 | 
            -
                g. | 
| 141 | 
            -
             | 
| 142 | 
            -
             | 
| 143 | 
            -
             | 
| 144 | 
            -
                g | 
| 145 | 
            -
                g.title = "Dots Test 800px"
         | 
| 146 | 
            -
                g.labels = {
         | 
| 147 | 
            -
                  0 => '5/6', 
         | 
| 148 | 
            -
                  10 => '5/15', 
         | 
| 149 | 
            -
                  20 => '5/24', 
         | 
| 150 | 
            -
                  30 => '5/30', 
         | 
| 151 | 
            -
                  40 => '6/4', 
         | 
| 152 | 
            -
                  50 => '6/16'
         | 
| 153 | 
            -
                }
         | 
| 154 | 
            -
                %w{jimmy jane philip arthur julie bert}.each do |student_name|
         | 
| 155 | 
            -
                  g.data(student_name, (0..50).collect { |i| rand 100 })
         | 
| 156 | 
            -
                end
         | 
| 157 | 
            -
             | 
| 158 | 
            -
                # Default theme
         | 
| 159 | 
            -
                g.write("test/output/line_dots.png")
         | 
| 160 | 
            -
              end
         | 
| 161 | 
            -
             | 
| 162 | 
            -
             | 
| 163 | 
            -
              def test_dots_graph_small
         | 
| 164 | 
            -
                g = Gruff::Line.new(400, false)
         | 
| 165 | 
            -
                g.title = "Dots Test 400px"
         | 
| 166 | 
            -
                g.labels = {
         | 
| 167 | 
            -
                  0 => '5/6', 
         | 
| 168 | 
            -
                  10 => '5/15', 
         | 
| 169 | 
            -
                  20 => '5/24', 
         | 
| 170 | 
            -
                  30 => '5/30', 
         | 
| 171 | 
            -
                  40 => '6/4', 
         | 
| 172 | 
            -
                  50 => '6/16'
         | 
| 173 | 
            -
                }
         | 
| 174 | 
            -
                %w{jimmy jane philip arthur julie bert}.each do |student_name|
         | 
| 175 | 
            -
                  g.data(student_name, (0..50).collect { |i| rand 100 })
         | 
| 176 | 
            -
                end
         | 
| 177 | 
            -
             | 
| 178 | 
            -
                # Default theme
         | 
| 179 | 
            -
                g.write("test/output/line_dots_small.png")
         | 
| 134 | 
            +
                g.write("test/output/line_similar_high_end_values.png")
         | 
| 135 | 
            +
                
         | 
| 136 | 
            +
                g = Gruff::Line.new
         | 
| 137 | 
            +
                g.title = "Similar High End Values With Floor"
         | 
| 138 | 
            +
                g.data('similar points', %w(29.43 29.459 29.498 29.53 29.548 29.589 29.619 29.66 29.689 29.849 29.878 29.74 29.769 29.79 29.808 29.828).collect {|i| i.to_f} )
         | 
| 139 | 
            +
                g.minimum_value = 0
         | 
| 140 | 
            +
                g.write("test/output/line_similar_high_end_values_with_floor.png")
         | 
| 180 141 | 
             
              end
         | 
| 181 142 |  | 
| 182 143 | 
             
              def test_many_lines_graph_small
         | 
| @@ -198,9 +159,9 @@ class TestGruffLine < Test::Unit::TestCase | |
| 198 159 | 
             
                g.write("test/output/line_many_lines_small.png")
         | 
| 199 160 | 
             
              end
         | 
| 200 161 |  | 
| 201 | 
            -
              def  | 
| 202 | 
            -
                g = Gruff::Line.new(300 | 
| 203 | 
            -
                g.title = " | 
| 162 | 
            +
              def test_graph_tiny
         | 
| 163 | 
            +
                g = Gruff::Line.new(300)
         | 
| 164 | 
            +
                g.title = "Tiny Test 300px"
         | 
| 204 165 | 
             
                g.labels = {
         | 
| 205 166 | 
             
                  0 => '5/6', 
         | 
| 206 167 | 
             
                  10 => '5/15', 
         | 
| @@ -214,7 +175,7 @@ class TestGruffLine < Test::Unit::TestCase | |
| 214 175 | 
             
                end
         | 
| 215 176 |  | 
| 216 177 | 
             
                # Default theme
         | 
| 217 | 
            -
                g.write("test/output/ | 
| 178 | 
            +
                g.write("test/output/line_tiny.png")
         | 
| 218 179 | 
             
              end
         | 
| 219 180 |  | 
| 220 181 | 
             
              def test_no_data
         | 
| @@ -343,7 +304,6 @@ class TestGruffLine < Test::Unit::TestCase | |
| 343 304 | 
             
                g.write("test/output/line_all_neg_400.png")
         | 
| 344 305 | 
             
              end
         | 
| 345 306 |  | 
| 346 | 
            -
             | 
| 347 307 | 
             
              def test_many_numbers    
         | 
| 348 308 | 
             
                g = Gruff::Line.new('400x170')
         | 
| 349 309 | 
             
                g.title = "Line Test, Many Numbers"
         | 
| @@ -419,7 +379,6 @@ class TestGruffLine < Test::Unit::TestCase | |
| 419 379 | 
             
              end
         | 
| 420 380 |  | 
| 421 381 |  | 
| 422 | 
            -
             | 
| 423 382 | 
             
            protected
         | 
| 424 383 |  | 
| 425 384 | 
             
              # TODO Reset data after each theme
         | 
    
        data/test/net_test.rb
    ADDED
    
    | @@ -0,0 +1,230 @@ | |
| 1 | 
            +
            #!/usr/bin/ruby
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require File.dirname(__FILE__) + "/gruff_test_case"
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            class TestGruffNet < GruffTestCase
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              def setup
         | 
| 8 | 
            +
                @datasets = [
         | 
| 9 | 
            +
                  [:Jimmy, [25, 36, 86, 39, 25, 31, 79, 88]],
         | 
| 10 | 
            +
                  [:Charles, [80, 54, 67, 54, 68, 70, 90, 95]],
         | 
| 11 | 
            +
                  [:Julie, [22, 29, 35, 38, 36, 40, 46, 57]],
         | 
| 12 | 
            +
                  [:Jane, [95, 95, 95, 90, 85, 80, 88, 100]],
         | 
| 13 | 
            +
                  [:Philip, [90, 34, 23, 12, 78, 89, 98, 88]],
         | 
| 14 | 
            +
                  ["Arthur", [5, 10, 13, 11, 6, 16, 22, 32]],
         | 
| 15 | 
            +
                  ]
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                @sample_labels = {
         | 
| 18 | 
            +
                    0 => '5/6', 
         | 
| 19 | 
            +
                    1 => '5/15', 
         | 
| 20 | 
            +
                    2 => '5/24', 
         | 
| 21 | 
            +
                    3 => '5/30', 
         | 
| 22 | 
            +
                    4 => '6/4', 
         | 
| 23 | 
            +
                    5 => '6/12', 
         | 
| 24 | 
            +
                    6 => '6/21', 
         | 
| 25 | 
            +
                    7 => '6/28', 
         | 
| 26 | 
            +
                  }      
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
                
         | 
| 29 | 
            +
              def test_net_small_values    
         | 
| 30 | 
            +
                @datasets = [
         | 
| 31 | 
            +
                  [:small, [0.1, 0.14356, 0.0, 0.5674839, 0.456]],
         | 
| 32 | 
            +
                  [:small2, [0.2, 0.3, 0.1, 0.05, 0.9]]
         | 
| 33 | 
            +
                  ]
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                g = Gruff::Net.new
         | 
| 36 | 
            +
                g.title = "Small Values Net Graph Test"
         | 
| 37 | 
            +
                @datasets.each do |data|
         | 
| 38 | 
            +
                  g.data(data[0], data[1])
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
                g.write("test/output/net_small.png")
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                g = Gruff::Net.new(400)
         | 
| 43 | 
            +
                g.title = "Small Values Net Graph Test 400px"
         | 
| 44 | 
            +
                @datasets.each do |data|
         | 
| 45 | 
            +
                  g.data(data[0], data[1])
         | 
| 46 | 
            +
                end
         | 
| 47 | 
            +
                g.write("test/output/net_small_small.png")
         | 
| 48 | 
            +
              end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
              def test_net_starts_with_zero
         | 
| 51 | 
            +
                @datasets = [
         | 
| 52 | 
            +
                  [:first0, [0, 5, 10, 8, 18]],
         | 
| 53 | 
            +
                  [:normal, [1, 2, 3, 4, 5]]
         | 
| 54 | 
            +
                  ]
         | 
| 55 | 
            +
             | 
| 56 | 
            +
                g = Gruff::Net.new
         | 
| 57 | 
            +
                g.title = "Small Values Net Graph Test"
         | 
| 58 | 
            +
                @datasets.each do |data|
         | 
| 59 | 
            +
                  g.data(data[0], data[1])
         | 
| 60 | 
            +
                end
         | 
| 61 | 
            +
                g.write("test/output/net_small_zero.png")
         | 
| 62 | 
            +
             | 
| 63 | 
            +
                g = Gruff::Net.new(400)
         | 
| 64 | 
            +
                g.title = "Small Values Net Graph Test 400px"
         | 
| 65 | 
            +
                @datasets.each do |data|
         | 
| 66 | 
            +
                  g.data(data[0], data[1])
         | 
| 67 | 
            +
                end
         | 
| 68 | 
            +
                g.write("test/output/net_small_small_zero.png")
         | 
| 69 | 
            +
              end
         | 
| 70 | 
            +
             | 
| 71 | 
            +
                
         | 
| 72 | 
            +
              def test_net_large_values    
         | 
| 73 | 
            +
                @datasets = [
         | 
| 74 | 
            +
                  [:large, [100_005, 35_000, 28_000, 27_000]],
         | 
| 75 | 
            +
                  [:large2, [35_000, 28_000, 27_000, 100_005]],
         | 
| 76 | 
            +
                  [:large3, [28_000, 27_000, 100_005, 35_000]],
         | 
| 77 | 
            +
                  [:large4, [1_238, 39_092, 27_938, 48_876]]
         | 
| 78 | 
            +
                  ]
         | 
| 79 | 
            +
             | 
| 80 | 
            +
                g = Gruff::Net.new
         | 
| 81 | 
            +
                g.title = "Very Large Values Net Graph Test"
         | 
| 82 | 
            +
                @datasets.each do |data|
         | 
| 83 | 
            +
                  g.data(data[0], data[1])
         | 
| 84 | 
            +
                end
         | 
| 85 | 
            +
             | 
| 86 | 
            +
                g.write("test/output/net_large.png")
         | 
| 87 | 
            +
              end
         | 
| 88 | 
            +
                
         | 
| 89 | 
            +
              def test_many_datapoints
         | 
| 90 | 
            +
                g = Gruff::Net.new
         | 
| 91 | 
            +
                g.title = "Many Multi-Net Graph Test"
         | 
| 92 | 
            +
                g.labels = {
         | 
| 93 | 
            +
                  0 => 'June', 
         | 
| 94 | 
            +
                  10 => 'July', 
         | 
| 95 | 
            +
                  30 => 'August', 
         | 
| 96 | 
            +
                  50 => 'September', 
         | 
| 97 | 
            +
                }
         | 
| 98 | 
            +
                g.data('many points', (0..50).collect {|i| rand(100) })
         | 
| 99 | 
            +
             | 
| 100 | 
            +
                # Default theme
         | 
| 101 | 
            +
                g.write("test/output/net_many.png")
         | 
| 102 | 
            +
              end
         | 
| 103 | 
            +
             | 
| 104 | 
            +
             | 
| 105 | 
            +
              def test_similar_high_end_values
         | 
| 106 | 
            +
                g = Gruff::Net.new
         | 
| 107 | 
            +
                g.title = "Similar High End Values Test"
         | 
| 108 | 
            +
                g.data('similar points', %w(29.43 29.459 29.498 29.53 29.548 29.589 29.619 29.66 29.689 29.849 29.878 29.74 29.769 29.79 29.808 29.828).collect {|i| i.to_f} )
         | 
| 109 | 
            +
             | 
| 110 | 
            +
                # Default theme
         | 
| 111 | 
            +
                g.write("test/output/net_similar_high_end_values.png")    
         | 
| 112 | 
            +
              end
         | 
| 113 | 
            +
             | 
| 114 | 
            +
              def test_many_nets_graph_small
         | 
| 115 | 
            +
                g = Gruff::Net.new(400)
         | 
| 116 | 
            +
                g.title = "Many Values Net Test 400px"
         | 
| 117 | 
            +
                g.labels = {
         | 
| 118 | 
            +
                  0 => '5/6', 
         | 
| 119 | 
            +
                  10 => '5/15', 
         | 
| 120 | 
            +
                  20 => '5/24', 
         | 
| 121 | 
            +
                  30 => '5/30', 
         | 
| 122 | 
            +
                  40 => '6/4', 
         | 
| 123 | 
            +
                  50 => '6/16'
         | 
| 124 | 
            +
                }
         | 
| 125 | 
            +
                %w{jimmy jane philip arthur julie bert}.each do |student_name|
         | 
| 126 | 
            +
                  g.data(student_name, (0..50).collect { |i| rand 100 })
         | 
| 127 | 
            +
                end
         | 
| 128 | 
            +
             | 
| 129 | 
            +
                # Default theme
         | 
| 130 | 
            +
                g.write("test/output/net_many_nets_small.png")
         | 
| 131 | 
            +
              end
         | 
| 132 | 
            +
             | 
| 133 | 
            +
              def test_dots_graph_tiny
         | 
| 134 | 
            +
                g = Gruff::Net.new(300)
         | 
| 135 | 
            +
                g.title = "Dots Test 300px"
         | 
| 136 | 
            +
                g.labels = {
         | 
| 137 | 
            +
                  0 => '5/6', 
         | 
| 138 | 
            +
                  10 => '5/15', 
         | 
| 139 | 
            +
                  20 => '5/24', 
         | 
| 140 | 
            +
                  30 => '5/30', 
         | 
| 141 | 
            +
                  40 => '6/4', 
         | 
| 142 | 
            +
                  50 => '6/16'
         | 
| 143 | 
            +
                }
         | 
| 144 | 
            +
                %w{jimmy jane philip arthur julie bert}.each do |student_name|
         | 
| 145 | 
            +
                  g.data(student_name, (0..50).collect { |i| rand 100 })
         | 
| 146 | 
            +
                end
         | 
| 147 | 
            +
             | 
| 148 | 
            +
                # Default theme
         | 
| 149 | 
            +
                g.write("test/output/net_dots_tiny.png")
         | 
| 150 | 
            +
              end
         | 
| 151 | 
            +
             | 
| 152 | 
            +
              def test_no_data
         | 
| 153 | 
            +
                g = Gruff::Net.new(400)
         | 
| 154 | 
            +
                g.title = "No Data"
         | 
| 155 | 
            +
                # Default theme
         | 
| 156 | 
            +
                g.write("test/output/net_no_data.png")
         | 
| 157 | 
            +
                
         | 
| 158 | 
            +
                g = Gruff::Net.new(400)
         | 
| 159 | 
            +
                g.title = "No Data Title"
         | 
| 160 | 
            +
                g.no_data_message = 'There is no data'
         | 
| 161 | 
            +
                g.write("test/output/net_no_data_msg.png")
         | 
| 162 | 
            +
              end
         | 
| 163 | 
            +
             | 
| 164 | 
            +
             | 
| 165 | 
            +
              def test_all_zeros
         | 
| 166 | 
            +
                g = Gruff::Net.new(400)
         | 
| 167 | 
            +
                g.title = "All Zeros"
         | 
| 168 | 
            +
             | 
| 169 | 
            +
                g.data(:gus, [0,0,0,0])
         | 
| 170 | 
            +
             | 
| 171 | 
            +
                # Default theme
         | 
| 172 | 
            +
                g.write("test/output/net_no_data_other.png")    
         | 
| 173 | 
            +
              end
         | 
| 174 | 
            +
             | 
| 175 | 
            +
              def test_no_title
         | 
| 176 | 
            +
                g = Gruff::Net.new(400)
         | 
| 177 | 
            +
                g.labels = @sample_labels
         | 
| 178 | 
            +
                @datasets.each do |data|
         | 
| 179 | 
            +
                  g.data(data[0], data[1])
         | 
| 180 | 
            +
                end
         | 
| 181 | 
            +
             | 
| 182 | 
            +
                g.write("test/output/net_no_title.png")
         | 
| 183 | 
            +
              end
         | 
| 184 | 
            +
             | 
| 185 | 
            +
              def test_no_net_markers
         | 
| 186 | 
            +
                g = setup_basic_graph(400)
         | 
| 187 | 
            +
                g.title = "No Net Markers"
         | 
| 188 | 
            +
                g.hide_line_markers = true
         | 
| 189 | 
            +
                g.write("test/output/net_no_net_markers.png")    
         | 
| 190 | 
            +
              end
         | 
| 191 | 
            +
             | 
| 192 | 
            +
              def test_no_legend
         | 
| 193 | 
            +
                g = setup_basic_graph(400)
         | 
| 194 | 
            +
                g.title = "No Legend"
         | 
| 195 | 
            +
                g.hide_legend = true
         | 
| 196 | 
            +
                g.write("test/output/net_no_legend.png")
         | 
| 197 | 
            +
              end
         | 
| 198 | 
            +
             | 
| 199 | 
            +
              def test_nothing_but_the_graph
         | 
| 200 | 
            +
                g = setup_basic_graph(400)
         | 
| 201 | 
            +
                g.title = "THIS TITLE SHOULD NOT DISPLAY!!!"
         | 
| 202 | 
            +
                g.hide_line_markers = true
         | 
| 203 | 
            +
                g.hide_legend = true
         | 
| 204 | 
            +
                g.hide_title = true
         | 
| 205 | 
            +
                g.write("test/output/net_nothing_but_the_graph.png")    
         | 
| 206 | 
            +
              end
         | 
| 207 | 
            +
             | 
| 208 | 
            +
              def test_wide_graph
         | 
| 209 | 
            +
                g = setup_basic_graph('800x400')
         | 
| 210 | 
            +
                g.title = "Wide Graph"
         | 
| 211 | 
            +
                g.write("test/output/net_wide_graph.png")    
         | 
| 212 | 
            +
             | 
| 213 | 
            +
                g = setup_basic_graph('400x200')
         | 
| 214 | 
            +
                g.title = "Wide Graph Small"
         | 
| 215 | 
            +
                g.write("test/output/net_wide_graph_small.png")
         | 
| 216 | 
            +
              end
         | 
| 217 | 
            +
             | 
| 218 | 
            +
            protected
         | 
| 219 | 
            +
             | 
| 220 | 
            +
              def setup_basic_graph(size=800)
         | 
| 221 | 
            +
                g = Gruff::Net.new(size)
         | 
| 222 | 
            +
                g.title = "My Graph Title"
         | 
| 223 | 
            +
                g.labels = @sample_labels
         | 
| 224 | 
            +
                @datasets.each do |data|
         | 
| 225 | 
            +
                  g.data(data[0], data[1])
         | 
| 226 | 
            +
                end
         | 
| 227 | 
            +
                return g
         | 
| 228 | 
            +
              end
         | 
| 229 | 
            +
              
         | 
| 230 | 
            +
            end
         | 
    
        data/test/photo_test.rb
    CHANGED
    
    | @@ -1,11 +1,8 @@ | |
| 1 1 | 
             
            #!/usr/bin/ruby
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 3 | 
            +
            require File.dirname(__FILE__) + "/gruff_test_case"
         | 
| 4 4 |  | 
| 5 | 
            -
             | 
| 6 | 
            -
            require 'gruff'
         | 
| 7 | 
            -
             | 
| 8 | 
            -
            class TestGruffPhotoBar < Test::Unit::TestCase
         | 
| 5 | 
            +
            class TestGruffPhotoBar < GruffTestCase
         | 
| 9 6 |  | 
| 10 7 | 
             
              def setup
         | 
| 11 8 | 
             
                @datasets = [
         | 
    
        data/test/pie_test.rb
    CHANGED
    
    | @@ -1,12 +1,8 @@ | |
| 1 1 | 
             
            #!/usr/bin/ruby
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 4 | 
            -
            #$:.unshift File.dirname(__FILE__) + "/fixtures/helpers"
         | 
| 3 | 
            +
            require File.dirname(__FILE__) + "/gruff_test_case"
         | 
| 5 4 |  | 
| 6 | 
            -
             | 
| 7 | 
            -
            require 'gruff'
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            class TestGruffPie < Test::Unit::TestCase
         | 
| 5 | 
            +
            class TestGruffPie < GruffTestCase
         | 
| 10 6 |  | 
| 11 7 | 
             
              def setup
         | 
| 12 8 | 
             
                @datasets = [
         |