rmagick 3.2.0 → 4.0.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.

@@ -361,13 +361,13 @@ Color_to_s(VALUE self)
361
361
 
362
362
  sprintf(buff, "name=%s, compliance=%s, "
363
363
  #if (MAGICKCORE_QUANTUM_DEPTH == 32 || MAGICKCORE_QUANTUM_DEPTH == 64) && defined(HAVE_TYPE_LONG_DOUBLE)
364
- "color.red=%Lg, color.green=%Lg, color.blue=%Lg, color.opacity=%Lg ",
364
+ "color.red=%Lg, color.green=%Lg, color.blue=%Lg, color.alpha=%Lg ",
365
365
  #else
366
- "color.red=%g, color.green=%g, color.blue=%g, color.opacity=%g ",
366
+ "color.red=%g, color.green=%g, color.blue=%g, color.alpha=%g ",
367
367
  #endif
368
368
  ci.name,
369
369
  ComplianceType_name(&ci.compliance),
370
- ci.color.red, ci.color.green, ci.color.blue, ci.color.opacity);
370
+ ci.color.red, ci.color.green, ci.color.blue, QuantumRange - ci.color.opacity);
371
371
 
372
372
  destroy_ColorInfo(&ci);
373
373
  return rb_str_new2(buff);
@@ -1,5 +1,5 @@
1
1
  module Magick
2
- VERSION = '3.2.0'
2
+ VERSION = '4.0.0'
3
3
  MIN_RUBY_VERSION = '2.3.0'
4
4
  MIN_IM_VERSION = '6.7.7'
5
5
  end
@@ -20,7 +20,6 @@ end
20
20
 
21
21
  require 'English'
22
22
  require 'RMagick2.so'
23
- require 'obsolete.rb'
24
23
 
25
24
  module Magick
26
25
  @formats = nil
@@ -427,14 +426,6 @@ module Magick
427
426
  primitive 'line ' + format('%g,%g %g,%g', start_x, start_y, end_x, end_y)
428
427
  end
429
428
 
430
- # Set matte (make transparent) in image according to the specified
431
- # colorization rule
432
- def matte(x, y, method)
433
- Kernel.warn 'Draw#matte is deprecated. Use Draw#alpha instead.'
434
- Kernel.raise ArgumentError, 'Unknown paint method' unless PAINT_METHOD_NAMES.key?(method.to_i)
435
- primitive 'matte ' + format('%g,%g, %s', x, y, PAINT_METHOD_NAMES[method.to_i])
436
- end
437
-
438
429
  # Specify drawing fill and stroke opacities. If the value is a string
439
430
  # ending with a %, the number will be multiplied by 0.01.
440
431
  def opacity(opacity)
@@ -60,10 +60,10 @@ module Magick
60
60
  # else, combine it with the background_fill_opacity.
61
61
  def bgfill
62
62
  if @background_fill.nil?
63
- color = Magick::Pixel.new(0, 0, 0, Magick::TransparentOpacity)
63
+ color = Magick::Pixel.new(0, 0, 0, Magick::OpaqueAlpha)
64
64
  else
65
65
  color = @background_fill
66
- color.opacity = (1.0 - @background_fill_opacity) * Magick::TransparentOpacity
66
+ color.alpha = @background_fill_opacity * Magick::OpaqueAlpha
67
67
  end
68
68
  color
69
69
  end
@@ -321,7 +321,7 @@ class Image1_UT < Test::Unit::TestCase
321
321
  assert_nothing_raised { @img.black_threshold(50) }
322
322
  assert_nothing_raised { @img.black_threshold(50, 50) }
323
323
  assert_nothing_raised { @img.black_threshold(50, 50, 50) }
324
- assert_nothing_raised { @img.black_threshold(50, 50, 50, 50) }
324
+ assert_raise(ArgumentError) { @img.black_threshold(50, 50, 50, 50) }
325
325
  assert_nothing_raised { @img.black_threshold(50, 50, 50, alpha: 50) }
326
326
  assert_raise(ArgumentError) { @img.black_threshold(50, 50, 50, wrong: 50) }
327
327
  assert_raise(ArgumentError) { @img.black_threshold(50, 50, 50, alpha: 50, extra: 50) }
@@ -570,27 +570,6 @@ class Image1_UT < Test::Unit::TestCase
570
570
  assert_raise(FreezeError) { @img.color_reset!('red') }
571
571
  end
572
572
 
573
- def test_combine
574
- r = Magick::Image.new(20, 20) { self.background_color = 'red' }
575
- g = Magick::Image.new(20, 20) { self.background_color = 'green' }
576
- b = Magick::Image.new(20, 20) { self.background_color = 'blue' }
577
- a = Magick::Image.new(20, 20) { self.background_color = 'transparent' }
578
- assert_nothing_raised { Magick::Image.combine(r) }
579
- assert_nothing_raised { Magick::Image.combine(r, g) }
580
- assert_nothing_raised { Magick::Image.combine(r, g, b) }
581
- assert_nothing_raised { Magick::Image.combine(r, g, b, a) }
582
- assert_nothing_raised { Magick::Image.combine(nil, g) }
583
- assert_nothing_raised { Magick::Image.combine(r, nil, b) }
584
- assert_nothing_raised { Magick::Image.combine(r, g, nil, a) }
585
- assert_nothing_raised { Magick::Image.combine(r, g, b, nil) }
586
- res = Magick::Image.combine(r, g, b)
587
- assert_instance_of(Magick::Image, res)
588
- assert_raise(ArgumentError) { Magick::Image.combine }
589
- assert_raise(ArgumentError) { Magick::Image.combine(nil) }
590
- assert_raise(ArgumentError) { Magick::Image.combine(r, g, b, a, r) }
591
- assert_raise(TypeError) { Magick::Image.combine(1, g, b, a) }
592
- end
593
-
594
573
  def test_compare_channel
595
574
  img1 = Magick::Image.read(IMAGES_DIR + '/Button_0.gif').first
596
575
  img2 = Magick::Image.read(IMAGES_DIR + '/Button_1.gif').first
@@ -387,7 +387,7 @@ class Image2_UT < Test::Unit::TestCase
387
387
 
388
388
  unmapped = Magick::ImageList.new(IMAGES_DIR + '/Hot_Air_Balloons.jpg', IMAGES_DIR + '/Violin.jpg', IMAGES_DIR + '/Polynesia.jpg')
389
389
  map = Magick::ImageList.new 'netscape:'
390
- mapped = unmapped.map map, false
390
+ mapped = unmapped.remap map
391
391
  unmapped.each(&:destroy!)
392
392
  map.destroy!
393
393
  mapped.each(&:destroy!)
@@ -521,6 +521,8 @@ class Image2_UT < Test::Unit::TestCase
521
521
  end
522
522
 
523
523
  def test_each_profile
524
+ assert_nil(@img.each_profile {})
525
+
524
526
  @img.iptc_profile = 'test profile'
525
527
  assert_nothing_raised do
526
528
  @img.each_profile do |name, value|
@@ -655,10 +657,6 @@ class Image2_UT < Test::Unit::TestCase
655
657
  res = @img.export_pixels_to_str(0, 0, 10, 10, 'I', Magick::ShortPixel)
656
658
  assert_equal(10 * 10 * 2, res.length)
657
659
  end
658
- assert_nothing_raised do
659
- res = @img.export_pixels_to_str(0, 0, 10, 10, 'I', Magick::IntegerPixel)
660
- assert_equal(10 * 10 * 4, res.length)
661
- end
662
660
  assert_nothing_raised do
663
661
  res = @img.export_pixels_to_str(0, 0, 10, 10, 'I', Magick::LongPixel)
664
662
  assert_equal(10 * 10 * [1].pack('L!').length, res.length)
@@ -1088,21 +1086,6 @@ class Image2_UT < Test::Unit::TestCase
1088
1086
  assert_same(@img, res)
1089
1087
  end
1090
1088
 
1091
- def test_map
1092
- map = Magick::Image.read('netscape:').first
1093
- assert_nothing_raised do
1094
- res = @img.map(map)
1095
- assert_instance_of(Magick::Image, res)
1096
- assert_not_same(@img, res)
1097
- end
1098
- assert_nothing_raised { @img.map(map, true) }
1099
- assert_raise(NoMethodError) { @img.map(2) }
1100
- assert_raise(ArgumentError) { @img.map(map, true, 2) }
1101
- assert_raise(ArgumentError) { @img.map }
1102
- map.destroy!
1103
- assert_raise(Magick::DestroyedImageError) { @img.map(map, true) }
1104
- end
1105
-
1106
1089
  def test_marshal
1107
1090
  img = Magick::Image.read(IMAGES_DIR + '/Button_0.gif').first
1108
1091
  d = nil
@@ -1345,23 +1328,22 @@ class Image2_UT < Test::Unit::TestCase
1345
1328
  assert_not_nil(res)
1346
1329
  assert_instance_of(Magick::Image, res)
1347
1330
  assert_not_same(res, @img)
1348
- assert_nothing_raised { @img.paint_transparent('red', Magick::TransparentOpacity) }
1331
+ assert_raise(ArgumentError) { @img.paint_transparent('red', Magick::TransparentAlpha) }
1349
1332
  assert_nothing_raised { @img.paint_transparent('red', alpha: Magick::TransparentAlpha) }
1350
1333
  assert_raise(ArgumentError) { @img.paint_transparent('red', wrong: Magick::TransparentAlpha) }
1351
- assert_nothing_raised { @img.paint_transparent('red', Magick::TransparentOpacity, true) }
1334
+ assert_raise(ArgumentError) { @img.paint_transparent('red', Magick::TransparentAlpha, true) }
1352
1335
  assert_nothing_raised { @img.paint_transparent('red', true, alpha: Magick::TransparentAlpha) }
1353
1336
  assert_raise(ArgumentError) { @img.paint_transparent('red', true, wrong: Magick::TransparentAlpha) }
1354
1337
  assert_raise(ArgumentError) { @img.paint_transparent('red', true, alpha: Magick::TransparentAlpha, extra: Magick::TransparentAlpha) }
1355
- assert_nothing_raised { @img.paint_transparent('red', Magick::TransparentOpacity, true, 50) }
1338
+ assert_raise(ArgumentError) { @img.paint_transparent('red', Magick::TransparentAlpha, true, 50) }
1356
1339
  assert_nothing_raised { @img.paint_transparent('red', true, 50, alpha: Magick::TransparentAlpha) }
1357
1340
  assert_raise(ArgumentError) { @img.paint_transparent('red', true, 50, wrong: Magick::TransparentAlpha) }
1358
1341
 
1359
1342
  # Too many arguments
1360
- assert_raise(ArgumentError) { @img.paint_transparent('red', Magick::TransparentOpacity, true, 50, 50) }
1343
+ assert_raise(ArgumentError) { @img.paint_transparent('red', true, 50, 50, 50) }
1361
1344
  # Not enough
1362
1345
  assert_raise(ArgumentError) { @img.paint_transparent }
1363
- assert_raise(TypeError) { @img.paint_transparent('red', Magick::TransparentOpacity, true, []) }
1364
- assert_raise(TypeError) { @img.paint_transparent('red', 'blue') }
1346
+ assert_raise(TypeError) { @img.paint_transparent('red', true, [], alpha: Magick::TransparentAlpha) }
1365
1347
  assert_raise(TypeError) { @img.paint_transparent(50) }
1366
1348
  end
1367
1349
 
@@ -690,10 +690,6 @@ class Image3_UT < Test::Unit::TestCase
690
690
  end
691
691
  end
692
692
 
693
- def test_sync_profiles
694
- assert_nothing_raised { assert(@img.sync_profiles) }
695
- end
696
-
697
693
  def test_texture_fill_to_border
698
694
  texture = Magick::Image.read('granite:').first
699
695
  assert_nothing_raised do
@@ -809,24 +805,23 @@ class Image3_UT < Test::Unit::TestCase
809
805
  end
810
806
  pixel = Magick::Pixel.new
811
807
  assert_nothing_raised { @img.transparent(pixel) }
812
- assert_nothing_raised { @img.transparent('white', Magick::TransparentOpacity) }
808
+ assert_raise(ArgumentError) { @img.transparent('white', Magick::TransparentAlpha) }
813
809
  assert_nothing_raised { @img.transparent('white', alpha: Magick::TransparentAlpha) }
814
810
  assert_raise(ArgumentError) { @img.transparent('white', wrong: Magick::TransparentAlpha) }
815
811
  assert_raise(ArgumentError) { @img.transparent('white', alpha: Magick::TransparentAlpha, extra: Magick::TransparentAlpha) }
816
- assert_raise(ArgumentError) { @img.transparent('white', Magick::TransparentOpacity, 2) }
817
- assert_nothing_raised { @img.transparent('white', Magick::QuantumRange / 2) }
812
+ assert_raise(ArgumentError) { @img.transparent('white', Magick::TransparentAlpha, 2) }
813
+ assert_raise(ArgumentError) { @img.transparent('white', Magick::QuantumRange / 2) }
818
814
  assert_raise(TypeError) { @img.transparent(2) }
819
815
  end
820
816
 
821
817
  def test_transparent_chroma
822
818
  assert_instance_of(Magick::Image, @img.transparent_chroma('white', Magick::Pixel.new(Magick::QuantumRange)))
823
819
  assert_nothing_raised { @img.transparent_chroma('white', Magick::Pixel.new(Magick::QuantumRange)) }
824
- assert_nothing_raised { @img.transparent_chroma('white', Magick::Pixel.new(Magick::QuantumRange), Magick::TransparentOpacity) }
820
+ assert_raise(ArgumentError) { @img.transparent_chroma('white', Magick::Pixel.new(Magick::QuantumRange), Magick::TransparentAlpha) }
825
821
  assert_nothing_raised { @img.transparent_chroma('white', Magick::Pixel.new(Magick::QuantumRange), alpha: Magick::TransparentAlpha) }
826
822
  assert_raise(ArgumentError) { @img.transparent_chroma('white', Magick::Pixel.new(Magick::QuantumRange), wrong: Magick::TransparentAlpha) }
827
- assert_nothing_raised { @img.transparent_chroma('white', Magick::Pixel.new(Magick::QuantumRange), Magick::TransparentOpacity, true) }
828
- assert_nothing_raised { @img.transparent_chroma('white', Magick::Pixel.new(Magick::QuantumRange), Magick::TransparentOpacity, false) }
829
- assert_nothing_raised { @img.transparent_chroma('white', Magick::Pixel.new(Magick::QuantumRange), false, alpha: Magick::TransparentAlpha) }
823
+ assert_raise(ArgumentError) { @img.transparent_chroma('white', Magick::Pixel.new(Magick::QuantumRange), Magick::TransparentAlpha, true) }
824
+ assert_nothing_raised { @img.transparent_chroma('white', Magick::Pixel.new(Magick::QuantumRange), true, alpha: Magick::TransparentAlpha) }
830
825
  assert_raise(ArgumentError) { @img.transparent_chroma('white', Magick::Pixel.new(Magick::QuantumRange), false, wrong: Magick::TransparentAlpha) }
831
826
  assert_raise(ArgumentError) { @img.transparent_chroma('white', Magick::Pixel.new(Magick::QuantumRange), false, alpha: Magick::TransparentAlpha, extra: Magick::TransparentAlpha) }
832
827
  end
@@ -1014,7 +1009,7 @@ class Image3_UT < Test::Unit::TestCase
1014
1009
  assert_nothing_raised { @img.white_threshold(50) }
1015
1010
  assert_nothing_raised { @img.white_threshold(50, 50) }
1016
1011
  assert_nothing_raised { @img.white_threshold(50, 50, 50) }
1017
- assert_nothing_raised { @img.white_threshold(50, 50, 50, 50) }
1012
+ assert_raise(ArgumentError) { @img.white_threshold(50, 50, 50, 50) }
1018
1013
  assert_nothing_raised { @img.white_threshold(50, 50, 50, alpha: 50) }
1019
1014
  assert_raise(ArgumentError) { @img.white_threshold(50, 50, 50, wrong: 50) }
1020
1015
  assert_raise(ArgumentError) { @img.white_threshold(50, 50, 50, alpha: 50, extra: 50) }
@@ -107,37 +107,6 @@ class ImageList2UT < Test::Unit::TestCase
107
107
  assert_equal(@ilist, ilist2)
108
108
  end
109
109
 
110
- def test_fx
111
- @ilist.read(IMAGES_DIR + '/Button_0.gif', IMAGES_DIR + '/Button_1.gif')
112
- assert_nothing_raised { @ilist.fx('1/2') }
113
- assert_nothing_raised { @ilist.fx('1/2', Magick::BlueChannel) }
114
- assert_nothing_raised { @ilist.fx('1/2', Magick::BlueChannel, Magick::RedChannel) }
115
- assert_raise(ArgumentError) { @ilist.fx }
116
- assert_raise(ArgumentError) { @ilist.fx(Magick::BlueChannel) }
117
- assert_raise(TypeError) { @ilist.fx(1) }
118
- assert_raise(TypeError) { @ilist.fx('1/2', 1) }
119
- end
120
-
121
- def test_map
122
- map = Magick::Image.read('netscape:')[0]
123
- @ilist.read(IMAGES_DIR + '/Button_0.gif', IMAGES_DIR + '/Button_1.gif')
124
- assert_nothing_raised do
125
- img = @ilist.map(map)
126
- assert_instance_of(Magick::ImageList, img)
127
- end
128
- assert_nothing_raised do
129
- img = @ilist.map(map, true)
130
- assert_instance_of(Magick::ImageList, img)
131
- end
132
-
133
- map = Magick::ImageList.new('netscape:')
134
- img = @ilist.map(map, true)
135
- assert_instance_of(Magick::ImageList, img)
136
-
137
- assert_raise(ArgumentError) { @ilist.map }
138
- assert_raise(ArgumentError) { @ilist.map(map, true, 42) }
139
- end
140
-
141
110
  def test_marshal
142
111
  ilist1 = Magick::ImageList.new(*Dir[IMAGES_DIR + '/Button_*.gif'])
143
112
  d = nil
@@ -23,13 +23,6 @@ class Image_Attributes_UT < Test::Unit::TestCase
23
23
  @p = Magick::Image.read(IMAGE_WITH_PROFILE).first.color_profile
24
24
  end
25
25
 
26
- # Test old alpha attribute. New alpha() behavior is tested in Image1.rb
27
- def test_alpha
28
- assert(@img.alpha)
29
- assert_nothing_raised { @img.alpha = Magick::DeactivateAlphaChannel }
30
- assert(!@img.alpha)
31
- end
32
-
33
26
  def test_background_color
34
27
  assert_nothing_raised { @img.background_color }
35
28
  assert_equal('white', @img.background_color)
@@ -92,13 +85,6 @@ class Image_Attributes_UT < Test::Unit::TestCase
92
85
  assert_equal(false, @img.black_point_compensation)
93
86
  end
94
87
 
95
- def test_blur
96
- assert_nothing_raised { @img.blur }
97
- assert_equal(1.0, @img.blur)
98
- assert_nothing_raised { @img.blur = 2.0 }
99
- assert_raise(TypeError) { @img.blur = 'x' }
100
- end
101
-
102
88
  def test_border_color
103
89
  assert_nothing_raised { @img.border_color }
104
90
  # assert_equal("rgb(223,223,223)", @img.border_color)
@@ -406,13 +392,6 @@ class Image_Attributes_UT < Test::Unit::TestCase
406
392
  assert_raise(TypeError) { @img.iptc_profile = 2 }
407
393
  end
408
394
 
409
- def test_matte
410
- assert_nothing_raised { @img.matte }
411
- assert(@img.matte)
412
- assert_nothing_raised { @img.matte = false }
413
- assert(!@img.matte)
414
- end
415
-
416
395
  def test_mean_error
417
396
  assert_nothing_raised { @hat.mean_error_per_pixel }
418
397
  assert_nothing_raised { @hat.normalized_mean_error }
@@ -467,12 +446,6 @@ class Image_Attributes_UT < Test::Unit::TestCase
467
446
  assert_raise(TypeError) { @img.offset = 'x' }
468
447
  end
469
448
 
470
- def test_opacity
471
- assert_raise(NoMethodError) { @img.opacity }
472
- assert_nothing_raised { @img.opacity = 50 }
473
- assert_raise(TypeError) { @img.opacity = 'x' }
474
- end
475
-
476
449
  def test_orientation
477
450
  assert_nothing_raised { @img.orientation }
478
451
  assert_instance_of(Magick::OrientationType, @img.orientation)
@@ -621,7 +594,6 @@ class Image_Attributes_UT < Test::Unit::TestCase
621
594
  def test_frozen
622
595
  @img.freeze
623
596
  assert_raise(FreezeError) { @img.background_color = 'xxx' }
624
- assert_raise(FreezeError) { @img.blur = 50 }
625
597
  assert_raise(FreezeError) { @img.border_color = 'xxx' }
626
598
  rp = Magick::Point.new(1, 1)
627
599
  gp = Magick::Point.new(1, 1)
@@ -645,11 +617,8 @@ class Image_Attributes_UT < Test::Unit::TestCase
645
617
  assert_raise(FreezeError) { @img.geometry = '100x100' }
646
618
  assert_raise(FreezeError) { @img.interlace = Magick::NoInterlace }
647
619
  assert_raise(FreezeError) { @img.iptc_profile = 'xxx' }
648
- assert_raise(FreezeError) { @img.mask = @img }
649
- assert_raise(FreezeError) { @img.matte = true }
650
620
  assert_raise(FreezeError) { @img.monitor = proc { |name, _q, _s| puts name } }
651
621
  assert_raise(FreezeError) { @img.offset = 100 }
652
- assert_raise(FreezeError) { @img.opacity = 100 }
653
622
  assert_raise(FreezeError) { @img.page = Magick::Rectangle.new(1, 2, 3, 4) }
654
623
  assert_raise(FreezeError) { @img.rendering_intent = Magick::SaturationIntent }
655
624
  assert_raise(FreezeError) { @img.start_loop = true }
@@ -54,7 +54,6 @@ class ImportExportUT < Test::Unit::TestCase
54
54
 
55
55
  ipixels = pixels.collect { |px| px * 16_843_009 }
56
56
  p = ipixels.pack('I*')
57
- import(p, Magick::IntegerPixel)
58
57
  import(p, Magick::LongPixel)
59
58
 
60
59
  when 16
@@ -70,7 +69,6 @@ class ImportExportUT < Test::Unit::TestCase
70
69
  ipixels = pixels.collect { |px| px * 65_537 }
71
70
  ipixels.pack('I*')
72
71
  # Diff s/b 0.0 but never is.
73
- # import(p, Magick::IntegerPixel, 430.7834)
74
72
  # import(p, Magick::LongPixel, 430.7834)
75
73
 
76
74
  when 32
@@ -83,7 +81,6 @@ class ImportExportUT < Test::Unit::TestCase
83
81
  import(p, Magick::ShortPixel)
84
82
 
85
83
  p = pixels.pack('I*')
86
- import(p, Magick::IntegerPixel)
87
84
  import(p, Magick::LongPixel)
88
85
  p = pixels.pack('D*') if is_hdri_support
89
86
  import(p, Magick::QuantumPixel)
@@ -99,7 +96,6 @@ class ImportExportUT < Test::Unit::TestCase
99
96
 
100
97
  ipixels = pixels.collect { |px| px / 4_294_967_297 }
101
98
  p = ipixels.pack('I*')
102
- import(p, Magick::IntegerPixel)
103
99
  import(p, Magick::LongPixel)
104
100
 
105
101
  p = pixels.pack('Q*')
@@ -234,14 +234,6 @@ class InfoUT < Test::Unit::TestCase
234
234
  assert_nothing_raised { @info.gravity = nil }
235
235
  end
236
236
 
237
- def test_group
238
- assert_kind_of(Integer, @info.group)
239
- assert_nothing_raised { @info.group = 50 }
240
- assert_equal(50, @info.group)
241
- assert_raise(TypeError) { @info.group = nil }
242
- assert_raise(TypeError) { @info.group = 'xxx' }
243
- end
244
-
245
237
  def test_image_type
246
238
  Magick::ImageType.values.each do |v|
247
239
  assert_nothing_raised { @info.image_type = v }
@@ -23,20 +23,12 @@ class KernelInfoUT < Test::Unit::TestCase
23
23
  assert_raise(TypeError) { Magick::KernelInfo.new(42) }
24
24
  end
25
25
 
26
- def test_zero_nans
27
- assert_nil(@kernel.zero_nans)
28
- end
29
-
30
26
  def test_unity_add
31
27
  assert_nil(@kernel.unity_add(1.0))
32
28
  assert_nil(@kernel.unity_add(12))
33
29
  assert_raise(TypeError) { @kernel.unity_add('x') }
34
30
  end
35
31
 
36
- def test_show
37
- assert_nil(@kernel.show)
38
- end
39
-
40
32
  def test_scale
41
33
  Magick::GeometryFlags.values do |flag|
42
34
  assert_nil(@kernel.scale(1.0, flag))
@@ -41,14 +41,6 @@ class PixelUT < Test::Unit::TestCase
41
41
  assert_raise(TypeError) { @pixel.alpha = 'x' }
42
42
  end
43
43
 
44
- def test_opacity
45
- assert_nothing_raised { @pixel.opacity = 123 }
46
- assert_equal(123, @pixel.opacity)
47
- assert_nothing_raised { @pixel.opacity = 255.25 }
48
- assert_equal(255, @pixel.opacity)
49
- assert_raise(TypeError) { @pixel.opacity = 'x' }
50
- end
51
-
52
44
  def test_cyan
53
45
  assert_nothing_raised { @pixel.cyan = 123 }
54
46
  assert_equal(123, @pixel.cyan)
@@ -118,13 +110,13 @@ class PixelUT < Test::Unit::TestCase
118
110
  hash = nil
119
111
  assert_nothing_raised { hash = @pixel.hash }
120
112
  assert_not_nil(hash)
121
- assert_equal(1_385_501_952, hash)
113
+ assert_equal(1_385_502_079, hash)
122
114
 
123
115
  p = Magick::Pixel.new
124
- assert_equal(0, p.hash)
116
+ assert_equal(127, p.hash)
125
117
 
126
118
  p = Magick::Pixel.from_color('red')
127
- assert_equal(2_139_095_040, p.hash)
119
+ assert_equal(2_139_095_167, p.hash)
128
120
 
129
121
  # Pixel.hash sacrifices the last bit of the opacity channel
130
122
  p = Magick::Pixel.new(0, 0, 0, 72)
@@ -198,11 +190,6 @@ class PixelUT < Test::Unit::TestCase
198
190
  assert_in_delta(hsla[3], hsla2[3], 0.005, "#{hsla.inspect} != #{hsla2.inspect} with args: #{args.inspect} and #{args2.inspect}")
199
191
  end
200
192
 
201
- def test_from_hsl
202
- assert_instance_of(Magick::Pixel, Magick::Pixel.from_HSL([127, 50, 50]))
203
- assert_raise(ArgumentError) { Magick::Pixel.from_HSL([127, 50]) }
204
- end
205
-
206
193
  def test_intensity
207
194
  assert_kind_of(Integer, @pixel.intensity)
208
195
  end
@@ -238,25 +225,12 @@ class PixelUT < Test::Unit::TestCase
238
225
  pixel.blue += 20
239
226
  assert_equal(-1, @pixel <=> pixel)
240
227
 
241
- @pixel.opacity = 100
242
- pixel = @pixel.dup
243
- pixel.opacity -= 10
244
- assert_equal(1, @pixel <=> pixel)
245
- pixel.opacity += 20
246
- assert_equal(-1, @pixel <=> pixel)
247
-
248
228
  @pixel.alpha = 100
249
229
  pixel = @pixel.dup
250
230
  pixel.alpha -= 10
251
- assert_equal(-1, @pixel <=> pixel)
252
- pixel.alpha += 20
253
231
  assert_equal(1, @pixel <=> pixel)
254
- end
255
-
256
- def test_to_hsl
257
- hsl = @pixel.to_HSL
258
- assert_instance_of(Array, hsl)
259
- assert_equal(3, hsl.size)
232
+ pixel.alpha += 20
233
+ assert_equal(-1, @pixel <=> pixel)
260
234
  end
261
235
 
262
236
  def test_to_color
@@ -280,6 +254,6 @@ class PixelUT < Test::Unit::TestCase
280
254
  end
281
255
 
282
256
  def test_to_s
283
- assert_match(/red=\d+, green=\d+, blue=\d+, opacity=\d+/, @pixel.to_s)
257
+ assert_match(/red=\d+, green=\d+, blue=\d+, alpha=\d+/, @pixel.to_s)
284
258
  end
285
259
  end