Sha256: 7e0349e4b14019c63338ba9697f7a099ed5e2df842b716496f8c5944ddbad589

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
describe Rubyvis::Layout::Treemap do
  include Rubyvis::LayoutSpec
  it "should have correct properties" do
    props=[:antialias, :bottom, :canvas, :cursor, :data, :events, :fill_style, :height, :id, :left, :line_width, :links, :mode, :nodes, :order, :overflow, :padding_bottom, :padding_left, :padding_right, :padding_top, :reverse, :right, :round, :stroke_style, :title, :top, :transform, :visible, :view_box, :width].inject({}) {|ac, v| ac[v]=true; ac}
    Rubyvis::Layout::Treemap.properties.should==props 
  end
  describe "rendered" do
    before do
    color=pv.Colors.category19
    w=200
    h=200

    @vis = pv.Panel.new().
      width(w).
      height(h)
    
    treemap = @vis.add(pv.Layout.Treemap).
    nodes(hier_nodes).
    size(lambda {|d| d.node_value})
    
    treemap.leaf.add(pv.Panel).
    fill_style(lambda {|d| color[d.node_value]}).
    stroke_style("black").
    line_width(1).
    antialias(false)
    
    treemap.node_label.add(pv.Label).
    text(lambda {|d| d.node_value})
    
      
      @vis.render

      @pv_out=fixture_svg_read("layout_treemap.svg")
    end
    
    it "should render equal to protovis version " do 
      expect(@vis.to_svg).to have_same_svg_elements(@pv_out)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubyvis-0.7.0 spec/layout_treemap_spec.rb