Permalink
Browse files

Add kerning=, kerning, interword_spacing=, interword_spacing, marshal…

…_dump, marshal_load tests
  • Loading branch information...
1 parent 0b3e7a4 commit e714c902eaff55e14a2ea51c9022fdaa2f2051ca rmagick committed Jan 1, 2009
Showing with 51 additions and 0 deletions.
  1. +51 −0 test/Draw.rb
View
@@ -42,6 +42,57 @@ def test_dummy_img
assert_same(dummy, dummy2)
end
+ def test_kerning
+ assert_nothing_raised { @draw.kerning = 1 }
+ assert_nothing_raised { @draw.kerning(1) }
+ assert_raise(ArgumentError) { @draw.kerning("a") }
+ assert_raise(TypeError) { @draw.kerning([]) }
+ end
+
+ def test_interword_spacing
+ assert_nothing_raised { @draw.interword_spacing = 1 }
+ assert_nothing_raised { @draw.interword_spacing(1) }
+ assert_raise(ArgumentError) { @draw.interword_spacing("a") }
+ assert_raise(TypeError) { @draw.interword_spacing([]) }
+ end
+
+ def assert_marshal
+ rose = Magick::Image.read("rose:").first
+ granite = Magick::Image.read("granite:").first
+ s = granite.to_blob {self.format="miff"}
+ granite = Magick::Image.from_blob(s).first
+ blue_stroke = Magick::Image.new(20,20) {self.background_color = "blue"}
+ s = blue_stroke.to_blob {self.format="miff"}
+ blue_stroke = Magick::Image.from_blob(s).first
+
+ @draw.affine = Magick::AffineMatrix.new(1, 2, 3, 4, 5, 6)
+ @draw.decorate = Magick::LineThroughDecoration
+ @draw.encoding = "AdobeCustom"
+ @draw.gravity = Magick::CenterGravity
+ @draw.fill = Magick::Pixel.from_color("red")
+ @draw.stroke = Magick::Pixel.from_color("blue")
+ @draw.stroke_width = 5
+ @draw.fill_pattern = granite
+ @draw.stroke_pattern = blue_stroke
+ @draw.text_antialias = true
+ @draw.font = "Arial-Bold"
+ @draw.font_family = "arial"
+ @draw.font_style = Magick::ItalicStyle
+ @draw.font_stretch = Magick::CondensedStretch
+ @draw.font_weight = Magick::BoldWeight
+ @draw.pointsize = 12
+ @draw.density = "72x72"
+ @draw.align = Magick::CenterAlign
+ @draw.undercolor = Magick::Pixel.from_color("green")
+ @draw.kerning = 10.5
+ @draw.interword_spacing = 3.75
+
+ @draw.circle(20, 25, 20, 28)
+ dumped = nil
+ assert_nothing_raised { dumped = Marshal.dump(@draw) }
+ assert_nothing_raised { Marshal.load(dumped) }
+ end
+
def test_patterns
img = Magick::Image.new(20,20)
assert_nothing_raised { @draw.fill_pattern = img }

0 comments on commit e714c90

Please sign in to comment.