diff -Nru ruby-gruff-0.3.6/debian/changelog ruby-gruff-0.3.6/debian/changelog --- ruby-gruff-0.3.6/debian/changelog 2011-09-29 00:52:06.000000000 +0900 +++ ruby-gruff-0.3.6/debian/changelog 2012-07-23 07:56:24.000000000 +0900 @@ -1,3 +1,11 @@ +ruby-gruff (0.3.6-5.1) unstable; urgency=low + + * Non-maintainer upload. + * Fix FTBFS with test. (Closes: #676206) + Add patches/support_1.9.3. This patch provides support ruby 1.9.3. + + -- Nobuhiro Iwamatsu Mon, 23 Jul 2012 07:38:24 +0900 + ruby-gruff (0.3.6-5) unstable; urgency=low * Added missing dependency and build-dependency on ruby-rmagick diff -Nru ruby-gruff-0.3.6/debian/patches/series ruby-gruff-0.3.6/debian/patches/series --- ruby-gruff-0.3.6/debian/patches/series 2011-09-29 00:52:06.000000000 +0900 +++ ruby-gruff-0.3.6/debian/patches/series 2012-07-23 07:43:41.000000000 +0900 @@ -1,3 +1,4 @@ drop_require_rubygems remove_obsolete_call_from_test_line sort_needed_for_test_scene +support_1.9.3 diff -Nru ruby-gruff-0.3.6/debian/patches/support_1.9.3 ruby-gruff-0.3.6/debian/patches/support_1.9.3 --- ruby-gruff-0.3.6/debian/patches/support_1.9.3 1970-01-01 09:00:00.000000000 +0900 +++ ruby-gruff-0.3.6/debian/patches/support_1.9.3 2012-07-23 07:46:36.000000000 +0900 @@ -0,0 +1,964 @@ +From: https://github.com/topfunky/gruff +Description: Support 1.9.3 + Patch create from upsteam. +Origin: upstream, https://github.com/topfunky/gruff/commit/719d989d91502925071c5b69aa7fa82a2b7112fb +Bug: None +Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=676206 + +diff --git a/Rakefile b/Rakefile +index a344837..5d2b2f4 100644 +--- a/Rakefile ++++ b/Rakefile +@@ -1,17 +1,18 @@ ++require 'rubygems' + require 'hoe' + $:.unshift(File.dirname(__FILE__) + "/lib") + require 'gruff' + +-Hoe.new('Gruff', Gruff::VERSION) do |p| +- p.name = "gruff" +- p.author = "Geoffrey Grosenbach" +- p.description = "Beautiful graphs for one or multiple datasets. Can be used on websites or in documents." +- p.email = 'boss@topfunky.com' +- p.summary = "Beautiful graphs for one or multiple datasets." +- p.url = "http://nubyonrails.com/pages/gruff" +- p.clean_globs = ['test/output/*.png'] +- p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n") +- p.remote_rdoc_dir = '' # Release to root ++Hoe.spec('Gruff') do ++ self.name = "gruff" ++ self.author = "Geoffrey Grosenbach" ++ self.description = "Beautiful graphs for one or multiple datasets. Can be used on websites or in documents." ++ self.email = 'boss@topfunky.com' ++ self.summary = "Beautiful graphs for one or multiple datasets." ++ self.url = "http://nubyonrails.com/pages/gruff" ++ self.clean_globs = ['test/output/*.png'] ++ self.changes = self.paragraphs_of('History.txt', 0..1).join("\n\n") ++ self.remote_rdoc_dir = '' # Release to root + end + + desc "Simple require on packaged files to make sure they are all there" +diff --git a/lib/gruff/base.rb b/lib/gruff/base.rb +index 4495e4b..d5fbef4 100644 +--- a/lib/gruff/base.rb ++++ b/lib/gruff/base.rb +@@ -1,4 +1,6 @@ ++require 'rubygems' + require 'RMagick' ++require 'bigdecimal' + + require File.dirname(__FILE__) + '/deprecated' + +@@ -40,7 +42,7 @@ module Gruff + DEFAULT_MARGIN = 20.0 + + DEFAULT_TARGET_WIDTH = 800 +- ++ + THOUSAND_SEPARATOR = ',' + + # Blank space above the graph +@@ -54,10 +56,10 @@ module Gruff + + # Blank space to the left of the graph + attr_accessor :left_margin +- ++ + # Blank space below the title + attr_accessor :title_margin +- ++ + # Blank space below the legend + attr_accessor :legend_margin + +@@ -222,7 +224,7 @@ module Gruff + @marker_font_size = 21.0 + @legend_font_size = 20.0 + @title_font_size = 36.0 +- ++ + @top_margin = @bottom_margin = @left_margin = @right_margin = DEFAULT_MARGIN + @legend_margin = LEGEND_MARGIN + @title_margin = TITLE_MARGIN +@@ -697,7 +699,8 @@ module Gruff + @d = @d.fill(@marker_color) + @d = @d.line(@graph_left, y, @graph_right, y) + +- marker_label = index * @increment + @minimum_value.to_f ++ marker_label = BigDecimal(index.to_s) * BigDecimal(@increment.to_s) + ++ BigDecimal(@minimum_value.to_s) + + unless @hide_line_numbers + @d.fill = @font_color +@@ -976,9 +979,10 @@ module Gruff + data_point + end + +- def significant(inc) # :nodoc: +- return 1.0 if inc == 0 # Keep from going into infinite loop +- factor = 1.0 ++ def significant(i) # :nodoc: ++ return 1.0 if i == 0 # Keep from going into infinite loop ++ inc = BigDecimal(i.to_s) ++ factor = BigDecimal('1.0') + while (inc < 10) + inc *= 10 + factor /= 10 +@@ -1062,7 +1066,7 @@ module Gruff + # Return a formatted string representing a number value that should be + # printed as a label. + def label(value) +- label = if (@spread.to_f % @marker_count.to_f == 0) || !@y_axis_increment.nil? ++ label = if (@spread.to_f % (@marker_count.to_f==0 ? 1 : @marker_count.to_f) == 0) || !@y_axis_increment.nil? + value.to_i.to_s + elsif @spread > 10.0 + sprintf("%0i", value) +@@ -1071,7 +1075,7 @@ module Gruff + else + value.to_s + end +- ++ + parts = label.split('.') + parts[0].gsub!(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{THOUSAND_SEPARATOR}") + parts.join('.') +@@ -1084,6 +1088,7 @@ module Gruff + # handle. + def calculate_caps_height(font_size) + @d.pointsize = font_size ++ @d.font = @font if @font + @d.get_type_metrics(@base_image, 'X').height + end + +@@ -1093,6 +1098,7 @@ module Gruff + # scaling will handle. + def calculate_width(font_size, text) + @d.pointsize = font_size ++ @d.font = @font if @font + @d.get_type_metrics(@base_image, text.to_s).width + end + +diff --git a/lib/gruff/mini/legend.rb b/lib/gruff/mini/legend.rb +index b869cb1..9c3b8d7 100644 +--- a/lib/gruff/mini/legend.rb ++++ b/lib/gruff/mini/legend.rb +@@ -1,28 +1,49 @@ + module Gruff + module Mini + module Legend +- +- attr_accessor :hide_mini_legend +- ++ ++ attr_accessor :hide_mini_legend, :legend_position ++ + ## + # The canvas needs to be bigger so we can put the legend beneath it. + + def expand_canvas_for_vertical_legend + return if @hide_mini_legend +- ++ ++ @legend_labels = @data.collect {|item| item[Gruff::Base::DATA_LABEL_INDEX] } ++ ++ legend_height = scale_fontsize( ++ @data.length * calculate_line_height + ++ @top_margin + @bottom_margin) ++ + @original_rows = @raw_rows +- @rows += @data.length * calculate_caps_height(scale_fontsize(@legend_font_size)) * 1.7 ++ @original_columns = @raw_columns ++ ++ case @legend_position ++ when :right then ++ @rows = [@rows, legend_height].max ++ @columns += calculate_legend_width + @left_margin ++ else ++ @rows += @data.length * calculate_caps_height(scale_fontsize(@legend_font_size)) * 1.7 ++ end + render_background + end +- ++ ++ def calculate_line_height ++ calculate_caps_height(@legend_font_size) * 1.7 ++ end ++ ++ def calculate_legend_width ++ width = @legend_labels.map { |label| calculate_width(@legend_font_size, label) }.max ++ scale_fontsize(width + 40*1.7) ++ end ++ + ## + # Draw the legend beneath the existing graph. + + def draw_vertical_legend + return if @hide_mini_legend +- +- @legend_labels = @data.collect {|item| item[Gruff::Base::DATA_LABEL_INDEX] } +- ++ + legend_square_width = 40.0 # small square with color of this item + legend_square_margin = 10.0 + @legend_left_margin = 100.0 +@@ -32,12 +53,18 @@ module Gruff + @d.font = @font if @font + @d.pointsize = @legend_font_size + +- current_x_offset = @legend_left_margin +- current_y_offset = @original_rows + legend_top_margin ++ case @legend_position ++ when :right then ++ current_x_offset = @original_columns + @left_margin ++ current_y_offset = @top_margin + legend_top_margin ++ else ++ current_x_offset = @legend_left_margin ++ current_y_offset = @original_rows + legend_top_margin ++ end + + debug { @d.line 0.0, current_y_offset, @raw_columns, current_y_offset } + +- @legend_labels.each_with_index do |legend_label, index| ++ @legend_labels.each_with_index do |legend_label, index| + + # Draw label + @d.fill = @font_color +@@ -46,20 +73,20 @@ module Gruff + @d.stroke = 'transparent' + @d.font_weight = Magick::NormalWeight + @d.gravity = Magick::WestGravity +- @d = @d.annotate_scaled( @base_image, +- @raw_columns, 1.0, +- current_x_offset + (legend_square_width * 1.7), current_y_offset, +- truncate_legend_label(legend_label), @scale) ++ @d = @d.annotate_scaled( @base_image, ++ @raw_columns, 1.0, ++ current_x_offset + (legend_square_width * 1.7), current_y_offset, ++ truncate_legend_label(legend_label), @scale) + + # Now draw box with color of this dataset + @d = @d.stroke 'transparent' + @d = @d.fill @data[index][Gruff::Base::DATA_COLOR_INDEX] +- @d = @d.rectangle(current_x_offset, +- current_y_offset - legend_square_width / 2.0, +- current_x_offset + legend_square_width, ++ @d = @d.rectangle(current_x_offset, ++ current_y_offset - legend_square_width / 2.0, ++ current_x_offset + legend_square_width, + current_y_offset + legend_square_width / 2.0) +- +- current_y_offset += calculate_caps_height(@legend_font_size) * 1.7 ++ ++ current_y_offset += calculate_line_height + end + @color_index = 0 + end +@@ -68,7 +95,7 @@ module Gruff + # Shorten long labels so they will fit on the canvas. + # + # Department of Hu... +- ++ + def truncate_legend_label(label) + truncated_label = label.to_s + while calculate_width(scale_fontsize(@legend_font_size), truncated_label) > (@columns - @legend_left_margin - @right_margin) && (truncated_label.length > 1) +@@ -76,7 +103,7 @@ module Gruff + end + truncated_label + (truncated_label.length < label.to_s.length ? "..." : '') + end +- ++ + end + end + end +diff --git a/lib/gruff/pie.rb b/lib/gruff/pie.rb +index c3f6ca1..1487bb7 100644 +--- a/lib/gruff/pie.rb ++++ b/lib/gruff/pie.rb +@@ -18,10 +18,14 @@ class Gruff::Pie < Gruff::Base + # Can be used to make the pie start cutting slices at the top (-90.0) + # or at another angle. Default is 0.0, which starts at 3 o'clock. + attr_accessor :zero_degree ++ # Do not show labels for slices that are less than this percent. Use 0 to always show all labels. ++ # Defaults to 0 ++ attr_accessor :hide_labels_less_than + + def initialize_ivars + super + @zero_degree = 0.0 ++ @hide_labels_less_than = 0.0 + end + + def draw +@@ -58,17 +62,15 @@ class Gruff::Pie < Gruff::Base + + half_angle = prev_degrees + ((prev_degrees + current_degrees) - prev_degrees) / 2 + +- # Following line is commented to allow display of the percentiles +- # bug appeared between r90 and r92 +- # unless @hide_line_markers then ++ label_val = ((data_row[DATA_VALUES_INDEX].first / total_sum) * 100.0).round ++ unless label_val < @hide_labels_less_than + # End the string with %% to escape the single %. + # RMagick must use sprintf with the string and % has special significance. +- label_string = ((data_row[DATA_VALUES_INDEX].first / total_sum) * +- 100.0).round.to_s + '%%' ++ label_string = label_val.to_s + '%%' + @d = draw_label(center_x,center_y, half_angle, + radius + (radius * TEXT_OFFSET_PERCENTAGE), + label_string) +- # end ++ end + + prev_degrees += current_degrees + end +diff --git a/lib/gruff/side_bar.rb b/lib/gruff/side_bar.rb +index 282c2c9..6c8a749 100644 +--- a/lib/gruff/side_bar.rb ++++ b/lib/gruff/side_bar.rb +@@ -5,22 +5,30 @@ require File.dirname(__FILE__) + '/base' + + class Gruff::SideBar < Gruff::Base + ++ # Spacing factor applied between bars ++ attr_accessor :bar_spacing ++ + def draw + @has_left_labels = true + super + + return unless @has_data ++ draw_bars ++ end ++ ++protected + ++ def draw_bars + # Setup spacing. + # + @bar_spacing ||= 0.9 + + @bars_width = @graph_height / @column_count.to_f +- @bar_width = @bars_width * @bar_spacing / @norm_data.size ++ @bar_width = @bars_width / @norm_data.size + @d = @d.stroke_opacity 0.0 + height = Array.new(@column_count, 0) + length = Array.new(@column_count, @graph_left) +- padding = (@bars_width * (1 - @bar_spacing)) / 2 ++ padding = (@bar_width * (1 - @bar_spacing)) / 2 + + @norm_data.each_with_index do |data_row, row_index| + @d = @d.fill data_row[DATA_COLOR_INDEX] +@@ -37,7 +45,7 @@ class Gruff::SideBar < Gruff::Base + left_x = length[point_index] - 1 + left_y = @graph_top + (@bars_width * point_index) + (@bar_width * row_index) + padding + right_x = left_x + difference +- right_y = left_y + @bar_width ++ right_y = left_y + @bar_width * @bar_spacing + + height[point_index] += (data_point * @graph_width) + +@@ -53,8 +61,6 @@ class Gruff::SideBar < Gruff::Base + @d.draw(@base_image) + end + +-protected +- + # Instead of base class version, draws vertical background lines and label + def draw_line_markers + +@@ -68,14 +74,14 @@ protected + number_of_lines = 5 + + # TODO Round maximum marker value to a round number like 100, 0.1, 0.5, etc. +- increment = significant(@maximum_value.to_f / number_of_lines) ++ increment = significant(@spread.to_f / number_of_lines) + (0..number_of_lines).each do |index| + + line_diff = (@graph_right - @graph_left) / number_of_lines + x = @graph_right - (line_diff * index) - 1 + @d = @d.line(x, @graph_bottom, x, @graph_top) + diff = index - number_of_lines +- marker_label = diff.abs * increment ++ marker_label = diff.abs * increment + @minimum_value + + unless @hide_line_numbers + @d.fill = @font_color +diff --git a/lib/gruff/side_stacked_bar.rb b/lib/gruff/side_stacked_bar.rb +index 7806bd5..102859b 100644 +--- a/lib/gruff/side_stacked_bar.rb ++++ b/lib/gruff/side_stacked_bar.rb +@@ -11,13 +11,18 @@ require File.dirname(__FILE__) + '/stacked_mixin' + class Gruff::SideStackedBar < Gruff::SideBar + include StackedMixin + ++ # Spacing factor applied between bars ++ attr_accessor :bar_spacing ++ + def draw + @has_left_labels = true + get_maximum_by_stack + super ++ end + +- return unless @has_data ++ protected + ++ def draw_bars + # Setup spacing. + # + # Columns sit stacked. +@@ -30,8 +35,6 @@ class Gruff::SideStackedBar < Gruff::SideBar + padding = (@bar_width * (1 - @bar_spacing)) / 2 + + @norm_data.each_with_index do |data_row, row_index| +- @d = @d.fill data_row[DATA_COLOR_INDEX] +- + data_row[DATA_VALUES_INDEX].each_with_index do |data_point, point_index| + + ## using the original calcs from the stacked bar chart to get the difference between +@@ -42,7 +45,9 @@ class Gruff::SideStackedBar < Gruff::SideBar + temp2 = @graph_left + @graph_width - height[point_index] - 1 + difference = temp2 - temp1 + +- left_x = length[point_index] #+ 1 ++ @d = @d.fill data_row[DATA_COLOR_INDEX] ++ ++ left_x = length[point_index] #+ 1 + left_y = @graph_top + (@bar_width * point_index) + padding + right_x = left_x + difference + right_y = left_y + @bar_width * @bar_spacing +@@ -61,8 +66,6 @@ class Gruff::SideStackedBar < Gruff::SideBar + @d.draw(@base_image) + end + +- protected +- + def larger_than_max?(data_point, index=0) + max(data_point, index) > @maximum_value + end +diff --git a/lib/gruff/stacked_bar.rb b/lib/gruff/stacked_bar.rb +index 53102c1..cdac7aa 100644 +--- a/lib/gruff/stacked_bar.rb ++++ b/lib/gruff/stacked_bar.rb +@@ -5,6 +5,9 @@ require File.dirname(__FILE__) + '/stacked_mixin' + class Gruff::StackedBar < Gruff::Base + include StackedMixin + ++ # Spacing factor applied between bars ++ attr_accessor :bar_spacing ++ + # Draws a bar graph, but multiple sets are stacked on top of each other. + def draw + get_maximum_by_stack +diff --git a/test/gruff_test_case.rb b/test/gruff_test_case.rb +index 074a8d5..e989788 100644 +--- a/test/gruff_test_case.rb ++++ b/test/gruff_test_case.rb +@@ -1,6 +1,8 @@ + $:.unshift(File.dirname(__FILE__) + "/../lib/") + # require 'rubygems' + ++RMAGICK_BYPASS_VERSION_TEST = true ++ + require 'test/unit' + require 'gruff' + require 'fileutils' +diff --git a/test/test_bar.rb b/test/test_bar.rb +index 370bf76..8b43e65 100644 +--- a/test/test_bar.rb ++++ b/test/test_bar.rb +@@ -37,7 +37,6 @@ class TestGruffBar < GruffTestCase + def test_thousand_separators + g = Gruff::Bar.new(600) + g.title = "Formatted numbers" +- g.bar_spacing = 0.2 + g.marker_count = 8 + g.data("data", [4025, 1024, 50257, 703672, 1580456]) + g.write("test/output/bar_formatted_numbers.png") +@@ -284,6 +283,22 @@ class TestGruffBar < GruffTestCase + write_test_file g, 'enhancements.png' + end + ++ def test_bar_spacing ++ g = setup_basic_graph ++ g.bar_spacing = 0 ++ g.title = "100% spacing between bars" ++ g.write("test/output/bar_spacing_full.png") ++ ++ g = setup_basic_graph ++ g.bar_spacing = 0.5 ++ g.title = "50% spacing between bars" ++ g.write("test/output/bar_spacing_half.png") ++ ++ g = setup_basic_graph ++ g.bar_spacing = 1 ++ g.title = "0% spacing between bars" ++ g.write("test/output/bar_spacing_none.png") ++ end + + protected + +diff --git a/test/test_line.rb b/test/test_line.rb +index 1531931..cf98581 100644 +--- a/test/test_line.rb ++++ b/test/test_line.rb +@@ -15,28 +15,28 @@ class TestGruffLine < GruffTestCase + :font_color => 'black', + :background_colors => 'transparent' + } +- ++ + g.labels = { +- 0 => '5/6', +- 1 => '5/15', +- 2 => '5/24', +- 3 => '5/30', ++ 0 => '5/6', ++ 1 => '5/15', ++ 2 => '5/24', ++ 3 => '5/30', + } + g.data(:apples, [-1, 0, 4, -4]) + g.data(:peaches, [10, 8, 6, 3]) + g.write("test/output/line_transparent.png") + end +- ++ + def test_line_graph_with_themes + line_graph_with_themes() + line_graph_with_themes(400) + end +- ++ + def test_one_value + g = Gruff::Line.new + g.title = "One Value" + g.labels = { +- 0 => '1', ++ 0 => '1', + 1 => '2' + } + g.data('one', 1) +@@ -48,7 +48,7 @@ class TestGruffLine < GruffTestCase + g = Gruff::Line.new + g.title = "One Value in an Array" + g.labels = { +- 0 => '1', ++ 0 => '1', + 1 => '2' + } + g.data('one', [1]) +@@ -76,8 +76,8 @@ class TestGruffLine < GruffTestCase + # g.write("test/output/line_crash_fix_test.png") + # end + +- +- def test_line_small_values ++ ++ def test_line_small_values + @datasets = [ + [:small, [0.1, 0.14356, 0.0, 0.5674839, 0.456]], + [:small2, [0.2, 0.3, 0.1, 0.05, 0.9]] +@@ -119,8 +119,8 @@ class TestGruffLine < GruffTestCase + g.write("test/output/line_small_small_zero.png") + end + +- +- def test_line_large_values ++ ++ def test_line_large_values + @datasets = [ + [:large, [100_005, 35_000, 28_000, 27_000]], + [:large2, [35_000, 28_000, 27_000, 100_005]], +@@ -140,15 +140,15 @@ class TestGruffLine < GruffTestCase + + g.write("test/output/line_large.png") + end +- ++ + # def test_long_title +- # ++ # + # end +- # ++ # + # def test_add_colors +- # ++ # + # end +- # ++ # + + def test_request_too_many_colors + g = Gruff::Line.new +@@ -160,22 +160,22 @@ class TestGruffLine < GruffTestCase + @datasets.each do |data| + g.data("#{data[0]}-B", data[1].map {|d| d + 20}) + end +- g.write("test/output/line_more_sets_than_colors.png") ++ g.write("test/output/line_more_sets_than_colors.png") + end +- +- # ++ ++ # + # def test_add_data +- # ++ # + # end + + def test_many_datapoints + g = Gruff::Line.new + g.title = "Many Multi-Line Graph Test" + g.labels = { +- 0 => 'June', +- 10 => 'July', +- 30 => 'August', +- 50 => 'September', ++ 0 => 'June', ++ 10 => 'July', ++ 30 => 'August', ++ 50 => 'September', + } + g.data('many points', (0..50).collect {|i| rand(100) }) + g.x_axis_label = "Months" +@@ -192,7 +192,7 @@ class TestGruffLine < GruffTestCase + g.title = "Similar High End Values Test" + g.data('similar points', @dataset ) + g.write("test/output/line_similar_high_end_values.png") +- ++ + g = Gruff::Line.new + g.title = "Similar High End Values With Floor" + g.data('similar points', @dataset ) +@@ -205,11 +205,11 @@ class TestGruffLine < GruffTestCase + g = Gruff::Line.new(400) + g.title = "Many Values Line Test 400px" + g.labels = { +- 0 => '5/6', +- 10 => '5/15', +- 20 => '5/24', +- 30 => '5/30', +- 40 => '6/4', ++ 0 => '5/6', ++ 10 => '5/15', ++ 20 => '5/24', ++ 30 => '5/30', ++ 40 => '6/4', + 50 => '6/16' + } + %w{jimmy jane philip arthur julie bert}.each do |student_name| +@@ -224,11 +224,11 @@ class TestGruffLine < GruffTestCase + g = Gruff::Line.new(300) + g.title = "Tiny Test 300px" + g.labels = { +- 0 => '5/6', +- 10 => '5/15', +- 20 => '5/24', +- 30 => '5/30', +- 40 => '6/4', ++ 0 => '5/6', ++ 10 => '5/15', ++ 20 => '5/24', ++ 30 => '5/30', ++ 40 => '6/4', + 50 => '6/16' + } + %w{jimmy jane philip arthur julie bert}.each do |student_name| +@@ -244,7 +244,7 @@ class TestGruffLine < GruffTestCase + g.title = "No Data" + # Default theme + g.write("test/output/line_no_data.png") +- ++ + g = Gruff::Line.new(400) + g.title = "No Data Title" + g.no_data_message = 'There is no data' +@@ -259,7 +259,7 @@ class TestGruffLine < GruffTestCase + g.data(:gus, [0,0,0,0]) + + # Default theme +- g.write("test/output/line_no_data_other.png") ++ g.write("test/output/line_no_data_other.png") + end + + +@@ -279,7 +279,7 @@ class TestGruffLine < GruffTestCase + end + + # Default theme +- g.write("test/output/line_some_nil_points.png") ++ g.write("test/output/line_some_nil_points.png") + end + + def test_no_title +@@ -296,7 +296,7 @@ class TestGruffLine < GruffTestCase + g = setup_basic_graph(400) + g.title = "No Line Markers" + g.hide_line_markers = true +- g.write("test/output/line_no_line_markers.png") ++ g.write("test/output/line_no_line_markers.png") + end + + def test_no_legend +@@ -312,14 +312,14 @@ class TestGruffLine < GruffTestCase + g.hide_line_markers = true + g.hide_legend = true + g.hide_title = true +- g.write("test/output/line_nothing_but_the_graph.png") ++ g.write("test/output/line_nothing_but_the_graph.png") + end + + def test_baseline_larger_than_data + g = setup_basic_graph(400) + g.title = "Baseline Larger Than Data" + g.baseline_value = 150 +- g.write("test/output/line_large_baseline.png") ++ g.write("test/output/line_large_baseline.png") + end + + +@@ -327,20 +327,20 @@ class TestGruffLine < GruffTestCase + g = setup_basic_graph(400) + g.title = "Hide Dots" + g.hide_dots = true +- g.write("test/output/line_hide_dots.png") ++ g.write("test/output/line_hide_dots.png") + end + + def test_hide_lines + g = setup_basic_graph(400) + g.title = "Hide Lines" + g.hide_lines = true +- g.write("test/output/line_hide_lines.png") ++ g.write("test/output/line_hide_lines.png") + end + + def test_wide_graph + g = setup_basic_graph('800x400') + g.title = "Wide Graph" +- g.write("test/output/line_wide_graph.png") ++ g.write("test/output/line_wide_graph.png") + + g = setup_basic_graph('400x200') + g.title = "Wide Graph Small" +@@ -350,7 +350,7 @@ class TestGruffLine < GruffTestCase + def test_negative + g = setup_pos_neg(800) + g.write("test/output/line_pos_neg.png") +- ++ + g = setup_pos_neg(400) + g.title = 'Pos/Neg Line Test Small' + g.write("test/output/line_pos_neg_400.png") +@@ -359,13 +359,13 @@ class TestGruffLine < GruffTestCase + def test_all_negative + g = setup_all_neg(800) + g.write("test/output/line_all_neg.png") +- ++ + g = setup_all_neg(400) + g.title = 'All Neg Line Test Small' + g.write("test/output/line_all_neg_400.png") + end + +- def test_many_numbers ++ def test_many_numbers + g = Gruff::Line.new('400x170') + g.title = "Line Test, Many Numbers" + +@@ -419,7 +419,7 @@ class TestGruffLine < GruffTestCase + { :date => '23'}, + { :date => '24'}, + { :date => '25'}, +- { :date => '26'}, ++ { :date => '26'}, + { :date => '27', + :wpm => 37, + :errors => 3, +@@ -448,7 +448,6 @@ class TestGruffLine < GruffTestCase + g.hide_line_markers = false + g.write('test/output/line_no_hide.png') + end +- + + def test_jruby_error + g = Gruff::Line.new +@@ -466,8 +465,26 @@ class TestGruffLine < GruffTestCase + g.write('test/output/line_jruby_error.png') + end + ++ def test_marker_label_accuracy ++ g = Gruff::Line.new ++ g.title = "Marker label accuracy" ++ g.labels = { ++ 0 => '1', ++ 1 => '2', ++ 2 => '3', ++ 3 => '4', ++ 4 => '5' ++ } ++ g.data('first', [0.5, 0.51, 0.52, 0.53, 0.54]) ++ g.data('second', [0.6, 0.61, 0.62, 0.63, 0.64]) ++ g.data('third', [0.7, 0.71, 0.72, 0.73, 0.74]) ++ ++ g.write("test/output/line_marker_label_accuracy.png") ++ end ++ ++ + private +- ++ + def bmi(params={}) + g = basic_graph() + +@@ -491,7 +508,7 @@ private + end + # Default theme + g.write("test/output/line_theme_keynote_#{size}.png") +- ++ + g = Gruff::Line.new(size) + g.title = "Multi-Line Graph Test #{size}" + g.labels = @labels +@@ -501,7 +518,7 @@ private + g.data(data[0], data[1]) + end + g.write("test/output/line_theme_37signals_#{size}.png") +- ++ + g = Gruff::Line.new(size) + g.title = "Multi-Line Graph Test #{size}" + g.labels = @labels +@@ -511,7 +528,7 @@ private + g.data(data[0], data[1]) + end + g.write("test/output/line_theme_rails_keynote_#{size}.png") +- ++ + g = Gruff::Line.new(size) + g.title = "Multi-Line Graph Test #{size}" + g.labels = @labels +@@ -527,10 +544,10 @@ private + g = Gruff::Line.new(size) + g.title = "Pos/Neg Line Graph Test" + g.labels = { +- 0 => '5/6', +- 1 => '5/15', +- 2 => '5/24', +- 3 => '5/30', ++ 0 => '5/6', ++ 1 => '5/15', ++ 2 => '5/24', ++ 3 => '5/30', + } + g.data(:apples, [-1, 0, 4, -4]) + g.data(:peaches, [10, 8, 6, 3]) +@@ -542,14 +559,14 @@ private + g = Gruff::Line.new(size) + g.title = "All Neg Line Graph Test" + g.labels = { +- 0 => '5/6', +- 1 => '5/15', +- 2 => '5/24', +- 3 => '5/30', ++ 0 => '5/6', ++ 1 => '5/15', ++ 2 => '5/24', ++ 3 => '5/30', + } + g.data(:apples, [-1, -5, -20, -4]) + g.data(:peaches, [-10, -8, -6, -3]) + g + end +- ++ + end +diff --git a/test/test_mini_bar.rb b/test/test_mini_bar.rb +index b69e60b..b7f05d5 100644 +--- a/test/test_mini_bar.rb ++++ b/test/test_mini_bar.rb +@@ -1,5 +1,5 @@ + +-require File.dirname(__FILE__) + "/gruff_test_case" ++require File.expand_path('../gruff_test_case', __FILE__) + + class TestMiniBar < GruffTestCase + +diff --git a/test/test_mini_pie.rb b/test/test_mini_pie.rb +index 87ff58a..df50b58 100644 +--- a/test/test_mini_pie.rb ++++ b/test/test_mini_pie.rb +@@ -1,5 +1,4 @@ +- +-require File.dirname(__FILE__) + "/gruff_test_case" ++require File.expand_path('../gruff_test_case', __FILE__) + + class TestMiniPie < GruffTestCase + +@@ -7,6 +6,12 @@ class TestMiniPie < GruffTestCase + g = setup_basic_graph(Gruff::Mini::Pie, 200) + write_test_file g, 'mini_pie.png' + end ++ ++ def test_pie_with_legend_right ++ g = setup_basic_graph(Gruff::Mini::Pie, 200) ++ g.legend_position = :right ++ write_test_file g, 'mini_pie_right_legend.png' ++ end + + # def test_code_sample + # g = Gruff::Mini::Pie.new(200) +diff --git a/test/test_mini_side_bar.rb b/test/test_mini_side_bar.rb +index 4145380..3b402fa 100644 +--- a/test/test_mini_side_bar.rb ++++ b/test/test_mini_side_bar.rb +@@ -1,5 +1,4 @@ +- +-require File.dirname(__FILE__) + "/gruff_test_case" ++require File.expand_path('../gruff_test_case', __FILE__) + + class TestMiniSideBar < GruffTestCase + +diff --git a/test/test_side_bar.rb b/test/test_side_bar.rb +index 7d2ea3d..8b7d4ba 100644 +--- a/test/test_side_bar.rb ++++ b/test/test_side_bar.rb +@@ -8,5 +8,36 @@ class TestGruffSideBar < GruffTestCase + write_test_file g, 'side_bar.png' + end + ++ def test_bar_spacing ++ g = setup_basic_graph(Gruff::SideBar, 800) ++ g.bar_spacing = 0 ++ g.title = "100% spacing between bars" ++ g.write("test/output/side_bar_spacing_full.png") ++ ++ g = setup_basic_graph(Gruff::SideBar, 800) ++ g.bar_spacing = 0.5 ++ g.title = "50% spacing between bars" ++ g.write("test/output/side_bar_spacing_half.png") ++ ++ g = setup_basic_graph(Gruff::SideBar, 800) ++ g.bar_spacing = 1 ++ g.title = "0% spacing between bars" ++ g.write("test/output/side_bar_spacing_none.png") ++ end ++ ++ def test_x_axis_range ++ g = Gruff::SideBar.new('400x300') ++ g.title = 'Should run from 8 to 32' ++ g.hide_line_numbers = false ++ g.theme_37signals ++ g.data("Grapes", [8]) ++ g.data("Apples", [24]) ++ g.data("Oranges", [32]) ++ g.data("Watermelon", [8]) ++ g.data("Peaches", [12]) ++ g.labels = {0 => '2003', 2 => '2004', 4 => '2005'} ++ g.write("test/output/side_bar_data_range.png") ++ end ++ + end + diff -Nru ruby-gruff-0.3.6/debian/require-rubygems.overrides ruby-gruff-0.3.6/debian/require-rubygems.overrides --- ruby-gruff-0.3.6/debian/require-rubygems.overrides 1970-01-01 09:00:00.000000000 +0900 +++ ruby-gruff-0.3.6/debian/require-rubygems.overrides 2012-07-23 07:43:04.000000000 +0900 @@ -0,0 +1 @@ +debian/ruby-gruff/usr/lib/ruby/vendor_ruby/gruff/base.rb