Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixes Rubyvis::Image example and adds test coverage #14

Merged
merged 1 commit into from

2 participants

@kwilcox

fixes #13

@clbustos clbustos merged commit c575346 into clbustos:master
@clbustos
Owner

Sorry for the delay.

Thank you very much for spot the error!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 10, 2012
  1. @kwilcox
This page is out of date. Refresh to see the latest.
View
5 lib/rubyvis/scene/svg_image.rb
@@ -15,10 +15,9 @@ def self.image(scenes)
"x"=> s.left,
"y"=> s.top,
"width"=> s.width,
- "height"=> s.height
+ "height"=> s.height,
+ "xlink:href" => s.url
})
-
- e.add_attribute("xlink:href", s.url);
end
e = self.append(e, scenes, i);
View
1  spec/fixtures/image.svg
@@ -0,0 +1 @@
+<svg font-size="10px" font-family="sans-serif" fill="none" stroke="none" stroke-width="1.5" width="440" height="440"><g transform="translate(20,20)"><image preserveAspectRatio="none" width="400" height="400" xlink:href="fixtures/tipsy.gif"/></g><rect x="20" y="20" width="400" height="400" fill="none" stroke="rgb(204,204,204)"/></svg>
View
BIN  spec/fixtures/tipsy.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
27 spec/image_spec.rb
@@ -0,0 +1,27 @@
+require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
+describe Rubyvis::Image do
+
+ include Rubyvis::GeneralSpec
+
+ it "Rubyvis.Image be the same as Rubyvis::Image" do
+ Rubyvis.Image.should eql Rubyvis::Image
+ end
+
+ it "should render correctly" do
+ w = 400
+ h = 400
+
+ vis = Rubyvis::Panel.new().
+ width(w).
+ height(h).
+ margin(20).
+ stroke_style("#ccc");
+
+ vis.add(Rubyvis::Image).url('fixtures/tipsy.gif')
+ vis.render()
+
+ pv_out=fixture_svg_read("image.svg")
+ vis.to_svg.should have_same_svg_elements(pv_out)
+ end
+
+end
Something went wrong with that request. Please try again.