rmagick 2.15.3 → 2.15.4
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/.editorconfig +14 -0
- data/.rubocop.yml +27 -3
- data/.travis.yml +9 -6
- data/CHANGELOG.md +4 -0
- data/CONTRIBUTING.md +10 -0
- data/README.textile +4 -0
- data/before_install_linux.sh +4 -4
- data/doc/ex/gravity.rb +2 -1
- data/ext/RMagick/extconf.rb +60 -17
- data/lib/rmagick/version.rb +1 -1
- data/lib/rvg/clippath.rb +37 -36
- data/lib/rvg/container.rb +106 -107
- data/lib/rvg/deep_equal.rb +46 -48
- data/lib/rvg/describable.rb +35 -36
- data/lib/rvg/embellishable.rb +384 -380
- data/lib/rvg/misc.rb +705 -690
- data/lib/rvg/paint.rb +39 -40
- data/lib/rvg/pathdata.rb +120 -121
- data/lib/rvg/rvg.rb +212 -209
- data/lib/rvg/stretchable.rb +159 -158
- data/lib/rvg/stylable.rb +99 -100
- data/lib/rvg/text.rb +0 -1
- data/lib/rvg/transformable.rb +110 -110
- data/lib/rvg/units.rb +58 -58
- data/rmagick.gemspec +1 -1
- 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 +3 -0
- data/test/Image1.rb +524 -718
- data/test/Image2.rb +1262 -1262
- data/test/Image3.rb +973 -973
- data/test/ImageList2.rb +341 -341
- data/test/Image_attributes.rb +678 -678
- data/test/Info.rb +336 -336
- data/test/Magick.rb +245 -242
- data/test/Pixel.rb +105 -105
- data/test/Preview.rb +42 -42
- metadata +21 -6
data/test/Pixel.rb
CHANGED
@@ -5,112 +5,112 @@ require 'test/unit'
|
|
5
5
|
require 'test/unit/ui/console/testrunner' unless RUBY_VERSION[/^1\.9|^2/]
|
6
6
|
|
7
7
|
class Pixel_UT < Test::Unit::TestCase
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
end
|
80
|
-
end
|
8
|
+
def setup
|
9
|
+
@pixel = Magick::Pixel.from_color('brown')
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_hash
|
13
|
+
hash = nil
|
14
|
+
assert_nothing_raised { hash = @pixel.hash}
|
15
|
+
assert_not_nil(hash)
|
16
|
+
assert_equal(1385501952, hash)
|
17
|
+
|
18
|
+
p = Magick::Pixel.new
|
19
|
+
assert_equal(0, p.hash)
|
20
|
+
|
21
|
+
p = Magick::Pixel.from_color('red')
|
22
|
+
assert_equal(2139095040, p.hash)
|
23
|
+
|
24
|
+
# Pixel.hash sacrifices the last bit of the opacity channel
|
25
|
+
p = Magick::Pixel.new(0, 0, 0, 72)
|
26
|
+
p2 = Magick::Pixel.new(0, 0, 0, 73)
|
27
|
+
assert_not_equal(p, p2)
|
28
|
+
assert_equal(p.hash, p2.hash)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_eql?
|
32
|
+
p = @pixel
|
33
|
+
assert(@pixel.eql?(p))
|
34
|
+
p = Magick::Pixel.new
|
35
|
+
assert(!@pixel.eql?(p))
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_fcmp
|
39
|
+
red = Magick::Pixel.from_color('red')
|
40
|
+
blue = Magick::Pixel.from_color('blue')
|
41
|
+
assert_nothing_raised { red.fcmp(red) }
|
42
|
+
assert(red.fcmp(red))
|
43
|
+
assert(!red.fcmp(blue))
|
44
|
+
|
45
|
+
assert_nothing_raised { red.fcmp(blue, 10) }
|
46
|
+
assert_nothing_raised { red.fcmp(blue, 10, Magick::RGBColorspace) }
|
47
|
+
assert_raises(TypeError) { red.fcmp(blue, 'x') }
|
48
|
+
assert_raises(TypeError) { red.fcmp(blue, 10, 'x') }
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_from_hsla
|
52
|
+
assert_nothing_raised { Magick::Pixel.from_hsla(127, 50, 50) }
|
53
|
+
assert_nothing_raised { Magick::Pixel.from_hsla(127, 50, 50, 0) }
|
54
|
+
assert_nothing_raised { Magick::Pixel.from_hsla(127, '50%', 50, 0) }
|
55
|
+
assert_nothing_raised { Magick::Pixel.from_hsla('10%', '50%', 50, 0) }
|
56
|
+
assert_raise(TypeError) { Magick::Pixel.from_hsla([], 50, 50, 0) }
|
57
|
+
assert_raise(TypeError) { Magick::Pixel.from_hsla(127, [], 50, 0) }
|
58
|
+
assert_raise(TypeError) { Magick::Pixel.from_hsla(127, 50, [], 0) }
|
59
|
+
assert_raise(TypeError) { Magick::Pixel.from_hsla(127, 50, 50, []) }
|
60
|
+
assert_nothing_raised { @pixel.to_hsla }
|
61
|
+
|
62
|
+
18.times do |h|
|
63
|
+
25.times do |s|
|
64
|
+
25.times do |l|
|
65
|
+
5.times do |a|
|
66
|
+
args = [20*h, s+25, l+25, a/5.0]
|
67
|
+
px = Magick::Pixel.from_hsla(*args)
|
68
|
+
hsla = px.to_hsla
|
69
|
+
#puts "[#{args.join(', ')}] = [#{hsla.join(', ')}]"
|
70
|
+
# Handle cases where the result is very near 360
|
71
|
+
#hsla[0] = ((hsla[0] + 0.005) % 360.0) - 0.005
|
72
|
+
#hsla[1] = ((hsla[1] + 0.005) % 360.0) - 0.005
|
73
|
+
#hsla[2] = ((hsla[2] + 0.005) % 360.0) - 0.005
|
74
|
+
assert_in_delta(args[0], hsla[0], 0.25, "expected #{args.inspect} got #{hsla.inspect}")
|
75
|
+
assert_in_delta(args[1], hsla[1], 0.25, "expected #{args.inspect} got #{hsla.inspect}")
|
76
|
+
assert_in_delta(args[2], hsla[2], 0.25, "expected #{args.inspect} got #{hsla.inspect}")
|
77
|
+
assert_in_delta(args[3], hsla[3], 0.005, "expected #{args.inspect} got #{hsla.inspect}")
|
78
|
+
end
|
81
79
|
end
|
82
|
-
|
83
|
-
# test percentages
|
84
|
-
args = ['20%','20%','20%','20%']
|
85
|
-
args2 = [360.0/5,255.0/5,255.0/5,1.0/5]
|
86
|
-
px = Magick::Pixel.from_hsla(*args)
|
87
|
-
hsla = px.to_hsla
|
88
|
-
px2 = Magick::Pixel.from_hsla(*args2)
|
89
|
-
hsla2 = px2.to_hsla
|
90
|
-
|
91
|
-
assert_in_delta(hsla[0], hsla2[0], 0.25, "#{hsla.inspect} != #{hsla2.inspect} with args: #{args.inspect} and #{args2.inspect}")
|
92
|
-
assert_in_delta(hsla[1], hsla2[1], 0.25, "#{hsla.inspect} != #{hsla2.inspect} with args: #{args.inspect} and #{args2.inspect}")
|
93
|
-
assert_in_delta(hsla[2], hsla2[2], 0.25, "#{hsla.inspect} != #{hsla2.inspect} with args: #{args.inspect} and #{args2.inspect}")
|
94
|
-
assert_in_delta(hsla[3], hsla2[3], 0.005, "#{hsla.inspect} != #{hsla2.inspect} with args: #{args.inspect} and #{args2.inspect}")
|
95
80
|
end
|
96
|
-
|
97
|
-
def test_to_color
|
98
|
-
assert_nothing_raised { @pixel.to_color(Magick::AllCompliance) }
|
99
|
-
assert_nothing_raised { @pixel.to_color(Magick::SVGCompliance) }
|
100
|
-
assert_nothing_raised { @pixel.to_color(Magick::X11Compliance) }
|
101
|
-
assert_nothing_raised { @pixel.to_color(Magick::XPMCompliance) }
|
102
|
-
assert_nothing_raised { @pixel.to_color(Magick::AllCompliance, true) }
|
103
|
-
assert_nothing_raised { @pixel.to_color(Magick::AllCompliance, false) }
|
104
|
-
assert_nothing_raised { @pixel.to_color(Magick::AllCompliance, false, 8) }
|
105
|
-
assert_nothing_raised { @pixel.to_color(Magick::AllCompliance, false, 16) }
|
106
|
-
# test "hex" format
|
107
|
-
assert_nothing_raised { @pixel.to_color(Magick::AllCompliance, false, 8, true) }
|
108
|
-
assert_nothing_raised { @pixel.to_color(Magick::AllCompliance, false, 16, true) }
|
109
|
-
|
110
|
-
assert_equal('#A52A2A', @pixel.to_color(Magick::AllCompliance, false, 8, true))
|
111
|
-
assert_equal('#A5A52A2A2A2A', @pixel.to_color(Magick::AllCompliance, false, 16, true))
|
112
|
-
|
113
|
-
assert_raise(ArgumentError) { @pixel.to_color(Magick::AllCompliance, false, 32) }
|
114
|
-
assert_raise(TypeError) { @pixel.to_color(1) }
|
115
81
|
end
|
82
|
+
|
83
|
+
# test percentages
|
84
|
+
args = ['20%','20%','20%','20%']
|
85
|
+
args2 = [360.0/5,255.0/5,255.0/5,1.0/5]
|
86
|
+
px = Magick::Pixel.from_hsla(*args)
|
87
|
+
hsla = px.to_hsla
|
88
|
+
px2 = Magick::Pixel.from_hsla(*args2)
|
89
|
+
hsla2 = px2.to_hsla
|
90
|
+
|
91
|
+
assert_in_delta(hsla[0], hsla2[0], 0.25, "#{hsla.inspect} != #{hsla2.inspect} with args: #{args.inspect} and #{args2.inspect}")
|
92
|
+
assert_in_delta(hsla[1], hsla2[1], 0.25, "#{hsla.inspect} != #{hsla2.inspect} with args: #{args.inspect} and #{args2.inspect}")
|
93
|
+
assert_in_delta(hsla[2], hsla2[2], 0.25, "#{hsla.inspect} != #{hsla2.inspect} with args: #{args.inspect} and #{args2.inspect}")
|
94
|
+
assert_in_delta(hsla[3], hsla2[3], 0.005, "#{hsla.inspect} != #{hsla2.inspect} with args: #{args.inspect} and #{args2.inspect}")
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_to_color
|
98
|
+
assert_nothing_raised { @pixel.to_color(Magick::AllCompliance) }
|
99
|
+
assert_nothing_raised { @pixel.to_color(Magick::SVGCompliance) }
|
100
|
+
assert_nothing_raised { @pixel.to_color(Magick::X11Compliance) }
|
101
|
+
assert_nothing_raised { @pixel.to_color(Magick::XPMCompliance) }
|
102
|
+
assert_nothing_raised { @pixel.to_color(Magick::AllCompliance, true) }
|
103
|
+
assert_nothing_raised { @pixel.to_color(Magick::AllCompliance, false) }
|
104
|
+
assert_nothing_raised { @pixel.to_color(Magick::AllCompliance, false, 8) }
|
105
|
+
assert_nothing_raised { @pixel.to_color(Magick::AllCompliance, false, 16) }
|
106
|
+
# test "hex" format
|
107
|
+
assert_nothing_raised { @pixel.to_color(Magick::AllCompliance, false, 8, true) }
|
108
|
+
assert_nothing_raised { @pixel.to_color(Magick::AllCompliance, false, 16, true) }
|
109
|
+
|
110
|
+
assert_equal('#A52A2A', @pixel.to_color(Magick::AllCompliance, false, 8, true))
|
111
|
+
assert_equal('#A5A52A2A2A2A', @pixel.to_color(Magick::AllCompliance, false, 16, true))
|
112
|
+
|
113
|
+
assert_raise(ArgumentError) { @pixel.to_color(Magick::AllCompliance, false, 32) }
|
114
|
+
assert_raise(TypeError) { @pixel.to_color(1) }
|
115
|
+
end
|
116
116
|
end
|
data/test/Preview.rb
CHANGED
@@ -5,50 +5,50 @@ require 'test/unit'
|
|
5
5
|
require 'test/unit/ui/console/testrunner' unless RUBY_VERSION[/^1\.9|^2/]
|
6
6
|
|
7
7
|
class Preview_UT < Test::Unit::TestCase
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
8
|
+
def test_preview
|
9
|
+
preview_types = [
|
10
|
+
Magick::RotatePreview,
|
11
|
+
Magick::ShearPreview,
|
12
|
+
Magick::RollPreview,
|
13
|
+
Magick::HuePreview,
|
14
|
+
Magick::SaturationPreview,
|
15
|
+
Magick::BrightnessPreview,
|
16
|
+
Magick::GammaPreview,
|
17
|
+
Magick::SpiffPreview,
|
18
|
+
Magick::DullPreview,
|
19
|
+
Magick::GrayscalePreview,
|
20
|
+
Magick::QuantizePreview,
|
21
|
+
Magick::DespecklePreview,
|
22
|
+
Magick::ReduceNoisePreview,
|
23
|
+
Magick::AddNoisePreview,
|
24
|
+
Magick::SharpenPreview,
|
25
|
+
Magick::BlurPreview,
|
26
|
+
Magick::ThresholdPreview,
|
27
|
+
Magick::EdgeDetectPreview,
|
28
|
+
Magick::SpreadPreview,
|
29
|
+
Magick::SolarizePreview,
|
30
|
+
Magick::ShadePreview,
|
31
|
+
Magick::RaisePreview,
|
32
|
+
Magick::SegmentPreview,
|
33
|
+
Magick::SwirlPreview,
|
34
|
+
Magick::ImplodePreview,
|
35
|
+
Magick::WavePreview,
|
36
|
+
Magick::OilPaintPreview,
|
37
|
+
Magick::CharcoalDrawingPreview,
|
38
|
+
Magick::JPEGPreview ]
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
end
|
45
|
-
puts "\n"
|
46
|
-
preview_types.each do |type|
|
47
|
-
puts "testing #{type}..."
|
48
|
-
assert_nothing_raised { hat.preview(type) }
|
49
|
-
end
|
50
|
-
assert_raise(TypeError) { hat.preview(2) }
|
40
|
+
hat = Magick::Image.read(IMAGES_DIR+'/Flower_Hat.jpg').first
|
41
|
+
assert_nothing_raised do
|
42
|
+
prev = hat.preview(Magick::RotatePreview)
|
43
|
+
assert_instance_of(Magick::Image, prev)
|
51
44
|
end
|
45
|
+
puts "\n"
|
46
|
+
preview_types.each do |type|
|
47
|
+
puts "testing #{type}..."
|
48
|
+
assert_nothing_raised { hat.preview(type) }
|
49
|
+
end
|
50
|
+
assert_raise(TypeError) { hat.preview(2) }
|
51
|
+
end
|
52
52
|
end
|
53
53
|
|
54
54
|
if __FILE__ == $PROGRAM_NAME
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rmagick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.15.
|
4
|
+
version: 2.15.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Hunter
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-
|
14
|
+
date: 2015-08-14 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake-compiler
|
@@ -45,16 +45,16 @@ dependencies:
|
|
45
45
|
name: rubocop
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
|
-
- - "
|
48
|
+
- - "~>"
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version:
|
50
|
+
version: 0.33.0
|
51
51
|
type: :development
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- - "
|
55
|
+
- - "~>"
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version:
|
57
|
+
version: 0.33.0
|
58
58
|
description: RMagick is an interface between Ruby and ImageMagick.
|
59
59
|
email: github@benjaminfleischer.com
|
60
60
|
executables: []
|
@@ -62,6 +62,7 @@ extensions:
|
|
62
62
|
- ext/RMagick/extconf.rb
|
63
63
|
extra_rdoc_files: []
|
64
64
|
files:
|
65
|
+
- ".editorconfig"
|
65
66
|
- ".gitignore"
|
66
67
|
- ".hound.yml"
|
67
68
|
- ".rspec"
|
@@ -428,6 +429,13 @@ files:
|
|
428
429
|
- rmagick.gemspec
|
429
430
|
- spec/rmagick/ImageList1_spec.rb
|
430
431
|
- spec/rmagick/draw_spec.rb
|
432
|
+
- spec/rmagick/image/blue_shift_spec.rb
|
433
|
+
- spec/rmagick/image/composite_spec.rb
|
434
|
+
- spec/rmagick/image/constitute_spec.rb
|
435
|
+
- spec/rmagick/image/dispatch_spec.rb
|
436
|
+
- spec/rmagick/image/from_blob_spec.rb
|
437
|
+
- spec/rmagick/image/ping_spec.rb
|
438
|
+
- spec/rmagick/image/properties_spec.rb
|
431
439
|
- spec/spec_helper.rb
|
432
440
|
- test/Image1.rb
|
433
441
|
- test/Image2.rb
|
@@ -474,6 +482,13 @@ summary: Ruby binding to ImageMagick
|
|
474
482
|
test_files:
|
475
483
|
- spec/rmagick/ImageList1_spec.rb
|
476
484
|
- spec/rmagick/draw_spec.rb
|
485
|
+
- spec/rmagick/image/blue_shift_spec.rb
|
486
|
+
- spec/rmagick/image/composite_spec.rb
|
487
|
+
- spec/rmagick/image/constitute_spec.rb
|
488
|
+
- spec/rmagick/image/dispatch_spec.rb
|
489
|
+
- spec/rmagick/image/from_blob_spec.rb
|
490
|
+
- spec/rmagick/image/ping_spec.rb
|
491
|
+
- spec/rmagick/image/properties_spec.rb
|
477
492
|
- spec/spec_helper.rb
|
478
493
|
- test/Image1.rb
|
479
494
|
- test/Image2.rb
|