rmagick 3.0.0 → 3.1.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.

Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.appveyor.yml +32 -6
  3. data/.circleci/config.yml +1 -1
  4. data/.gitignore +1 -0
  5. data/.rubocop.yml +9 -9
  6. data/.rubocop_todo.yml +351 -17
  7. data/.travis.yml +14 -1
  8. data/CHANGELOG.md +55 -0
  9. data/CONTRIBUTING.md +11 -18
  10. data/README.textile +2 -2
  11. data/Rakefile +1 -1
  12. data/before_install_linux.sh +56 -19
  13. data/doc/ex/sparse_color.rb +5 -0
  14. data/doc/magick.html +9 -4
  15. data/doc/rvg.html +2 -2
  16. data/doc/rvgtut.html +1 -1
  17. data/examples/histogram.rb +1 -1
  18. data/ext/RMagick/extconf.rb +90 -264
  19. data/ext/RMagick/rmagick.c +28 -6
  20. data/ext/RMagick/rmagick.h +53 -199
  21. data/ext/RMagick/rmdraw.c +52 -70
  22. data/ext/RMagick/rmenum.c +332 -274
  23. data/ext/RMagick/rmfill.c +62 -112
  24. data/ext/RMagick/rmilist.c +27 -62
  25. data/ext/RMagick/rmimage.c +424 -634
  26. data/ext/RMagick/rminfo.c +46 -37
  27. data/ext/RMagick/rmkinfo.c +47 -42
  28. data/ext/RMagick/rmmain.c +125 -180
  29. data/ext/RMagick/rmmontage.c +5 -5
  30. data/ext/RMagick/rmpixel.c +133 -62
  31. data/ext/RMagick/rmstruct.c +14 -181
  32. data/ext/RMagick/rmutil.c +195 -111
  33. data/lib/rmagick/version.rb +2 -3
  34. data/lib/rvg/deep_equal.rb +1 -1
  35. data/lib/rvg/misc.rb +4 -4
  36. data/lib/rvg/units.rb +2 -2
  37. data/rmagick.gemspec +2 -2
  38. data/spec/rmagick/ImageList1_spec.rb +2 -2
  39. data/spec/rmagick/draw_spec.rb +4 -4
  40. data/spec/rmagick/image/composite_spec.rb +6 -1
  41. data/spec/rmagick/image/properties_spec.rb +8 -8
  42. data/test/Draw.rb +414 -0
  43. data/test/Enum.rb +76 -0
  44. data/test/Fill.rb +93 -0
  45. data/test/Image1.rb +9 -1
  46. data/test/Image2.rb +14 -4
  47. data/test/Image3.rb +73 -3
  48. data/test/ImageList1.rb +22 -9
  49. data/test/ImageList2.rb +41 -9
  50. data/test/Image_attributes.rb +45 -8
  51. data/test/Info.rb +102 -6
  52. data/test/Magick.rb +8 -1
  53. data/test/PolaroidOptions.rb +23 -0
  54. data/test/test_all_basic.rb +4 -0
  55. metadata +28 -8
  56. data/.hound.yml +0 -2
  57. data/wercker.yml +0 -10
@@ -133,6 +133,9 @@ class ImageList2UT < Test::Unit::TestCase
133
133
  map = Magick::ImageList.new('netscape:')
134
134
  img = @ilist.map(map, true)
135
135
  assert_instance_of(Magick::ImageList, img)
136
+
137
+ assert_raise(ArgumentError) { @ilist.map }
138
+ assert_raise(ArgumentError) { @ilist.map(map, true, 42) }
136
139
  end
137
140
 
138
141
  def test_marshal
@@ -156,6 +159,7 @@ class ImageList2UT < Test::Unit::TestCase
156
159
  self.border_color = Magick::Pixel.new(0, 0, 0)
157
160
  self.border_width = 2
158
161
  self.compose = Magick::OverCompositeOp
162
+ self.filename = 'test.png'
159
163
  self.fill = 'green'
160
164
  self.font = 'Arial'
161
165
  self.frame = '20x20+4+4'
@@ -164,11 +168,15 @@ class ImageList2UT < Test::Unit::TestCase
164
168
  self.geometry = Magick::Geometry.new(63, 60, 5, 5)
165
169
  self.gravity = Magick::SouthGravity
166
170
  self.matte_color = '#bdbdbd'
171
+ self.matte_color = Magick::Pixel.new(Magick::QuantumRange, 0, 0)
167
172
  self.pointsize = 12
168
173
  self.shadow = true
169
174
  self.stroke = 'transparent'
175
+ self.texture = Magick::Image.read(IMAGES_DIR + '/Button_0.gif').first
176
+ self.texture = Magick::Image.read(IMAGES_DIR + '/Button_1.gif').first
170
177
  self.tile = '4x9'
171
178
  self.tile = Magick::Geometry.new(4, 9)
179
+ self.title = 'sample'
172
180
  end
173
181
  assert_instance_of(Magick::ImageList, montage)
174
182
  assert_equal(@ilist, ilist)
@@ -193,6 +201,10 @@ class ImageList2UT < Test::Unit::TestCase
193
201
  montage = ilist.montage { self.compose = 2 }
194
202
  assert_equal(@ilist, ilist)
195
203
  end
204
+ assert_raise(TypeError) do
205
+ montage = ilist.montage { self.filename = 2 }
206
+ assert_equal(@ilist, ilist)
207
+ end
196
208
  assert_raise(TypeError) do
197
209
  montage = ilist.montage { self.fill = 2 }
198
210
  assert_equal(@ilist, ilist)
@@ -201,8 +213,8 @@ class ImageList2UT < Test::Unit::TestCase
201
213
  montage = ilist.montage { self.font = 2 }
202
214
  assert_equal(@ilist, ilist)
203
215
  end
204
- assert_raise(Magick::ImageMagickError) do
205
- montage = ilist.montage { self.frame = 'z' }
216
+ assert_raise(TypeError) do
217
+ montage = ilist.montage { self.gravity = 2 }
206
218
  assert_equal(@ilist, ilist)
207
219
  end
208
220
  assert_raise(TypeError) do
@@ -217,6 +229,10 @@ class ImageList2UT < Test::Unit::TestCase
217
229
  montage = ilist.montage { self.stroke = 'x' }
218
230
  assert_equal(@ilist, ilist)
219
231
  end
232
+ assert_raise(NoMethodError) do
233
+ montage = ilist.montage { self.texture = 'x' }
234
+ assert_equal(@ilist, ilist)
235
+ end
220
236
  end
221
237
 
222
238
  def test_morph
@@ -241,6 +257,12 @@ class ImageList2UT < Test::Unit::TestCase
241
257
  end
242
258
  end
243
259
 
260
+ def test_mosaic_with_invalid_imagelist
261
+ list = @ilist.copy
262
+ list.instance_variable_set("@images", nil)
263
+ assert_raise(Magick::ImageMagickError) { list.mosaic }
264
+ end
265
+
244
266
  def test_new_image
245
267
  assert_nothing_raised do
246
268
  @ilist.new_image(20, 20)
@@ -257,27 +279,34 @@ class ImageList2UT < Test::Unit::TestCase
257
279
 
258
280
  def test_optimize_layers
259
281
  layer_methods = [
260
- Magick::CompareAnyLayer,
261
- Magick::CompareClearLayer,
262
- Magick::CompareOverlayLayer,
263
- Magick::OptimizeLayer,
264
- Magick::OptimizePlusLayer,
265
282
  Magick::CoalesceLayer,
266
283
  Magick::DisposeLayer,
267
284
  Magick::OptimizeTransLayer,
268
285
  Magick::RemoveDupsLayer,
269
- Magick::RemoveZeroLayer
286
+ Magick::RemoveZeroLayer,
287
+ Magick::OptimizeImageLayer,
288
+ Magick::OptimizeLayer,
289
+ Magick::OptimizePlusLayer,
290
+ Magick::CompareAnyLayer,
291
+ Magick::CompareClearLayer,
292
+ Magick::CompareOverlayLayer,
293
+ Magick::MosaicLayer,
294
+ Magick::FlattenLayer,
295
+ Magick::MergeLayer
270
296
  ]
271
297
  @ilist.read(IMAGES_DIR + '/Button_0.gif', IMAGES_DIR + '/Button_1.gif')
272
298
  layer_methods.each do |method|
273
299
  assert_nothing_raised do
274
300
  res = @ilist.optimize_layers(method)
275
301
  assert_instance_of(Magick::ImageList, res)
276
- assert_equal(2, res.length)
302
+ assert_kind_of(Integer, res.length)
277
303
  end
278
304
  end
305
+
306
+ assert_nothing_raised { @ilist.optimize_layers(Magick::CompareClearLayer) }
279
307
  assert_raise(ArgumentError) { @ilist.optimize_layers(Magick::UndefinedLayer) }
280
308
  assert_raise(TypeError) { @ilist.optimize_layers(2) }
309
+ assert_raise(NotImplementedError) { @ilist.optimize_layers(Magick::CompositeLayer) }
281
310
  end
282
311
 
283
312
  def test_ping
@@ -309,6 +338,9 @@ class ImageList2UT < Test::Unit::TestCase
309
338
  assert_nothing_raised { @ilist.quantize(128, Magick::RGBColorspace, Magick::NoDitherMethod) }
310
339
  assert_nothing_raised { @ilist.quantize(128, Magick::RGBColorspace, Magick::RiemersmaDitherMethod) }
311
340
  assert_nothing_raised { @ilist.quantize(128, Magick::RGBColorspace, Magick::FloydSteinbergDitherMethod) }
341
+ assert_nothing_raised { @ilist.quantize(128, Magick::RGBColorspace, Magick::FloydSteinbergDitherMethod, 32) }
342
+ assert_nothing_raised { @ilist.quantize(128, Magick::RGBColorspace, Magick::FloydSteinbergDitherMethod, 32, true) }
343
+ assert_nothing_raised { @ilist.quantize(128, Magick::RGBColorspace, Magick::FloydSteinbergDitherMethod, 32, false) }
312
344
  assert_raise(TypeError) { @ilist.quantize(128, Magick::RGBColorspace, true, 'x') }
313
345
  assert_raise(ArgumentError) { @ilist.quantize(128, Magick::RGBColorspace, true, 0, false, 'extra') }
314
346
  end
@@ -35,10 +35,20 @@ class Image_Attributes_UT < Test::Unit::TestCase
35
35
  assert_equal('white', @img.background_color)
36
36
  assert_nothing_raised { @img.background_color = '#dfdfdf' }
37
37
  # assert_equal("rgb(223,223,223)", @img.background_color)
38
- assert_equal('#DFDFDFDFDFDF', @img.background_color)
38
+ background_color = @img.background_color
39
+ if background_color.length == 13
40
+ assert_equal('#DFDFDFDFDFDF', background_color)
41
+ else
42
+ assert_equal('#DFDFDFDFDFDFFFFF', background_color)
43
+ end
39
44
  assert_nothing_raised { @img.background_color = Magick::Pixel.new(Magick::QuantumRange, Magick::QuantumRange / 2.0, Magick::QuantumRange / 2.0) }
40
45
  # assert_equal("rgb(100%,49.9992%,49.9992%)", @img.background_color)
41
- assert_equal('#FFFF7FFF7FFF', @img.background_color)
46
+ background_color = @img.background_color
47
+ if background_color.length == 13
48
+ assert_equal('#FFFF7FFF7FFF', background_color)
49
+ else
50
+ assert_equal('#FFFF7FFF7FFFFFFF', background_color)
51
+ end
42
52
  assert_raise(TypeError) { @img.background_color = 2 }
43
53
  end
44
54
 
@@ -92,12 +102,22 @@ class Image_Attributes_UT < Test::Unit::TestCase
92
102
  def test_border_color
93
103
  assert_nothing_raised { @img.border_color }
94
104
  # assert_equal("rgb(223,223,223)", @img.border_color)
95
- assert_equal('#DFDFDFDFDFDF', @img.border_color)
105
+ border_color = @img.border_color
106
+ if border_color.length == 13
107
+ assert_equal('#DFDFDFDFDFDF', border_color)
108
+ else
109
+ assert_equal('#DFDFDFDFDFDFFFFF', border_color)
110
+ end
96
111
  assert_nothing_raised { @img.border_color = 'red' }
97
112
  assert_equal('red', @img.border_color)
98
113
  assert_nothing_raised { @img.border_color = Magick::Pixel.new(Magick::QuantumRange, Magick::QuantumRange / 2, Magick::QuantumRange / 2) }
99
114
  # assert_equal("rgb(100%,49.9992%,49.9992%)", @img.border_color)
100
- assert_equal('#FFFF7FFF7FFF', @img.border_color)
115
+ border_color = @img.border_color
116
+ if border_color.length == 13
117
+ assert_equal('#FFFF7FFF7FFF', border_color)
118
+ else
119
+ assert_equal('#FFFF7FFF7FFFFFFF', border_color)
120
+ end
101
121
  assert_raise(TypeError) { @img.border_color = 2 }
102
122
  end
103
123
 
@@ -153,7 +173,7 @@ class Image_Attributes_UT < Test::Unit::TestCase
153
173
  assert_equal(0, @img.colors)
154
174
  img = @img.copy
155
175
  img.class_type = Magick::PseudoClass
156
- assert_equal(40, img.colors)
176
+ assert_kind_of(Integer, img.colors)
157
177
  assert_raise(NoMethodError) { img.colors = 2 }
158
178
  end
159
179
 
@@ -236,6 +256,11 @@ class Image_Attributes_UT < Test::Unit::TestCase
236
256
  assert_nothing_raised { @img.compose = Magick::SubtractCompositeOp }
237
257
  assert_nothing_raised { @img.compose = Magick::ThresholdCompositeOp }
238
258
  assert_nothing_raised { @img.compose = Magick::XorCompositeOp }
259
+ assert_nothing_raised { @img.compose = Magick::MathematicsCompositeOp }
260
+ assert_nothing_raised { @img.compose = Magick::DivideSrcCompositeOp }
261
+ assert_nothing_raised { @img.compose = Magick::MinusSrcCompositeOp }
262
+ assert_nothing_raised { @img.compose = Magick::DarkenIntensityCompositeOp }
263
+ assert_nothing_raised { @img.compose = Magick::LightenIntensityCompositeOp }
239
264
  assert_raise(TypeError) { @img.compose = 2 }
240
265
  end
241
266
 
@@ -263,6 +288,9 @@ class Image_Attributes_UT < Test::Unit::TestCase
263
288
  assert_nothing_raised { @img.compression = Magick::RLECompression }
264
289
  assert_nothing_raised { @img.compression = Magick::ZipCompression }
265
290
  assert_nothing_raised { @img.compression = Magick::ZipSCompression }
291
+ assert_nothing_raised { @img.compression = Magick::LZMACompression }
292
+ assert_nothing_raised { @img.compression = Magick::JBIG1Compression }
293
+ assert_nothing_raised { @img.compression = Magick::JBIG2Compression }
266
294
  assert_raise(TypeError) { @img.compression = 2 }
267
295
  end
268
296
 
@@ -357,6 +385,15 @@ class Image_Attributes_UT < Test::Unit::TestCase
357
385
  assert_nothing_raised { @img.filter = Magick::LanczosFilter }
358
386
  assert_nothing_raised { @img.filter = Magick::BesselFilter }
359
387
  assert_nothing_raised { @img.filter = Magick::SincFilter }
388
+ assert_nothing_raised { @img.filter = Magick::JincFilter }
389
+ assert_nothing_raised { @img.filter = Magick::SincFastFilter }
390
+ assert_nothing_raised { @img.filter = Magick::LanczosSharpFilter }
391
+ assert_nothing_raised { @img.filter = Magick::Lanczos2Filter }
392
+ assert_nothing_raised { @img.filter = Magick::Lanczos2SharpFilter }
393
+ assert_nothing_raised { @img.filter = Magick::RobidouxFilter }
394
+ assert_nothing_raised { @img.filter = Magick::RobidouxSharpFilter }
395
+ assert_nothing_raised { @img.filter = Magick::CosineFilter }
396
+ assert_nothing_raised { @img.filter = Magick::SplineFilter }
360
397
  assert_raise(TypeError) { @img.filter = 2 }
361
398
  end
362
399
 
@@ -409,7 +446,6 @@ class Image_Attributes_UT < Test::Unit::TestCase
409
446
  def test_image_type
410
447
  assert_nothing_raised { @img.image_type }
411
448
  assert_instance_of(Magick::ImageType, @img.image_type)
412
- assert_equal(Magick::GrayscaleMatteType, @img.image_type)
413
449
  end
414
450
 
415
451
  def test_interlace_type
@@ -427,6 +463,7 @@ class Image_Attributes_UT < Test::Unit::TestCase
427
463
  assert_nothing_raised { @img.iptc_profile }
428
464
  assert_nil(@img.iptc_profile)
429
465
  assert_nothing_raised { @img.iptc_profile = 'xxx' }
466
+ assert_equal('xxx', @img.iptc_profile)
430
467
  assert_raise(TypeError) { @img.iptc_profile = 2 }
431
468
  end
432
469
 
@@ -479,7 +516,7 @@ class Image_Attributes_UT < Test::Unit::TestCase
479
516
 
480
517
  def test_number_colors
481
518
  assert_nothing_raised { @hat.number_colors }
482
- assert_equal(27_942, @hat.number_colors)
519
+ assert_kind_of(Integer, @hat.number_colors)
483
520
  assert_raise(NoMethodError) { @hat.number_colors = 2 }
484
521
  end
485
522
 
@@ -587,7 +624,7 @@ class Image_Attributes_UT < Test::Unit::TestCase
587
624
 
588
625
  def test_total_colors
589
626
  assert_nothing_raised { @hat.total_colors }
590
- assert_equal(27_942, @hat.total_colors)
627
+ assert_kind_of(Integer, @hat.total_colors)
591
628
  assert_raise(NoMethodError) { @img.total_colors = 2 }
592
629
  end
593
630
 
@@ -30,6 +30,7 @@ class InfoUT < Test::Unit::TestCase
30
30
 
31
31
  assert_nothing_raised { @info.undefine('tiff', 'bits-per-sample') }
32
32
  assert_nil(@info['tiff', 'bits-per-sample'])
33
+ assert_raise(ArgumentError) { @info.undefine('tiff', 'a' * 10_000) }
33
34
  end
34
35
 
35
36
  def test_antialias
@@ -38,18 +39,31 @@ class InfoUT < Test::Unit::TestCase
38
39
  assert !@info.antialias
39
40
  end
40
41
 
42
+ def test_aref_aset
43
+ assert_nothing_raised { @info['tiff'] = 'xxx' }
44
+ assert_equal('xxx', @info['tiff'])
45
+ assert_nothing_raised { @info['tiff', 'bits-per-sample'] = 'abc' }
46
+ assert_equal('abc', @info['tiff', 'bits-per-sample'])
47
+ assert_raise(ArgumentError) { @info['tiff', 'a', 'b'] }
48
+ assert_raise(ArgumentError) { @info['tiff', 'a' * 10_000] }
49
+ assert_raise(ArgumentError) { @info['tiff', 'a' * 10_000] = 'abc' }
50
+ assert_raise(ArgumentError) { @info['tiff', 'a', 'b'] = 'abc' }
51
+ end
52
+
41
53
  def test_attenuate
42
54
  assert_nothing_raised { @info.attenuate = 10 }
43
55
  assert_equal(10, @info.attenuate)
44
56
  assert_nothing_raised { @info.attenuate = 5.25 }
45
57
  assert_equal(5.25, @info.attenuate)
46
58
  assert_nothing_raised { @info.attenuate = nil }
47
- assert_equal(nil, @info.attenuate)
59
+ assert_nil(@info.attenuate)
48
60
  end
49
61
 
50
62
  def test_authenticate
51
63
  assert_nothing_raised { @info.authenticate = 'string' }
52
64
  assert_equal('string', @info.authenticate)
65
+ assert_nothing_raised { @info.authenticate = nil }
66
+ assert_nil(@info.authenticate)
53
67
  end
54
68
 
55
69
  def test_background_color
@@ -70,11 +84,12 @@ class InfoUT < Test::Unit::TestCase
70
84
  assert_equal('red', img.border_color)
71
85
  end
72
86
 
73
- def caption
87
+ def test_caption
74
88
  assert_nothing_raised { @info.caption = 'string' }
75
89
  assert_equal('string', @info.caption)
76
- img = Magick::Image.new(20, 20) { self.caption = 'string' }
77
- assert_equal('string', img.caption)
90
+ assert_nothing_raised { @info.caption = nil }
91
+ assert_nil(@info.caption)
92
+ assert_nothing_raised { Magick::Image.new(20, 20) { self.caption = 'string' } }
78
93
  end
79
94
 
80
95
  def test_channel
@@ -106,6 +121,8 @@ class InfoUT < Test::Unit::TestCase
106
121
  def test_define
107
122
  assert_nothing_raised { @info.define('tiff', 'bits-per-sample', 2) }
108
123
  assert_nothing_raised { @info.undefine('tiff', 'bits-per-sample') }
124
+ assert_raise(ArgumentError) { @info.define('tiff', 'bits-per-sample', 2, 2) }
125
+ assert_raise(ArgumentError) { @info.define('tiff', 'a' * 10_000) }
109
126
  end
110
127
 
111
128
  def test_density
@@ -113,11 +130,17 @@ class InfoUT < Test::Unit::TestCase
113
130
  assert_equal('72x72', @info.density)
114
131
  assert_nothing_raised { @info.density = Magick::Geometry.new(72, 72) }
115
132
  assert_equal('72x72', @info.density)
133
+ assert_nothing_raised { @info.density = nil }
134
+ assert_nil(@info.density)
135
+ assert_raise(ArgumentError) { @info.density = 'aaa' }
116
136
  end
117
137
 
118
138
  def test_delay
119
139
  assert_nothing_raised { @info.delay = 60 }
120
140
  assert_equal(60, @info.delay)
141
+ assert_nothing_raised { @info.delay = nil }
142
+ assert_nil(@info.delay)
143
+ assert_raise(TypeError) { @info.delay = '60' }
121
144
  end
122
145
 
123
146
  def test_depth
@@ -133,6 +156,7 @@ class InfoUT < Test::Unit::TestCase
133
156
  assert_nothing_raised { @info.dispose = v }
134
157
  assert_equal(v, @info.dispose)
135
158
  end
159
+ assert_nothing_raised { @info.dispose = nil }
136
160
  end
137
161
 
138
162
  def test_dither
@@ -142,16 +166,27 @@ class InfoUT < Test::Unit::TestCase
142
166
  assert_equal(false, @info.dither)
143
167
  end
144
168
 
169
+ def test_endian
170
+ assert_nothing_raised { @info.endian = Magick::LSBEndian }
171
+ assert_equal(Magick::LSBEndian, @info.endian)
172
+ assert_nothing_raised { @info.endian = nil }
173
+ end
174
+
145
175
  def test_extract
146
176
  assert_nothing_raised { @info.extract = '100x100' }
147
177
  assert_equal('100x100', @info.extract)
148
178
  assert_nothing_raised { @info.extract = Magick::Geometry.new(100, 100) }
149
179
  assert_equal('100x100', @info.extract)
180
+ assert_nothing_raised { @info.extract = nil }
181
+ assert_nil(@info.extract)
182
+ assert_raise(ArgumentError) { @info.extract = 'aaa' }
150
183
  end
151
184
 
152
185
  def test_filename
153
186
  assert_nothing_raised { @info.filename = 'string' }
154
187
  assert_equal('string', @info.filename)
188
+ assert_nothing_raised { @info.filename = nil }
189
+ assert_equal('', @info.filename)
155
190
  end
156
191
 
157
192
  def test_fill
@@ -170,11 +205,14 @@ class InfoUT < Test::Unit::TestCase
170
205
  def test_font
171
206
  assert_nothing_raised { @info.font = 'Arial' }
172
207
  assert_equal('Arial', @info.font)
208
+ assert_nothing_raised { @info.font = nil }
209
+ assert_nil(@info.font)
173
210
  end
174
211
 
175
212
  def test_format
176
213
  assert_nothing_raised { @info.format = 'GIF' }
177
214
  assert_equal('GIF', @info.format)
215
+ assert_raise(TypeError) { @info.format = nil }
178
216
  end
179
217
 
180
218
  def test_fuzz
@@ -182,6 +220,8 @@ class InfoUT < Test::Unit::TestCase
182
220
  assert_equal(50, @info.fuzz)
183
221
  assert_nothing_raised { @info.fuzz = '50%' }
184
222
  assert_equal(Magick::QuantumRange * 0.5, @info.fuzz)
223
+ assert_raise(TypeError) { @info.fuzz = nil }
224
+ assert_raise(ArgumentError) { @info.fuzz = 'xxx' }
185
225
  end
186
226
 
187
227
  def test_gravity
@@ -189,6 +229,15 @@ class InfoUT < Test::Unit::TestCase
189
229
  assert_nothing_raised { @info.gravity = v }
190
230
  assert_equal(v, @info.gravity)
191
231
  end
232
+ assert_nothing_raised { @info.gravity = nil }
233
+ end
234
+
235
+ def test_group
236
+ assert_kind_of(Integer, @info.group)
237
+ assert_nothing_raised { @info.group = 50 }
238
+ assert_equal(50, @info.group)
239
+ assert_raise(TypeError) { @info.group = nil }
240
+ assert_raise(TypeError) { @info.group = 'xxx' }
192
241
  end
193
242
 
194
243
  def test_image_type
@@ -196,6 +245,7 @@ class InfoUT < Test::Unit::TestCase
196
245
  assert_nothing_raised { @info.image_type = v }
197
246
  assert_equal(v, @info.image_type)
198
247
  end
248
+ assert_raise(TypeError) { @info.image_type = nil }
199
249
  end
200
250
 
201
251
  def test_interlace
@@ -203,11 +253,14 @@ class InfoUT < Test::Unit::TestCase
203
253
  assert_nothing_raised { @info.interlace = v }
204
254
  assert_equal(v, @info.interlace)
205
255
  end
256
+ assert_raise(TypeError) { @info.interlace = nil }
206
257
  end
207
258
 
208
259
  def test_label
209
260
  assert_nothing_raised { @info.label = 'string' }
210
261
  assert_equal('string', @info.label)
262
+ assert_nothing_raised { @info.label = nil }
263
+ assert_nil(@info.label)
211
264
  end
212
265
 
213
266
  def test_matte_color
@@ -217,24 +270,37 @@ class InfoUT < Test::Unit::TestCase
217
270
  assert_equal('red', @info.matte_color)
218
271
  img = Magick::Image.new(20, 20) { self.matte_color = 'red' }
219
272
  assert_equal('red', img.matte_color)
273
+ assert_raise(TypeError) { @info.matte_color = nil }
220
274
  end
221
275
 
222
276
  def test_monitor
223
277
  assert_nothing_raised { @info.monitor = -> {} }
224
278
  monitor = proc do |mth, q, s|
225
279
  assert_equal('resize!', mth)
226
- assert_instance_of(Fixnum, q)
227
- assert_instance_of(Fixnum, s)
280
+ assert_kind_of(Integer, q)
281
+ assert_kind_of(Integer, s)
282
+ GC.start
228
283
  true
229
284
  end
230
285
  img = Magick::Image.new(2000, 2000) { self.monitor = monitor }
231
286
  img.resize!(20, 20)
232
287
  img.monitor = nil
288
+
289
+ assert_nothing_raised { @info.monitor = nil }
233
290
  end
234
291
 
235
292
  def test_monochrome
236
293
  assert_nothing_raised { @info.monochrome = true }
237
294
  assert @info.monochrome
295
+ assert_nothing_raised { @info.monochrome = nil }
296
+ end
297
+
298
+ def test_number_scenes
299
+ assert_kind_of(Integer, @info.number_scenes)
300
+ assert_nothing_raised { @info.number_scenes = 50 }
301
+ assert_equal(50, @info.number_scenes)
302
+ assert_raise(TypeError) { @info.number_scenes = nil }
303
+ assert_raise(TypeError) { @info.number_scenes = 'xxx' }
238
304
  end
239
305
 
240
306
  def test_orientation
@@ -242,6 +308,7 @@ class InfoUT < Test::Unit::TestCase
242
308
  assert_nothing_raised { @info.orientation = v }
243
309
  assert_equal(v, @info.orientation)
244
310
  end
311
+ assert_raise(TypeError) { @info.orientation = nil }
245
312
  end
246
313
 
247
314
  def test_origin
@@ -249,11 +316,16 @@ class InfoUT < Test::Unit::TestCase
249
316
  assert_equal('+10+10', @info.origin)
250
317
  assert_nothing_raised { @info.origin = Magick::Geometry.new(nil, nil, 10, 10) }
251
318
  assert_equal('+10+10', @info.origin)
319
+ assert_nothing_raised { @info.origin = nil }
320
+ assert_nil(@info.origin)
321
+ assert_raise(ArgumentError) { @info.origin = 'aaa' }
252
322
  end
253
323
 
254
324
  def test_page
255
325
  assert_nothing_raised { @info.page = '612x792>' }
256
326
  assert_equal('612x792>', @info.page)
327
+ assert_nothing_raised { @info.page = nil }
328
+ assert_nil(@info.page)
257
329
  end
258
330
 
259
331
  def test_pointsize
@@ -269,11 +341,21 @@ class InfoUT < Test::Unit::TestCase
269
341
  def test_sampling_factor
270
342
  assert_nothing_raised { @info.sampling_factor = '2x1' }
271
343
  assert_equal('2x1', @info.sampling_factor)
344
+ assert_nothing_raised { @info.sampling_factor = nil }
345
+ assert_nil(@info.sampling_factor)
346
+ end
347
+
348
+ def test_scene
349
+ assert_nothing_raised { @info.scene = 123 }
350
+ assert_equal(123, @info.scene)
351
+ assert_raise(TypeError) { @info.scene = 'xxx' }
272
352
  end
273
353
 
274
354
  def test_server_name
275
355
  assert_nothing_raised { @info.server_name = 'foo' }
276
356
  assert_equal('foo', @info.server_name)
357
+ assert_nothing_raised { @info.server_name = nil }
358
+ assert_nil(@info.server_name)
277
359
  end
278
360
 
279
361
  def test_size
@@ -281,6 +363,9 @@ class InfoUT < Test::Unit::TestCase
281
363
  assert_equal('200x100', @info.size)
282
364
  assert_nothing_raised { @info.size = Magick::Geometry.new(100, 200) }
283
365
  assert_equal('100x200', @info.size)
366
+ assert_nothing_raised { @info.size = nil }
367
+ assert_nil(@info.size)
368
+ assert_raise(ArgumentError) { @info.size = 'aaa' }
284
369
  end
285
370
 
286
371
  def test_stroke
@@ -303,11 +388,13 @@ class InfoUT < Test::Unit::TestCase
303
388
  assert_equal(5.25, @info.stroke_width)
304
389
  assert_nothing_raised { @info.stroke_width = nil }
305
390
  assert_equal(nil, @info.stroke_width)
391
+ assert_raise(TypeError) { @info.stroke_width = 'xxx' }
306
392
  end
307
393
 
308
394
  def test_texture
309
395
  img = Magick::Image.read('granite:') { self.size = '20x20' }
310
396
  assert_nothing_raised { @info.texture = img.first }
397
+ assert_nothing_raised { @info.texture = nil }
311
398
  end
312
399
 
313
400
  def test_tile_offset
@@ -315,6 +402,13 @@ class InfoUT < Test::Unit::TestCase
315
402
  assert_equal('200x100', @info.tile_offset)
316
403
  assert_nothing_raised { @info.tile_offset = Magick::Geometry.new(100, 200) }
317
404
  assert_equal('100x200', @info.tile_offset)
405
+ assert_raise(ArgumentError) { @info.tile_offset = nil }
406
+ end
407
+
408
+ def test_transparent_color
409
+ assert_nothing_raised { @info.transparent_color = 'white' }
410
+ assert_equal('white', @info.transparent_color)
411
+ assert_raise(TypeError) { @info.transparent_color = nil }
318
412
  end
319
413
 
320
414
  def test_undercolor
@@ -340,5 +434,7 @@ class InfoUT < Test::Unit::TestCase
340
434
  def test_view
341
435
  assert_nothing_raised { @info.view = 'string' }
342
436
  assert_equal('string', @info.view)
437
+ assert_nothing_raised { @info.view = nil }
438
+ assert_nil(@info.view)
343
439
  end
344
440
  end