Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
rmagick
committed
Aug 8, 2005
1 parent
23d0b13
commit 281c16e
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#! /usr/local/bin/ruby -w | ||
|
||
require 'RMagick' | ||
require 'test/unit' | ||
require 'test/unit/ui/console/testrunner' | ||
|
||
class Image1_UT < Test::Unit::TestCase | ||
|
||
def setup | ||
@img = Magick::Image.new(20, 20) | ||
end | ||
|
||
# Test [], []=, and #properties | ||
def test_properties | ||
assert_nothing_raised do | ||
@img['a'] = 'string1' | ||
@img['b'] = 'string2' | ||
@img['c'] = 'string3' | ||
end | ||
assert_equal('string1', @img['a']) | ||
assert_equal('string2', @img['b']) | ||
assert_equal('string3', @img['c']) | ||
assert_nil(@img['d']) | ||
assert_nothing_raised do | ||
props = @img.properties | ||
assert_equal(3, props.length) | ||
assert_equal('string1', props['a']) | ||
assert_equal('string2', props['b']) | ||
assert_equal('string3', props['c']) | ||
end | ||
|
||
known = {'a'=>'string1', 'b'=>'string2', 'c'=>'string3'} | ||
@img.properties do |name, value| | ||
assert(known.has_key?(name)) | ||
assert_equal(known[name], value) | ||
end | ||
end | ||
|
||
|
||
end | ||
|
||
if __FILE__ == $0 | ||
IMAGES_DIR = '../doc/ex/images' | ||
FILES = Dir[IMAGES_DIR+'/Button_*.gif'] | ||
Test::Unit::UI::Console::TestRunner.run(Image1_UT) | ||
end |