File: test_svg_graph.rb

package info (click to toggle)
ruby-svg-graph 1.0.5-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 684 kB
  • ctags: 177
  • sloc: ruby: 2,939; xml: 453; makefile: 8
file content (26 lines) | stat: -rw-r--r-- 635 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$: << File.dirname(__FILE__) + '/../lib'
require "test/unit"
require "svggraph"
require "SVG/Graph/DataPoint"

class TestSvgGraph < Test::Unit::TestCase
  def test_bar_line_and_pie
    fields = %w(Jan Feb Mar);
    data_sales_02 = [12, 45, 21]
    [SVG::Graph::Bar, SVG::Graph::BarHorizontal, SVG::Graph::Line, SVG::Graph::Pie].each do 
      |klass|
      graph = klass.new(
        :height => 500,
        :width => 300,
        :fields => fields
      )
      graph.add_data(
        :data => data_sales_02,
        :title => 'Sales 2002'
      )
      out=graph.burn
      assert(out=~/Created with SVG::Graph/)
    end
  end
end