rmagick-windows 2.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.editorconfig +14 -0
- data/.gitignore +23 -0
- data/.hound.yml +2 -0
- data/.rspec +1 -0
- data/.rubocop.yml +340 -0
- data/.simplecov +27 -0
- data/.travis.yml +60 -0
- data/CHANGELOG.md +915 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/CONTRIBUTING.md +50 -0
- data/Doxyfile +1514 -0
- data/Gemfile +10 -0
- data/LICENSE +20 -0
- data/README.textile +257 -0
- data/Rakefile +188 -0
- data/before_install_linux.sh +32 -0
- data/before_install_osx.sh +2 -0
- data/deprecated/RMagick.rb +6 -0
- data/doc/.cvsignore +1 -0
- data/doc/comtasks.html +287 -0
- data/doc/constants.html +1581 -0
- data/doc/css/doc.css +299 -0
- data/doc/css/popup.css +34 -0
- data/doc/css/ref.css +67 -0
- data/doc/draw.html +3272 -0
- data/doc/ex/InitialCoords.rb +22 -0
- data/doc/ex/NewCoordSys.rb +30 -0
- data/doc/ex/OrigCoordSys.rb +16 -0
- data/doc/ex/PreserveAspectRatio.rb +204 -0
- data/doc/ex/RotateScale.rb +36 -0
- data/doc/ex/Skew.rb +38 -0
- data/doc/ex/Use01.rb +15 -0
- data/doc/ex/Use02.rb +20 -0
- data/doc/ex/Use03.rb +16 -0
- data/doc/ex/ViewBox.rb +31 -0
- data/doc/ex/adaptive_threshold.rb +9 -0
- data/doc/ex/add_noise.rb +16 -0
- data/doc/ex/affine.rb +48 -0
- data/doc/ex/affine_transform.rb +20 -0
- data/doc/ex/arc.rb +49 -0
- data/doc/ex/arcpath.rb +32 -0
- data/doc/ex/arcs01.rb +28 -0
- data/doc/ex/arcs02.rb +59 -0
- data/doc/ex/average.rb +15 -0
- data/doc/ex/axes.rb +64 -0
- data/doc/ex/baseline_shift01.rb +17 -0
- data/doc/ex/bilevel_channel.rb +8 -0
- data/doc/ex/blur_image.rb +12 -0
- data/doc/ex/border.rb +10 -0
- data/doc/ex/bounding_box.rb +42 -0
- data/doc/ex/cbezier1.rb +41 -0
- data/doc/ex/cbezier2.rb +41 -0
- data/doc/ex/cbezier3.rb +41 -0
- data/doc/ex/cbezier4.rb +42 -0
- data/doc/ex/cbezier5.rb +42 -0
- data/doc/ex/cbezier6.rb +53 -0
- data/doc/ex/channel.rb +25 -0
- data/doc/ex/charcoal.rb +12 -0
- data/doc/ex/chop.rb +29 -0
- data/doc/ex/circle.rb +33 -0
- data/doc/ex/circle01.rb +16 -0
- data/doc/ex/clip_path.rb +60 -0
- data/doc/ex/coalesce.rb +57 -0
- data/doc/ex/color_fill_to_border.rb +29 -0
- data/doc/ex/color_floodfill.rb +28 -0
- data/doc/ex/color_histogram.rb +47 -0
- data/doc/ex/color_reset.rb +11 -0
- data/doc/ex/colorize.rb +16 -0
- data/doc/ex/colors.rb +64 -0
- data/doc/ex/compose_mask.rb +22 -0
- data/doc/ex/composite.rb +133 -0
- data/doc/ex/composite_layers.rb +53 -0
- data/doc/ex/composite_tiled.rb +21 -0
- data/doc/ex/contrast.rb +36 -0
- data/doc/ex/crop.rb +31 -0
- data/doc/ex/crop_with_gravity.rb +42 -0
- data/doc/ex/cubic01.rb +43 -0
- data/doc/ex/cubic02.rb +91 -0
- data/doc/ex/cycle_colormap.rb +21 -0
- data/doc/ex/dissolve.rb +12 -0
- data/doc/ex/drawcomp.rb +42 -0
- data/doc/ex/drop_shadow.rb +60 -0
- data/doc/ex/edge.rb +11 -0
- data/doc/ex/ellipse.rb +45 -0
- data/doc/ex/ellipse01.rb +21 -0
- data/doc/ex/emboss.rb +11 -0
- data/doc/ex/enhance.rb +28 -0
- data/doc/ex/equalize.rb +11 -0
- data/doc/ex/evenodd.rb +42 -0
- data/doc/ex/fill_pattern.rb +23 -0
- data/doc/ex/flatten_images.rb +36 -0
- data/doc/ex/flip.rb +11 -0
- data/doc/ex/flop.rb +11 -0
- data/doc/ex/font_styles.rb +32 -0
- data/doc/ex/fonts.rb +20 -0
- data/doc/ex/frame.rb +12 -0
- data/doc/ex/gaussian_blur.rb +11 -0
- data/doc/ex/get_multiline_type_metrics.rb +41 -0
- data/doc/ex/get_pixels.rb +47 -0
- data/doc/ex/get_type_metrics.rb +141 -0
- data/doc/ex/gradientfill.rb +27 -0
- data/doc/ex/grav.rb +45 -0
- data/doc/ex/gravity.rb +80 -0
- data/doc/ex/group.rb +26 -0
- data/doc/ex/hatchfill.rb +27 -0
- data/doc/ex/image.rb +44 -0
- data/doc/ex/images/Apple.miff +0 -0
- data/doc/ex/images/Ballerina.jpg +0 -0
- data/doc/ex/images/Ballerina3.jpg +0 -0
- data/doc/ex/images/Button_0.gif +0 -0
- data/doc/ex/images/Button_1.gif +0 -0
- data/doc/ex/images/Button_2.gif +0 -0
- data/doc/ex/images/Button_3.gif +0 -0
- data/doc/ex/images/Button_4.gif +0 -0
- data/doc/ex/images/Button_5.gif +0 -0
- data/doc/ex/images/Button_6.gif +0 -0
- data/doc/ex/images/Button_7.gif +0 -0
- data/doc/ex/images/Button_8.gif +0 -0
- data/doc/ex/images/Button_9.gif +0 -0
- data/doc/ex/images/Button_A.gif +0 -0
- data/doc/ex/images/Button_B.gif +0 -0
- data/doc/ex/images/Button_C.gif +0 -0
- data/doc/ex/images/Button_D.gif +0 -0
- data/doc/ex/images/Button_E.gif +0 -0
- data/doc/ex/images/Button_F.gif +0 -0
- data/doc/ex/images/Button_G.gif +0 -0
- data/doc/ex/images/Button_H.gif +0 -0
- data/doc/ex/images/Button_I.gif +0 -0
- data/doc/ex/images/Button_J.gif +0 -0
- data/doc/ex/images/Button_K.gif +0 -0
- data/doc/ex/images/Button_L.gif +0 -0
- data/doc/ex/images/Button_M.gif +0 -0
- data/doc/ex/images/Button_N.gif +0 -0
- data/doc/ex/images/Button_O.gif +0 -0
- data/doc/ex/images/Button_P.gif +0 -0
- data/doc/ex/images/Button_Q.gif +0 -0
- data/doc/ex/images/Button_R.gif +0 -0
- data/doc/ex/images/Button_S.gif +0 -0
- data/doc/ex/images/Button_T.gif +0 -0
- data/doc/ex/images/Button_U.gif +0 -0
- data/doc/ex/images/Button_V.gif +0 -0
- data/doc/ex/images/Button_W.gif +0 -0
- data/doc/ex/images/Button_X.gif +0 -0
- data/doc/ex/images/Button_Y.gif +0 -0
- data/doc/ex/images/Button_Z.gif +0 -0
- data/doc/ex/images/Cheetah.jpg +0 -0
- data/doc/ex/images/Coffee.wmf +0 -0
- data/doc/ex/images/Flower_Hat.jpg +0 -0
- data/doc/ex/images/Gold_Statue.jpg +0 -0
- data/doc/ex/images/Hot_Air_Balloons.jpg +0 -0
- data/doc/ex/images/Hot_Air_Balloons_H.jpg +0 -0
- data/doc/ex/images/Leaf.miff +0 -0
- data/doc/ex/images/No.wmf +0 -0
- data/doc/ex/images/Polynesia.jpg +0 -0
- data/doc/ex/images/Red_Rocks.jpg +0 -0
- data/doc/ex/images/Rocks_On_Beach.miff +0 -0
- data/doc/ex/images/Shorts.jpg +0 -0
- data/doc/ex/images/Snake.wmf +0 -0
- data/doc/ex/images/Violin.jpg +0 -0
- data/doc/ex/images/Yellow_Rose.miff +0 -0
- data/doc/ex/images/big-duck.gif +0 -0
- data/doc/ex/images/duck.gif +0 -0
- data/doc/ex/images/duck0.gif +0 -0
- data/doc/ex/images/duck1.gif +0 -0
- data/doc/ex/images/duck10.gif +0 -0
- data/doc/ex/images/duck11.gif +0 -0
- data/doc/ex/images/duck12.gif +0 -0
- data/doc/ex/images/duck13.gif +0 -0
- data/doc/ex/images/duck14.gif +0 -0
- data/doc/ex/images/duck15.gif +0 -0
- data/doc/ex/images/duck2.gif +0 -0
- data/doc/ex/images/duck3.gif +0 -0
- data/doc/ex/images/duck4.gif +0 -0
- data/doc/ex/images/duck5.gif +0 -0
- data/doc/ex/images/duck6.gif +0 -0
- data/doc/ex/images/duck7.gif +0 -0
- data/doc/ex/images/duck8.gif +0 -0
- data/doc/ex/images/duck9.gif +0 -0
- data/doc/ex/images/graydient230x6.gif +0 -0
- data/doc/ex/images/image_with_profile.jpg +0 -0
- data/doc/ex/images/logo400x83.gif +0 -0
- data/doc/ex/images/model.miff +0 -0
- data/doc/ex/images/notimplemented.gif +0 -0
- data/doc/ex/images/smile.miff +0 -0
- data/doc/ex/images/spin.gif +0 -0
- data/doc/ex/implode.rb +34 -0
- data/doc/ex/level.rb +11 -0
- data/doc/ex/level_colors.rb +11 -0
- data/doc/ex/line.rb +41 -0
- data/doc/ex/line01.rb +21 -0
- data/doc/ex/mask.rb +35 -0
- data/doc/ex/matte_fill_to_border.rb +39 -0
- data/doc/ex/matte_floodfill.rb +32 -0
- data/doc/ex/matte_replace.rb +39 -0
- data/doc/ex/median_filter.rb +28 -0
- data/doc/ex/modulate.rb +11 -0
- data/doc/ex/mono.rb +23 -0
- data/doc/ex/morph.rb +25 -0
- data/doc/ex/mosaic.rb +35 -0
- data/doc/ex/motion_blur.rb +11 -0
- data/doc/ex/negate.rb +11 -0
- data/doc/ex/negate_channel.rb +9 -0
- data/doc/ex/nested_rvg.rb +21 -0
- data/doc/ex/nonzero.rb +42 -0
- data/doc/ex/normalize.rb +11 -0
- data/doc/ex/oil_paint.rb +11 -0
- data/doc/ex/opacity.rb +37 -0
- data/doc/ex/ordered_dither.rb +11 -0
- data/doc/ex/path.rb +63 -0
- data/doc/ex/pattern1.rb +25 -0
- data/doc/ex/pattern2.rb +26 -0
- data/doc/ex/polaroid.rb +27 -0
- data/doc/ex/polygon.rb +23 -0
- data/doc/ex/polygon01.rb +21 -0
- data/doc/ex/polyline.rb +22 -0
- data/doc/ex/polyline01.rb +21 -0
- data/doc/ex/posterize.rb +8 -0
- data/doc/ex/preview.rb +8 -0
- data/doc/ex/qbezierpath.rb +52 -0
- data/doc/ex/quad01.rb +34 -0
- data/doc/ex/quantize-m.rb +25 -0
- data/doc/ex/radial_blur.rb +9 -0
- data/doc/ex/raise.rb +8 -0
- data/doc/ex/random_threshold_channel.rb +13 -0
- data/doc/ex/rect01.rb +14 -0
- data/doc/ex/rect02.rb +20 -0
- data/doc/ex/rectangle.rb +34 -0
- data/doc/ex/reduce_noise.rb +28 -0
- data/doc/ex/remap.rb +11 -0
- data/doc/ex/remap_images.rb +19 -0
- data/doc/ex/resize_to_fill.rb +8 -0
- data/doc/ex/resize_to_fit.rb +8 -0
- data/doc/ex/roll.rb +9 -0
- data/doc/ex/rotate.rb +44 -0
- data/doc/ex/rotate_f.rb +14 -0
- data/doc/ex/roundrect.rb +33 -0
- data/doc/ex/rubyname.rb +30 -0
- data/doc/ex/rvg_clippath.rb +12 -0
- data/doc/ex/rvg_linecap.rb +42 -0
- data/doc/ex/rvg_linejoin.rb +40 -0
- data/doc/ex/rvg_opacity.rb +18 -0
- data/doc/ex/rvg_pattern.rb +26 -0
- data/doc/ex/rvg_stroke_dasharray.rb +11 -0
- data/doc/ex/segment.rb +11 -0
- data/doc/ex/sepiatone.rb +7 -0
- data/doc/ex/shade.rb +11 -0
- data/doc/ex/shadow.rb +30 -0
- data/doc/ex/shave.rb +15 -0
- data/doc/ex/shear.rb +10 -0
- data/doc/ex/sketch.rb +17 -0
- data/doc/ex/skewx.rb +51 -0
- data/doc/ex/skewy.rb +47 -0
- data/doc/ex/smile.rb +125 -0
- data/doc/ex/solarize.rb +11 -0
- data/doc/ex/sparse_color.rb +54 -0
- data/doc/ex/splice.rb +8 -0
- data/doc/ex/spread.rb +11 -0
- data/doc/ex/stegano.rb +55 -0
- data/doc/ex/stroke_dasharray.rb +42 -0
- data/doc/ex/stroke_fill.rb +10 -0
- data/doc/ex/stroke_linecap.rb +44 -0
- data/doc/ex/stroke_linejoin.rb +48 -0
- data/doc/ex/stroke_width.rb +49 -0
- data/doc/ex/swirl.rb +17 -0
- data/doc/ex/text.rb +37 -0
- data/doc/ex/text01.rb +16 -0
- data/doc/ex/text_align.rb +36 -0
- data/doc/ex/text_antialias.rb +37 -0
- data/doc/ex/text_styles.rb +19 -0
- data/doc/ex/text_undercolor.rb +28 -0
- data/doc/ex/texture_fill_to_border.rb +34 -0
- data/doc/ex/texture_floodfill.rb +32 -0
- data/doc/ex/texturefill.rb +24 -0
- data/doc/ex/threshold.rb +13 -0
- data/doc/ex/to_blob.rb +13 -0
- data/doc/ex/translate.rb +39 -0
- data/doc/ex/transparent.rb +38 -0
- data/doc/ex/transpose.rb +9 -0
- data/doc/ex/transverse.rb +9 -0
- data/doc/ex/tref01.rb +24 -0
- data/doc/ex/triangle01.rb +15 -0
- data/doc/ex/trim.rb +23 -0
- data/doc/ex/tspan01.rb +17 -0
- data/doc/ex/tspan02.rb +17 -0
- data/doc/ex/tspan03.rb +19 -0
- data/doc/ex/unsharp_mask.rb +28 -0
- data/doc/ex/viewex.rb +33 -0
- data/doc/ex/vignette.rb +12 -0
- data/doc/ex/watermark.rb +27 -0
- data/doc/ex/wave.rb +9 -0
- data/doc/ex/wet_floor.rb +58 -0
- data/doc/ex/writing_mode01.rb +26 -0
- data/doc/ex/writing_mode02.rb +26 -0
- data/doc/ilist.html +2056 -0
- data/doc/image1.html +4680 -0
- data/doc/image2.html +3665 -0
- data/doc/image3.html +4522 -0
- data/doc/imageattrs.html +1638 -0
- data/doc/imusage.html +514 -0
- data/doc/index.html +416 -0
- data/doc/info.html +1499 -0
- data/doc/magick.html +565 -0
- data/doc/optequiv.html +2435 -0
- data/doc/rvg.html +975 -0
- data/doc/rvgclip.html +248 -0
- data/doc/rvggroup.html +305 -0
- data/doc/rvgimage.html +289 -0
- data/doc/rvgpattern.html +475 -0
- data/doc/rvgshape.html +406 -0
- data/doc/rvgstyle.html +270 -0
- data/doc/rvgtext.html +465 -0
- data/doc/rvgtspan.html +238 -0
- data/doc/rvgtut.html +530 -0
- data/doc/rvguse.html +145 -0
- data/doc/rvgxform.html +294 -0
- data/doc/scripts/doc.js +22 -0
- data/doc/scripts/stripeTables.js +23 -0
- data/doc/struct.html +1339 -0
- data/doc/usage.html +1621 -0
- data/examples/constitute.rb +7 -0
- data/examples/crop_with_gravity.rb +42 -0
- data/examples/demo.rb +324 -0
- data/examples/describe.rb +43 -0
- data/examples/find_similar_region.rb +34 -0
- data/examples/histogram.rb +321 -0
- data/examples/identify.rb +185 -0
- data/examples/image_opacity.rb +29 -0
- data/examples/import_export.rb +31 -0
- data/examples/pattern_fill.rb +38 -0
- data/examples/rotating_text.rb +44 -0
- data/examples/spinner.rb +49 -0
- data/examples/thumbnail.rb +64 -0
- data/examples/vignette.rb +78 -0
- data/ext/RMagick/extconf.rb +548 -0
- data/ext/RMagick/rmagick.c +401 -0
- data/ext/RMagick/rmagick.h +1287 -0
- data/ext/RMagick/rmdraw.c +2022 -0
- data/ext/RMagick/rmenum.c +1235 -0
- data/ext/RMagick/rmfill.c +720 -0
- data/ext/RMagick/rmilist.c +1270 -0
- data/ext/RMagick/rmimage.c +15427 -0
- data/ext/RMagick/rminfo.c +2590 -0
- data/ext/RMagick/rmmain.c +1741 -0
- data/ext/RMagick/rmmontage.c +519 -0
- data/ext/RMagick/rmpixel.c +1114 -0
- data/ext/RMagick/rmstruct.c +1124 -0
- data/ext/RMagick/rmutil.c +1754 -0
- data/lib/rmagick.rb +1 -0
- data/lib/rmagick/version.rb +6 -0
- data/lib/rmagick_internal.rb +1947 -0
- data/lib/rvg/clippath.rb +45 -0
- data/lib/rvg/container.rb +122 -0
- data/lib/rvg/deep_equal.rb +52 -0
- data/lib/rvg/describable.rb +47 -0
- data/lib/rvg/embellishable.rb +391 -0
- data/lib/rvg/misc.rb +723 -0
- data/lib/rvg/paint.rb +50 -0
- data/lib/rvg/pathdata.rb +126 -0
- data/lib/rvg/rvg.rb +283 -0
- data/lib/rvg/stretchable.rb +165 -0
- data/lib/rvg/stylable.rb +116 -0
- data/lib/rvg/text.rb +172 -0
- data/lib/rvg/transformable.rb +126 -0
- data/lib/rvg/units.rb +63 -0
- data/rmagick.gemspec +46 -0
- data/spec/rmagick/ImageList1_spec.rb +24 -0
- data/spec/rmagick/draw_spec.rb +156 -0
- data/spec/rmagick/image/blue_shift_spec.rb +16 -0
- data/spec/rmagick/image/composite_spec.rb +140 -0
- data/spec/rmagick/image/constitute_spec.rb +15 -0
- data/spec/rmagick/image/dispatch_spec.rb +18 -0
- data/spec/rmagick/image/from_blob_spec.rb +14 -0
- data/spec/rmagick/image/ping_spec.rb +14 -0
- data/spec/rmagick/image/properties_spec.rb +29 -0
- data/spec/spec_helper.rb +4 -0
- data/test/Image1.rb +565 -0
- data/test/Image2.rb +1304 -0
- data/test/Image3.rb +1030 -0
- data/test/ImageList1.rb +806 -0
- data/test/ImageList2.rb +385 -0
- data/test/Image_attributes.rb +697 -0
- data/test/Import_Export.rb +121 -0
- data/test/Info.rb +345 -0
- data/test/Magick.rb +321 -0
- data/test/Pixel.rb +116 -0
- data/test/Preview.rb +57 -0
- data/test/cmyk.icm +0 -0
- data/test/srgb.icm +0 -0
- data/test/test_all_basic.rb +38 -0
- data/test/tmpnam_test.rb +50 -0
- data/wercker.yml +10 -0
- metadata +509 -0
data/test/ImageList2.rb
ADDED
@@ -0,0 +1,385 @@
|
|
1
|
+
|
2
|
+
#!/usr/bin/env ruby -w
|
3
|
+
|
4
|
+
require 'fileutils'
|
5
|
+
require 'rmagick'
|
6
|
+
require 'test/unit'
|
7
|
+
require 'test/unit/ui/console/testrunner' unless RUBY_VERSION[/^1\.9|^2/]
|
8
|
+
|
9
|
+
class ImageList2_UT < Test::Unit::TestCase
|
10
|
+
def setup
|
11
|
+
@ilist = Magick::ImageList.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_append
|
15
|
+
@ilist.read(IMAGES_DIR+'/Button_0.gif', IMAGES_DIR+'/Button_0.gif')
|
16
|
+
assert_nothing_raised do
|
17
|
+
img = @ilist.append(true)
|
18
|
+
assert_instance_of(Magick::Image, img)
|
19
|
+
end
|
20
|
+
assert_nothing_raised do
|
21
|
+
img = @ilist.append(false)
|
22
|
+
assert_instance_of(Magick::Image, img)
|
23
|
+
end
|
24
|
+
assert_raise(ArgumentError) { @ilist.append }
|
25
|
+
assert_raise(ArgumentError) { @ilist.append(true, 1) }
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_average
|
29
|
+
@ilist.read(IMAGES_DIR+'/Button_0.gif', IMAGES_DIR+'/Button_0.gif')
|
30
|
+
assert_nothing_raised do
|
31
|
+
img = @ilist.average
|
32
|
+
assert_instance_of(Magick::Image, img)
|
33
|
+
end
|
34
|
+
assert_raise(ArgumentError) { @ilist.average(1) }
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_clone
|
38
|
+
@ilist.read(*Dir[IMAGES_DIR+'/Button_*.gif'])
|
39
|
+
ilist2 = @ilist.clone
|
40
|
+
assert_equal(ilist2, @ilist)
|
41
|
+
assert_equal(@ilist.frozen?, ilist2.frozen?)
|
42
|
+
assert_equal(@ilist.tainted?, ilist2.tainted?)
|
43
|
+
@ilist.taint
|
44
|
+
@ilist.freeze
|
45
|
+
ilist2 = @ilist.clone
|
46
|
+
assert_equal(@ilist.frozen?, ilist2.frozen?)
|
47
|
+
assert_equal(@ilist.tainted?, ilist2.tainted?)
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_coalesce
|
51
|
+
@ilist.read(IMAGES_DIR+'/Button_0.gif', IMAGES_DIR+'/Button_0.gif')
|
52
|
+
ilist = nil
|
53
|
+
assert_nothing_raised { ilist = @ilist.coalesce }
|
54
|
+
assert_instance_of(Magick::ImageList, ilist)
|
55
|
+
assert_equal(2, ilist.length)
|
56
|
+
assert_equal(0, ilist.scene)
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_copy
|
60
|
+
@ilist.read(*Dir[IMAGES_DIR+'/Button_*.gif'])
|
61
|
+
@ilist.scene = 7
|
62
|
+
ilist2 = @ilist.copy
|
63
|
+
assert_not_same(@ilist, ilist2)
|
64
|
+
assert_equal(@ilist.scene, ilist2.scene)
|
65
|
+
@ilist.each_with_index do |img, x|
|
66
|
+
assert_equal(img, ilist2[x])
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_deconstruct
|
71
|
+
@ilist.read(IMAGES_DIR+'/Button_0.gif', IMAGES_DIR+'/Button_1.gif')
|
72
|
+
ilist = nil
|
73
|
+
assert_nothing_raised { ilist = @ilist.deconstruct }
|
74
|
+
assert_instance_of(Magick::ImageList, ilist)
|
75
|
+
assert_equal(2, ilist.length)
|
76
|
+
assert_equal(0, ilist.scene)
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_dup
|
80
|
+
@ilist.read(*Dir[IMAGES_DIR+'/Button_*.gif'])
|
81
|
+
ilist2 = @ilist.dup
|
82
|
+
assert_equal(ilist2, @ilist)
|
83
|
+
assert_equal(@ilist.frozen?, ilist2.frozen?)
|
84
|
+
assert_equal(@ilist.tainted?, ilist2.tainted?)
|
85
|
+
@ilist.taint
|
86
|
+
@ilist.freeze
|
87
|
+
ilist2 = @ilist.dup
|
88
|
+
assert_not_equal(@ilist.frozen?, ilist2.frozen?)
|
89
|
+
assert_equal(@ilist.tainted?, ilist2.tainted?)
|
90
|
+
end
|
91
|
+
|
92
|
+
def flatten_images
|
93
|
+
@ilist.read(IMAGES_DIR+'/Button_0.gif', IMAGES_DIR+'/Button_1.gif')
|
94
|
+
assert_nothing_thrown do
|
95
|
+
img = @ilist.flatten_images
|
96
|
+
assert_instance_of(Magick::Image, img)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_from_blob
|
101
|
+
hat = File.open(FLOWER_HAT, 'rb')
|
102
|
+
blob = hat.read
|
103
|
+
assert_nothing_raised { @ilist.from_blob(blob) }
|
104
|
+
assert_instance_of(Magick::Image, @ilist[0])
|
105
|
+
assert_equal(0, @ilist.scene)
|
106
|
+
|
107
|
+
ilist2 = Magick::ImageList.new(FLOWER_HAT)
|
108
|
+
assert_equal(@ilist, ilist2)
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_fx
|
112
|
+
@ilist.read(IMAGES_DIR+'/Button_0.gif', IMAGES_DIR+'/Button_1.gif')
|
113
|
+
assert_nothing_raised { @ilist.fx('1/2') }
|
114
|
+
assert_nothing_raised { @ilist.fx('1/2', Magick::BlueChannel) }
|
115
|
+
assert_nothing_raised { @ilist.fx('1/2', Magick::BlueChannel, Magick::RedChannel) }
|
116
|
+
assert_raise(ArgumentError) { @ilist.fx }
|
117
|
+
assert_raise(ArgumentError) { @ilist.fx(Magick::BlueChannel) }
|
118
|
+
assert_raise(TypeError) { @ilist.fx(1) }
|
119
|
+
assert_raise(TypeError) { @ilist.fx('1/2', 1) }
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_map
|
123
|
+
map = Magick::Image.read('netscape:')[0]
|
124
|
+
@ilist.read(IMAGES_DIR+'/Button_0.gif', IMAGES_DIR+'/Button_1.gif')
|
125
|
+
assert_nothing_raised do
|
126
|
+
img = @ilist.map(map)
|
127
|
+
assert_instance_of(Magick::ImageList, img)
|
128
|
+
end
|
129
|
+
assert_nothing_raised do
|
130
|
+
img = @ilist.map(map, true)
|
131
|
+
assert_instance_of(Magick::ImageList, img)
|
132
|
+
end
|
133
|
+
|
134
|
+
map = Magick::ImageList.new('netscape:')
|
135
|
+
img = @ilist.map(map, true)
|
136
|
+
assert_instance_of(Magick::ImageList, img)
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_marshal
|
140
|
+
ilist1 = Magick::ImageList.new(*Dir[IMAGES_DIR+'/Button_*.gif'])
|
141
|
+
d = nil
|
142
|
+
ilist2 = nil
|
143
|
+
assert_nothing_raised { d = Marshal.dump(ilist1) }
|
144
|
+
assert_nothing_raised { ilist2 = Marshal.load(d) }
|
145
|
+
assert_equal(ilist1, ilist2)
|
146
|
+
end
|
147
|
+
|
148
|
+
def test_montage
|
149
|
+
@ilist.read(*Dir[IMAGES_DIR+'/Button_*.gif'])
|
150
|
+
ilist = @ilist.copy
|
151
|
+
montage = nil
|
152
|
+
assert_nothing_thrown do
|
153
|
+
montage = ilist.montage do
|
154
|
+
self.background_color = 'black'
|
155
|
+
self.background_color = Magick::Pixel.new(Magick::QuantumRange, 0, 0)
|
156
|
+
self.border_color = 'red'
|
157
|
+
self.border_color = Magick::Pixel.new(0, 0, 0)
|
158
|
+
self.border_width = 2
|
159
|
+
self.compose = Magick::OverCompositeOp
|
160
|
+
self.fill = 'green'
|
161
|
+
self.font = 'Arial'
|
162
|
+
self.frame = '20x20+4+4'
|
163
|
+
self.frame = Magick::Geometry.new(20, 20, 4, 4)
|
164
|
+
self.geometry = '63x60+5+5'
|
165
|
+
self.geometry = Magick::Geometry.new(63, 60, 5, 5)
|
166
|
+
self.gravity = Magick::SouthGravity
|
167
|
+
self.matte_color = '#bdbdbd'
|
168
|
+
self.pointsize = 12
|
169
|
+
self.shadow = true
|
170
|
+
self.stroke = 'transparent'
|
171
|
+
self.tile = '4x9'
|
172
|
+
self.tile = Magick::Geometry.new(4, 9)
|
173
|
+
end
|
174
|
+
assert_instance_of(Magick::ImageList, montage)
|
175
|
+
assert_equal(@ilist, ilist)
|
176
|
+
end
|
177
|
+
|
178
|
+
# test illegal option arguments
|
179
|
+
# looks like IM doesn't diagnose invalid geometry args
|
180
|
+
# to tile= and geometry=
|
181
|
+
assert_raise(TypeError) do
|
182
|
+
montage = ilist.montage { self.background_color = 2 }
|
183
|
+
assert_equal(@ilist, ilist)
|
184
|
+
end
|
185
|
+
assert_raise(TypeError) do
|
186
|
+
montage = ilist.montage { self.border_color = 2 }
|
187
|
+
assert_equal(@ilist, ilist)
|
188
|
+
end
|
189
|
+
assert_raise(TypeError) do
|
190
|
+
montage = ilist.montage { self.border_width = [2] }
|
191
|
+
assert_equal(@ilist, ilist)
|
192
|
+
end
|
193
|
+
assert_raise(TypeError) do
|
194
|
+
montage = ilist.montage { self.compose = 2 }
|
195
|
+
assert_equal(@ilist, ilist)
|
196
|
+
end
|
197
|
+
assert_raise(TypeError) do
|
198
|
+
montage = ilist.montage { self.fill = 2 }
|
199
|
+
assert_equal(@ilist, ilist)
|
200
|
+
end
|
201
|
+
assert_raise(TypeError) do
|
202
|
+
montage = ilist.montage { self.font = 2 }
|
203
|
+
assert_equal(@ilist, ilist)
|
204
|
+
end
|
205
|
+
assert_raise(Magick::ImageMagickError) do
|
206
|
+
montage = ilist.montage { self.frame = 'z' }
|
207
|
+
assert_equal(@ilist, ilist)
|
208
|
+
end
|
209
|
+
assert_raise(TypeError) do
|
210
|
+
montage = ilist.montage { self.matte_color = 2 }
|
211
|
+
assert_equal(@ilist, ilist)
|
212
|
+
end
|
213
|
+
assert_raise(TypeError) do
|
214
|
+
montage = ilist.montage { self.pointsize = 'x' }
|
215
|
+
assert_equal(@ilist, ilist)
|
216
|
+
end
|
217
|
+
assert_raise(ArgumentError) do
|
218
|
+
montage = ilist.montage { self.stroke = 'x' }
|
219
|
+
assert_equal(@ilist, ilist)
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
def test_morph
|
224
|
+
# can't morph an empty list
|
225
|
+
assert_raise(ArgumentError) { @ilist.morph(1) }
|
226
|
+
@ilist.read(IMAGES_DIR+'/Button_0.gif', IMAGES_DIR+'/Button_1.gif')
|
227
|
+
# can't specify a negative argument
|
228
|
+
assert_raise(ArgumentError) { @ilist.morph(-1) }
|
229
|
+
assert_nothing_raised do
|
230
|
+
res = @ilist.morph(2)
|
231
|
+
assert_instance_of(Magick::ImageList, res)
|
232
|
+
assert_equal(4, res.length)
|
233
|
+
assert_equal(0, res.scene)
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
def test_mosaic
|
238
|
+
@ilist.read(IMAGES_DIR+'/Button_0.gif', IMAGES_DIR+'/Button_1.gif')
|
239
|
+
assert_nothing_thrown do
|
240
|
+
res = @ilist.mosaic
|
241
|
+
assert_instance_of(Magick::Image, res)
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
def test_new_image
|
246
|
+
assert_nothing_raised do
|
247
|
+
@ilist.new_image(20, 20)
|
248
|
+
end
|
249
|
+
assert_equal(1, @ilist.length)
|
250
|
+
assert_equal(0, @ilist.scene)
|
251
|
+
@ilist.new_image(20, 20, Magick::HatchFill.new('black'))
|
252
|
+
assert_equal(2, @ilist.length)
|
253
|
+
assert_equal(1, @ilist.scene)
|
254
|
+
@ilist.new_image(20, 20) { self.background_color = 'red' }
|
255
|
+
assert_equal(3, @ilist.length)
|
256
|
+
assert_equal(2, @ilist.scene)
|
257
|
+
end
|
258
|
+
|
259
|
+
def test_optimize_layers
|
260
|
+
layer_methods = [
|
261
|
+
Magick::CompareAnyLayer,
|
262
|
+
Magick::CompareClearLayer,
|
263
|
+
Magick::CompareOverlayLayer,
|
264
|
+
Magick::OptimizeLayer,
|
265
|
+
Magick::OptimizePlusLayer,
|
266
|
+
Magick::CoalesceLayer,
|
267
|
+
Magick::DisposeLayer,
|
268
|
+
Magick::OptimizeTransLayer,
|
269
|
+
Magick::RemoveDupsLayer,
|
270
|
+
Magick::RemoveZeroLayer
|
271
|
+
]
|
272
|
+
@ilist.read(IMAGES_DIR+'/Button_0.gif', IMAGES_DIR+'/Button_1.gif')
|
273
|
+
layer_methods.each do |method|
|
274
|
+
assert_nothing_raised do
|
275
|
+
res = @ilist.optimize_layers(method)
|
276
|
+
assert_instance_of(Magick::ImageList, res)
|
277
|
+
assert_equal(2, res.length)
|
278
|
+
end
|
279
|
+
end
|
280
|
+
assert_raise(ArgumentError) {@ilist.optimize_layers(Magick::UndefinedLayer)}
|
281
|
+
assert_raise(TypeError) {@ilist.optimize_layers(2)}
|
282
|
+
end
|
283
|
+
|
284
|
+
def test_ping
|
285
|
+
assert_nothing_raised { @ilist.ping(FLOWER_HAT) }
|
286
|
+
assert_equal(1, @ilist.length)
|
287
|
+
assert_equal(0, @ilist.scene)
|
288
|
+
assert_nothing_raised { @ilist.ping(FLOWER_HAT, FLOWER_HAT) }
|
289
|
+
assert_equal(3, @ilist.length)
|
290
|
+
assert_equal(2, @ilist.scene)
|
291
|
+
assert_nothing_raised { @ilist.ping(FLOWER_HAT) { self.background_color = 'red ' } }
|
292
|
+
assert_equal(4, @ilist.length)
|
293
|
+
assert_equal(3, @ilist.scene)
|
294
|
+
end
|
295
|
+
|
296
|
+
def test_quantize
|
297
|
+
@ilist.read(IMAGES_DIR+'/Button_0.gif', IMAGES_DIR+'/Button_1.gif')
|
298
|
+
assert_nothing_raised do
|
299
|
+
res = @ilist.quantize
|
300
|
+
assert_instance_of(Magick::ImageList, res)
|
301
|
+
assert_equal(1, res.scene)
|
302
|
+
end
|
303
|
+
assert_nothing_raised { @ilist.quantize(128) }
|
304
|
+
assert_raise(TypeError) { @ilist.quantize('x') }
|
305
|
+
assert_nothing_raised { @ilist.quantize(128, Magick::RGBColorspace) }
|
306
|
+
assert_raise(TypeError) { @ilist.quantize(128, 'x') }
|
307
|
+
assert_nothing_raised { @ilist.quantize(128, Magick::RGBColorspace, true, 0) }
|
308
|
+
assert_nothing_raised { @ilist.quantize(128, Magick::RGBColorspace, true) }
|
309
|
+
assert_nothing_raised { @ilist.quantize(128, Magick::RGBColorspace, false) }
|
310
|
+
assert_nothing_raised { @ilist.quantize(128, Magick::RGBColorspace, Magick::NoDitherMethod) }
|
311
|
+
assert_nothing_raised { @ilist.quantize(128, Magick::RGBColorspace, Magick::RiemersmaDitherMethod) }
|
312
|
+
assert_nothing_raised { @ilist.quantize(128, Magick::RGBColorspace, Magick::FloydSteinbergDitherMethod) }
|
313
|
+
assert_raise(TypeError) { @ilist.quantize(128, Magick::RGBColorspace, true, 'x') }
|
314
|
+
assert_raise(ArgumentError) { @ilist.quantize(128, Magick::RGBColorspace, true, 0, false, 'extra') }
|
315
|
+
end
|
316
|
+
|
317
|
+
def test_read
|
318
|
+
assert_nothing_raised { @ilist.read(FLOWER_HAT) }
|
319
|
+
assert_equal(1, @ilist.length)
|
320
|
+
assert_equal(0, @ilist.scene)
|
321
|
+
assert_nothing_raised { @ilist.read(FLOWER_HAT, FLOWER_HAT) }
|
322
|
+
assert_equal(3, @ilist.length)
|
323
|
+
assert_equal(2, @ilist.scene)
|
324
|
+
assert_nothing_raised { @ilist.read(FLOWER_HAT) { self.background_color = 'red ' } }
|
325
|
+
assert_equal(4, @ilist.length)
|
326
|
+
assert_equal(3, @ilist.scene)
|
327
|
+
end
|
328
|
+
|
329
|
+
def test_remap
|
330
|
+
@ilist.read(*Dir[IMAGES_DIR+'/Button_*.gif'])
|
331
|
+
assert_nothing_raised { @ilist.remap }
|
332
|
+
remap_image = Magick::Image.new(20,20) {self.background_color = 'green'}
|
333
|
+
assert_nothing_raised { @ilist.remap(remap_image) }
|
334
|
+
assert_nothing_raised { @ilist.remap(remap_image, Magick::NoDitherMethod) }
|
335
|
+
assert_nothing_raised { @ilist.remap(remap_image, Magick::RiemersmaDitherMethod) }
|
336
|
+
assert_nothing_raised { @ilist.remap(remap_image, Magick::FloydSteinbergDitherMethod) }
|
337
|
+
assert_raise(ArgumentError) { @ilist.remap(remap_image, Magick::NoDitherMethod, 1) }
|
338
|
+
|
339
|
+
remap_image.destroy!
|
340
|
+
assert_raise(Magick::DestroyedImageError) { @ilist.remap(remap_image) }
|
341
|
+
#assert_raise(TypeError) { @ilist.affinity(affinity_image, 1) }
|
342
|
+
end
|
343
|
+
|
344
|
+
def test_to_blob
|
345
|
+
@ilist.read(IMAGES_DIR+'/Button_0.gif')
|
346
|
+
blob = nil
|
347
|
+
assert_nothing_raised { blob = @ilist.to_blob }
|
348
|
+
img = @ilist.from_blob(blob)
|
349
|
+
assert_equal(@ilist[0], img[0])
|
350
|
+
assert_equal(1, img.scene)
|
351
|
+
end
|
352
|
+
|
353
|
+
def test_write
|
354
|
+
@ilist.read(IMAGES_DIR+'/Button_0.gif')
|
355
|
+
assert_nothing_raised do
|
356
|
+
@ilist.write('temp.gif')
|
357
|
+
end
|
358
|
+
list = Magick::ImageList.new('temp.gif')
|
359
|
+
assert_equal('GIF', list.format)
|
360
|
+
FileUtils.rm('temp.gif')
|
361
|
+
|
362
|
+
@ilist.write('jpg:temp.foo')
|
363
|
+
list = Magick::ImageList.new('temp.foo')
|
364
|
+
assert_equal('JPEG', list.format)
|
365
|
+
FileUtils.rm('temp.foo')
|
366
|
+
|
367
|
+
@ilist.write('temp.0') { self.format = 'JPEG' }
|
368
|
+
list = Magick::ImageList.new('temp.0')
|
369
|
+
assert_equal('JPEG', list.format)
|
370
|
+
FileUtils.rm('temp.0')
|
371
|
+
|
372
|
+
f = File.new('test.0', 'w')
|
373
|
+
@ilist.write(f) { self.format = 'JPEG' }
|
374
|
+
f.close
|
375
|
+
list = Magick::ImageList.new('test.0')
|
376
|
+
assert_equal('JPEG', list.format)
|
377
|
+
FileUtils.rm('test.0')
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|
381
|
+
if __FILE__ == $PROGRAM_NAME
|
382
|
+
IMAGES_DIR = '../doc/ex/images'
|
383
|
+
FLOWER_HAT = IMAGES_DIR+'/Flower_Hat.jpg'
|
384
|
+
Test::Unit::UI::Console::TestRunner.run(ImageList2_UT) unless RUBY_VERSION[/^1\.9|^2/]
|
385
|
+
end
|
@@ -0,0 +1,697 @@
|
|
1
|
+
#!/usr/bin/env ruby -w
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
require 'rmagick'
|
5
|
+
require 'test/unit'
|
6
|
+
require 'test/unit/ui/console/testrunner' unless RUBY_VERSION[/^1\.9|^2/]
|
7
|
+
|
8
|
+
# TODO
|
9
|
+
# test frozen attributes!
|
10
|
+
# improve test_directory
|
11
|
+
# improve test_montage
|
12
|
+
|
13
|
+
class Image_Attributes_UT < Test::Unit::TestCase
|
14
|
+
FreezeError = RUBY_VERSION[/^1\.9|^2/] ? RuntimeError : TypeError
|
15
|
+
|
16
|
+
def setup
|
17
|
+
@img = Magick::Image.new(100, 100)
|
18
|
+
gc = Magick::Draw.new
|
19
|
+
|
20
|
+
gc.stroke_width(5)
|
21
|
+
gc.circle(50, 50, 80, 80)
|
22
|
+
gc.draw(@img)
|
23
|
+
|
24
|
+
@hat = Magick::Image.read(FLOWER_HAT).first
|
25
|
+
@p = Magick::Image.read(IMAGE_WITH_PROFILE).first.color_profile
|
26
|
+
end
|
27
|
+
|
28
|
+
# Test old alpha attribute. New alpha() behavior is tested in Image1.rb
|
29
|
+
def test_alpha
|
30
|
+
assert(@img.alpha)
|
31
|
+
assert_nothing_raised { @img.alpha = Magick::DeactivateAlphaChannel }
|
32
|
+
assert(!@img.alpha)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_background_color
|
36
|
+
assert_nothing_raised { @img.background_color }
|
37
|
+
assert_equal('white', @img.background_color)
|
38
|
+
assert_nothing_raised { @img.background_color = '#dfdfdf' }
|
39
|
+
#assert_equal("rgb(223,223,223)", @img.background_color)
|
40
|
+
assert_equal('#DFDFDFDFDFDF', @img.background_color)
|
41
|
+
assert_nothing_raised { @img.background_color = Magick::Pixel.new(Magick::QuantumRange, Magick::QuantumRange/2.0, Magick::QuantumRange/2.0) }
|
42
|
+
#assert_equal("rgb(100%,49.9992%,49.9992%)", @img.background_color)
|
43
|
+
assert_equal('#FFFF7FFF7FFF', @img.background_color)
|
44
|
+
assert_raise(TypeError) { @img.background_color = 2 }
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_base_columns
|
48
|
+
assert_nothing_raised { @img.base_columns }
|
49
|
+
assert_equal(0, @img.base_columns)
|
50
|
+
assert_raise(NoMethodError) { @img.base_columns = 1 }
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_base_filename
|
54
|
+
assert_nothing_raised { @img.base_filename }
|
55
|
+
assert_equal('', @img.base_filename)
|
56
|
+
assert_raise(NoMethodError) { @img.base_filename = 'xxx' }
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_base_rows
|
60
|
+
assert_nothing_raised { @img.base_rows }
|
61
|
+
assert_equal(0, @img.base_rows)
|
62
|
+
assert_raise(NoMethodError) { @img.base_rows = 1 }
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_bias
|
66
|
+
assert_nothing_raised { @img.bias }
|
67
|
+
assert_equal(0.0, @img.bias)
|
68
|
+
assert_instance_of(Float, @img.bias)
|
69
|
+
|
70
|
+
assert_nothing_raised { @img.bias = 0.1 }
|
71
|
+
assert_in_delta(Magick::QuantumRange * 0.1, @img.bias, 0.1)
|
72
|
+
|
73
|
+
assert_nothing_raised { @img.bias = '10%' }
|
74
|
+
assert_in_delta(Magick::QuantumRange * 0.10, @img.bias, 0.1)
|
75
|
+
|
76
|
+
assert_raise(TypeError) { @img.bias = [] }
|
77
|
+
assert_raise(ArgumentError) { @img.bias = 'x' }
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_black_point_compensation
|
81
|
+
assert_nothing_raised { @img.black_point_compensation = true }
|
82
|
+
assert(@img.black_point_compensation)
|
83
|
+
assert_nothing_raised { @img.black_point_compensation = false }
|
84
|
+
assert_equal(false, @img.black_point_compensation)
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_blur
|
88
|
+
assert_nothing_raised { @img.blur }
|
89
|
+
assert_equal(1.0, @img.blur)
|
90
|
+
assert_nothing_raised { @img.blur = 2.0 }
|
91
|
+
assert_raise(TypeError) { @img.blur = 'x' }
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_border_color
|
95
|
+
assert_nothing_raised { @img.border_color }
|
96
|
+
#assert_equal("rgb(223,223,223)", @img.border_color)
|
97
|
+
assert_equal('#DFDFDFDFDFDF', @img.border_color)
|
98
|
+
assert_nothing_raised { @img.border_color = 'red' }
|
99
|
+
assert_equal('red', @img.border_color)
|
100
|
+
assert_nothing_raised { @img.border_color = Magick::Pixel.new(Magick::QuantumRange, Magick::QuantumRange/2, Magick::QuantumRange/2) }
|
101
|
+
#assert_equal("rgb(100%,49.9992%,49.9992%)", @img.border_color)
|
102
|
+
assert_equal('#FFFF7FFF7FFF', @img.border_color)
|
103
|
+
assert_raise(TypeError) { @img.border_color = 2 }
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_bounding_box
|
107
|
+
assert_nothing_raised { @img.bounding_box }
|
108
|
+
box = @img.bounding_box
|
109
|
+
assert_equal(87, box.width)
|
110
|
+
assert_equal(87, box.height)
|
111
|
+
assert_equal(7, box.x)
|
112
|
+
assert_equal(7, box.y)
|
113
|
+
assert_raise(NoMethodError) { @img.bounding_box = 2 }
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_chromaticity
|
117
|
+
chrom = @img.chromaticity
|
118
|
+
assert_nothing_raised { @img.chromaticity }
|
119
|
+
assert_instance_of(Magick::Chromaticity, chrom)
|
120
|
+
assert_equal(0, chrom.red_primary.x)
|
121
|
+
assert_equal(0, chrom.red_primary.y)
|
122
|
+
assert_equal(0, chrom.red_primary.z)
|
123
|
+
assert_equal(0, chrom.green_primary.x)
|
124
|
+
assert_equal(0, chrom.green_primary.y)
|
125
|
+
assert_equal(0, chrom.green_primary.z)
|
126
|
+
assert_equal(0, chrom.blue_primary.x)
|
127
|
+
assert_equal(0, chrom.blue_primary.y)
|
128
|
+
assert_equal(0, chrom.blue_primary.z)
|
129
|
+
assert_equal(0, chrom.white_point.x)
|
130
|
+
assert_equal(0, chrom.white_point.y)
|
131
|
+
assert_equal(0, chrom.white_point.z)
|
132
|
+
assert_nothing_raised { @img.chromaticity = chrom }
|
133
|
+
assert_raise(TypeError) { @img.chromaticity = 2 }
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_class_type
|
137
|
+
assert_nothing_raised { @img.class_type }
|
138
|
+
assert_instance_of(Magick::ClassType, @img.class_type)
|
139
|
+
assert_equal(Magick::DirectClass, @img.class_type)
|
140
|
+
assert_nothing_raised { @img.class_type = Magick::PseudoClass }
|
141
|
+
assert_equal(Magick::PseudoClass, @img.class_type)
|
142
|
+
assert_raise(TypeError) { @img.class_type = 2 }
|
143
|
+
end
|
144
|
+
|
145
|
+
def test_color_profile
|
146
|
+
assert_nothing_raised { @img.color_profile }
|
147
|
+
assert_nil(@img.color_profile)
|
148
|
+
assert_nothing_raised { @img.color_profile = @p }
|
149
|
+
assert_equal(@p, @img.color_profile)
|
150
|
+
assert_raise(TypeError) { @img.color_profile = 2 }
|
151
|
+
end
|
152
|
+
|
153
|
+
def test_colors
|
154
|
+
assert_nothing_raised { @img.colors }
|
155
|
+
assert_equal(0, @img.colors)
|
156
|
+
img = @img.copy
|
157
|
+
img.class_type = Magick::PseudoClass
|
158
|
+
assert_equal(40, img.colors)
|
159
|
+
assert_raise(NoMethodError) { img.colors = 2 }
|
160
|
+
end
|
161
|
+
|
162
|
+
def test_colorspace
|
163
|
+
assert_nothing_raised { @img.colorspace }
|
164
|
+
assert_instance_of(Magick::ColorspaceType, @img.colorspace)
|
165
|
+
if IM_VERSION < Gem::Version.new('6.7.5') || (IM_VERSION == Gem::Version.new('6.7.5') && IM_REVISION < Gem::Version.new('5'))
|
166
|
+
assert_equal(Magick::RGBColorspace, @img.colorspace)
|
167
|
+
else
|
168
|
+
assert_equal(Magick::SRGBColorspace, @img.colorspace)
|
169
|
+
end
|
170
|
+
img = @img.copy
|
171
|
+
assert_nothing_raised { img.colorspace = Magick::GRAYColorspace }
|
172
|
+
assert_equal(Magick::GRAYColorspace, img.colorspace)
|
173
|
+
assert_raise(TypeError) { @img.colorspace = 2 }
|
174
|
+
Magick::ColorspaceType.values.each do |cs|
|
175
|
+
assert_nothing_raised { img.colorspace = cs }
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
def test_columns
|
180
|
+
assert_nothing_raised { @img.columns }
|
181
|
+
assert_equal(100, @img.columns)
|
182
|
+
assert_raise(NoMethodError) { @img.columns = 2 }
|
183
|
+
end
|
184
|
+
|
185
|
+
def test_compose
|
186
|
+
assert_nothing_raised { @img.compose }
|
187
|
+
assert_instance_of(Magick::CompositeOperator, @img.compose)
|
188
|
+
assert_equal(Magick::OverCompositeOp, @img.compose)
|
189
|
+
assert_raise(TypeError) { @img.compose = 2 }
|
190
|
+
assert_nothing_raised { @img.compose = Magick::UndefinedCompositeOp }
|
191
|
+
assert_equal(Magick::UndefinedCompositeOp, @img.compose)
|
192
|
+
|
193
|
+
assert_nothing_raised { @img.compose = Magick::NoCompositeOp }
|
194
|
+
assert_nothing_raised { @img.compose = Magick::AddCompositeOp }
|
195
|
+
assert_nothing_raised { @img.compose = Magick::AtopCompositeOp }
|
196
|
+
assert_nothing_raised { @img.compose = Magick::BlendCompositeOp }
|
197
|
+
assert_nothing_raised { @img.compose = Magick::BumpmapCompositeOp }
|
198
|
+
assert_nothing_raised { @img.compose = Magick::ClearCompositeOp }
|
199
|
+
assert_nothing_raised { @img.compose = Magick::ColorBurnCompositeOp }
|
200
|
+
assert_nothing_raised { @img.compose = Magick::ColorDodgeCompositeOp }
|
201
|
+
assert_nothing_raised { @img.compose = Magick::ColorizeCompositeOp }
|
202
|
+
assert_nothing_raised { @img.compose = Magick::CopyBlackCompositeOp }
|
203
|
+
assert_nothing_raised { @img.compose = Magick::CopyBlueCompositeOp }
|
204
|
+
assert_nothing_raised { @img.compose = Magick::CopyCompositeOp }
|
205
|
+
assert_nothing_raised { @img.compose = Magick::CopyCyanCompositeOp }
|
206
|
+
assert_nothing_raised { @img.compose = Magick::CopyGreenCompositeOp }
|
207
|
+
assert_nothing_raised { @img.compose = Magick::CopyMagentaCompositeOp }
|
208
|
+
assert_nothing_raised { @img.compose = Magick::CopyOpacityCompositeOp }
|
209
|
+
assert_nothing_raised { @img.compose = Magick::CopyRedCompositeOp }
|
210
|
+
assert_nothing_raised { @img.compose = Magick::CopyYellowCompositeOp }
|
211
|
+
assert_nothing_raised { @img.compose = Magick::DarkenCompositeOp }
|
212
|
+
assert_nothing_raised { @img.compose = Magick::DstAtopCompositeOp }
|
213
|
+
assert_nothing_raised { @img.compose = Magick::DstCompositeOp }
|
214
|
+
assert_nothing_raised { @img.compose = Magick::DstInCompositeOp }
|
215
|
+
assert_nothing_raised { @img.compose = Magick::DstOutCompositeOp }
|
216
|
+
assert_nothing_raised { @img.compose = Magick::DstOverCompositeOp }
|
217
|
+
assert_nothing_raised { @img.compose = Magick::DifferenceCompositeOp }
|
218
|
+
assert_nothing_raised { @img.compose = Magick::DisplaceCompositeOp }
|
219
|
+
assert_nothing_raised { @img.compose = Magick::DissolveCompositeOp }
|
220
|
+
assert_nothing_raised { @img.compose = Magick::ExclusionCompositeOp }
|
221
|
+
assert_nothing_raised { @img.compose = Magick::HardLightCompositeOp }
|
222
|
+
assert_nothing_raised { @img.compose = Magick::HueCompositeOp }
|
223
|
+
assert_nothing_raised { @img.compose = Magick::InCompositeOp }
|
224
|
+
assert_nothing_raised { @img.compose = Magick::LightenCompositeOp }
|
225
|
+
assert_nothing_raised { @img.compose = Magick::LuminizeCompositeOp }
|
226
|
+
assert_nothing_raised { @img.compose = Magick::MinusCompositeOp }
|
227
|
+
assert_nothing_raised { @img.compose = Magick::ModulateCompositeOp }
|
228
|
+
assert_nothing_raised { @img.compose = Magick::MultiplyCompositeOp }
|
229
|
+
assert_nothing_raised { @img.compose = Magick::OutCompositeOp }
|
230
|
+
assert_nothing_raised { @img.compose = Magick::OverCompositeOp }
|
231
|
+
assert_nothing_raised { @img.compose = Magick::OverlayCompositeOp }
|
232
|
+
assert_nothing_raised { @img.compose = Magick::PlusCompositeOp }
|
233
|
+
assert_nothing_raised { @img.compose = Magick::ReplaceCompositeOp }
|
234
|
+
assert_nothing_raised { @img.compose = Magick::SaturateCompositeOp }
|
235
|
+
assert_nothing_raised { @img.compose = Magick::ScreenCompositeOp }
|
236
|
+
assert_nothing_raised { @img.compose = Magick::SoftLightCompositeOp }
|
237
|
+
assert_nothing_raised { @img.compose = Magick::SrcAtopCompositeOp }
|
238
|
+
assert_nothing_raised { @img.compose = Magick::SrcCompositeOp }
|
239
|
+
assert_nothing_raised { @img.compose = Magick::SrcInCompositeOp }
|
240
|
+
assert_nothing_raised { @img.compose = Magick::SrcOutCompositeOp }
|
241
|
+
assert_nothing_raised { @img.compose = Magick::SrcOverCompositeOp }
|
242
|
+
assert_nothing_raised { @img.compose = Magick::SubtractCompositeOp }
|
243
|
+
assert_nothing_raised { @img.compose = Magick::ThresholdCompositeOp }
|
244
|
+
assert_nothing_raised { @img.compose = Magick::XorCompositeOp }
|
245
|
+
assert_raise(TypeError) { @img.compose = 2 }
|
246
|
+
end
|
247
|
+
|
248
|
+
def test_compression
|
249
|
+
assert_nothing_raised { @img.compression }
|
250
|
+
assert_instance_of(Magick::CompressionType, @img.compression)
|
251
|
+
assert_equal(Magick::UndefinedCompression, @img.compression)
|
252
|
+
assert_nothing_raised { @img.compression = Magick::BZipCompression }
|
253
|
+
assert_equal(Magick::BZipCompression, @img.compression)
|
254
|
+
assert_nothing_raised { @img.compression = Magick::NoCompression }
|
255
|
+
assert_nothing_raised { @img.compression = Magick::BZipCompression }
|
256
|
+
assert_nothing_raised { @img.compression = Magick::B44Compression }
|
257
|
+
assert_nothing_raised { @img.compression = Magick::B44ACompression }
|
258
|
+
assert_nothing_raised { @img.compression = Magick::DXT1Compression }
|
259
|
+
assert_nothing_raised { @img.compression = Magick::DXT3Compression }
|
260
|
+
assert_nothing_raised { @img.compression = Magick::DXT5Compression }
|
261
|
+
assert_nothing_raised { @img.compression = Magick::FaxCompression }
|
262
|
+
assert_nothing_raised { @img.compression = Magick::Group4Compression }
|
263
|
+
assert_nothing_raised { @img.compression = Magick::JPEGCompression }
|
264
|
+
assert_nothing_raised { @img.compression = Magick::JPEG2000Compression }
|
265
|
+
assert_nothing_raised { @img.compression = Magick::LosslessJPEGCompression }
|
266
|
+
assert_nothing_raised { @img.compression = Magick::LZWCompression }
|
267
|
+
assert_nothing_raised { @img.compression = Magick::PizCompression }
|
268
|
+
assert_nothing_raised { @img.compression = Magick::Pxr24Compression }
|
269
|
+
assert_nothing_raised { @img.compression = Magick::RLECompression }
|
270
|
+
assert_nothing_raised { @img.compression = Magick::ZipCompression }
|
271
|
+
assert_nothing_raised { @img.compression = Magick::ZipSCompression }
|
272
|
+
assert_raise(TypeError) { @img.compression = 2 }
|
273
|
+
end
|
274
|
+
|
275
|
+
def test_delay
|
276
|
+
assert_nothing_raised { @img.delay }
|
277
|
+
assert_equal(0, @img.delay)
|
278
|
+
assert_nothing_raised { @img.delay = 10 }
|
279
|
+
assert_equal(10, @img.delay)
|
280
|
+
assert_raise(TypeError) { @img.delay = 'x' }
|
281
|
+
end
|
282
|
+
|
283
|
+
def test_density
|
284
|
+
assert_nothing_raised { @img.density }
|
285
|
+
assert_nothing_raised { @img.density = '90x90' }
|
286
|
+
assert_nothing_raised { @img.density = 'x90' }
|
287
|
+
assert_nothing_raised { @img.density = '90' }
|
288
|
+
assert_raise(TypeError) { @img.density = 2 }
|
289
|
+
end
|
290
|
+
|
291
|
+
def test_depth
|
292
|
+
assert_equal(Magick::MAGICKCORE_QUANTUM_DEPTH, @img.depth)
|
293
|
+
assert_raise(NoMethodError) { @img.depth = 2 }
|
294
|
+
end
|
295
|
+
|
296
|
+
def test_directory
|
297
|
+
assert_nothing_raised { @img.directory }
|
298
|
+
assert_nil(@img.directory)
|
299
|
+
assert_raise(NoMethodError) { @img.directory = nil }
|
300
|
+
end
|
301
|
+
|
302
|
+
def test_dispose
|
303
|
+
assert_nothing_raised { @img.dispose }
|
304
|
+
assert_instance_of(Magick::DisposeType, @img.dispose)
|
305
|
+
assert_equal(Magick::UndefinedDispose, @img.dispose)
|
306
|
+
assert_nothing_raised { @img.dispose = Magick::NoneDispose }
|
307
|
+
assert_equal(Magick::NoneDispose, @img.dispose)
|
308
|
+
assert_nothing_raised { @img.dispose = Magick::BackgroundDispose }
|
309
|
+
assert_nothing_raised { @img.dispose = Magick::PreviousDispose }
|
310
|
+
assert_raise(TypeError) { @img.dispose = 2 }
|
311
|
+
end
|
312
|
+
|
313
|
+
def test_endian
|
314
|
+
assert_nothing_raised { @img.endian }
|
315
|
+
assert_instance_of(Magick::EndianType, @img.endian)
|
316
|
+
assert_equal(Magick::UndefinedEndian, @img.endian)
|
317
|
+
assert_nothing_raised { @img.endian = Magick::LSBEndian }
|
318
|
+
assert_equal(Magick::LSBEndian, @img.endian)
|
319
|
+
assert_nothing_raised { @img.endian = Magick::MSBEndian }
|
320
|
+
assert_raise(TypeError) { @img.endian = 2 }
|
321
|
+
end
|
322
|
+
|
323
|
+
def test_extract_info
|
324
|
+
assert_nothing_raised { @img.extract_info }
|
325
|
+
assert_instance_of(Magick::Rectangle, @img.extract_info)
|
326
|
+
ext = @img.extract_info
|
327
|
+
assert_equal(0, ext.x)
|
328
|
+
assert_equal(0, ext.y)
|
329
|
+
assert_equal(0, ext.width)
|
330
|
+
assert_equal(0, ext.height)
|
331
|
+
ext = Magick::Rectangle.new(1, 2, 3, 4)
|
332
|
+
assert_nothing_raised { @img.extract_info = ext }
|
333
|
+
assert_equal(1, ext.width)
|
334
|
+
assert_equal(2, ext.height)
|
335
|
+
assert_equal(3, ext.x)
|
336
|
+
assert_equal(4, ext.y)
|
337
|
+
assert_raise(TypeError) { @img.extract_info = 2 }
|
338
|
+
end
|
339
|
+
|
340
|
+
def test_filename
|
341
|
+
assert_nothing_raised { @img.filename }
|
342
|
+
assert_equal('', @img.filename)
|
343
|
+
assert_raises(NoMethodError) { @img.filename = 'xxx' }
|
344
|
+
end
|
345
|
+
|
346
|
+
def test_filter
|
347
|
+
assert_nothing_raised { @img.filter }
|
348
|
+
assert_instance_of(Magick::FilterTypes, @img.filter)
|
349
|
+
assert_equal(Magick::UndefinedFilter, @img.filter)
|
350
|
+
assert_nothing_raised { @img.filter = Magick::PointFilter }
|
351
|
+
assert_equal(Magick::PointFilter, @img.filter)
|
352
|
+
assert_nothing_raised { @img.filter = Magick::BoxFilter }
|
353
|
+
assert_nothing_raised { @img.filter = Magick::TriangleFilter }
|
354
|
+
assert_nothing_raised { @img.filter = Magick::HermiteFilter }
|
355
|
+
assert_nothing_raised { @img.filter = Magick::HanningFilter }
|
356
|
+
assert_nothing_raised { @img.filter = Magick::HammingFilter }
|
357
|
+
assert_nothing_raised { @img.filter = Magick::BlackmanFilter }
|
358
|
+
assert_nothing_raised { @img.filter = Magick::GaussianFilter }
|
359
|
+
assert_nothing_raised { @img.filter = Magick::QuadraticFilter }
|
360
|
+
assert_nothing_raised { @img.filter = Magick::CubicFilter }
|
361
|
+
assert_nothing_raised { @img.filter = Magick::CatromFilter }
|
362
|
+
assert_nothing_raised { @img.filter = Magick::MitchellFilter }
|
363
|
+
assert_nothing_raised { @img.filter = Magick::LanczosFilter }
|
364
|
+
assert_nothing_raised { @img.filter = Magick::BesselFilter }
|
365
|
+
assert_nothing_raised { @img.filter = Magick::SincFilter }
|
366
|
+
assert_raise(TypeError) { @img.filter = 2 }
|
367
|
+
end
|
368
|
+
|
369
|
+
def test_format
|
370
|
+
assert_nothing_raised { @img.format }
|
371
|
+
assert_nil(@img.format)
|
372
|
+
assert_nothing_raised { @img.format = 'GIF' }
|
373
|
+
assert_nothing_raised { @img.format = 'JPG' }
|
374
|
+
assert_nothing_raised { @img.format = 'TIFF' }
|
375
|
+
assert_nothing_raised { @img.format = 'MIFF' }
|
376
|
+
assert_nothing_raised { @img.format = 'MPEG' }
|
377
|
+
v = $VERBOSE
|
378
|
+
$VERBOSE = nil
|
379
|
+
assert_raise(ArgumentError) { @img.format = 'shit' }
|
380
|
+
$VERBOSE = v
|
381
|
+
assert_raise(TypeError) { @img.format = 2 }
|
382
|
+
end
|
383
|
+
|
384
|
+
def test_fuzz
|
385
|
+
assert_nothing_raised { @img.fuzz }
|
386
|
+
assert_instance_of(Float, @img.fuzz)
|
387
|
+
assert_equal(0.0, @img.fuzz)
|
388
|
+
assert_nothing_raised { @img.fuzz = 50 }
|
389
|
+
assert_equal(50.0, @img.fuzz)
|
390
|
+
assert_nothing_raised { @img.fuzz = '50%' }
|
391
|
+
assert_in_delta(Magick::QuantumRange * 0.50, @img.fuzz, 0.1)
|
392
|
+
assert_raise(TypeError) { @img.fuzz = [] }
|
393
|
+
assert_raise(ArgumentError) { @img.fuzz = 'xxx' }
|
394
|
+
end
|
395
|
+
|
396
|
+
def test_gamma
|
397
|
+
assert_nothing_raised { @img.gamma }
|
398
|
+
assert_instance_of(Float, @img.gamma)
|
399
|
+
if IM_VERSION < Gem::Version.new('6.7.5') || (IM_VERSION == Gem::Version.new('6.7.5') && IM_REVISION < Gem::Version.new('5'))
|
400
|
+
assert_equal(0.0, @img.gamma)
|
401
|
+
else
|
402
|
+
assert_equal(0.45454543828964233, @img.gamma)
|
403
|
+
end
|
404
|
+
assert_nothing_raised { @img.gamma = 2.0 }
|
405
|
+
assert_equal(2.0, @img.gamma)
|
406
|
+
assert_raise(TypeError) { @img.gamma = 'x' }
|
407
|
+
end
|
408
|
+
|
409
|
+
def test_geometry
|
410
|
+
assert_nothing_raised { @img.geometry }
|
411
|
+
assert_nil(@img.geometry)
|
412
|
+
assert_nothing_raised { @img.geometry = '90x90' }
|
413
|
+
assert_equal('90x90', @img.geometry)
|
414
|
+
assert_nothing_raised { @img.geometry = Magick::Geometry.new(100, 80) }
|
415
|
+
assert_equal('100x80', @img.geometry)
|
416
|
+
assert_raise(TypeError) { @img.geometry = [] }
|
417
|
+
end
|
418
|
+
|
419
|
+
def test_image_type
|
420
|
+
assert_nothing_raised { @img.image_type }
|
421
|
+
assert_instance_of(Magick::ImageType, @img.image_type)
|
422
|
+
assert_equal(Magick::GrayscaleMatteType, @img.image_type)
|
423
|
+
end
|
424
|
+
|
425
|
+
def test_interlace_type
|
426
|
+
assert_nothing_raised { @img.interlace }
|
427
|
+
assert_instance_of(Magick::InterlaceType, @img.interlace)
|
428
|
+
assert_equal(Magick::NoInterlace, @img.interlace)
|
429
|
+
assert_nothing_raised { @img.interlace = Magick::LineInterlace }
|
430
|
+
assert_equal(Magick::LineInterlace, @img.interlace)
|
431
|
+
assert_nothing_raised { @img.interlace = Magick::PlaneInterlace }
|
432
|
+
assert_nothing_raised { @img.interlace = Magick::PartitionInterlace }
|
433
|
+
assert_raise(TypeError) { @img.interlace = 2 }
|
434
|
+
end
|
435
|
+
|
436
|
+
def test_iptc_profile
|
437
|
+
assert_nothing_raised { @img.iptc_profile }
|
438
|
+
assert_nil(@img.iptc_profile)
|
439
|
+
assert_nothing_raised { @img.iptc_profile = 'xxx' }
|
440
|
+
assert_raise(TypeError) { @img.iptc_profile = 2 }
|
441
|
+
end
|
442
|
+
|
443
|
+
def test_matte
|
444
|
+
assert_nothing_raised { @img.matte }
|
445
|
+
assert(@img.matte)
|
446
|
+
assert_nothing_raised { @img.matte = false }
|
447
|
+
assert(!@img.matte)
|
448
|
+
end
|
449
|
+
|
450
|
+
def test_mean_error
|
451
|
+
assert_nothing_raised { @hat.mean_error_per_pixel }
|
452
|
+
assert_nothing_raised { @hat.normalized_mean_error }
|
453
|
+
assert_nothing_raised { @hat.normalized_maximum_error }
|
454
|
+
assert_equal(0.0, @hat.mean_error_per_pixel)
|
455
|
+
assert_equal(0.0, @hat.normalized_mean_error)
|
456
|
+
assert_equal(0.0, @hat.normalized_maximum_error)
|
457
|
+
|
458
|
+
hat = @hat.quantize(16, Magick::RGBColorspace, true, 0, true)
|
459
|
+
|
460
|
+
assert_not_equal(0.0, hat.mean_error_per_pixel)
|
461
|
+
assert_not_equal(0.0, hat.normalized_mean_error)
|
462
|
+
assert_not_equal(0.0, hat.normalized_maximum_error)
|
463
|
+
assert_raise(NoMethodError) { hat.mean_error_per_pixel = 1 }
|
464
|
+
assert_raise(NoMethodError) { hat.normalized_mean_error = 1 }
|
465
|
+
assert_raise(NoMethodError) { hat.normalized_maximum_error = 1 }
|
466
|
+
end
|
467
|
+
|
468
|
+
def test_mime_type
|
469
|
+
img = @img.copy
|
470
|
+
img.format = 'GIF'
|
471
|
+
assert_nothing_raised { img.mime_type }
|
472
|
+
assert_equal('image/gif', img.mime_type)
|
473
|
+
img.format = 'JPG'
|
474
|
+
assert_equal('image/jpeg', img.mime_type)
|
475
|
+
assert_raise(NoMethodError) { img.mime_type = 'image/jpeg' }
|
476
|
+
end
|
477
|
+
|
478
|
+
def test_monitor
|
479
|
+
assert_raise(NoMethodError) { @img.monitor }
|
480
|
+
monitor = proc { |name, q, s| puts name }
|
481
|
+
assert_nothing_raised { @img.monitor = monitor }
|
482
|
+
assert_nothing_raised { @img.monitor = nil }
|
483
|
+
end
|
484
|
+
|
485
|
+
def test_montage
|
486
|
+
assert_nothing_raised { @img.montage }
|
487
|
+
assert_nil(@img.montage)
|
488
|
+
end
|
489
|
+
|
490
|
+
def test_number_colors
|
491
|
+
assert_nothing_raised { @hat.number_colors }
|
492
|
+
if IM_VERSION < Gem::Version.new('6.7.5') || (IM_VERSION == Gem::Version.new('6.7.5') && IM_REVISION < Gem::Version.new('5'))
|
493
|
+
assert_equal(27980, @hat.number_colors)
|
494
|
+
else
|
495
|
+
assert_equal(27942, @hat.number_colors)
|
496
|
+
end
|
497
|
+
assert_raise(NoMethodError) { @hat.number_colors = 2 }
|
498
|
+
end
|
499
|
+
|
500
|
+
def test_offset
|
501
|
+
assert_nothing_raised { @img.offset }
|
502
|
+
assert_equal(0, @img.offset)
|
503
|
+
assert_nothing_raised { @img.offset = 10 }
|
504
|
+
assert_equal(10, @img.offset)
|
505
|
+
assert_raise(TypeError) { @img.offset = 'x' }
|
506
|
+
end
|
507
|
+
|
508
|
+
def test_opacity
|
509
|
+
assert_raise(NoMethodError) { @img.opacity }
|
510
|
+
assert_nothing_raised { @img.opacity = 50 }
|
511
|
+
assert_raise(TypeError) { @img.opacity = 'x' }
|
512
|
+
end
|
513
|
+
|
514
|
+
def test_orientation
|
515
|
+
assert_nothing_raised { @img.orientation }
|
516
|
+
assert_instance_of(Magick::OrientationType, @img.orientation)
|
517
|
+
assert_equal(Magick::UndefinedOrientation, @img.orientation)
|
518
|
+
assert_nothing_raised { @img.orientation = Magick::UndefinedOrientation }
|
519
|
+
assert_nothing_raised { @img.orientation = Magick::TopLeftOrientation }
|
520
|
+
assert_nothing_raised { @img.orientation = Magick::TopRightOrientation }
|
521
|
+
assert_nothing_raised { @img.orientation = Magick::BottomRightOrientation }
|
522
|
+
assert_nothing_raised { @img.orientation = Magick::LeftTopOrientation }
|
523
|
+
assert_nothing_raised { @img.orientation = Magick::RightTopOrientation }
|
524
|
+
assert_nothing_raised { @img.orientation = Magick::RightBottomOrientation }
|
525
|
+
assert_nothing_raised { @img.orientation = Magick::LeftBottomOrientation }
|
526
|
+
end
|
527
|
+
|
528
|
+
def test_page
|
529
|
+
assert_nothing_raised { @img.page }
|
530
|
+
page = @img.page
|
531
|
+
assert_equal(0, page.width)
|
532
|
+
assert_equal(0, page.height)
|
533
|
+
assert_equal(0, page.x)
|
534
|
+
assert_equal(0, page.y)
|
535
|
+
page = Magick::Rectangle.new(1,2,3,4)
|
536
|
+
assert_nothing_raised { @img.page = page }
|
537
|
+
assert_equal(1, page.width)
|
538
|
+
assert_equal(2, page.height)
|
539
|
+
assert_equal(3, page.x)
|
540
|
+
assert_equal(4, page.y)
|
541
|
+
assert_raise(TypeError) { @img.page = 2 }
|
542
|
+
end
|
543
|
+
|
544
|
+
def test_quality
|
545
|
+
assert_nothing_raised { @hat.quality }
|
546
|
+
assert_equal(75, @hat.quality)
|
547
|
+
assert_raise(NoMethodError) { @img.quality = 80 }
|
548
|
+
end
|
549
|
+
|
550
|
+
def test_quantum_depth
|
551
|
+
assert_nothing_raised { @img.quantum_depth }
|
552
|
+
assert_equal(Magick::MAGICKCORE_QUANTUM_DEPTH, @img.quantum_depth)
|
553
|
+
assert_raise(NoMethodError) { @img.quantum_depth = 8 }
|
554
|
+
end
|
555
|
+
|
556
|
+
def test_rendering_intent
|
557
|
+
assert_nothing_raised { @img.rendering_intent }
|
558
|
+
assert_instance_of(Magick::RenderingIntent, @img.rendering_intent)
|
559
|
+
if IM_VERSION < Gem::Version.new('6.7.5') || (IM_VERSION == Gem::Version.new('6.7.5') && IM_REVISION < Gem::Version.new('5'))
|
560
|
+
assert_equal(Magick::UndefinedIntent, @img.rendering_intent)
|
561
|
+
else
|
562
|
+
assert_equal(Magick::PerceptualIntent, @img.rendering_intent)
|
563
|
+
end
|
564
|
+
assert_nothing_raised { @img.rendering_intent = Magick::SaturationIntent }
|
565
|
+
assert_nothing_raised { @img.rendering_intent = Magick::PerceptualIntent }
|
566
|
+
assert_nothing_raised { @img.rendering_intent = Magick::AbsoluteIntent }
|
567
|
+
assert_nothing_raised { @img.rendering_intent = Magick::RelativeIntent }
|
568
|
+
assert_raise(TypeError) { @img.rendering_intent = 2 }
|
569
|
+
end
|
570
|
+
|
571
|
+
def test_rows
|
572
|
+
assert_nothing_raised { @img.rows }
|
573
|
+
assert_equal(100, @img.rows)
|
574
|
+
assert_raise(NoMethodError) { @img.rows = 2 }
|
575
|
+
end
|
576
|
+
|
577
|
+
def test_scene
|
578
|
+
ilist = Magick::ImageList.new
|
579
|
+
ilist << @img
|
580
|
+
img = @img.copy
|
581
|
+
ilist << img
|
582
|
+
ilist.write('temp.gif')
|
583
|
+
FileUtils.rm('temp.gif')
|
584
|
+
|
585
|
+
assert_nothing_raised { img.scene }
|
586
|
+
assert_equal(0, @img.scene)
|
587
|
+
assert_equal(1, img.scene)
|
588
|
+
assert_raise(NoMethodError) { img.scene = 2 }
|
589
|
+
end
|
590
|
+
|
591
|
+
def test_start_loop
|
592
|
+
assert_nothing_raised { @img.start_loop }
|
593
|
+
assert(! @img.start_loop)
|
594
|
+
assert_nothing_raised { @img.start_loop = true }
|
595
|
+
assert(@img.start_loop)
|
596
|
+
end
|
597
|
+
|
598
|
+
def test_ticks_per_second
|
599
|
+
assert_nothing_raised { @img.ticks_per_second }
|
600
|
+
assert_equal(100, @img.ticks_per_second)
|
601
|
+
assert_nothing_raised { @img.ticks_per_second = 1000 }
|
602
|
+
assert_equal(1000, @img.ticks_per_second)
|
603
|
+
assert_raise(TypeError) { @img.ticks_per_second = 'x' }
|
604
|
+
end
|
605
|
+
|
606
|
+
def test_total_colors
|
607
|
+
assert_nothing_raised { @hat.total_colors }
|
608
|
+
if IM_VERSION < Gem::Version.new('6.7.5') || (IM_VERSION == Gem::Version.new('6.7.5') && IM_REVISION < Gem::Version.new('5'))
|
609
|
+
assert_equal(27980, @hat.total_colors)
|
610
|
+
else
|
611
|
+
assert_equal(27942, @hat.total_colors)
|
612
|
+
end
|
613
|
+
assert_raise(NoMethodError) { @img.total_colors = 2 }
|
614
|
+
end
|
615
|
+
|
616
|
+
def test_units
|
617
|
+
assert_nothing_raised { @img.units }
|
618
|
+
assert_instance_of(Magick::ResolutionType, @img.units)
|
619
|
+
assert_equal(Magick::UndefinedResolution, @img.units)
|
620
|
+
assert_nothing_raised { @img.units = Magick::PixelsPerInchResolution }
|
621
|
+
assert_equal(Magick::PixelsPerInchResolution, @img.units)
|
622
|
+
assert_nothing_raised { @img.units = Magick::PixelsPerCentimeterResolution }
|
623
|
+
assert_raise(TypeError) { @img.units = 2 }
|
624
|
+
end
|
625
|
+
|
626
|
+
def test_virtual_pixel_method
|
627
|
+
assert_nothing_raised { @img.virtual_pixel_method }
|
628
|
+
assert_equal(Magick::UndefinedVirtualPixelMethod, @img.virtual_pixel_method)
|
629
|
+
assert_nothing_raised { @img.virtual_pixel_method = Magick::EdgeVirtualPixelMethod }
|
630
|
+
assert_equal(Magick::EdgeVirtualPixelMethod, @img.virtual_pixel_method)
|
631
|
+
assert_nothing_raised { @img.virtual_pixel_method = Magick::MirrorVirtualPixelMethod }
|
632
|
+
assert_nothing_raised { @img.virtual_pixel_method = Magick::TileVirtualPixelMethod }
|
633
|
+
assert_nothing_raised { @img.virtual_pixel_method = Magick::TransparentVirtualPixelMethod }
|
634
|
+
assert_nothing_raised { @img.virtual_pixel_method = Magick::BackgroundVirtualPixelMethod }
|
635
|
+
assert_raise(TypeError) { @img.virtual_pixel_method = 2 }
|
636
|
+
end
|
637
|
+
|
638
|
+
def test_x_resolution
|
639
|
+
assert_nothing_raised { @img.x_resolution }
|
640
|
+
assert_nothing_raised { @img.x_resolution = 90 }
|
641
|
+
assert_equal(90.0, @img.x_resolution)
|
642
|
+
assert_raise(TypeError) { @img.x_resolution = 'x' }
|
643
|
+
end
|
644
|
+
|
645
|
+
def test_y_resolution
|
646
|
+
assert_nothing_raised { @img.y_resolution }
|
647
|
+
assert_nothing_raised { @img.y_resolution = 90 }
|
648
|
+
assert_equal(90.0, @img.y_resolution)
|
649
|
+
assert_raise(TypeError) { @img.y_resolution = 'x' }
|
650
|
+
end
|
651
|
+
|
652
|
+
def test_frozen
|
653
|
+
@img.freeze
|
654
|
+
assert_raise(FreezeError) { @img.background_color = 'xxx' }
|
655
|
+
assert_raise(FreezeError) { @img.blur = 50 }
|
656
|
+
assert_raise(FreezeError) { @img.border_color = 'xxx' }
|
657
|
+
rp = Magick::Point.new(1,1)
|
658
|
+
gp = Magick::Point.new(1,1)
|
659
|
+
bp = Magick::Point.new(1,1)
|
660
|
+
wp = Magick::Point.new(1,1)
|
661
|
+
assert_raise(FreezeError) { @img.chromaticity = Magick::Chromaticity.new(rp, gp, bp, wp) }
|
662
|
+
assert_raise(FreezeError) { @img.class_type = Magick::DirectClass }
|
663
|
+
assert_raise(FreezeError) { @img.color_profile = 'xxx' }
|
664
|
+
assert_raise(FreezeError) { @img.colorspace = Magick::RGBColorspace }
|
665
|
+
assert_raise(FreezeError) { @img.compose = Magick::OverCompositeOp }
|
666
|
+
assert_raise(FreezeError) { @img.compression = Magick::RLECompression }
|
667
|
+
assert_raise(FreezeError) { @img.delay = 2 }
|
668
|
+
assert_raise(FreezeError) { @img.density = '72.0x72.0' }
|
669
|
+
assert_raise(FreezeError) { @img.dispose = Magick::NoneDispose }
|
670
|
+
assert_raise(FreezeError) { @img.endian = Magick::MSBEndian }
|
671
|
+
assert_raise(FreezeError) { @img.extract_info = Magick::Rectangle.new(1,2,3,4) }
|
672
|
+
assert_raise(FreezeError) { @img.filter = Magick::PointFilter }
|
673
|
+
assert_raise(FreezeError) { @img.format = 'GIF' }
|
674
|
+
assert_raise(FreezeError) { @img.fuzz = 50.0 }
|
675
|
+
assert_raise(FreezeError) { @img.gamma = 2.0 }
|
676
|
+
assert_raise(FreezeError) { @img.geometry = '100x100' }
|
677
|
+
assert_raise(FreezeError) { @img.interlace = Magick::NoInterlace }
|
678
|
+
assert_raise(FreezeError) { @img.iptc_profile = 'xxx' }
|
679
|
+
assert_raise(FreezeError) { @img.mask = @img }
|
680
|
+
assert_raise(FreezeError) { @img.matte = true }
|
681
|
+
assert_raise(FreezeError) { @img.monitor = proc { |name, q, s| puts name } }
|
682
|
+
assert_raise(FreezeError) { @img.offset = 100 }
|
683
|
+
assert_raise(FreezeError) { @img.opacity = 100 }
|
684
|
+
assert_raise(FreezeError) { @img.page = Magick::Rectangle.new(1,2,3,4) }
|
685
|
+
assert_raise(FreezeError) { @img.rendering_intent = Magick::SaturationIntent }
|
686
|
+
assert_raise(FreezeError) { @img.start_loop = true }
|
687
|
+
assert_raise(FreezeError) { @img.ticks_per_second = 1000 }
|
688
|
+
assert_raise(FreezeError) { @img.units = Magick::PixelsPerInchResolution }
|
689
|
+
assert_raise(FreezeError) { @img.x_resolution = 72.0 }
|
690
|
+
assert_raise(FreezeError) { @img.y_resolution = 72.0 }
|
691
|
+
end
|
692
|
+
end # class Image_Attributes_UT
|
693
|
+
|
694
|
+
if __FILE__ == $PROGRAM_NAME
|
695
|
+
FLOWER_HAT = '../doc/ex/images/Flower_Hat.jpg'
|
696
|
+
Test::Unit::UI::Console::TestRunner.run(Image_Attributes_UT) unless RUBY_VERSION[/^1\.9|^2/]
|
697
|
+
end
|