Sha256: 9597b5e4601a3ae05b4e705342601df9c3589c829d92d40cdb7d30f429644e59
Contents?: true
Size: 1.39 KB
Versions: 1
Compression:
Stored size: 1.39 KB
Contents
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Layout::Pack 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, :nodes, :order, :overflow, :reverse, :right, :spacing, :stroke_style, :title, :top, :transform, :visible, :view_box, :width].inject({}) {|ac, v| ac[v]=true; ac} Rubyvis::Layout::Pack.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). top(20). bottom(10). left(10) pack = @vis.add(pv.Layout.Pack). nodes(hier_nodes_big) pack.node.add(pv.Dot). fill_style(lambda {|d| color[d.node_value]}). stroke_style("black"). line_width(1). antialias(false) pack.node_label.add(pv.Label). text(lambda {|d| d.node_value}) @vis.render html_out=fixture_svg_read("layout_pack.svg") @rv_svg=Nokogiri::XML(@vis.to_svg) @pv_svg=Nokogiri::XML(html_out) end it "should render equal nodes (circles)" do pv_rects=@pv_svg.xpath("//circle") @rv_svg.xpath("//xmlns:circle").each_with_index {|rv_rect,i| expect(rv_rect).to have_same_position pv_rects[i] } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubyvis-0.7.0 | spec/layout_pack_spec.rb |