Skip to content
Browse files

Add initial tests for Draw class

  • Loading branch information...
1 parent 300e1ea commit 95590df047156d5faa91283c914235d5ef42d1b3 rmagick committed
Showing with 33 additions and 0 deletions.
  1. +32 −0 test/Draw.rb
  2. +1 −0 test/all_basic.rb
View
32 test/Draw.rb
@@ -0,0 +1,32 @@
+
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+require 'test/unit'
+require 'test/unit/ui/console/testrunner'
+
+class Draw_UT < Test::Unit::TestCase
+
+ def setup
+ @draw = Magick::Draw.new
+ end
+
+ def test_patterns
+ img = Magick::Image.new(20,20)
+ assert_nothing_raised { @draw.fill_pattern = img }
+ assert_nothing_raised { @draw.stroke_pattern = img }
+
+ ilist = Magick::ImageList.new
+ ilist << img
+ assert_nothing_raised { @draw.fill_pattern = ilist }
+ assert_nothing_raised { @draw.stroke_pattern = ilist }
+
+ assert_raise(NoMethodError) { @draw.fill_pattern = 1 }
+ assert_raise(NoMethodError) { @draw.stroke_pattern = 1 }
+ end
+end
+
+if __FILE__ == $0
+Test::Unit::UI::Console::TestRunner.run(Draw_UT)
+end
+
View
1 test/all_basic.rb
@@ -33,3 +33,4 @@ def run(result, &blk)
require 'Pixel.rb'
require 'Info.rb'
require 'Magick.rb'
+require 'Draw.rb'

0 comments on commit 95590df

Please sign in to comment.
Something went wrong with that request. Please try again.