rmagick 2.16.0 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.devcontainer/Dockerfile +14 -0
- data/.devcontainer/ImageMagick6/devcontainer.json +11 -0
- data/.devcontainer/devcontainer.json +11 -0
- data/.devcontainer/setup-repo.sh +10 -0
- data/.devcontainer/setup-user.sh +45 -0
- data/.editorconfig +3 -0
- data/.github/ISSUE_TEMPLATE.md +17 -0
- data/.github/workflows/ci.yml +138 -0
- data/.gitignore +7 -1
- data/.rspec +1 -0
- data/.rubocop.yml +37 -340
- data/.rubocop_todo.yml +448 -0
- data/.yardopts +5 -0
- data/CHANGELOG.md +455 -0
- data/CODE_OF_CONDUCT.md +122 -7
- data/CONTRIBUTING.md +37 -6
- data/Gemfile +0 -6
- data/README.md +316 -0
- data/Rakefile +74 -100
- data/before_install_linux.sh +65 -28
- data/before_install_osx.sh +58 -2
- data/ext/RMagick/extconf.rb +287 -393
- data/ext/RMagick/rmagick.c +106 -111
- data/ext/RMagick/rmagick.h +235 -331
- data/ext/RMagick/rmagick_gvl.h +224 -0
- data/ext/RMagick/rmdraw.c +516 -843
- data/ext/RMagick/rmenum.c +316 -755
- data/ext/RMagick/rmfill.c +281 -191
- data/ext/RMagick/rmilist.c +451 -456
- data/ext/RMagick/rmimage.c +6250 -5290
- data/ext/RMagick/rminfo.c +721 -894
- data/ext/RMagick/rmkinfo.c +228 -0
- data/ext/RMagick/rmmain.c +735 -521
- data/ext/RMagick/rmmontage.c +127 -172
- data/ext/RMagick/rmpixel.c +638 -431
- data/ext/RMagick/rmstruct.c +102 -282
- data/ext/RMagick/rmutil.c +450 -363
- data/lib/rmagick/version.rb +5 -4
- data/lib/rmagick.rb +2 -0
- data/lib/rmagick_internal.rb +349 -413
- data/lib/rvg/clippath.rb +3 -4
- data/lib/rvg/container.rb +30 -22
- data/lib/rvg/deep_equal.rb +11 -11
- data/lib/rvg/describable.rb +2 -2
- data/lib/rvg/embellishable.rb +63 -68
- data/lib/rvg/misc.rb +136 -139
- data/lib/rvg/paint.rb +2 -1
- data/lib/rvg/pathdata.rb +7 -8
- data/lib/rvg/rvg.rb +47 -46
- data/lib/rvg/stretchable.rb +22 -28
- data/lib/rvg/stylable.rb +12 -10
- data/lib/rvg/text.rb +169 -165
- data/lib/rvg/transformable.rb +17 -16
- data/lib/rvg/units.rb +5 -5
- data/rmagick.gemspec +16 -39
- metadata +114 -392
- data/.hound.yml +0 -2
- data/.simplecov +0 -27
- data/.travis.yml +0 -74
- data/Doxyfile +0 -1514
- data/README.textile +0 -251
- data/deprecated/RMagick.rb +0 -6
- data/doc/.cvsignore +0 -1
- data/doc/comtasks.html +0 -287
- data/doc/constants.html +0 -1581
- data/doc/css/doc.css +0 -299
- data/doc/css/popup.css +0 -34
- data/doc/css/ref.css +0 -67
- data/doc/draw.html +0 -3272
- data/doc/ex/InitialCoords.rb +0 -22
- data/doc/ex/NewCoordSys.rb +0 -30
- data/doc/ex/OrigCoordSys.rb +0 -16
- data/doc/ex/PreserveAspectRatio.rb +0 -204
- data/doc/ex/RotateScale.rb +0 -36
- data/doc/ex/Skew.rb +0 -38
- data/doc/ex/Use01.rb +0 -15
- data/doc/ex/Use02.rb +0 -20
- data/doc/ex/Use03.rb +0 -16
- data/doc/ex/ViewBox.rb +0 -31
- data/doc/ex/adaptive_threshold.rb +0 -9
- data/doc/ex/add_noise.rb +0 -16
- data/doc/ex/affine.rb +0 -48
- data/doc/ex/affine_transform.rb +0 -20
- data/doc/ex/arc.rb +0 -49
- data/doc/ex/arcpath.rb +0 -32
- data/doc/ex/arcs01.rb +0 -28
- data/doc/ex/arcs02.rb +0 -59
- data/doc/ex/average.rb +0 -15
- data/doc/ex/axes.rb +0 -64
- data/doc/ex/baseline_shift01.rb +0 -17
- data/doc/ex/bilevel_channel.rb +0 -8
- data/doc/ex/blur_image.rb +0 -12
- data/doc/ex/border.rb +0 -10
- data/doc/ex/bounding_box.rb +0 -42
- data/doc/ex/cbezier1.rb +0 -41
- data/doc/ex/cbezier2.rb +0 -41
- data/doc/ex/cbezier3.rb +0 -41
- data/doc/ex/cbezier4.rb +0 -42
- data/doc/ex/cbezier5.rb +0 -42
- data/doc/ex/cbezier6.rb +0 -53
- data/doc/ex/channel.rb +0 -25
- data/doc/ex/charcoal.rb +0 -12
- data/doc/ex/chop.rb +0 -29
- data/doc/ex/circle.rb +0 -33
- data/doc/ex/circle01.rb +0 -16
- data/doc/ex/clip_path.rb +0 -60
- data/doc/ex/coalesce.rb +0 -57
- data/doc/ex/color_fill_to_border.rb +0 -29
- data/doc/ex/color_floodfill.rb +0 -28
- data/doc/ex/color_histogram.rb +0 -47
- data/doc/ex/color_reset.rb +0 -11
- data/doc/ex/colorize.rb +0 -16
- data/doc/ex/colors.rb +0 -64
- data/doc/ex/compose_mask.rb +0 -22
- data/doc/ex/composite.rb +0 -133
- data/doc/ex/composite_layers.rb +0 -53
- data/doc/ex/composite_tiled.rb +0 -21
- data/doc/ex/contrast.rb +0 -36
- data/doc/ex/crop.rb +0 -31
- data/doc/ex/crop_with_gravity.rb +0 -42
- data/doc/ex/cubic01.rb +0 -43
- data/doc/ex/cubic02.rb +0 -91
- data/doc/ex/cycle_colormap.rb +0 -21
- data/doc/ex/dissolve.rb +0 -12
- data/doc/ex/drawcomp.rb +0 -42
- data/doc/ex/drop_shadow.rb +0 -60
- data/doc/ex/edge.rb +0 -11
- data/doc/ex/ellipse.rb +0 -45
- data/doc/ex/ellipse01.rb +0 -21
- data/doc/ex/emboss.rb +0 -11
- data/doc/ex/enhance.rb +0 -28
- data/doc/ex/equalize.rb +0 -11
- data/doc/ex/evenodd.rb +0 -42
- data/doc/ex/fill_pattern.rb +0 -23
- data/doc/ex/flatten_images.rb +0 -36
- data/doc/ex/flip.rb +0 -11
- data/doc/ex/flop.rb +0 -11
- data/doc/ex/font_styles.rb +0 -32
- data/doc/ex/fonts.rb +0 -20
- data/doc/ex/frame.rb +0 -12
- data/doc/ex/gaussian_blur.rb +0 -11
- data/doc/ex/get_multiline_type_metrics.rb +0 -41
- data/doc/ex/get_pixels.rb +0 -47
- data/doc/ex/get_type_metrics.rb +0 -141
- data/doc/ex/gradientfill.rb +0 -27
- data/doc/ex/grav.rb +0 -45
- data/doc/ex/gravity.rb +0 -80
- data/doc/ex/group.rb +0 -26
- data/doc/ex/hatchfill.rb +0 -27
- data/doc/ex/image.rb +0 -44
- 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 +0 -34
- data/doc/ex/level.rb +0 -11
- data/doc/ex/level_colors.rb +0 -11
- data/doc/ex/line.rb +0 -41
- data/doc/ex/line01.rb +0 -21
- data/doc/ex/mask.rb +0 -35
- data/doc/ex/matte_fill_to_border.rb +0 -39
- data/doc/ex/matte_floodfill.rb +0 -32
- data/doc/ex/matte_replace.rb +0 -39
- data/doc/ex/median_filter.rb +0 -28
- data/doc/ex/modulate.rb +0 -11
- data/doc/ex/mono.rb +0 -23
- data/doc/ex/morph.rb +0 -25
- data/doc/ex/mosaic.rb +0 -35
- data/doc/ex/motion_blur.rb +0 -11
- data/doc/ex/negate.rb +0 -11
- data/doc/ex/negate_channel.rb +0 -9
- data/doc/ex/nested_rvg.rb +0 -21
- data/doc/ex/nonzero.rb +0 -42
- data/doc/ex/normalize.rb +0 -11
- data/doc/ex/oil_paint.rb +0 -11
- data/doc/ex/opacity.rb +0 -37
- data/doc/ex/ordered_dither.rb +0 -11
- data/doc/ex/path.rb +0 -63
- data/doc/ex/pattern1.rb +0 -25
- data/doc/ex/pattern2.rb +0 -26
- data/doc/ex/polaroid.rb +0 -27
- data/doc/ex/polygon.rb +0 -23
- data/doc/ex/polygon01.rb +0 -21
- data/doc/ex/polyline.rb +0 -22
- data/doc/ex/polyline01.rb +0 -21
- data/doc/ex/posterize.rb +0 -8
- data/doc/ex/preview.rb +0 -8
- data/doc/ex/qbezierpath.rb +0 -52
- data/doc/ex/quad01.rb +0 -34
- data/doc/ex/quantize-m.rb +0 -25
- data/doc/ex/radial_blur.rb +0 -9
- data/doc/ex/raise.rb +0 -8
- data/doc/ex/random_threshold_channel.rb +0 -13
- data/doc/ex/rect01.rb +0 -14
- data/doc/ex/rect02.rb +0 -20
- data/doc/ex/rectangle.rb +0 -34
- data/doc/ex/reduce_noise.rb +0 -28
- data/doc/ex/remap.rb +0 -11
- data/doc/ex/remap_images.rb +0 -19
- data/doc/ex/resize_to_fill.rb +0 -8
- data/doc/ex/resize_to_fit.rb +0 -8
- data/doc/ex/roll.rb +0 -9
- data/doc/ex/rotate.rb +0 -44
- data/doc/ex/rotate_f.rb +0 -14
- data/doc/ex/roundrect.rb +0 -33
- data/doc/ex/rubyname.rb +0 -30
- data/doc/ex/rvg_clippath.rb +0 -12
- data/doc/ex/rvg_linecap.rb +0 -42
- data/doc/ex/rvg_linejoin.rb +0 -40
- data/doc/ex/rvg_opacity.rb +0 -18
- data/doc/ex/rvg_pattern.rb +0 -26
- data/doc/ex/rvg_stroke_dasharray.rb +0 -11
- data/doc/ex/segment.rb +0 -11
- data/doc/ex/sepiatone.rb +0 -7
- data/doc/ex/shade.rb +0 -11
- data/doc/ex/shadow.rb +0 -30
- data/doc/ex/shave.rb +0 -15
- data/doc/ex/shear.rb +0 -10
- data/doc/ex/sketch.rb +0 -17
- data/doc/ex/skewx.rb +0 -51
- data/doc/ex/skewy.rb +0 -47
- data/doc/ex/smile.rb +0 -125
- data/doc/ex/solarize.rb +0 -11
- data/doc/ex/sparse_color.rb +0 -54
- data/doc/ex/splice.rb +0 -8
- data/doc/ex/spread.rb +0 -11
- data/doc/ex/stegano.rb +0 -55
- data/doc/ex/stroke_dasharray.rb +0 -42
- data/doc/ex/stroke_fill.rb +0 -10
- data/doc/ex/stroke_linecap.rb +0 -44
- data/doc/ex/stroke_linejoin.rb +0 -48
- data/doc/ex/stroke_width.rb +0 -49
- data/doc/ex/swirl.rb +0 -17
- data/doc/ex/text.rb +0 -37
- data/doc/ex/text01.rb +0 -16
- data/doc/ex/text_align.rb +0 -36
- data/doc/ex/text_antialias.rb +0 -37
- data/doc/ex/text_styles.rb +0 -19
- data/doc/ex/text_undercolor.rb +0 -28
- data/doc/ex/texture_fill_to_border.rb +0 -34
- data/doc/ex/texture_floodfill.rb +0 -32
- data/doc/ex/texturefill.rb +0 -24
- data/doc/ex/threshold.rb +0 -13
- data/doc/ex/to_blob.rb +0 -13
- data/doc/ex/translate.rb +0 -39
- data/doc/ex/transparent.rb +0 -38
- data/doc/ex/transpose.rb +0 -9
- data/doc/ex/transverse.rb +0 -9
- data/doc/ex/tref01.rb +0 -24
- data/doc/ex/triangle01.rb +0 -15
- data/doc/ex/trim.rb +0 -23
- data/doc/ex/tspan01.rb +0 -17
- data/doc/ex/tspan02.rb +0 -17
- data/doc/ex/tspan03.rb +0 -19
- data/doc/ex/unsharp_mask.rb +0 -28
- data/doc/ex/viewex.rb +0 -33
- data/doc/ex/vignette.rb +0 -12
- data/doc/ex/watermark.rb +0 -27
- data/doc/ex/wave.rb +0 -9
- data/doc/ex/wet_floor.rb +0 -58
- data/doc/ex/writing_mode01.rb +0 -26
- data/doc/ex/writing_mode02.rb +0 -26
- data/doc/ilist.html +0 -2056
- data/doc/image1.html +0 -4680
- data/doc/image2.html +0 -3665
- data/doc/image3.html +0 -4522
- data/doc/imageattrs.html +0 -1638
- data/doc/imusage.html +0 -514
- data/doc/index.html +0 -416
- data/doc/info.html +0 -1499
- data/doc/magick.html +0 -565
- data/doc/optequiv.html +0 -2435
- data/doc/rvg.html +0 -975
- data/doc/rvgclip.html +0 -248
- data/doc/rvggroup.html +0 -305
- data/doc/rvgimage.html +0 -289
- data/doc/rvgpattern.html +0 -475
- data/doc/rvgshape.html +0 -406
- data/doc/rvgstyle.html +0 -270
- data/doc/rvgtext.html +0 -465
- data/doc/rvgtspan.html +0 -238
- data/doc/rvgtut.html +0 -530
- data/doc/rvguse.html +0 -145
- data/doc/rvgxform.html +0 -294
- data/doc/scripts/doc.js +0 -22
- data/doc/scripts/stripeTables.js +0 -23
- data/doc/struct.html +0 -1339
- data/doc/usage.html +0 -1621
- data/examples/constitute.rb +0 -7
- data/examples/crop_with_gravity.rb +0 -42
- data/examples/demo.rb +0 -324
- data/examples/describe.rb +0 -43
- data/examples/find_similar_region.rb +0 -34
- data/examples/histogram.rb +0 -321
- data/examples/identify.rb +0 -185
- data/examples/image_opacity.rb +0 -29
- data/examples/import_export.rb +0 -31
- data/examples/pattern_fill.rb +0 -38
- data/examples/rotating_text.rb +0 -44
- data/examples/spinner.rb +0 -49
- data/examples/thumbnail.rb +0 -64
- data/examples/vignette.rb +0 -78
- data/spec/rmagick/ImageList1_spec.rb +0 -24
- data/spec/rmagick/draw_spec.rb +0 -156
- data/spec/rmagick/image/blue_shift_spec.rb +0 -16
- data/spec/rmagick/image/composite_spec.rb +0 -140
- data/spec/rmagick/image/constitute_spec.rb +0 -15
- data/spec/rmagick/image/dispatch_spec.rb +0 -18
- data/spec/rmagick/image/from_blob_spec.rb +0 -14
- data/spec/rmagick/image/ping_spec.rb +0 -14
- data/spec/rmagick/image/properties_spec.rb +0 -29
- data/spec/spec_helper.rb +0 -4
- data/test/Image1.rb +0 -565
- data/test/Image2.rb +0 -1304
- data/test/Image3.rb +0 -1030
- data/test/ImageList1.rb +0 -806
- data/test/ImageList2.rb +0 -385
- data/test/Image_attributes.rb +0 -697
- data/test/Import_Export.rb +0 -121
- data/test/Info.rb +0 -345
- data/test/Magick.rb +0 -321
- data/test/Pixel.rb +0 -116
- data/test/Preview.rb +0 -57
- data/test/cmyk.icm +0 -0
- data/test/srgb.icm +0 -0
- data/test/test_all_basic.rb +0 -38
- data/test/tmpnam_test.rb +0 -50
- data/wercker.yml +0 -10
data/test/ImageList1.rb
DELETED
@@ -1,806 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby -w
|
2
|
-
|
3
|
-
require 'rmagick'
|
4
|
-
require 'test/unit'
|
5
|
-
require 'test/unit/ui/console/testrunner' unless RUBY_VERSION[/^1\.9|^2/]
|
6
|
-
|
7
|
-
class ImageList1_UT < Test::Unit::TestCase
|
8
|
-
def setup
|
9
|
-
@list = Magick::ImageList.new(*FILES[0..9])
|
10
|
-
@list2 = Magick::ImageList.new # intersection is 5..9
|
11
|
-
@list2 << @list[5]
|
12
|
-
@list2 << @list[6]
|
13
|
-
@list2 << @list[7]
|
14
|
-
@list2 << @list[8]
|
15
|
-
@list2 << @list[9]
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_delay
|
19
|
-
assert_nothing_raised { @list.delay }
|
20
|
-
assert_equal(0, @list.delay)
|
21
|
-
assert_nothing_raised { @list.delay = 20 }
|
22
|
-
assert_equal(20, @list.delay)
|
23
|
-
assert_raise(ArgumentError) { @list.delay = 'x' }
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_ticks_per_second
|
27
|
-
assert_nothing_raised { @list.ticks_per_second }
|
28
|
-
assert_equal(100, @list.ticks_per_second)
|
29
|
-
assert_nothing_raised { @list.ticks_per_second = 1000 }
|
30
|
-
assert_equal(1000, @list.ticks_per_second)
|
31
|
-
assert_raise(ArgumentError) { @list.ticks_per_second = 'x' }
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_iterations
|
35
|
-
assert_nothing_raised { @list.iterations }
|
36
|
-
assert_equal(1, @list.iterations)
|
37
|
-
assert_nothing_raised { @list.iterations = 20 }
|
38
|
-
assert_equal(20, @list.iterations)
|
39
|
-
assert_raise(ArgumentError) { @list.iterations = 'x' }
|
40
|
-
end
|
41
|
-
|
42
|
-
# also tests #size
|
43
|
-
def test_length
|
44
|
-
assert_nothing_raised { @list.length }
|
45
|
-
assert_equal(10, @list.length)
|
46
|
-
assert_raise(NoMethodError) { @list.length = 2 }
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_scene
|
50
|
-
assert_nothing_raised { @list.scene }
|
51
|
-
assert_equal(9, @list.scene)
|
52
|
-
assert_nothing_raised { @list.scene = 0 }
|
53
|
-
assert_equal(0, @list.scene)
|
54
|
-
assert_nothing_raised { @list.scene = 1 }
|
55
|
-
assert_equal(1, @list.scene)
|
56
|
-
assert_raise(IndexError) { @list.scene = -1 }
|
57
|
-
assert_raise(IndexError) { @list.scene = 1000 }
|
58
|
-
assert_raise(IndexError) { @list.scene = nil }
|
59
|
-
|
60
|
-
# allow nil on empty list
|
61
|
-
empty_list = Magick::ImageList.new
|
62
|
-
assert_nothing_raised { empty_list.scene = nil }
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_undef_array_methods
|
66
|
-
assert_raise(NoMethodError) { @list.assoc }
|
67
|
-
assert_raise(NoMethodError) { @list.flatten }
|
68
|
-
assert_raise(NoMethodError) { @list.flatten! }
|
69
|
-
assert_raise(NoMethodError) { @list.join }
|
70
|
-
assert_raise(NoMethodError) { @list.pack }
|
71
|
-
assert_raise(NoMethodError) { @list.rassoc }
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_all
|
75
|
-
q = nil
|
76
|
-
assert_nothing_raised { q = @list.all? { |i| i.class == Magick::Image } }
|
77
|
-
assert(q)
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_any
|
81
|
-
q = nil
|
82
|
-
assert_nothing_raised { q = @list.all? { |i| false } }
|
83
|
-
assert(!q)
|
84
|
-
assert_nothing_raised { q = @list.all? { |i| i.class == Magick::Image } }
|
85
|
-
assert(q)
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_aref
|
89
|
-
assert_nothing_raised { @list[0] }
|
90
|
-
assert_instance_of(Magick::Image, @list[0])
|
91
|
-
assert_instance_of(Magick::Image, @list[-1])
|
92
|
-
assert_instance_of(Magick::ImageList, @list[0,1])
|
93
|
-
assert_instance_of(Magick::ImageList, @list[0..2])
|
94
|
-
assert_nil(@list[20])
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_aset
|
98
|
-
img = Magick::Image.new(5,5)
|
99
|
-
assert_nothing_raised do
|
100
|
-
rv = @list[0] = img
|
101
|
-
assert_same(img, rv)
|
102
|
-
assert_same(img, @list[0])
|
103
|
-
assert_equal(0, @list.scene)
|
104
|
-
end
|
105
|
-
|
106
|
-
# replace 2 images with 1
|
107
|
-
assert_nothing_raised do
|
108
|
-
img = Magick::Image.new(5,5)
|
109
|
-
rv = @list[1,2] = img
|
110
|
-
assert_same(img, rv)
|
111
|
-
assert_equal(9, @list.length)
|
112
|
-
assert_same(img, @list[1])
|
113
|
-
assert_equal(1, @list.scene)
|
114
|
-
end
|
115
|
-
|
116
|
-
# replace 1 image with 2
|
117
|
-
assert_nothing_raised do
|
118
|
-
img = Magick::Image.new(5,5)
|
119
|
-
img2 = Magick::Image.new(5,5)
|
120
|
-
ary = [img, img2]
|
121
|
-
rv = @list[3,1] = ary
|
122
|
-
assert_same(ary, rv)
|
123
|
-
assert_equal(10, @list.length)
|
124
|
-
assert_same(img, @list[3])
|
125
|
-
assert_same(img2, @list[4])
|
126
|
-
assert_equal(4, @list.scene)
|
127
|
-
end
|
128
|
-
|
129
|
-
assert_nothing_raised do
|
130
|
-
img = Magick::Image.new(5,5)
|
131
|
-
rv = @list[5..6] = img
|
132
|
-
assert_same(img, rv)
|
133
|
-
assert_equal(9, @list.length)
|
134
|
-
assert_same(img, @list[5])
|
135
|
-
assert_equal(5, @list.scene)
|
136
|
-
end
|
137
|
-
|
138
|
-
assert_nothing_raised do
|
139
|
-
ary = [img, img]
|
140
|
-
rv = @list[7..8] = ary
|
141
|
-
assert_same(ary, rv)
|
142
|
-
assert_equal(9, @list.length)
|
143
|
-
assert_same(img, @list[7])
|
144
|
-
assert_same(img, @list[8])
|
145
|
-
assert_equal(8, @list.scene)
|
146
|
-
end
|
147
|
-
|
148
|
-
assert_nothing_raised do
|
149
|
-
rv = @list[-1] = img
|
150
|
-
assert_same(img, rv)
|
151
|
-
assert_equal(9, @list.length)
|
152
|
-
assert_same(img, @list[8])
|
153
|
-
assert_equal(8, @list.scene)
|
154
|
-
end
|
155
|
-
|
156
|
-
assert_raise(ArgumentError) { @list[0] = 1 }
|
157
|
-
assert_raise(ArgumentError) { @list[0,1] = [1,2] }
|
158
|
-
assert_raise(ArgumentError) { @list[2..3] = 'x' }
|
159
|
-
end
|
160
|
-
|
161
|
-
def test_and
|
162
|
-
@list.scene = 7
|
163
|
-
cur = @list.cur_image
|
164
|
-
assert_nothing_raised do
|
165
|
-
res = @list & @list2
|
166
|
-
assert_instance_of(Magick::ImageList, res)
|
167
|
-
assert_not_same(res, @list)
|
168
|
-
assert_not_same(res, @list2)
|
169
|
-
assert_equal(5, res.length)
|
170
|
-
assert_equal(2, res.scene)
|
171
|
-
assert_same(cur, res.cur_image)
|
172
|
-
end
|
173
|
-
|
174
|
-
# current scene not in the result, set result scene to last image in result
|
175
|
-
@list.scene = 2
|
176
|
-
assert_nothing_raised do
|
177
|
-
res = @list & @list2
|
178
|
-
assert_instance_of(Magick::ImageList, res)
|
179
|
-
assert_equal(4, res.scene)
|
180
|
-
end
|
181
|
-
|
182
|
-
assert_raise(ArgumentError) { @list & 2 }
|
183
|
-
end
|
184
|
-
|
185
|
-
def test_at
|
186
|
-
assert_nothing_raised do
|
187
|
-
cur = @list.cur_image
|
188
|
-
img = @list.at(7)
|
189
|
-
assert_same(img, @list[7])
|
190
|
-
assert_same(cur, @list.cur_image)
|
191
|
-
img = @list.at(10)
|
192
|
-
assert_nil(img)
|
193
|
-
assert_same(cur, @list.cur_image)
|
194
|
-
img = @list.at(-1)
|
195
|
-
assert_same(img, @list[9])
|
196
|
-
assert_same(cur, @list.cur_image)
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
def test_star
|
201
|
-
@list.scene = 7
|
202
|
-
cur = @list.cur_image
|
203
|
-
assert_nothing_raised do
|
204
|
-
res = @list * 2
|
205
|
-
assert_instance_of(Magick::ImageList, res)
|
206
|
-
assert_equal(20, res.length)
|
207
|
-
assert_not_same(res, @list)
|
208
|
-
assert_same(cur, res.cur_image)
|
209
|
-
end
|
210
|
-
|
211
|
-
assert_raise(ArgumentError) { @list * 'x' }
|
212
|
-
end
|
213
|
-
|
214
|
-
def test_plus
|
215
|
-
@list.scene = 7
|
216
|
-
cur = @list.cur_image
|
217
|
-
assert_nothing_raised do
|
218
|
-
res = @list + @list2
|
219
|
-
assert_instance_of(Magick::ImageList, res)
|
220
|
-
assert_equal(15, res.length)
|
221
|
-
assert_not_same(res, @list)
|
222
|
-
assert_not_same(res, @list2)
|
223
|
-
assert_same(cur, res.cur_image)
|
224
|
-
end
|
225
|
-
|
226
|
-
assert_raise(ArgumentError) { @list + [2] }
|
227
|
-
end
|
228
|
-
|
229
|
-
def test_minus
|
230
|
-
@list.scene = 0
|
231
|
-
cur = @list.cur_image
|
232
|
-
assert_nothing_raised do
|
233
|
-
res = @list - @list2
|
234
|
-
assert_instance_of(Magick::ImageList, res)
|
235
|
-
assert_equal(5, res.length)
|
236
|
-
assert_not_same(res, @list)
|
237
|
-
assert_not_same(res, @list2)
|
238
|
-
assert_same(cur, res.cur_image)
|
239
|
-
end
|
240
|
-
|
241
|
-
# current scene not in result - set result scene to last image in result
|
242
|
-
@list.scene = 7
|
243
|
-
cur = @list.cur_image
|
244
|
-
assert_nothing_raised do
|
245
|
-
res = @list - @list2
|
246
|
-
assert_instance_of(Magick::ImageList, res)
|
247
|
-
assert_equal(5, res.length)
|
248
|
-
assert_equal(4, res.scene)
|
249
|
-
end
|
250
|
-
end
|
251
|
-
|
252
|
-
def test_catenate
|
253
|
-
assert_nothing_raised do
|
254
|
-
@list2.each { |img| @list << img }
|
255
|
-
assert_equal(15, @list.length)
|
256
|
-
assert_equal(14, @list.scene)
|
257
|
-
end
|
258
|
-
|
259
|
-
assert_raise(ArgumentError) { @list << 2 }
|
260
|
-
assert_raise(ArgumentError) { @list << [2] }
|
261
|
-
end
|
262
|
-
|
263
|
-
def test_or
|
264
|
-
assert_nothing_raised do
|
265
|
-
@list.scene = 7
|
266
|
-
# The or of these two lists should be the same as @list
|
267
|
-
# but not be the *same* list
|
268
|
-
res = @list | @list2
|
269
|
-
assert_instance_of(Magick::ImageList, res)
|
270
|
-
assert_not_same(res, @list)
|
271
|
-
assert_not_same(res, @list2)
|
272
|
-
assert_equal(res, @list)
|
273
|
-
end
|
274
|
-
|
275
|
-
# Try or'ing disjoint lists
|
276
|
-
temp_list = Magick::ImageList.new(*FILES[10..14])
|
277
|
-
res = @list | temp_list
|
278
|
-
assert_instance_of(Magick::ImageList, res)
|
279
|
-
assert_equal(15, res.length)
|
280
|
-
assert_equal(7, res.scene)
|
281
|
-
|
282
|
-
assert_raise(ArgumentError) { @list | 2 }
|
283
|
-
assert_raise(ArgumentError) { @list | [2] }
|
284
|
-
end
|
285
|
-
|
286
|
-
def test_clear
|
287
|
-
assert_nothing_raised { @list.clear }
|
288
|
-
assert_instance_of(Magick::ImageList, @list)
|
289
|
-
assert_equal(0, @list.length)
|
290
|
-
assert_nil(@list.scene)
|
291
|
-
end
|
292
|
-
|
293
|
-
def test_collect
|
294
|
-
assert_nothing_raised do
|
295
|
-
cur = @list.cur_image
|
296
|
-
scene = @list.scene
|
297
|
-
res = @list.collect { |img| img.negate }
|
298
|
-
assert_instance_of(Magick::ImageList, res)
|
299
|
-
assert_not_same(res, @list)
|
300
|
-
assert_equal(scene, res.scene)
|
301
|
-
end
|
302
|
-
assert_nothing_raised do
|
303
|
-
scene = @list.scene
|
304
|
-
@list.collect! { |img| img.negate }
|
305
|
-
assert_instance_of(Magick::ImageList, @list)
|
306
|
-
assert_equal(scene, @list.scene)
|
307
|
-
end
|
308
|
-
end
|
309
|
-
|
310
|
-
def test_compact
|
311
|
-
assert_nothing_raised do
|
312
|
-
res = @list.compact
|
313
|
-
assert_not_same(res, @list)
|
314
|
-
assert_equal(res, @list)
|
315
|
-
end
|
316
|
-
assert_nothing_raised do
|
317
|
-
res = @list
|
318
|
-
@list.compact!
|
319
|
-
assert_instance_of(Magick::ImageList, @list)
|
320
|
-
assert_equal(res, @list)
|
321
|
-
assert_same(res, @list)
|
322
|
-
end
|
323
|
-
end
|
324
|
-
|
325
|
-
def test_concat
|
326
|
-
assert_nothing_raised do
|
327
|
-
res = @list.concat(@list2)
|
328
|
-
assert_instance_of(Magick::ImageList, res)
|
329
|
-
assert_equal(15, res.length)
|
330
|
-
assert_same(res[14], res.cur_image)
|
331
|
-
end
|
332
|
-
assert_raise(ArgumentError) { res = @list.concat(2) }
|
333
|
-
assert_raise(ArgumentError) { res = @list.concat([2]) }
|
334
|
-
end
|
335
|
-
|
336
|
-
def test_delete
|
337
|
-
assert_nothing_raised do
|
338
|
-
cur = @list.cur_image
|
339
|
-
img = @list[7]
|
340
|
-
assert_same(img, @list.delete(img))
|
341
|
-
assert_equal(9, @list.length)
|
342
|
-
assert_same(cur, @list.cur_image)
|
343
|
-
|
344
|
-
# Try deleting the current image.
|
345
|
-
assert_same(cur, @list.delete(cur))
|
346
|
-
assert_same(@list[-1], @list.cur_image)
|
347
|
-
|
348
|
-
assert_raise(ArgumentError) { @list.delete(2) }
|
349
|
-
assert_raise(ArgumentError) { @list.delete([2]) }
|
350
|
-
|
351
|
-
# Try deleting something that isn't in the list.
|
352
|
-
# Should return the value of the block.
|
353
|
-
assert_nothing_raised do
|
354
|
-
img = Magick::Image.read(FILES[10]).first
|
355
|
-
res = @list.delete(img) { 1 }
|
356
|
-
assert_equal(1, res)
|
357
|
-
end
|
358
|
-
end
|
359
|
-
end
|
360
|
-
|
361
|
-
def test_delete_at
|
362
|
-
@list.scene = 7
|
363
|
-
cur = @list.cur_image
|
364
|
-
assert_nothing_raised { @list.delete_at(9) }
|
365
|
-
assert_same(cur, @list.cur_image)
|
366
|
-
assert_nothing_raised { @list.delete_at(7) }
|
367
|
-
assert_same(@list[-1], @list.cur_image)
|
368
|
-
end
|
369
|
-
|
370
|
-
def test_delete_if
|
371
|
-
@list.scene = 7
|
372
|
-
cur = @list.cur_image
|
373
|
-
assert_nothing_raised do
|
374
|
-
@list.delete_if { |img| img.filename =~ /5/ }
|
375
|
-
assert_instance_of(Magick::ImageList, @list)
|
376
|
-
assert_equal(9, @list.length)
|
377
|
-
assert_same(cur, @list.cur_image)
|
378
|
-
end
|
379
|
-
|
380
|
-
# Delete the current image
|
381
|
-
assert_nothing_raised do
|
382
|
-
@list.delete_if { |img| img.filename =~ /7/ }
|
383
|
-
assert_instance_of(Magick::ImageList, @list)
|
384
|
-
assert_equal(8, @list.length)
|
385
|
-
assert_same(@list[-1], @list.cur_image)
|
386
|
-
end
|
387
|
-
end
|
388
|
-
|
389
|
-
# defined by Enumerable
|
390
|
-
def test_enumerables
|
391
|
-
assert_nothing_raised { @list.detect { true } }
|
392
|
-
assert_nothing_raised do
|
393
|
-
@list.each_with_index { |img, n| assert_instance_of(Magick::Image, img) }
|
394
|
-
end
|
395
|
-
assert_nothing_raised { @list.entries }
|
396
|
-
assert_nothing_raised { @list.include?(@list[0]) }
|
397
|
-
assert_nothing_raised { @list.inject(0) { 0 } }
|
398
|
-
assert_nothing_raised { @list.max }
|
399
|
-
assert_nothing_raised { @list.min }
|
400
|
-
assert_nothing_raised { @list.sort }
|
401
|
-
assert_nothing_raised { @list.sort_by {|img| img.signature} }
|
402
|
-
assert_nothing_raised { @list.zip }
|
403
|
-
end
|
404
|
-
|
405
|
-
def test_eql?
|
406
|
-
list2 = @list
|
407
|
-
assert(@list.eql?(list2))
|
408
|
-
list2 = @list.copy
|
409
|
-
assert(! @list.eql?(list2))
|
410
|
-
end
|
411
|
-
|
412
|
-
def test_fill
|
413
|
-
list = @list.copy
|
414
|
-
img = list[0].copy
|
415
|
-
assert_nothing_raised do
|
416
|
-
assert_instance_of(Magick::ImageList, list.fill(img))
|
417
|
-
end
|
418
|
-
list.each {|el| assert_same(el, img) }
|
419
|
-
|
420
|
-
list = @list.copy
|
421
|
-
list.fill(img, 0, 3)
|
422
|
-
0.upto(2) {|i| assert_same(img, list[i]) }
|
423
|
-
|
424
|
-
list = @list.copy
|
425
|
-
list.fill(img, 4..7)
|
426
|
-
4.upto(7) {|i| assert_same(img, list[i]) }
|
427
|
-
|
428
|
-
list = @list.copy
|
429
|
-
list.fill { |i| list[i] = img }
|
430
|
-
list.each {|el| assert_same(el, img) }
|
431
|
-
|
432
|
-
list = @list.copy
|
433
|
-
list.fill(0, 3) { |i| list[i] = img }
|
434
|
-
0.upto(2) {|i| assert_same(img, list[i]) }
|
435
|
-
|
436
|
-
assert_raise(ArgumentError) { list.fill('x', 0) }
|
437
|
-
end
|
438
|
-
|
439
|
-
def test_find
|
440
|
-
assert_nothing_raised { @list.find { true } }
|
441
|
-
end
|
442
|
-
|
443
|
-
def find_all
|
444
|
-
assert_nothing_raised do
|
445
|
-
res = @list.select { |img| img.filename =~ /Button_2/ }
|
446
|
-
assert_instance_of(Magick::ImageList, res)
|
447
|
-
assert_equal(1, res.length)
|
448
|
-
assert_same(res[0], @list[2])
|
449
|
-
end
|
450
|
-
end
|
451
|
-
|
452
|
-
def test_insert
|
453
|
-
assert_nothing_raised do
|
454
|
-
@list.scene = 7
|
455
|
-
cur = @list.cur_image
|
456
|
-
assert_instance_of(Magick::ImageList, @list.insert(1, @list[2]))
|
457
|
-
assert_same(cur, @list.cur_image)
|
458
|
-
@list.insert(1, @list[2], @list[3], @list[4])
|
459
|
-
assert_same(cur, @list.cur_image)
|
460
|
-
end
|
461
|
-
|
462
|
-
assert_raise(ArgumentError) { @list.insert(0, 'x') }
|
463
|
-
assert_raise(ArgumentError) { @list.insert(0, 'x', 'y') }
|
464
|
-
end
|
465
|
-
|
466
|
-
def test_last
|
467
|
-
img = Magick::Image.new(5,5)
|
468
|
-
@list << img
|
469
|
-
img2 = nil
|
470
|
-
assert_nothing_raised { img2 = @list.last }
|
471
|
-
assert_instance_of(Magick::Image, img2)
|
472
|
-
assert_equal(img2, img)
|
473
|
-
img2 = Magick::Image.new(5,5)
|
474
|
-
@list << img2
|
475
|
-
ilist = nil
|
476
|
-
assert_nothing_raised { ilist = @list.last(2) }
|
477
|
-
assert_instance_of(Magick::ImageList, ilist)
|
478
|
-
assert_equal(2, ilist.length)
|
479
|
-
assert_equal(1, ilist.scene)
|
480
|
-
assert_equal(img, ilist[0])
|
481
|
-
assert_equal(img2, ilist[1])
|
482
|
-
end
|
483
|
-
|
484
|
-
def test___map__
|
485
|
-
img = @list[0]
|
486
|
-
assert_nothing_raised do
|
487
|
-
@list.__map__ { |x| img }
|
488
|
-
end
|
489
|
-
assert_instance_of(Magick::ImageList, @list)
|
490
|
-
assert_raise(ArgumentError) { @list.__map__ { 2 } }
|
491
|
-
end
|
492
|
-
|
493
|
-
def test_map!
|
494
|
-
img = @list[0]
|
495
|
-
assert_nothing_raised do
|
496
|
-
@list.map! { img }
|
497
|
-
end
|
498
|
-
assert_instance_of(Magick::ImageList, @list)
|
499
|
-
assert_raise(ArgumentError) { @list.map! { 2 } }
|
500
|
-
end
|
501
|
-
|
502
|
-
unless RUBY_VERSION[/^1\.9|^2/]
|
503
|
-
def test_nitems
|
504
|
-
n = nil
|
505
|
-
assert_nothing_raised { n = @list.nitems }
|
506
|
-
assert_equal(10, n)
|
507
|
-
end
|
508
|
-
end
|
509
|
-
|
510
|
-
def test_partition
|
511
|
-
a = nil
|
512
|
-
n = -1
|
513
|
-
assert_nothing_raised { a = @list.partition { n += 1; (n&1).zero? } }
|
514
|
-
assert_instance_of(Array, a)
|
515
|
-
assert_equal(2, a.size)
|
516
|
-
assert_instance_of(Magick::ImageList, a[0])
|
517
|
-
assert_instance_of(Magick::ImageList, a[1])
|
518
|
-
assert_equal(4, a[0].scene)
|
519
|
-
assert_equal(5, a[0].length)
|
520
|
-
assert_equal(4, a[1].scene)
|
521
|
-
assert_equal(5, a[1].length)
|
522
|
-
end
|
523
|
-
|
524
|
-
def test_pop
|
525
|
-
@list.scene = 8
|
526
|
-
cur = @list.cur_image
|
527
|
-
last = @list[-1]
|
528
|
-
assert_nothing_raised do
|
529
|
-
assert_same(last, @list.pop)
|
530
|
-
assert_same(cur, @list.cur_image)
|
531
|
-
end
|
532
|
-
|
533
|
-
assert_same(cur, @list.pop)
|
534
|
-
assert_same(@list[-1], @list.cur_image)
|
535
|
-
end
|
536
|
-
|
537
|
-
def test_push
|
538
|
-
list = @list
|
539
|
-
img1 = @list[0]
|
540
|
-
img2 = @list[1]
|
541
|
-
assert_nothing_raised { @list.push(img1, img2) }
|
542
|
-
assert_same(list, @list) # push returns self
|
543
|
-
assert_same(img2, @list.cur_image)
|
544
|
-
end
|
545
|
-
|
546
|
-
def test_reject
|
547
|
-
@list.scene = 7
|
548
|
-
cur = @list.cur_image
|
549
|
-
list = @list
|
550
|
-
assert_nothing_raised do
|
551
|
-
res = @list.reject {|img| img.filename =~ /Button_9/ }
|
552
|
-
assert_equal(9, res.length)
|
553
|
-
assert_instance_of(Magick::ImageList, res)
|
554
|
-
assert_same(cur, res.cur_image)
|
555
|
-
end
|
556
|
-
assert_same(list, @list)
|
557
|
-
assert_same(cur, @list.cur_image)
|
558
|
-
|
559
|
-
# Omit current image from result list - result cur_image s/b last image
|
560
|
-
res = @list.reject {|img| img.filename =~ /Button_7/}
|
561
|
-
assert_equal(9, res.length)
|
562
|
-
assert_same(res[-1], res.cur_image)
|
563
|
-
assert_same(cur, @list.cur_image)
|
564
|
-
end
|
565
|
-
|
566
|
-
def test_reject!
|
567
|
-
@list.scene = 7
|
568
|
-
cur = @list.cur_image
|
569
|
-
assert_nothing_raised do
|
570
|
-
@list.reject! { |img| img.filename =~ /5/ }
|
571
|
-
assert_instance_of(Magick::ImageList, @list)
|
572
|
-
assert_equal(9, @list.length)
|
573
|
-
assert_same(cur, @list.cur_image)
|
574
|
-
end
|
575
|
-
|
576
|
-
# Delete the current image
|
577
|
-
assert_nothing_raised do
|
578
|
-
@list.reject! { |img| img.filename =~ /7/ }
|
579
|
-
assert_instance_of(Magick::ImageList, @list)
|
580
|
-
assert_equal(8, @list.length)
|
581
|
-
assert_same(@list[-1], @list.cur_image)
|
582
|
-
end
|
583
|
-
|
584
|
-
# returns nil if no changes are made
|
585
|
-
assert_nil(@list.reject! { false })
|
586
|
-
end
|
587
|
-
|
588
|
-
def test_replace1
|
589
|
-
# Replace with empty list
|
590
|
-
assert_nothing_raised do
|
591
|
-
res = @list.replace([])
|
592
|
-
assert_same(res, @list)
|
593
|
-
assert_equal(0, @list.length)
|
594
|
-
assert_nil(@list.scene)
|
595
|
-
end
|
596
|
-
|
597
|
-
# Replace empty list with non-empty list
|
598
|
-
temp = Magick::ImageList.new
|
599
|
-
assert_nothing_raised do
|
600
|
-
temp.replace(@list2)
|
601
|
-
assert_equal(5, temp.length)
|
602
|
-
assert_equal(4, temp.scene)
|
603
|
-
end
|
604
|
-
|
605
|
-
# Try to replace with illegal values
|
606
|
-
assert_raise(ArgumentError) { @list.replace([1, 2, 3]) }
|
607
|
-
end
|
608
|
-
|
609
|
-
def test_replace2
|
610
|
-
# Replace with shorter list
|
611
|
-
assert_nothing_raised do
|
612
|
-
@list.scene = 7
|
613
|
-
cur = @list.cur_image
|
614
|
-
res = @list.replace(@list2)
|
615
|
-
assert_same(res, @list)
|
616
|
-
assert_equal(5, @list.length)
|
617
|
-
assert_equal(2, @list.scene)
|
618
|
-
assert_same(cur, @list.cur_image)
|
619
|
-
end
|
620
|
-
end
|
621
|
-
|
622
|
-
def test_replace3
|
623
|
-
# Replace with longer list
|
624
|
-
assert_nothing_raised do
|
625
|
-
@list2.scene = 2
|
626
|
-
cur = @list2.cur_image
|
627
|
-
res = @list2.replace(@list)
|
628
|
-
assert_same(res, @list2)
|
629
|
-
assert_equal(10, @list2.length)
|
630
|
-
assert_equal(7, @list2.scene)
|
631
|
-
assert_same(cur, @list2.cur_image)
|
632
|
-
end
|
633
|
-
end
|
634
|
-
|
635
|
-
def test_reverse
|
636
|
-
list = nil
|
637
|
-
cur = @list.cur_image
|
638
|
-
assert_nothing_raised { list = @list.reverse }
|
639
|
-
assert_equal(list.length, @list.length)
|
640
|
-
assert_same(cur, @list.cur_image)
|
641
|
-
end
|
642
|
-
|
643
|
-
def test_reverse!
|
644
|
-
list = @list
|
645
|
-
cur = @list.cur_image
|
646
|
-
assert_nothing_raised { @list.reverse! }
|
647
|
-
assert_same(list, @list)
|
648
|
-
assert_same(cur, @list.cur_image)
|
649
|
-
end
|
650
|
-
|
651
|
-
# Just validate its existence
|
652
|
-
def test_reverse_each
|
653
|
-
assert_nothing_raised do
|
654
|
-
@list.reverse_each { |img| assert_instance_of(Magick::Image, img) }
|
655
|
-
end
|
656
|
-
end
|
657
|
-
|
658
|
-
def test_rindex
|
659
|
-
img = @list.last
|
660
|
-
n = nil
|
661
|
-
assert_nothing_raised { n = @list.rindex(img) }
|
662
|
-
assert_equal(9, n)
|
663
|
-
end
|
664
|
-
|
665
|
-
def test_select
|
666
|
-
assert_nothing_raised do
|
667
|
-
res = @list.select { |img| img.filename =~ /Button_2/ }
|
668
|
-
assert_instance_of(Magick::ImageList, res)
|
669
|
-
assert_equal(1, res.length)
|
670
|
-
assert_same(res[0], @list[2])
|
671
|
-
end
|
672
|
-
end
|
673
|
-
|
674
|
-
def test_shift
|
675
|
-
assert_nothing_raised do
|
676
|
-
@list.scene = 0
|
677
|
-
res = @list[0]
|
678
|
-
img = @list.shift
|
679
|
-
assert_same(res, img)
|
680
|
-
assert_equal(8, @list.scene)
|
681
|
-
end
|
682
|
-
res = @list[0]
|
683
|
-
img = @list.shift
|
684
|
-
assert_same(res, img)
|
685
|
-
assert_equal(7, @list.scene)
|
686
|
-
end
|
687
|
-
|
688
|
-
def test_slice
|
689
|
-
assert_nothing_raised { @list.slice(0) }
|
690
|
-
assert_nothing_raised { @list.slice(-1) }
|
691
|
-
assert_nothing_raised { @list.slice(0,1) }
|
692
|
-
assert_nothing_raised { @list.slice(0..2) }
|
693
|
-
assert_nothing_raised { @list.slice(20) }
|
694
|
-
end
|
695
|
-
|
696
|
-
def test_slice!
|
697
|
-
@list.scene = 7
|
698
|
-
assert_nothing_raised do
|
699
|
-
img0 = @list[0]
|
700
|
-
img = @list.slice!(0)
|
701
|
-
assert_same(img0, img)
|
702
|
-
assert_equal(9, @list.length)
|
703
|
-
assert_equal(6, @list.scene)
|
704
|
-
end
|
705
|
-
cur = @list.cur_image
|
706
|
-
img = @list.slice!(6)
|
707
|
-
assert_same(cur, img)
|
708
|
-
assert_equal(8, @list.length)
|
709
|
-
assert_equal(7, @list.scene)
|
710
|
-
assert_nothing_raised { @list.slice!(-1) }
|
711
|
-
assert_nothing_raised { @list.slice!(0,1) }
|
712
|
-
assert_nothing_raised { @list.slice!(0..2) }
|
713
|
-
assert_nothing_raised { @list.slice!(20) }
|
714
|
-
end
|
715
|
-
|
716
|
-
# simply ensure existence
|
717
|
-
def test_sort
|
718
|
-
assert_nothing_raised { @list.sort }
|
719
|
-
assert_nothing_raised { @list.sort! }
|
720
|
-
end
|
721
|
-
|
722
|
-
def test_to_a
|
723
|
-
a = nil
|
724
|
-
assert_nothing_raised { a = @list.to_a }
|
725
|
-
assert_instance_of(Array, a)
|
726
|
-
assert_equal(10, a.length)
|
727
|
-
end
|
728
|
-
|
729
|
-
def test_uniq
|
730
|
-
assert_nothing_raised { @list.uniq }
|
731
|
-
assert_instance_of(Magick::ImageList, @list.uniq)
|
732
|
-
@list[1] = @list[0]
|
733
|
-
@list.scene = 7
|
734
|
-
list = @list.uniq
|
735
|
-
assert_equal(9, list.length)
|
736
|
-
assert_equal(6, list.scene)
|
737
|
-
assert_equal(7, @list.scene)
|
738
|
-
@list[6] = @list[7]
|
739
|
-
list = @list.uniq
|
740
|
-
assert_equal(8, list.length)
|
741
|
-
assert_equal(5, list.scene)
|
742
|
-
assert_equal(7, @list.scene)
|
743
|
-
end
|
744
|
-
|
745
|
-
def test_uniq!
|
746
|
-
assert_nothing_raised do
|
747
|
-
assert_nil(@list.uniq!)
|
748
|
-
end
|
749
|
-
@list[1] = @list[0]
|
750
|
-
@list.scene = 7
|
751
|
-
cur = @list.cur_image
|
752
|
-
list = @list
|
753
|
-
@list.uniq!
|
754
|
-
assert_same(list, @list)
|
755
|
-
assert_same(cur, @list.cur_image)
|
756
|
-
assert_equal(6, @list.scene)
|
757
|
-
@list[5] = @list[6]
|
758
|
-
@list.uniq!
|
759
|
-
assert_same(cur, @list.cur_image)
|
760
|
-
assert_equal(5, @list.scene)
|
761
|
-
end
|
762
|
-
|
763
|
-
def test_unshift
|
764
|
-
img = @list[9]
|
765
|
-
@list.scene = 7
|
766
|
-
@list.unshift(img)
|
767
|
-
assert_equal(0, @list.scene)
|
768
|
-
assert_raise(ArgumentError) { @list.unshift(2) }
|
769
|
-
assert_raise(ArgumentError) { @list.unshift([1,2]) }
|
770
|
-
end
|
771
|
-
|
772
|
-
def test_values_at
|
773
|
-
ilist = nil
|
774
|
-
assert_nothing_raised { ilist = @list.values_at(1,3,5) }
|
775
|
-
assert_instance_of(Magick::ImageList, ilist)
|
776
|
-
assert_equal(3, ilist.length)
|
777
|
-
assert_equal(2, ilist.scene)
|
778
|
-
end
|
779
|
-
|
780
|
-
def test_spaceship
|
781
|
-
list2 = @list.copy
|
782
|
-
assert_equal(@list.scene, list2.scene)
|
783
|
-
assert_equal(@list, list2)
|
784
|
-
list2.scene = 0
|
785
|
-
assert_not_equal(@list, list2)
|
786
|
-
list2 = @list.copy
|
787
|
-
list2[9] = list2[0]
|
788
|
-
assert_not_equal(@list, list2)
|
789
|
-
list2 = @list.copy
|
790
|
-
list2 << @list[9]
|
791
|
-
assert_not_equal(@list, list2)
|
792
|
-
|
793
|
-
assert_raise(TypeError) { @list <=> 2 }
|
794
|
-
list = Magick::ImageList.new
|
795
|
-
list2 = Magick::ImageList.new
|
796
|
-
assert_raise(TypeError) { list2 <=> @list }
|
797
|
-
assert_raise(TypeError) { @list <=> list2 }
|
798
|
-
assert_nothing_raised(TypeError) { list <=> list2 }
|
799
|
-
end
|
800
|
-
end
|
801
|
-
|
802
|
-
if __FILE__ == $PROGRAM_NAME
|
803
|
-
IMAGES_DIR = '../doc/ex/images'
|
804
|
-
FILES = Dir[IMAGES_DIR+'/Button_*.gif'].sort
|
805
|
-
Test::Unit::UI::Console::TestRunner.run(ImageList1_UT) unless RUBY_VERSION[/^1\.9|^2/]
|
806
|
-
end
|