rmagick 3.2.0 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rmagick might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.codeclimate.yml +63 -0
- 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 +79 -0
- data/.gitignore +3 -1
- data/.rspec +1 -0
- data/.rubocop.yml +24 -0
- data/.rubocop_todo.yml +151 -297
- data/.yardopts +5 -0
- data/CHANGELOG.md +233 -0
- data/CODE_OF_CONDUCT.md +122 -7
- data/CONTRIBUTING.md +14 -10
- data/README.md +326 -0
- data/Rakefile +16 -22
- data/before_install_linux.sh +22 -28
- data/before_install_osx.sh +57 -2
- data/ext/RMagick/extconf.rb +149 -105
- data/ext/RMagick/rmagick.c +77 -104
- data/ext/RMagick/rmagick.h +121 -103
- data/ext/RMagick/rmdraw.c +364 -436
- data/ext/RMagick/rmenum.c +106 -114
- data/ext/RMagick/rmfill.c +149 -70
- data/ext/RMagick/rmilist.c +225 -367
- data/ext/RMagick/rmimage.c +4751 -4405
- data/ext/RMagick/rminfo.c +574 -787
- data/ext/RMagick/rmkinfo.c +51 -121
- data/ext/RMagick/rmmain.c +454 -286
- data/ext/RMagick/rmmontage.c +64 -130
- data/ext/RMagick/rmpixel.c +488 -437
- data/ext/RMagick/rmstruct.c +83 -96
- data/ext/RMagick/rmutil.c +302 -214
- data/lib/rmagick/version.rb +1 -1
- data/lib/rmagick_internal.rb +138 -93
- data/lib/rvg/clippath.rb +2 -1
- data/lib/rvg/container.rb +10 -5
- data/lib/rvg/describable.rb +1 -1
- data/lib/rvg/embellishable.rb +5 -4
- data/lib/rvg/misc.rb +15 -12
- data/lib/rvg/paint.rb +2 -1
- data/lib/rvg/pathdata.rb +12 -11
- data/lib/rvg/rvg.rb +12 -8
- data/lib/rvg/stylable.rb +9 -7
- data/lib/rvg/text.rb +11 -6
- data/lib/rvg/transformable.rb +3 -2
- data/lib/rvg/units.rb +1 -1
- data/rmagick.gemspec +10 -11
- metadata +52 -423
- data/.appveyor.yml +0 -45
- data/.circleci/config.yml +0 -56
- data/.ruby-version +0 -1
- data/.simplecov +0 -27
- data/.travis.yml +0 -62
- data/Doxyfile +0 -1514
- data/README.textile +0 -259
- data/benchmarks/memory/README.md +0 -50
- data/benchmarks/memory/image_new.rb +0 -8
- data/benchmarks/memory/rmagick.gnuplot +0 -16
- 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 -52
- 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 -41
- 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 -16
- 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 -45
- data/doc/ex/get_type_metrics.rb +0 -142
- data/doc/ex/gradientfill.rb +0 -27
- data/doc/ex/grav.rb +0 -45
- data/doc/ex/gravity.rb +0 -78
- 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.png +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.png +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.png +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 -37
- 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 -26
- 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 -126
- data/doc/ex/solarize.rb +0 -11
- data/doc/ex/sparse_color.rb +0 -55
- data/doc/ex/splice.rb +0 -8
- data/doc/ex/spread.rb +0 -11
- data/doc/ex/stegano.rb +0 -54
- 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 -570
- 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 -323
- data/examples/describe.rb +0 -41
- data/examples/find_similar_region.rb +0 -34
- data/examples/histogram.rb +0 -312
- data/examples/identify.rb +0 -174
- data/examples/image_opacity.rb +0 -28
- data/examples/import_export.rb +0 -31
- data/examples/pattern_fill.rb +0 -37
- data/examples/rotating_text.rb +0 -45
- data/examples/spinner.rb +0 -49
- data/examples/thumbnail.rb +0 -64
- data/examples/vignette.rb +0 -78
- data/lib/obsolete.rb +0 -66
- data/spec/rmagick/ImageList1_spec.rb +0 -24
- data/spec/rmagick/draw_spec.rb +0 -155
- data/spec/rmagick/image/blue_shift_spec.rb +0 -14
- data/spec/rmagick/image/channel_entropy_spec.rb +0 -9
- data/spec/rmagick/image/composite_spec.rb +0 -72
- data/spec/rmagick/image/constitute_spec.rb +0 -13
- data/spec/rmagick/image/dispatch_spec.rb +0 -16
- data/spec/rmagick/image/from_blob_spec.rb +0 -12
- data/spec/rmagick/image/ping_spec.rb +0 -12
- data/spec/rmagick/image/properties_spec.rb +0 -27
- data/spec/rmagick/image/read_spec.rb +0 -28
- data/spec/spec_helper.rb +0 -10
- data/spec/support/issue_200/app.rb +0 -8
- data/test/Draw.rb +0 -351
- data/test/Enum.rb +0 -228
- data/test/Fill.rb +0 -93
- data/test/Image1.rb +0 -627
- data/test/Image2.rb +0 -1426
- data/test/Image3.rb +0 -1091
- data/test/ImageList1.rb +0 -858
- data/test/ImageList2.rb +0 -406
- data/test/Image_attributes.rb +0 -666
- data/test/Import_Export.rb +0 -115
- data/test/Info.rb +0 -444
- data/test/KernelInfo.rb +0 -67
- data/test/Magick.rb +0 -311
- data/test/Pixel.rb +0 -285
- data/test/PolaroidOptions.rb +0 -23
- data/test/Preview.rb +0 -26
- data/test/Struct.rb +0 -45
- data/test/appearance/Montage.rb +0 -26
- data/test/appearance/appearance_assertion.rb +0 -13
- data/test/appearance/expected/montage_border_color.jpg +0 -0
- data/test/cmyk.icm +0 -0
- data/test/lib/Obsolete.rb +0 -30
- data/test/lib/internal/Draw.rb +0 -823
- data/test/lib/internal/Geometry.rb +0 -98
- data/test/lib/internal/Magick.rb +0 -40
- data/test/srgb.icm +0 -0
- data/test/test_all_basic.rb +0 -49
- data/test/tmpnam_test.rb +0 -50
data/test/lib/internal/Draw.rb
DELETED
@@ -1,823 +0,0 @@
|
|
1
|
-
require 'rmagick'
|
2
|
-
require 'test/unit'
|
3
|
-
require 'test/unit/ui/console/testrunner'
|
4
|
-
|
5
|
-
class LibDrawUT < Test::Unit::TestCase
|
6
|
-
def setup
|
7
|
-
@draw = Magick::Draw.new
|
8
|
-
@img = Magick::Image.new(200, 200)
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_affine
|
12
|
-
@draw.affine(10.5, 12, 15, 20, 22, 25)
|
13
|
-
assert_equal('affine 10.5,12,15,20,22,25', @draw.inspect)
|
14
|
-
assert_nothing_raised { @draw.draw(@img) }
|
15
|
-
|
16
|
-
assert_raise(ArgumentError) { @draw.affine('x', 12, 15, 20, 22, 25) }
|
17
|
-
assert_raise(ArgumentError) { @draw.affine(10, 'x', 15, 20, 22, 25) }
|
18
|
-
assert_raise(ArgumentError) { @draw.affine(10, 12, 'x', 20, 22, 25) }
|
19
|
-
assert_raise(ArgumentError) { @draw.affine(10, 12, 15, 'x', 22, 25) }
|
20
|
-
assert_raise(ArgumentError) { @draw.affine(10, 12, 15, 20, 'x', 25) }
|
21
|
-
assert_raise(ArgumentError) { @draw.affine(10, 12, 15, 20, 22, 'x') }
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_alpha
|
25
|
-
Magick::PaintMethod.values do |method|
|
26
|
-
draw = Magick::Draw.new
|
27
|
-
draw.alpha(10, '20.5', method)
|
28
|
-
assert_nothing_raised { draw.draw(@img) }
|
29
|
-
end
|
30
|
-
|
31
|
-
assert_raise(ArgumentError) { @draw.alpha(10, '20.5', 'xxx') }
|
32
|
-
assert_raise(ArgumentError) { @draw.alpha('x', 10, Magick::PointMethod) }
|
33
|
-
assert_raise(ArgumentError) { @draw.alpha(10, 'x', Magick::PointMethod) }
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_arc
|
37
|
-
@draw.arc(100.5, 120.5, 200, 250, 20, 370)
|
38
|
-
assert_equal('arc 100.5,120.5 200,250 20,370', @draw.inspect)
|
39
|
-
assert_nothing_raised { @draw.draw(@img) }
|
40
|
-
|
41
|
-
assert_raise(ArgumentError) { @draw.arc('x', 120.5, 200, 250, 20, 370) }
|
42
|
-
assert_raise(ArgumentError) { @draw.arc(100.5, 'x', 200, 250, 20, 370) }
|
43
|
-
assert_raise(ArgumentError) { @draw.arc(100.5, 120.5, 'x', 250, 20, 370) }
|
44
|
-
assert_raise(ArgumentError) { @draw.arc(100.5, 120.5, 200, 'x', 20, 370) }
|
45
|
-
assert_raise(ArgumentError) { @draw.arc(100.5, 120.5, 200, 250, 'x', 370) }
|
46
|
-
assert_raise(ArgumentError) { @draw.arc(100.5, 120.5, 200, 250, 20, 'x') }
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_bezier
|
50
|
-
@draw.bezier(10, '20', '20.5', 30, 40.5, 50)
|
51
|
-
assert_equal('bezier 10,20,20.5,30,40.5,50', @draw.inspect)
|
52
|
-
assert_nothing_raised { @draw.draw(@img) }
|
53
|
-
|
54
|
-
assert_raise(ArgumentError) { @draw.bezier }
|
55
|
-
assert_raise(ArgumentError) { @draw.bezier(1) }
|
56
|
-
assert_raise(ArgumentError) { @draw.bezier('x', 20, 30, 40.5) }
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_circle
|
60
|
-
@draw.circle(10, '20.5', 30, 40.5)
|
61
|
-
assert_equal('circle 10,20.5 30,40.5', @draw.inspect)
|
62
|
-
assert_nothing_raised { @draw.draw(@img) }
|
63
|
-
|
64
|
-
assert_raise(ArgumentError) { @draw.circle('x', 20, 30, 40) }
|
65
|
-
assert_raise(ArgumentError) { @draw.circle(10, 'x', 30, 40) }
|
66
|
-
assert_raise(ArgumentError) { @draw.circle(10, 20, 'x', 40) }
|
67
|
-
assert_raise(ArgumentError) { @draw.circle(10, 20, 30, 'x') }
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_clip_path
|
71
|
-
@draw.clip_path('test')
|
72
|
-
assert_equal('clip-path test', @draw.inspect)
|
73
|
-
assert_nothing_raised { @draw.draw(@img) }
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_clip_rule
|
77
|
-
draw = Magick::Draw.new
|
78
|
-
draw.clip_rule('evenodd')
|
79
|
-
assert_equal('clip-rule evenodd', draw.inspect)
|
80
|
-
assert_nothing_raised { draw.draw(@img) }
|
81
|
-
|
82
|
-
draw = Magick::Draw.new
|
83
|
-
draw.clip_rule('nonzero')
|
84
|
-
assert_equal('clip-rule nonzero', draw.inspect)
|
85
|
-
assert_nothing_raised { draw.draw(@img) }
|
86
|
-
|
87
|
-
assert_raise(ArgumentError) { @draw.clip_rule('foo') }
|
88
|
-
end
|
89
|
-
|
90
|
-
def test_clip_units
|
91
|
-
draw = Magick::Draw.new
|
92
|
-
draw.clip_units('userspace')
|
93
|
-
assert_equal('clip-units userspace', draw.inspect)
|
94
|
-
assert_nothing_raised { draw.draw(@img) }
|
95
|
-
|
96
|
-
draw = Magick::Draw.new
|
97
|
-
draw.clip_units('userspaceonuse')
|
98
|
-
assert_equal('clip-units userspaceonuse', draw.inspect)
|
99
|
-
assert_nothing_raised { draw.draw(@img) }
|
100
|
-
|
101
|
-
draw = Magick::Draw.new
|
102
|
-
draw.clip_units('objectboundingbox')
|
103
|
-
assert_equal('clip-units objectboundingbox', draw.inspect)
|
104
|
-
assert_nothing_raised { draw.draw(@img) }
|
105
|
-
|
106
|
-
assert_raise(ArgumentError) { @draw.clip_units('foo') }
|
107
|
-
end
|
108
|
-
|
109
|
-
def test_color
|
110
|
-
draw = Magick::Draw.new
|
111
|
-
draw.color(50.5, 50, Magick::PointMethod)
|
112
|
-
assert_equal('color 50.5,50,point', draw.inspect)
|
113
|
-
assert_nothing_raised { draw.draw(@img) }
|
114
|
-
|
115
|
-
draw = Magick::Draw.new
|
116
|
-
draw.color(50.5, 50, Magick::ReplaceMethod)
|
117
|
-
assert_equal('color 50.5,50,replace', draw.inspect)
|
118
|
-
assert_nothing_raised { draw.draw(@img) }
|
119
|
-
|
120
|
-
draw = Magick::Draw.new
|
121
|
-
draw.color(50.5, 50, Magick::FloodfillMethod)
|
122
|
-
assert_equal('color 50.5,50,floodfill', draw.inspect)
|
123
|
-
assert_nothing_raised { draw.draw(@img) }
|
124
|
-
|
125
|
-
draw = Magick::Draw.new
|
126
|
-
draw.color(50.5, 50, Magick::FillToBorderMethod)
|
127
|
-
assert_equal('color 50.5,50,filltoborder', draw.inspect)
|
128
|
-
assert_nothing_raised { draw.draw(@img) }
|
129
|
-
|
130
|
-
draw = Magick::Draw.new
|
131
|
-
draw.color(50.5, 50, Magick::ResetMethod)
|
132
|
-
assert_equal('color 50.5,50,reset', draw.inspect)
|
133
|
-
assert_nothing_raised { draw.draw(@img) }
|
134
|
-
|
135
|
-
assert_raise(ArgumentError) { @draw.color(10, 20, 'unknown') }
|
136
|
-
assert_raise(ArgumentError) { @draw.color('x', 20, Magick::PointMethod) }
|
137
|
-
assert_raise(ArgumentError) { @draw.color(10, 'x', Magick::PointMethod) }
|
138
|
-
end
|
139
|
-
|
140
|
-
def test_decorate
|
141
|
-
draw = Magick::Draw.new
|
142
|
-
draw.decorate(Magick::NoDecoration)
|
143
|
-
assert_equal('decorate none', draw.inspect)
|
144
|
-
draw.text(50, 50, 'Hello world')
|
145
|
-
assert_nothing_raised { draw.draw(@img) }
|
146
|
-
|
147
|
-
draw = Magick::Draw.new
|
148
|
-
draw.decorate(Magick::UnderlineDecoration)
|
149
|
-
assert_equal('decorate underline', draw.inspect)
|
150
|
-
draw.text(50, 50, 'Hello world')
|
151
|
-
assert_nothing_raised { draw.draw(@img) }
|
152
|
-
|
153
|
-
draw = Magick::Draw.new
|
154
|
-
draw.decorate(Magick::OverlineDecoration)
|
155
|
-
assert_equal('decorate overline', draw.inspect)
|
156
|
-
draw.text(50, 50, 'Hello world')
|
157
|
-
assert_nothing_raised { draw.draw(@img) }
|
158
|
-
|
159
|
-
draw = Magick::Draw.new
|
160
|
-
draw.decorate(Magick::OverlineDecoration)
|
161
|
-
assert_equal('decorate overline', draw.inspect)
|
162
|
-
draw.text(50, 50, 'Hello world')
|
163
|
-
assert_nothing_raised { draw.draw(@img) }
|
164
|
-
|
165
|
-
# draw = Magick::Draw.new
|
166
|
-
# draw.decorate('tomato')
|
167
|
-
# assert_equal('decorate "tomato"', draw.inspect)
|
168
|
-
# draw.text(50, 50, 'Hello world')
|
169
|
-
# assert_nothing_raised { draw.draw(@img) }
|
170
|
-
end
|
171
|
-
|
172
|
-
def test_define_clip_path
|
173
|
-
assert_nothing_raised { @draw.define_clip_path('test') { @draw } }
|
174
|
-
assert_equal("push defs\npush clip-path \"test\"\npush graphic-context\npop graphic-context\npop clip-path\npop defs", @draw.inspect)
|
175
|
-
end
|
176
|
-
|
177
|
-
def test_ellipse
|
178
|
-
@draw.ellipse(50.5, 30, 25, 25, 60, 120)
|
179
|
-
assert_equal('ellipse 50.5,30 25,25 60,120', @draw.inspect)
|
180
|
-
assert_nothing_raised { @draw.draw(@img) }
|
181
|
-
|
182
|
-
assert_raise(ArgumentError) { @draw.ellipse('x', 20, 30, 40, 50, 60) }
|
183
|
-
assert_raise(ArgumentError) { @draw.ellipse(10, 'x', 30, 40, 50, 60) }
|
184
|
-
assert_raise(ArgumentError) { @draw.ellipse(10, 20, 'x', 40, 50, 60) }
|
185
|
-
assert_raise(ArgumentError) { @draw.ellipse(10, 20, 30, 'x', 50, 60) }
|
186
|
-
assert_raise(ArgumentError) { @draw.ellipse(10, 20, 30, 40, 'x', 60) }
|
187
|
-
assert_raise(ArgumentError) { @draw.ellipse(10, 20, 30, 40, 50, 'x') }
|
188
|
-
end
|
189
|
-
|
190
|
-
def test_encoding
|
191
|
-
@draw.encoding('UTF-8')
|
192
|
-
assert_equal('encoding UTF-8', @draw.inspect)
|
193
|
-
assert_nothing_raised { @draw.draw(@img) }
|
194
|
-
end
|
195
|
-
|
196
|
-
def test_fill
|
197
|
-
draw = Magick::Draw.new
|
198
|
-
draw.fill('tomato')
|
199
|
-
assert_equal('fill "tomato"', draw.inspect)
|
200
|
-
draw.circle(10, '20.5', 30, 40.5)
|
201
|
-
assert_nothing_raised { draw.draw(@img) }
|
202
|
-
|
203
|
-
draw = Magick::Draw.new
|
204
|
-
draw.fill_color('tomato')
|
205
|
-
assert_equal('fill "tomato"', draw.inspect)
|
206
|
-
draw.circle(10, '20.5', 30, 40.5)
|
207
|
-
assert_nothing_raised { draw.draw(@img) }
|
208
|
-
|
209
|
-
draw = Magick::Draw.new
|
210
|
-
draw.fill_pattern('tomato')
|
211
|
-
assert_equal('fill "tomato"', draw.inspect)
|
212
|
-
draw.circle(10, '20.5', 30, 40.5)
|
213
|
-
assert_nothing_raised { draw.draw(@img) }
|
214
|
-
|
215
|
-
# draw = Magick::Draw.new
|
216
|
-
# draw.fill_pattern('foo')
|
217
|
-
# assert_nothing_raised { draw.draw(@img) }
|
218
|
-
end
|
219
|
-
|
220
|
-
def test_fill_opacity
|
221
|
-
draw = Magick::Draw.new
|
222
|
-
draw.fill_opacity(0.5)
|
223
|
-
assert_equal('fill-opacity 0.5', draw.inspect)
|
224
|
-
draw.circle(10, '20.5', 30, 40.5)
|
225
|
-
assert_nothing_raised { draw.draw(@img) }
|
226
|
-
|
227
|
-
draw = Magick::Draw.new
|
228
|
-
draw.fill_opacity('50%')
|
229
|
-
assert_equal('fill-opacity 50%', draw.inspect)
|
230
|
-
draw.circle(10, '20.5', 30, 40.5)
|
231
|
-
assert_nothing_raised { draw.draw(@img) }
|
232
|
-
|
233
|
-
assert_nothing_raised { @draw.fill_opacity(0.0) }
|
234
|
-
assert_nothing_raised { @draw.fill_opacity(1.0) }
|
235
|
-
assert_nothing_raised { @draw.fill_opacity('0.0') }
|
236
|
-
assert_nothing_raised { @draw.fill_opacity('1.0') }
|
237
|
-
assert_nothing_raised { @draw.fill_opacity('20%') }
|
238
|
-
|
239
|
-
assert_raise(ArgumentError) { @draw.fill_opacity(-0.01) }
|
240
|
-
assert_raise(ArgumentError) { @draw.fill_opacity(1.01) }
|
241
|
-
assert_raise(ArgumentError) { @draw.fill_opacity('-0.01') }
|
242
|
-
assert_raise(ArgumentError) { @draw.fill_opacity('1.01') }
|
243
|
-
assert_raise(ArgumentError) { @draw.fill_opacity('xxx') }
|
244
|
-
end
|
245
|
-
|
246
|
-
def test_fill_rule
|
247
|
-
draw = Magick::Draw.new
|
248
|
-
draw.fill_rule('evenodd')
|
249
|
-
assert_equal('fill-rule evenodd', draw.inspect)
|
250
|
-
draw.circle(10, '20.5', 30, 40.5)
|
251
|
-
assert_nothing_raised { draw.draw(@img) }
|
252
|
-
|
253
|
-
draw = Magick::Draw.new
|
254
|
-
draw.fill_rule('nonzero')
|
255
|
-
assert_equal('fill-rule nonzero', draw.inspect)
|
256
|
-
draw.circle(10, '20.5', 30, 40.5)
|
257
|
-
assert_nothing_raised { draw.draw(@img) }
|
258
|
-
|
259
|
-
assert_raise(ArgumentError) { @draw.fill_rule('zero') }
|
260
|
-
end
|
261
|
-
|
262
|
-
def test_font
|
263
|
-
draw = Magick::Draw.new
|
264
|
-
draw.font('Arial')
|
265
|
-
assert_equal("font 'Arial'", draw.inspect)
|
266
|
-
draw.text(50, 50, 'Hello world')
|
267
|
-
assert_nothing_raised { draw.draw(@img) }
|
268
|
-
end
|
269
|
-
|
270
|
-
def test_font_family
|
271
|
-
draw = Magick::Draw.new
|
272
|
-
draw.font_family('sans-serif')
|
273
|
-
assert_equal("font-family 'sans-serif'", draw.inspect)
|
274
|
-
draw.text(50, 50, 'Hello world')
|
275
|
-
assert_nothing_raised { draw.draw(@img) }
|
276
|
-
end
|
277
|
-
|
278
|
-
def test_font_stretch
|
279
|
-
Magick::StretchType.values do |stretch|
|
280
|
-
next if stretch == Magick::AnyStretch
|
281
|
-
|
282
|
-
draw = Magick::Draw.new
|
283
|
-
draw.font_stretch(stretch)
|
284
|
-
draw.text(50, 50, 'Hello world')
|
285
|
-
assert_nothing_raised { draw.draw(@img) }
|
286
|
-
end
|
287
|
-
|
288
|
-
assert_raise(ArgumentError) { @draw.font_stretch('xxx') }
|
289
|
-
end
|
290
|
-
|
291
|
-
def test_font_style
|
292
|
-
draw = Magick::Draw.new
|
293
|
-
draw.font_style(Magick::NormalStyle)
|
294
|
-
assert_equal('font-style normal', draw.inspect)
|
295
|
-
draw.text(50, 50, 'Hello world')
|
296
|
-
assert_nothing_raised { draw.draw(@img) }
|
297
|
-
|
298
|
-
draw = Magick::Draw.new
|
299
|
-
draw.font_style(Magick::ItalicStyle)
|
300
|
-
assert_equal('font-style italic', draw.inspect)
|
301
|
-
draw.text(50, 50, 'Hello world')
|
302
|
-
assert_nothing_raised { draw.draw(@img) }
|
303
|
-
|
304
|
-
draw = Magick::Draw.new
|
305
|
-
draw.font_style(Magick::ObliqueStyle)
|
306
|
-
assert_equal('font-style oblique', draw.inspect)
|
307
|
-
draw.text(50, 50, 'Hello world')
|
308
|
-
assert_nothing_raised { draw.draw(@img) }
|
309
|
-
|
310
|
-
assert_raise(ArgumentError) { @draw.font_style('xxx') }
|
311
|
-
end
|
312
|
-
|
313
|
-
def test_font_weight
|
314
|
-
Magick::WeightType.values do |weight|
|
315
|
-
draw = Magick::Draw.new
|
316
|
-
draw.font_weight(weight)
|
317
|
-
draw.text(50, 50, 'Hello world')
|
318
|
-
assert_nothing_raised { draw.draw(@img) }
|
319
|
-
end
|
320
|
-
|
321
|
-
draw = Magick::Draw.new
|
322
|
-
draw.font_weight(400)
|
323
|
-
assert_equal('font-weight 400', draw.inspect)
|
324
|
-
draw.text(50, 50, 'Hello world')
|
325
|
-
assert_nothing_raised { draw.draw(@img) }
|
326
|
-
|
327
|
-
assert_raise(ArgumentError) { @draw.font_weight('xxx') }
|
328
|
-
end
|
329
|
-
|
330
|
-
def test_gravity
|
331
|
-
Magick::GravityType.values do |gravity|
|
332
|
-
next if [Magick::UndefinedGravity, Magick::StaticGravity].include?(gravity)
|
333
|
-
|
334
|
-
draw = Magick::Draw.new
|
335
|
-
draw.gravity(gravity)
|
336
|
-
draw.circle(10, '20.5', 30, 40.5)
|
337
|
-
assert_nothing_raised { draw.draw(@img) }
|
338
|
-
end
|
339
|
-
|
340
|
-
assert_raise(ArgumentError) { @draw.gravity('xxx') }
|
341
|
-
end
|
342
|
-
|
343
|
-
def test_image
|
344
|
-
Magick::CompositeOperator.values do |composite|
|
345
|
-
next if [Magick::CopyAlphaCompositeOp, Magick::NoCompositeOp].include?(composite)
|
346
|
-
|
347
|
-
draw = Magick::Draw.new
|
348
|
-
draw.image(composite, 10, 10, 200, 100, "#{IMAGES_DIR}/Flower_Hat.jpg")
|
349
|
-
assert_nothing_raised { draw.draw(@img) }
|
350
|
-
end
|
351
|
-
|
352
|
-
assert_raise(ArgumentError) { @draw.image('xxx', 10, 10, 200, 100, "#{IMAGES_DIR}/Flower_Hat.jpg") }
|
353
|
-
assert_raise(ArgumentError) { @draw.image(Magick::AtopCompositeOp, 'x', 100, 200, 100, "#{IMAGES_DIR}/Flower_Hat.jpg") }
|
354
|
-
assert_raise(ArgumentError) { @draw.image(Magick::AtopCompositeOp, 100, 'x', 200, 100, "#{IMAGES_DIR}/Flower_Hat.jpg") }
|
355
|
-
assert_raise(ArgumentError) { @draw.image(Magick::AtopCompositeOp, 100, 100, 'x', 100, "#{IMAGES_DIR}/Flower_Hat.jpg") }
|
356
|
-
assert_raise(ArgumentError) { @draw.image(Magick::AtopCompositeOp, 100, 100, 200, 'x', "#{IMAGES_DIR}/Flower_Hat.jpg") }
|
357
|
-
end
|
358
|
-
|
359
|
-
def test_interline_spacing
|
360
|
-
draw = Magick::Draw.new
|
361
|
-
draw.interline_spacing(40.5)
|
362
|
-
assert_equal('interline-spacing 40.5', draw.inspect)
|
363
|
-
assert_nothing_raised { draw.draw(@img) }
|
364
|
-
|
365
|
-
draw = Magick::Draw.new
|
366
|
-
draw.interline_spacing('40.5')
|
367
|
-
assert_equal('interline-spacing 40.5', draw.inspect)
|
368
|
-
assert_nothing_raised { draw.draw(@img) }
|
369
|
-
|
370
|
-
# assert_raise(ArgumentError) { @draw.interline_spacing(Float::NAN) }
|
371
|
-
assert_raise(ArgumentError) { @draw.interline_spacing('nan') }
|
372
|
-
assert_raise(ArgumentError) { @draw.interline_spacing('xxx') }
|
373
|
-
assert_raise(TypeError) { @draw.interline_spacing(nil) }
|
374
|
-
end
|
375
|
-
|
376
|
-
def test_interword_spacing
|
377
|
-
draw = Magick::Draw.new
|
378
|
-
draw.interword_spacing(40.5)
|
379
|
-
assert_equal('interword-spacing 40.5', draw.inspect)
|
380
|
-
assert_nothing_raised { draw.draw(@img) }
|
381
|
-
|
382
|
-
draw = Magick::Draw.new
|
383
|
-
draw.interword_spacing('40.5')
|
384
|
-
assert_equal('interword-spacing 40.5', draw.inspect)
|
385
|
-
assert_nothing_raised { draw.draw(@img) }
|
386
|
-
|
387
|
-
# assert_raise(ArgumentError) { @draw.interword_spacing(Float::NAN) }
|
388
|
-
assert_raise(ArgumentError) { @draw.interword_spacing('nan') }
|
389
|
-
assert_raise(ArgumentError) { @draw.interword_spacing('xxx') }
|
390
|
-
assert_raise(TypeError) { @draw.interword_spacing(nil) }
|
391
|
-
end
|
392
|
-
|
393
|
-
def test_kerning
|
394
|
-
draw = Magick::Draw.new
|
395
|
-
draw.kerning(40.5)
|
396
|
-
assert_equal('kerning 40.5', draw.inspect)
|
397
|
-
assert_nothing_raised { draw.draw(@img) }
|
398
|
-
|
399
|
-
draw = Magick::Draw.new
|
400
|
-
draw.kerning('40.5')
|
401
|
-
assert_equal('kerning 40.5', draw.inspect)
|
402
|
-
assert_nothing_raised { draw.draw(@img) }
|
403
|
-
|
404
|
-
# assert_raise(ArgumentError) { @draw.kerning(Float::NAN) }
|
405
|
-
assert_raise(ArgumentError) { @draw.kerning('nan') }
|
406
|
-
assert_raise(ArgumentError) { @draw.kerning('xxx') }
|
407
|
-
assert_raise(TypeError) { @draw.kerning(nil) }
|
408
|
-
end
|
409
|
-
|
410
|
-
def test_line
|
411
|
-
@draw.line(10, '20.5', 30, 40.5)
|
412
|
-
assert_equal('line 10,20.5 30,40.5', @draw.inspect)
|
413
|
-
assert_nothing_raised { @draw.draw(@img) }
|
414
|
-
|
415
|
-
assert_raise(ArgumentError) { @draw.line('x', '20.5', 30, 40.5) }
|
416
|
-
assert_raise(ArgumentError) { @draw.line(10, 'x', 30, 40.5) }
|
417
|
-
assert_raise(ArgumentError) { @draw.line(10, '20.5', 'x', 40.5) }
|
418
|
-
assert_raise(ArgumentError) { @draw.line(10, '20.5', 30, 'x') }
|
419
|
-
end
|
420
|
-
|
421
|
-
def test_matte
|
422
|
-
Magick::PaintMethod.values do |method|
|
423
|
-
draw = Magick::Draw.new
|
424
|
-
draw.matte(10, '20.5', method)
|
425
|
-
assert_nothing_raised { draw.draw(@img) }
|
426
|
-
end
|
427
|
-
|
428
|
-
assert_raise(ArgumentError) { @draw.matte(10, '20.5', 'xxx') }
|
429
|
-
assert_raise(ArgumentError) { @draw.matte('x', 10, Magick::PointMethod) }
|
430
|
-
assert_raise(ArgumentError) { @draw.matte(10, 'x', Magick::PointMethod) }
|
431
|
-
end
|
432
|
-
|
433
|
-
def test_opacity
|
434
|
-
@draw.opacity(0.8)
|
435
|
-
assert_equal('opacity 0.8', @draw.inspect)
|
436
|
-
assert_nothing_raised { @draw.draw(@img) }
|
437
|
-
|
438
|
-
assert_nothing_raised { @draw.opacity(0.0) }
|
439
|
-
assert_nothing_raised { @draw.opacity(1.0) }
|
440
|
-
assert_nothing_raised { @draw.opacity('0.0') }
|
441
|
-
assert_nothing_raised { @draw.opacity('1.0') }
|
442
|
-
assert_nothing_raised { @draw.opacity('20%') }
|
443
|
-
|
444
|
-
assert_raise(ArgumentError) { @draw.opacity(-0.01) }
|
445
|
-
assert_raise(ArgumentError) { @draw.opacity(1.01) }
|
446
|
-
assert_raise(ArgumentError) { @draw.opacity('-0.01') }
|
447
|
-
assert_raise(ArgumentError) { @draw.opacity('1.01') }
|
448
|
-
assert_raise(ArgumentError) { @draw.opacity('xxx') }
|
449
|
-
end
|
450
|
-
|
451
|
-
def test_path
|
452
|
-
@draw.path('M110,100 h-75 a75,75 0 1,0 75,-75 z')
|
453
|
-
assert_equal("path 'M110,100 h-75 a75,75 0 1,0 75,-75 z'", @draw.inspect)
|
454
|
-
assert_nothing_raised { @draw.draw(@img) }
|
455
|
-
end
|
456
|
-
|
457
|
-
def test_pattern
|
458
|
-
@draw.pattern('hat', 0, 10.5, 20, '20') {}
|
459
|
-
assert_equal("push defs\npush pattern hat 0 10.5 20 20\npush graphic-context\npop graphic-context\npop pattern\npop defs", @draw.inspect)
|
460
|
-
assert_nothing_raised { @draw.draw(@img) }
|
461
|
-
|
462
|
-
assert_raise(ArgumentError) { @draw.pattern('hat', 'x', 0, 20, 20) {} }
|
463
|
-
assert_raise(ArgumentError) { @draw.pattern('hat', 0, 'x', 20, 20) {} }
|
464
|
-
assert_raise(ArgumentError) { @draw.pattern('hat', 0, 0, 'x', 20) {} }
|
465
|
-
assert_raise(ArgumentError) { @draw.pattern('hat', 0, 0, 20, 'x') {} }
|
466
|
-
end
|
467
|
-
|
468
|
-
def test_point
|
469
|
-
@draw.point(10.5, '20')
|
470
|
-
assert_equal('point 10.5,20', @draw.inspect)
|
471
|
-
assert_nothing_raised { @draw.draw(@img) }
|
472
|
-
|
473
|
-
assert_raise(ArgumentError) { @draw.point('x', 20) }
|
474
|
-
assert_raise(ArgumentError) { @draw.point(10, 'x') }
|
475
|
-
end
|
476
|
-
|
477
|
-
def test_pointsize
|
478
|
-
@draw.pointsize(20.5)
|
479
|
-
assert_equal('font-size 20.5', @draw.inspect)
|
480
|
-
assert_nothing_raised { @draw.draw(@img) }
|
481
|
-
|
482
|
-
assert_raise(ArgumentError) { @draw.pointsize('x') }
|
483
|
-
end
|
484
|
-
|
485
|
-
def test_font_size
|
486
|
-
@draw.font_size(20)
|
487
|
-
assert_equal('font-size 20', @draw.inspect)
|
488
|
-
assert_nothing_raised { @draw.draw(@img) }
|
489
|
-
|
490
|
-
assert_raise(ArgumentError) { @draw.font_size('x') }
|
491
|
-
end
|
492
|
-
|
493
|
-
def test_polygon
|
494
|
-
@draw.polygon(0, '0.5', 8.5, 16, 16, 0, 0, 0)
|
495
|
-
assert_equal('polygon 0,0.5,8.5,16,16,0,0,0', @draw.inspect)
|
496
|
-
assert_nothing_raised { @draw.draw(@img) }
|
497
|
-
|
498
|
-
assert_raise(ArgumentError) { @draw.polygon }
|
499
|
-
assert_raise(ArgumentError) { @draw.polygon(0) }
|
500
|
-
assert_raise(ArgumentError) { @draw.polygon('x', 0, 8, 16, 16, 0, 0, 0) }
|
501
|
-
end
|
502
|
-
|
503
|
-
def test_polyline
|
504
|
-
@draw.polyline(0, '0.5', 16.5, 16)
|
505
|
-
assert_equal('polyline 0,0.5,16.5,16', @draw.inspect)
|
506
|
-
assert_nothing_raised { @draw.draw(@img) }
|
507
|
-
|
508
|
-
assert_raise(ArgumentError) { @draw.polyline }
|
509
|
-
assert_raise(ArgumentError) { @draw.polyline(0) }
|
510
|
-
assert_raise(ArgumentError) { @draw.polyline('x', 0, 16, 16) }
|
511
|
-
end
|
512
|
-
|
513
|
-
def test_rectangle
|
514
|
-
@draw.rectangle(10, '10', 100, 100)
|
515
|
-
assert_equal('rectangle 10,10 100,100', @draw.inspect)
|
516
|
-
assert_nothing_raised { @draw.draw(@img) }
|
517
|
-
|
518
|
-
assert_raise(ArgumentError) { @draw.rectangle('x', 10, 20, 20) }
|
519
|
-
assert_raise(ArgumentError) { @draw.rectangle(10, 'x', 20, 20) }
|
520
|
-
assert_raise(ArgumentError) { @draw.rectangle(10, 10, 'x', 20) }
|
521
|
-
assert_raise(ArgumentError) { @draw.rectangle(10, 10, 20, 'x') }
|
522
|
-
end
|
523
|
-
|
524
|
-
def test_rotate
|
525
|
-
@draw.rotate(45)
|
526
|
-
assert_equal('rotate 45', @draw.inspect)
|
527
|
-
@draw.text(50, 50, 'Hello world')
|
528
|
-
assert_nothing_raised { @draw.draw(@img) }
|
529
|
-
|
530
|
-
assert_raise(ArgumentError) { @draw.rotate('x') }
|
531
|
-
end
|
532
|
-
|
533
|
-
def test_roundrectangle
|
534
|
-
@draw.roundrectangle(10, '10', 100, 100, 20, 20)
|
535
|
-
assert_equal('roundrectangle 10,10,100,100,20,20', @draw.inspect)
|
536
|
-
assert_nothing_raised { @draw.draw(@img) }
|
537
|
-
|
538
|
-
assert_raise(ArgumentError) { @draw.roundrectangle('x', '10', 100, 100, 20, 20) }
|
539
|
-
assert_raise(ArgumentError) { @draw.roundrectangle(10, 'x', 100, 100, 20, 20) }
|
540
|
-
assert_raise(ArgumentError) { @draw.roundrectangle(10, '10', 'x', 100, 20, 20) }
|
541
|
-
assert_raise(ArgumentError) { @draw.roundrectangle(10, '10', 100, 'x', 20, 20) }
|
542
|
-
assert_raise(ArgumentError) { @draw.roundrectangle(10, '10', 100, 100, 'x', 20) }
|
543
|
-
assert_raise(ArgumentError) { @draw.roundrectangle(10, '10', 100, 100, 20, 'x') }
|
544
|
-
end
|
545
|
-
|
546
|
-
def test_scale
|
547
|
-
@draw.scale('0.5', 1.5)
|
548
|
-
assert_equal('scale 0.5,1.5', @draw.inspect)
|
549
|
-
@draw.rectangle(10, '10', 100, 100)
|
550
|
-
assert_nothing_raised { @draw.draw(@img) }
|
551
|
-
|
552
|
-
assert_raise(ArgumentError) { @draw.scale('x', 1.5) }
|
553
|
-
assert_raise(ArgumentError) { @draw.scale(0.5, 'x') }
|
554
|
-
end
|
555
|
-
|
556
|
-
def test_skewx
|
557
|
-
@draw.skewx(45)
|
558
|
-
assert_equal('skewX 45', @draw.inspect)
|
559
|
-
@draw.text(50, 50, 'Hello world')
|
560
|
-
assert_nothing_raised { @draw.draw(@img) }
|
561
|
-
|
562
|
-
assert_raise(ArgumentError) { @draw.skewx('x') }
|
563
|
-
end
|
564
|
-
|
565
|
-
def test_skewy
|
566
|
-
@draw.skewy(45)
|
567
|
-
assert_equal('skewY 45', @draw.inspect)
|
568
|
-
@draw.text(50, 50, 'Hello world')
|
569
|
-
assert_nothing_raised { @draw.draw(@img) }
|
570
|
-
|
571
|
-
assert_raise(ArgumentError) { @draw.skewy('x') }
|
572
|
-
end
|
573
|
-
|
574
|
-
def test_stroke
|
575
|
-
@draw.stroke('red')
|
576
|
-
assert_equal('stroke "red"', @draw.inspect)
|
577
|
-
@draw.rectangle(10, '10', 100, 100)
|
578
|
-
assert_nothing_raised { @draw.draw(@img) }
|
579
|
-
|
580
|
-
# assert_raise(ArgumentError) { @draw.stroke(100) }
|
581
|
-
end
|
582
|
-
|
583
|
-
def test_stroke_color
|
584
|
-
@draw.stroke_color('red')
|
585
|
-
assert_equal('stroke "red"', @draw.inspect)
|
586
|
-
@draw.rectangle(10, '10', 100, 100)
|
587
|
-
assert_nothing_raised { @draw.draw(@img) }
|
588
|
-
|
589
|
-
# assert_raise(ArgumentError) { @draw.stroke_color(100) }
|
590
|
-
end
|
591
|
-
|
592
|
-
def test_stroke_pattern
|
593
|
-
@draw.stroke_pattern('red')
|
594
|
-
assert_equal('stroke "red"', @draw.inspect)
|
595
|
-
@draw.rectangle(10, '10', 100, 100)
|
596
|
-
assert_nothing_raised { @draw.draw(@img) }
|
597
|
-
|
598
|
-
# assert_raise(ArgumentError) { @draw.stroke_pattern(100) }
|
599
|
-
end
|
600
|
-
|
601
|
-
def test_stroke_antialias
|
602
|
-
draw = Magick::Draw.new
|
603
|
-
draw.stroke_antialias(true)
|
604
|
-
assert_equal('stroke-antialias 1', draw.inspect)
|
605
|
-
draw.stroke_pattern('red')
|
606
|
-
draw.stroke_width(5)
|
607
|
-
draw.circle(10, '20.5', 30, 40.5)
|
608
|
-
assert_nothing_raised { draw.draw(@img) }
|
609
|
-
|
610
|
-
draw = Magick::Draw.new
|
611
|
-
draw.stroke_antialias(false)
|
612
|
-
assert_equal('stroke-antialias 0', draw.inspect)
|
613
|
-
draw.stroke_pattern('red')
|
614
|
-
draw.stroke_width(5)
|
615
|
-
draw.circle(10, '20.5', 30, 40.5)
|
616
|
-
assert_nothing_raised { draw.draw(@img) }
|
617
|
-
end
|
618
|
-
|
619
|
-
def test_stroke_dasharray
|
620
|
-
draw = Magick::Draw.new
|
621
|
-
draw.stroke_dasharray(2, 2)
|
622
|
-
assert_equal('stroke-dasharray 2,2', draw.inspect)
|
623
|
-
draw.stroke_pattern('red')
|
624
|
-
draw.stroke_width(2)
|
625
|
-
draw.rectangle(10, '10', 100, 100)
|
626
|
-
assert_nothing_raised { draw.draw(@img) }
|
627
|
-
|
628
|
-
draw = Magick::Draw.new
|
629
|
-
draw.stroke_dasharray
|
630
|
-
assert_equal('stroke-dasharray none', draw.inspect)
|
631
|
-
assert_nothing_raised { draw.draw(@img) }
|
632
|
-
|
633
|
-
assert_raise(ArgumentError) { @draw.stroke_dasharray(-0.1) }
|
634
|
-
assert_raise(ArgumentError) { @draw.stroke_dasharray('x') }
|
635
|
-
end
|
636
|
-
|
637
|
-
def test_stroke_dashoffset
|
638
|
-
@draw.stroke_dashoffset(10)
|
639
|
-
assert_equal('stroke-dashoffset 10', @draw.inspect)
|
640
|
-
assert_nothing_raised { @draw.draw(@img) }
|
641
|
-
|
642
|
-
assert_raise(ArgumentError) { @draw.stroke_dashoffset('x') }
|
643
|
-
end
|
644
|
-
|
645
|
-
def test_stroke_linecap
|
646
|
-
draw = Magick::Draw.new
|
647
|
-
draw.stroke_linecap('butt')
|
648
|
-
assert_equal('stroke-linecap butt', draw.inspect)
|
649
|
-
assert_nothing_raised { draw.draw(@img) }
|
650
|
-
|
651
|
-
draw = Magick::Draw.new
|
652
|
-
draw.stroke_linecap('round')
|
653
|
-
assert_equal('stroke-linecap round', draw.inspect)
|
654
|
-
assert_nothing_raised { draw.draw(@img) }
|
655
|
-
|
656
|
-
draw = Magick::Draw.new
|
657
|
-
draw.stroke_linecap('square')
|
658
|
-
assert_equal('stroke-linecap square', draw.inspect)
|
659
|
-
assert_nothing_raised { draw.draw(@img) }
|
660
|
-
|
661
|
-
assert_raise(ArgumentError) { @draw.stroke_linecap('foo') }
|
662
|
-
end
|
663
|
-
|
664
|
-
def test_stroke_linejoin
|
665
|
-
draw = Magick::Draw.new
|
666
|
-
draw.stroke_linejoin('round')
|
667
|
-
assert_equal('stroke-linejoin round', draw.inspect)
|
668
|
-
assert_nothing_raised { draw.draw(@img) }
|
669
|
-
|
670
|
-
draw = Magick::Draw.new
|
671
|
-
draw.stroke_linejoin('miter')
|
672
|
-
assert_equal('stroke-linejoin miter', draw.inspect)
|
673
|
-
assert_nothing_raised { draw.draw(@img) }
|
674
|
-
|
675
|
-
draw = Magick::Draw.new
|
676
|
-
draw.stroke_linejoin('bevel')
|
677
|
-
assert_equal('stroke-linejoin bevel', draw.inspect)
|
678
|
-
assert_nothing_raised { draw.draw(@img) }
|
679
|
-
|
680
|
-
assert_raise(ArgumentError) { @draw.stroke_linejoin('foo') }
|
681
|
-
end
|
682
|
-
|
683
|
-
def test_stroke_miterlimit
|
684
|
-
draw = Magick::Draw.new
|
685
|
-
draw.stroke_miterlimit(1.0)
|
686
|
-
assert_equal('stroke-miterlimit 1.0', draw.inspect)
|
687
|
-
assert_nothing_raised { draw.draw(@img) }
|
688
|
-
|
689
|
-
assert_raise(ArgumentError) { @draw.stroke_miterlimit(0.9) }
|
690
|
-
assert_raise(ArgumentError) { @draw.stroke_miterlimit('foo') }
|
691
|
-
end
|
692
|
-
|
693
|
-
def test_stroke_opacity
|
694
|
-
@draw.stroke_opacity(0.8)
|
695
|
-
assert_equal('stroke-opacity 0.8', @draw.inspect)
|
696
|
-
assert_nothing_raised { @draw.draw(@img) }
|
697
|
-
|
698
|
-
assert_nothing_raised { @draw.stroke_opacity(0.0) }
|
699
|
-
assert_nothing_raised { @draw.stroke_opacity(1.0) }
|
700
|
-
assert_nothing_raised { @draw.stroke_opacity('0.0') }
|
701
|
-
assert_nothing_raised { @draw.stroke_opacity('1.0') }
|
702
|
-
assert_nothing_raised { @draw.stroke_opacity('20%') }
|
703
|
-
|
704
|
-
assert_raise(ArgumentError) { @draw.stroke_opacity(-0.01) }
|
705
|
-
assert_raise(ArgumentError) { @draw.stroke_opacity(1.01) }
|
706
|
-
assert_raise(ArgumentError) { @draw.stroke_opacity('-0.01') }
|
707
|
-
assert_raise(ArgumentError) { @draw.stroke_opacity('1.01') }
|
708
|
-
assert_raise(ArgumentError) { @draw.stroke_opacity('xxx') }
|
709
|
-
end
|
710
|
-
|
711
|
-
def test_stroke_width
|
712
|
-
@draw.stroke_width(2.5)
|
713
|
-
assert_equal('stroke-width 2.5', @draw.inspect)
|
714
|
-
assert_nothing_raised { @draw.draw(@img) }
|
715
|
-
|
716
|
-
assert_raise(ArgumentError) { @draw.stroke_width('xxx') }
|
717
|
-
end
|
718
|
-
|
719
|
-
def test_text
|
720
|
-
draw = Magick::Draw.new
|
721
|
-
draw.text(50, 50, 'Hello world')
|
722
|
-
assert_equal("text 50,50 'Hello world'", draw.inspect)
|
723
|
-
assert_nothing_raised { draw.draw(@img) }
|
724
|
-
|
725
|
-
draw = Magick::Draw.new
|
726
|
-
draw.text(50, 50, "Hello 'world'")
|
727
|
-
assert_equal("text 50,50 \"Hello 'world'\"", draw.inspect)
|
728
|
-
assert_nothing_raised { draw.draw(@img) }
|
729
|
-
|
730
|
-
draw = Magick::Draw.new
|
731
|
-
draw.text(50, 50, 'Hello "world"')
|
732
|
-
assert_equal("text 50,50 'Hello \"world\"'", draw.inspect)
|
733
|
-
assert_nothing_raised { draw.draw(@img) }
|
734
|
-
|
735
|
-
draw = Magick::Draw.new
|
736
|
-
draw.text(50, 50, "Hello 'world\"")
|
737
|
-
assert_equal("text 50,50 {Hello 'world\"}", draw.inspect)
|
738
|
-
assert_nothing_raised { draw.draw(@img) }
|
739
|
-
|
740
|
-
draw = Magick::Draw.new
|
741
|
-
draw.text(50, 50, "Hello {'world\"")
|
742
|
-
assert_equal("text 50,50 {Hello {'world\"}", draw.inspect)
|
743
|
-
assert_nothing_raised { draw.draw(@img) }
|
744
|
-
|
745
|
-
assert_raise(ArgumentError) { @draw.text(50, 50, '') }
|
746
|
-
assert_raise(ArgumentError) { @draw.text('x', 50, 'Hello world') }
|
747
|
-
assert_raise(ArgumentError) { @draw.text(50, 'x', 'Hello world') }
|
748
|
-
end
|
749
|
-
|
750
|
-
def test_text_align
|
751
|
-
draw = Magick::Draw.new
|
752
|
-
draw.text_align(Magick::LeftAlign)
|
753
|
-
assert_equal('text-align left', draw.inspect)
|
754
|
-
draw.text(50, 50, 'Hello world')
|
755
|
-
assert_nothing_raised { draw.draw(@img) }
|
756
|
-
|
757
|
-
draw = Magick::Draw.new
|
758
|
-
draw.text_align(Magick::RightAlign)
|
759
|
-
assert_equal('text-align right', draw.inspect)
|
760
|
-
draw.text(50, 50, 'Hello world')
|
761
|
-
assert_nothing_raised { draw.draw(@img) }
|
762
|
-
|
763
|
-
draw = Magick::Draw.new
|
764
|
-
draw.text_align(Magick::CenterAlign)
|
765
|
-
assert_equal('text-align center', draw.inspect)
|
766
|
-
draw.text(50, 50, 'Hello world')
|
767
|
-
assert_nothing_raised { draw.draw(@img) }
|
768
|
-
|
769
|
-
assert_raise(ArgumentError) { @draw.text_align('x') }
|
770
|
-
end
|
771
|
-
|
772
|
-
def test_text_anchor
|
773
|
-
draw = Magick::Draw.new
|
774
|
-
draw.text_anchor(Magick::StartAnchor)
|
775
|
-
assert_equal('text-anchor start', draw.inspect)
|
776
|
-
draw.text(50, 50, 'Hello world')
|
777
|
-
assert_nothing_raised { draw.draw(@img) }
|
778
|
-
|
779
|
-
draw = Magick::Draw.new
|
780
|
-
draw.text_anchor(Magick::MiddleAnchor)
|
781
|
-
assert_equal('text-anchor middle', draw.inspect)
|
782
|
-
draw.text(50, 50, 'Hello world')
|
783
|
-
assert_nothing_raised { draw.draw(@img) }
|
784
|
-
|
785
|
-
draw = Magick::Draw.new
|
786
|
-
draw.text_anchor(Magick::EndAnchor)
|
787
|
-
assert_equal('text-anchor end', draw.inspect)
|
788
|
-
draw.text(50, 50, 'Hello world')
|
789
|
-
assert_nothing_raised { draw.draw(@img) }
|
790
|
-
|
791
|
-
assert_raise(ArgumentError) { @draw.text_anchor('x') }
|
792
|
-
end
|
793
|
-
|
794
|
-
def test_text_antialias
|
795
|
-
draw = Magick::Draw.new
|
796
|
-
draw.text_antialias(true)
|
797
|
-
assert_equal('text-antialias 1', draw.inspect)
|
798
|
-
draw.text(50, 50, 'Hello world')
|
799
|
-
assert_nothing_raised { draw.draw(@img) }
|
800
|
-
|
801
|
-
draw = Magick::Draw.new
|
802
|
-
draw.text_antialias(false)
|
803
|
-
assert_equal('text-antialias 0', draw.inspect)
|
804
|
-
draw.text(50, 50, 'Hello world')
|
805
|
-
assert_nothing_raised { draw.draw(@img) }
|
806
|
-
end
|
807
|
-
|
808
|
-
def test_text_undercolor
|
809
|
-
@draw.text_undercolor('red')
|
810
|
-
assert_equal('text-undercolor "red"', @draw.inspect)
|
811
|
-
@draw.text(50, 50, 'Hello world')
|
812
|
-
assert_nothing_raised { @draw.draw(@img) }
|
813
|
-
end
|
814
|
-
|
815
|
-
def test_translate
|
816
|
-
@draw.translate('200', 300)
|
817
|
-
assert_equal('translate 200,300', @draw.inspect)
|
818
|
-
assert_nothing_raised { @draw.draw(@img) }
|
819
|
-
|
820
|
-
assert_raise(ArgumentError) { @draw.translate('x', 300) }
|
821
|
-
assert_raise(ArgumentError) { @draw.translate(200, 'x') }
|
822
|
-
end
|
823
|
-
end
|