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/Image_attributes.rb
CHANGED
@@ -11,684 +11,684 @@ require 'test/unit/ui/console/testrunner' unless RUBY_VERSION[/^1\.9|^2/]
|
|
11
11
|
# improve test_montage
|
12
12
|
|
13
13
|
class Image_Attributes_UT < Test::Unit::TestCase
|
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
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
14
|
+
FreezeError = RUBY_VERSION[/^1\.9|^2/] ? RuntimeError : TypeError
|
15
|
+
|
16
|
+
def setup
|
17
|
+
@img = Magick::Image.new(100, 100)
|
18
|
+
gc = Magick::Draw.new
|
19
|
+
|
20
|
+
gc.stroke_width(5)
|
21
|
+
gc.circle(50, 50, 80, 80)
|
22
|
+
gc.draw(@img)
|
23
|
+
|
24
|
+
@hat = Magick::Image.read(FLOWER_HAT).first
|
25
|
+
@p = Magick::Image.read(IMAGE_WITH_PROFILE).first.color_profile
|
26
|
+
end
|
27
|
+
|
28
|
+
# Test old alpha attribute. New alpha() behavior is tested in Image1.rb
|
29
|
+
def test_alpha
|
30
|
+
assert(@img.alpha)
|
31
|
+
assert_nothing_raised { @img.alpha = Magick::DeactivateAlphaChannel }
|
32
|
+
assert(!@img.alpha)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_background_color
|
36
|
+
assert_nothing_raised { @img.background_color }
|
37
|
+
assert_equal('white', @img.background_color)
|
38
|
+
assert_nothing_raised { @img.background_color = '#dfdfdf' }
|
39
|
+
#assert_equal("rgb(223,223,223)", @img.background_color)
|
40
|
+
assert_equal('#DFDFDFDFDFDF', @img.background_color)
|
41
|
+
assert_nothing_raised { @img.background_color = Magick::Pixel.new(Magick::QuantumRange, Magick::QuantumRange/2.0, Magick::QuantumRange/2.0) }
|
42
|
+
#assert_equal("rgb(100%,49.9992%,49.9992%)", @img.background_color)
|
43
|
+
assert_equal('#FFFF7FFF7FFF', @img.background_color)
|
44
|
+
assert_raise(TypeError) { @img.background_color = 2 }
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_base_columns
|
48
|
+
assert_nothing_raised { @img.base_columns }
|
49
|
+
assert_equal(0, @img.base_columns)
|
50
|
+
assert_raise(NoMethodError) { @img.base_columns = 1 }
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_base_filename
|
54
|
+
assert_nothing_raised { @img.base_filename }
|
55
|
+
assert_equal('', @img.base_filename)
|
56
|
+
assert_raise(NoMethodError) { @img.base_filename = 'xxx' }
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_base_rows
|
60
|
+
assert_nothing_raised { @img.base_rows }
|
61
|
+
assert_equal(0, @img.base_rows)
|
62
|
+
assert_raise(NoMethodError) { @img.base_rows = 1 }
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_bias
|
66
|
+
assert_nothing_raised { @img.bias }
|
67
|
+
assert_equal(0.0, @img.bias)
|
68
|
+
assert_instance_of(Float, @img.bias)
|
69
|
+
|
70
|
+
assert_nothing_raised { @img.bias = 0.1 }
|
71
|
+
assert_in_delta(Magick::QuantumRange * 0.1, @img.bias, 0.1)
|
72
|
+
|
73
|
+
assert_nothing_raised { @img.bias = '10%' }
|
74
|
+
assert_in_delta(Magick::QuantumRange * 0.10, @img.bias, 0.1)
|
75
|
+
|
76
|
+
assert_raise(TypeError) { @img.bias = [] }
|
77
|
+
assert_raise(ArgumentError) { @img.bias = 'x' }
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_black_point_compensation
|
81
|
+
assert_nothing_raised { @img.black_point_compensation = true }
|
82
|
+
assert(@img.black_point_compensation)
|
83
|
+
assert_nothing_raised { @img.black_point_compensation = false }
|
84
|
+
assert_equal(false, @img.black_point_compensation)
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_blur
|
88
|
+
assert_nothing_raised { @img.blur }
|
89
|
+
assert_equal(1.0, @img.blur)
|
90
|
+
assert_nothing_raised { @img.blur = 2.0 }
|
91
|
+
assert_raise(TypeError) { @img.blur = 'x' }
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_border_color
|
95
|
+
assert_nothing_raised { @img.border_color }
|
96
|
+
#assert_equal("rgb(223,223,223)", @img.border_color)
|
97
|
+
assert_equal('#DFDFDFDFDFDF', @img.border_color)
|
98
|
+
assert_nothing_raised { @img.border_color = 'red' }
|
99
|
+
assert_equal('red', @img.border_color)
|
100
|
+
assert_nothing_raised { @img.border_color = Magick::Pixel.new(Magick::QuantumRange, Magick::QuantumRange/2, Magick::QuantumRange/2) }
|
101
|
+
#assert_equal("rgb(100%,49.9992%,49.9992%)", @img.border_color)
|
102
|
+
assert_equal('#FFFF7FFF7FFF', @img.border_color)
|
103
|
+
assert_raise(TypeError) { @img.border_color = 2 }
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_bounding_box
|
107
|
+
assert_nothing_raised { @img.bounding_box }
|
108
|
+
box = @img.bounding_box
|
109
|
+
assert_equal(87, box.width)
|
110
|
+
assert_equal(87, box.height)
|
111
|
+
assert_equal(7, box.x)
|
112
|
+
assert_equal(7, box.y)
|
113
|
+
assert_raise(NoMethodError) { @img.bounding_box = 2 }
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_chromaticity
|
117
|
+
chrom = @img.chromaticity
|
118
|
+
assert_nothing_raised { @img.chromaticity }
|
119
|
+
assert_instance_of(Magick::Chromaticity, chrom)
|
120
|
+
assert_equal(0, chrom.red_primary.x)
|
121
|
+
assert_equal(0, chrom.red_primary.y)
|
122
|
+
assert_equal(0, chrom.red_primary.z)
|
123
|
+
assert_equal(0, chrom.green_primary.x)
|
124
|
+
assert_equal(0, chrom.green_primary.y)
|
125
|
+
assert_equal(0, chrom.green_primary.z)
|
126
|
+
assert_equal(0, chrom.blue_primary.x)
|
127
|
+
assert_equal(0, chrom.blue_primary.y)
|
128
|
+
assert_equal(0, chrom.blue_primary.z)
|
129
|
+
assert_equal(0, chrom.white_point.x)
|
130
|
+
assert_equal(0, chrom.white_point.y)
|
131
|
+
assert_equal(0, chrom.white_point.z)
|
132
|
+
assert_nothing_raised { @img.chromaticity = chrom }
|
133
|
+
assert_raise(TypeError) { @img.chromaticity = 2 }
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_class_type
|
137
|
+
assert_nothing_raised { @img.class_type }
|
138
|
+
assert_instance_of(Magick::ClassType, @img.class_type)
|
139
|
+
assert_equal(Magick::DirectClass, @img.class_type)
|
140
|
+
assert_nothing_raised { @img.class_type = Magick::PseudoClass }
|
141
|
+
assert_equal(Magick::PseudoClass, @img.class_type)
|
142
|
+
assert_raise(TypeError) { @img.class_type = 2 }
|
143
|
+
end
|
144
|
+
|
145
|
+
def test_color_profile
|
146
|
+
assert_nothing_raised { @img.color_profile }
|
147
|
+
assert_nil(@img.color_profile)
|
148
|
+
assert_nothing_raised { @img.color_profile = @p }
|
149
|
+
assert_equal(@p, @img.color_profile)
|
150
|
+
assert_raise(TypeError) { @img.color_profile = 2 }
|
151
|
+
end
|
152
|
+
|
153
|
+
def test_colors
|
154
|
+
assert_nothing_raised { @img.colors }
|
155
|
+
assert_equal(0, @img.colors)
|
156
|
+
img = @img.copy
|
157
|
+
img.class_type = Magick::PseudoClass
|
158
|
+
assert_equal(40, img.colors)
|
159
|
+
assert_raise(NoMethodError) { img.colors = 2 }
|
160
|
+
end
|
161
|
+
|
162
|
+
def test_colorspace
|
163
|
+
assert_nothing_raised { @img.colorspace }
|
164
|
+
assert_instance_of(Magick::ColorspaceType, @img.colorspace)
|
165
|
+
if IM_VERSION < Gem::Version.new('6.7.5') || (IM_VERSION == Gem::Version.new('6.7.5') && IM_REVISION < Gem::Version.new('5'))
|
166
|
+
assert_equal(Magick::RGBColorspace, @img.colorspace)
|
167
|
+
else
|
168
|
+
assert_equal(Magick::SRGBColorspace, @img.colorspace)
|
169
|
+
end
|
170
|
+
img = @img.copy
|
171
|
+
assert_nothing_raised { img.colorspace = Magick::GRAYColorspace }
|
172
|
+
assert_equal(Magick::GRAYColorspace, img.colorspace)
|
173
|
+
assert_raise(TypeError) { @img.colorspace = 2 }
|
174
|
+
Magick::ColorspaceType.values.each do |cs|
|
175
|
+
assert_nothing_raised { img.colorspace = cs }
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
def test_columns
|
180
|
+
assert_nothing_raised { @img.columns }
|
181
|
+
assert_equal(100, @img.columns)
|
182
|
+
assert_raise(NoMethodError) { @img.columns = 2 }
|
183
|
+
end
|
184
|
+
|
185
|
+
def test_compose
|
186
|
+
assert_nothing_raised { @img.compose }
|
187
|
+
assert_instance_of(Magick::CompositeOperator, @img.compose)
|
188
|
+
assert_equal(Magick::OverCompositeOp, @img.compose)
|
189
|
+
assert_raise(TypeError) { @img.compose = 2 }
|
190
|
+
assert_nothing_raised { @img.compose = Magick::UndefinedCompositeOp }
|
191
|
+
assert_equal(Magick::UndefinedCompositeOp, @img.compose)
|
192
|
+
|
193
|
+
assert_nothing_raised { @img.compose = Magick::NoCompositeOp }
|
194
|
+
assert_nothing_raised { @img.compose = Magick::AddCompositeOp }
|
195
|
+
assert_nothing_raised { @img.compose = Magick::AtopCompositeOp }
|
196
|
+
assert_nothing_raised { @img.compose = Magick::BlendCompositeOp }
|
197
|
+
assert_nothing_raised { @img.compose = Magick::BumpmapCompositeOp }
|
198
|
+
assert_nothing_raised { @img.compose = Magick::ClearCompositeOp }
|
199
|
+
assert_nothing_raised { @img.compose = Magick::ColorBurnCompositeOp }
|
200
|
+
assert_nothing_raised { @img.compose = Magick::ColorDodgeCompositeOp }
|
201
|
+
assert_nothing_raised { @img.compose = Magick::ColorizeCompositeOp }
|
202
|
+
assert_nothing_raised { @img.compose = Magick::CopyBlackCompositeOp }
|
203
|
+
assert_nothing_raised { @img.compose = Magick::CopyBlueCompositeOp }
|
204
|
+
assert_nothing_raised { @img.compose = Magick::CopyCompositeOp }
|
205
|
+
assert_nothing_raised { @img.compose = Magick::CopyCyanCompositeOp }
|
206
|
+
assert_nothing_raised { @img.compose = Magick::CopyGreenCompositeOp }
|
207
|
+
assert_nothing_raised { @img.compose = Magick::CopyMagentaCompositeOp }
|
208
|
+
assert_nothing_raised { @img.compose = Magick::CopyOpacityCompositeOp }
|
209
|
+
assert_nothing_raised { @img.compose = Magick::CopyRedCompositeOp }
|
210
|
+
assert_nothing_raised { @img.compose = Magick::CopyYellowCompositeOp }
|
211
|
+
assert_nothing_raised { @img.compose = Magick::DarkenCompositeOp }
|
212
|
+
assert_nothing_raised { @img.compose = Magick::DstAtopCompositeOp }
|
213
|
+
assert_nothing_raised { @img.compose = Magick::DstCompositeOp }
|
214
|
+
assert_nothing_raised { @img.compose = Magick::DstInCompositeOp }
|
215
|
+
assert_nothing_raised { @img.compose = Magick::DstOutCompositeOp }
|
216
|
+
assert_nothing_raised { @img.compose = Magick::DstOverCompositeOp }
|
217
|
+
assert_nothing_raised { @img.compose = Magick::DifferenceCompositeOp }
|
218
|
+
assert_nothing_raised { @img.compose = Magick::DisplaceCompositeOp }
|
219
|
+
assert_nothing_raised { @img.compose = Magick::DissolveCompositeOp }
|
220
|
+
assert_nothing_raised { @img.compose = Magick::ExclusionCompositeOp }
|
221
|
+
assert_nothing_raised { @img.compose = Magick::HardLightCompositeOp }
|
222
|
+
assert_nothing_raised { @img.compose = Magick::HueCompositeOp }
|
223
|
+
assert_nothing_raised { @img.compose = Magick::InCompositeOp }
|
224
|
+
assert_nothing_raised { @img.compose = Magick::LightenCompositeOp }
|
225
|
+
assert_nothing_raised { @img.compose = Magick::LuminizeCompositeOp }
|
226
|
+
assert_nothing_raised { @img.compose = Magick::MinusCompositeOp }
|
227
|
+
assert_nothing_raised { @img.compose = Magick::ModulateCompositeOp }
|
228
|
+
assert_nothing_raised { @img.compose = Magick::MultiplyCompositeOp }
|
229
|
+
assert_nothing_raised { @img.compose = Magick::OutCompositeOp }
|
230
|
+
assert_nothing_raised { @img.compose = Magick::OverCompositeOp }
|
231
|
+
assert_nothing_raised { @img.compose = Magick::OverlayCompositeOp }
|
232
|
+
assert_nothing_raised { @img.compose = Magick::PlusCompositeOp }
|
233
|
+
assert_nothing_raised { @img.compose = Magick::ReplaceCompositeOp }
|
234
|
+
assert_nothing_raised { @img.compose = Magick::SaturateCompositeOp }
|
235
|
+
assert_nothing_raised { @img.compose = Magick::ScreenCompositeOp }
|
236
|
+
assert_nothing_raised { @img.compose = Magick::SoftLightCompositeOp }
|
237
|
+
assert_nothing_raised { @img.compose = Magick::SrcAtopCompositeOp }
|
238
|
+
assert_nothing_raised { @img.compose = Magick::SrcCompositeOp }
|
239
|
+
assert_nothing_raised { @img.compose = Magick::SrcInCompositeOp }
|
240
|
+
assert_nothing_raised { @img.compose = Magick::SrcOutCompositeOp }
|
241
|
+
assert_nothing_raised { @img.compose = Magick::SrcOverCompositeOp }
|
242
|
+
assert_nothing_raised { @img.compose = Magick::SubtractCompositeOp }
|
243
|
+
assert_nothing_raised { @img.compose = Magick::ThresholdCompositeOp }
|
244
|
+
assert_nothing_raised { @img.compose = Magick::XorCompositeOp }
|
245
|
+
assert_raise(TypeError) { @img.compose = 2 }
|
246
|
+
end
|
247
|
+
|
248
|
+
def test_compression
|
249
|
+
assert_nothing_raised { @img.compression }
|
250
|
+
assert_instance_of(Magick::CompressionType, @img.compression)
|
251
|
+
assert_equal(Magick::UndefinedCompression, @img.compression)
|
252
|
+
assert_nothing_raised { @img.compression = Magick::BZipCompression }
|
253
|
+
assert_equal(Magick::BZipCompression, @img.compression)
|
254
|
+
assert_nothing_raised { @img.compression = Magick::NoCompression }
|
255
|
+
assert_nothing_raised { @img.compression = Magick::BZipCompression }
|
256
|
+
assert_nothing_raised { @img.compression = Magick::B44Compression }
|
257
|
+
assert_nothing_raised { @img.compression = Magick::B44ACompression }
|
258
|
+
assert_nothing_raised { @img.compression = Magick::DXT1Compression }
|
259
|
+
assert_nothing_raised { @img.compression = Magick::DXT3Compression }
|
260
|
+
assert_nothing_raised { @img.compression = Magick::DXT5Compression }
|
261
|
+
assert_nothing_raised { @img.compression = Magick::FaxCompression }
|
262
|
+
assert_nothing_raised { @img.compression = Magick::Group4Compression }
|
263
|
+
assert_nothing_raised { @img.compression = Magick::JPEGCompression }
|
264
|
+
assert_nothing_raised { @img.compression = Magick::JPEG2000Compression }
|
265
|
+
assert_nothing_raised { @img.compression = Magick::LosslessJPEGCompression }
|
266
|
+
assert_nothing_raised { @img.compression = Magick::LZWCompression }
|
267
|
+
assert_nothing_raised { @img.compression = Magick::PizCompression }
|
268
|
+
assert_nothing_raised { @img.compression = Magick::Pxr24Compression }
|
269
|
+
assert_nothing_raised { @img.compression = Magick::RLECompression }
|
270
|
+
assert_nothing_raised { @img.compression = Magick::ZipCompression }
|
271
|
+
assert_nothing_raised { @img.compression = Magick::ZipSCompression }
|
272
|
+
assert_raise(TypeError) { @img.compression = 2 }
|
273
|
+
end
|
274
|
+
|
275
|
+
def test_delay
|
276
|
+
assert_nothing_raised { @img.delay }
|
277
|
+
assert_equal(0, @img.delay)
|
278
|
+
assert_nothing_raised { @img.delay = 10 }
|
279
|
+
assert_equal(10, @img.delay)
|
280
|
+
assert_raise(TypeError) { @img.delay = 'x' }
|
281
|
+
end
|
282
|
+
|
283
|
+
def test_density
|
284
|
+
assert_nothing_raised { @img.density }
|
285
|
+
assert_nothing_raised { @img.density = '90x90' }
|
286
|
+
assert_nothing_raised { @img.density = 'x90' }
|
287
|
+
assert_nothing_raised { @img.density = '90' }
|
288
|
+
assert_raise(TypeError) { @img.density = 2 }
|
289
|
+
end
|
290
|
+
|
291
|
+
def test_depth
|
292
|
+
assert_equal(Magick::MAGICKCORE_QUANTUM_DEPTH, @img.depth)
|
293
|
+
assert_raise(NoMethodError) { @img.depth = 2 }
|
294
|
+
end
|
295
|
+
|
296
|
+
def test_directory
|
297
|
+
assert_nothing_raised { @img.directory }
|
298
|
+
assert_nil(@img.directory)
|
299
|
+
assert_raise(NoMethodError) { @img.directory = nil }
|
300
|
+
end
|
301
|
+
|
302
|
+
def test_dispose
|
303
|
+
assert_nothing_raised { @img.dispose }
|
304
|
+
assert_instance_of(Magick::DisposeType, @img.dispose)
|
305
|
+
assert_equal(Magick::UndefinedDispose, @img.dispose)
|
306
|
+
assert_nothing_raised { @img.dispose = Magick::NoneDispose }
|
307
|
+
assert_equal(Magick::NoneDispose, @img.dispose)
|
308
|
+
assert_nothing_raised { @img.dispose = Magick::BackgroundDispose }
|
309
|
+
assert_nothing_raised { @img.dispose = Magick::PreviousDispose }
|
310
|
+
assert_raise(TypeError) { @img.dispose = 2 }
|
311
|
+
end
|
312
|
+
|
313
|
+
def test_endian
|
314
|
+
assert_nothing_raised { @img.endian }
|
315
|
+
assert_instance_of(Magick::EndianType, @img.endian)
|
316
|
+
assert_equal(Magick::UndefinedEndian, @img.endian)
|
317
|
+
assert_nothing_raised { @img.endian = Magick::LSBEndian }
|
318
|
+
assert_equal(Magick::LSBEndian, @img.endian)
|
319
|
+
assert_nothing_raised { @img.endian = Magick::MSBEndian }
|
320
|
+
assert_raise(TypeError) { @img.endian = 2 }
|
321
|
+
end
|
322
|
+
|
323
|
+
def test_extract_info
|
324
|
+
assert_nothing_raised { @img.extract_info }
|
325
|
+
assert_instance_of(Magick::Rectangle, @img.extract_info)
|
326
|
+
ext = @img.extract_info
|
327
|
+
assert_equal(0, ext.x)
|
328
|
+
assert_equal(0, ext.y)
|
329
|
+
assert_equal(0, ext.width)
|
330
|
+
assert_equal(0, ext.height)
|
331
|
+
ext = Magick::Rectangle.new(1, 2, 3, 4)
|
332
|
+
assert_nothing_raised { @img.extract_info = ext }
|
333
|
+
assert_equal(1, ext.width)
|
334
|
+
assert_equal(2, ext.height)
|
335
|
+
assert_equal(3, ext.x)
|
336
|
+
assert_equal(4, ext.y)
|
337
|
+
assert_raise(TypeError) { @img.extract_info = 2 }
|
338
|
+
end
|
339
|
+
|
340
|
+
def test_filename
|
341
|
+
assert_nothing_raised { @img.filename }
|
342
|
+
assert_equal('', @img.filename)
|
343
|
+
assert_raises(NoMethodError) { @img.filename = 'xxx' }
|
344
|
+
end
|
345
|
+
|
346
|
+
def test_filter
|
347
|
+
assert_nothing_raised { @img.filter }
|
348
|
+
assert_instance_of(Magick::FilterTypes, @img.filter)
|
349
|
+
assert_equal(Magick::UndefinedFilter, @img.filter)
|
350
|
+
assert_nothing_raised { @img.filter = Magick::PointFilter }
|
351
|
+
assert_equal(Magick::PointFilter, @img.filter)
|
352
|
+
assert_nothing_raised { @img.filter = Magick::BoxFilter }
|
353
|
+
assert_nothing_raised { @img.filter = Magick::TriangleFilter }
|
354
|
+
assert_nothing_raised { @img.filter = Magick::HermiteFilter }
|
355
|
+
assert_nothing_raised { @img.filter = Magick::HanningFilter }
|
356
|
+
assert_nothing_raised { @img.filter = Magick::HammingFilter }
|
357
|
+
assert_nothing_raised { @img.filter = Magick::BlackmanFilter }
|
358
|
+
assert_nothing_raised { @img.filter = Magick::GaussianFilter }
|
359
|
+
assert_nothing_raised { @img.filter = Magick::QuadraticFilter }
|
360
|
+
assert_nothing_raised { @img.filter = Magick::CubicFilter }
|
361
|
+
assert_nothing_raised { @img.filter = Magick::CatromFilter }
|
362
|
+
assert_nothing_raised { @img.filter = Magick::MitchellFilter }
|
363
|
+
assert_nothing_raised { @img.filter = Magick::LanczosFilter }
|
364
|
+
assert_nothing_raised { @img.filter = Magick::BesselFilter }
|
365
|
+
assert_nothing_raised { @img.filter = Magick::SincFilter }
|
366
|
+
assert_raise(TypeError) { @img.filter = 2 }
|
367
|
+
end
|
368
|
+
|
369
|
+
def test_format
|
370
|
+
assert_nothing_raised { @img.format }
|
371
|
+
assert_nil(@img.format)
|
372
|
+
assert_nothing_raised { @img.format = 'GIF' }
|
373
|
+
assert_nothing_raised { @img.format = 'JPG' }
|
374
|
+
assert_nothing_raised { @img.format = 'TIFF' }
|
375
|
+
assert_nothing_raised { @img.format = 'MIFF' }
|
376
|
+
assert_nothing_raised { @img.format = 'MPEG' }
|
377
|
+
v = $VERBOSE
|
378
|
+
$VERBOSE = nil
|
379
|
+
assert_raise(ArgumentError) { @img.format = 'shit' }
|
380
|
+
$VERBOSE = v
|
381
|
+
assert_raise(TypeError) { @img.format = 2 }
|
382
|
+
end
|
383
|
+
|
384
|
+
def test_fuzz
|
385
|
+
assert_nothing_raised { @img.fuzz }
|
386
|
+
assert_instance_of(Float, @img.fuzz)
|
387
|
+
assert_equal(0.0, @img.fuzz)
|
388
|
+
assert_nothing_raised { @img.fuzz = 50 }
|
389
|
+
assert_equal(50.0, @img.fuzz)
|
390
|
+
assert_nothing_raised { @img.fuzz = '50%' }
|
391
|
+
assert_in_delta(Magick::QuantumRange * 0.50, @img.fuzz, 0.1)
|
392
|
+
assert_raise(TypeError) { @img.fuzz = [] }
|
393
|
+
assert_raise(ArgumentError) { @img.fuzz = 'xxx' }
|
394
|
+
end
|
395
|
+
|
396
|
+
def test_gamma
|
397
|
+
assert_nothing_raised { @img.gamma }
|
398
|
+
assert_instance_of(Float, @img.gamma)
|
399
|
+
if IM_VERSION < Gem::Version.new('6.7.5') || (IM_VERSION == Gem::Version.new('6.7.5') && IM_REVISION < Gem::Version.new('5'))
|
400
|
+
assert_equal(0.0, @img.gamma)
|
401
|
+
else
|
402
|
+
assert_equal(0.45454543828964233, @img.gamma)
|
403
|
+
end
|
404
|
+
assert_nothing_raised { @img.gamma = 2.0 }
|
405
|
+
assert_equal(2.0, @img.gamma)
|
406
|
+
assert_raise(TypeError) { @img.gamma = 'x' }
|
407
|
+
end
|
408
|
+
|
409
|
+
def test_geometry
|
410
|
+
assert_nothing_raised { @img.geometry }
|
411
|
+
assert_nil(@img.geometry)
|
412
|
+
assert_nothing_raised { @img.geometry = '90x90' }
|
413
|
+
assert_equal('90x90', @img.geometry)
|
414
|
+
assert_nothing_raised { @img.geometry = Magick::Geometry.new(100, 80) }
|
415
|
+
assert_equal('100x80', @img.geometry)
|
416
|
+
assert_raise(TypeError) { @img.geometry = [] }
|
417
|
+
end
|
418
|
+
|
419
|
+
def test_image_type
|
420
|
+
assert_nothing_raised { @img.image_type }
|
421
|
+
assert_instance_of(Magick::ImageType, @img.image_type)
|
422
|
+
assert_equal(Magick::GrayscaleMatteType, @img.image_type)
|
423
|
+
end
|
424
|
+
|
425
|
+
def test_interlace_type
|
426
|
+
assert_nothing_raised { @img.interlace }
|
427
|
+
assert_instance_of(Magick::InterlaceType, @img.interlace)
|
428
|
+
assert_equal(Magick::NoInterlace, @img.interlace)
|
429
|
+
assert_nothing_raised { @img.interlace = Magick::LineInterlace }
|
430
|
+
assert_equal(Magick::LineInterlace, @img.interlace)
|
431
|
+
assert_nothing_raised { @img.interlace = Magick::PlaneInterlace }
|
432
|
+
assert_nothing_raised { @img.interlace = Magick::PartitionInterlace }
|
433
|
+
assert_raise(TypeError) { @img.interlace = 2 }
|
434
|
+
end
|
435
|
+
|
436
|
+
def test_iptc_profile
|
437
|
+
assert_nothing_raised { @img.iptc_profile }
|
438
|
+
assert_nil(@img.iptc_profile)
|
439
|
+
assert_nothing_raised { @img.iptc_profile = 'xxx' }
|
440
|
+
assert_raise(TypeError) { @img.iptc_profile = 2 }
|
441
|
+
end
|
442
|
+
|
443
|
+
def test_matte
|
444
|
+
assert_nothing_raised { @img.matte }
|
445
|
+
assert(@img.matte)
|
446
|
+
assert_nothing_raised { @img.matte = false }
|
447
|
+
assert(!@img.matte)
|
448
|
+
end
|
449
|
+
|
450
|
+
def test_mean_error
|
451
|
+
assert_nothing_raised { @hat.mean_error_per_pixel }
|
452
|
+
assert_nothing_raised { @hat.normalized_mean_error }
|
453
|
+
assert_nothing_raised { @hat.normalized_maximum_error }
|
454
|
+
assert_equal(0.0, @hat.mean_error_per_pixel)
|
455
|
+
assert_equal(0.0, @hat.normalized_mean_error)
|
456
|
+
assert_equal(0.0, @hat.normalized_maximum_error)
|
457
|
+
|
458
|
+
hat = @hat.quantize(16, Magick::RGBColorspace, true, 0, true)
|
459
|
+
|
460
|
+
assert_not_equal(0.0, hat.mean_error_per_pixel)
|
461
|
+
assert_not_equal(0.0, hat.normalized_mean_error)
|
462
|
+
assert_not_equal(0.0, hat.normalized_maximum_error)
|
463
|
+
assert_raise(NoMethodError) { hat.mean_error_per_pixel = 1 }
|
464
|
+
assert_raise(NoMethodError) { hat.normalized_mean_error = 1 }
|
465
|
+
assert_raise(NoMethodError) { hat.normalized_maximum_error = 1 }
|
466
|
+
end
|
467
|
+
|
468
|
+
def test_mime_type
|
469
|
+
img = @img.copy
|
470
|
+
img.format = 'GIF'
|
471
|
+
assert_nothing_raised { img.mime_type }
|
472
|
+
assert_equal('image/gif', img.mime_type)
|
473
|
+
img.format = 'JPG'
|
474
|
+
assert_equal('image/jpeg', img.mime_type)
|
475
|
+
assert_raise(NoMethodError) { img.mime_type = 'image/jpeg' }
|
476
|
+
end
|
477
|
+
|
478
|
+
def test_monitor
|
479
|
+
assert_raise(NoMethodError) { @img.monitor }
|
480
|
+
monitor = proc { |name, q, s| puts name }
|
481
|
+
assert_nothing_raised { @img.monitor = monitor }
|
482
|
+
assert_nothing_raised { @img.monitor = nil }
|
483
|
+
end
|
484
|
+
|
485
|
+
def test_montage
|
486
|
+
assert_nothing_raised { @img.montage }
|
487
|
+
assert_nil(@img.montage)
|
488
|
+
end
|
489
|
+
|
490
|
+
def test_number_colors
|
491
|
+
assert_nothing_raised { @hat.number_colors }
|
492
|
+
if IM_VERSION < Gem::Version.new('6.7.5') || (IM_VERSION == Gem::Version.new('6.7.5') && IM_REVISION < Gem::Version.new('5'))
|
493
|
+
assert_equal(27980, @hat.number_colors)
|
494
|
+
else
|
495
|
+
assert_equal(27942, @hat.number_colors)
|
496
|
+
end
|
497
|
+
assert_raise(NoMethodError) { @hat.number_colors = 2 }
|
498
|
+
end
|
499
|
+
|
500
|
+
def test_offset
|
501
|
+
assert_nothing_raised { @img.offset }
|
502
|
+
assert_equal(0, @img.offset)
|
503
|
+
assert_nothing_raised { @img.offset = 10 }
|
504
|
+
assert_equal(10, @img.offset)
|
505
|
+
assert_raise(TypeError) { @img.offset = 'x' }
|
506
|
+
end
|
507
|
+
|
508
|
+
def test_opacity
|
509
|
+
assert_raise(NoMethodError) { @img.opacity }
|
510
|
+
assert_nothing_raised { @img.opacity = 50 }
|
511
|
+
assert_raise(TypeError) { @img.opacity = 'x' }
|
512
|
+
end
|
513
|
+
|
514
|
+
def test_orientation
|
515
|
+
assert_nothing_raised { @img.orientation }
|
516
|
+
assert_instance_of(Magick::OrientationType, @img.orientation)
|
517
|
+
assert_equal(Magick::UndefinedOrientation, @img.orientation)
|
518
|
+
assert_nothing_raised { @img.orientation = Magick::UndefinedOrientation }
|
519
|
+
assert_nothing_raised { @img.orientation = Magick::TopLeftOrientation }
|
520
|
+
assert_nothing_raised { @img.orientation = Magick::TopRightOrientation }
|
521
|
+
assert_nothing_raised { @img.orientation = Magick::BottomRightOrientation }
|
522
|
+
assert_nothing_raised { @img.orientation = Magick::LeftTopOrientation }
|
523
|
+
assert_nothing_raised { @img.orientation = Magick::RightTopOrientation }
|
524
|
+
assert_nothing_raised { @img.orientation = Magick::RightBottomOrientation }
|
525
|
+
assert_nothing_raised { @img.orientation = Magick::LeftBottomOrientation }
|
526
|
+
end
|
527
|
+
|
528
|
+
def test_page
|
529
|
+
assert_nothing_raised { @img.page }
|
530
|
+
page = @img.page
|
531
|
+
assert_equal(0, page.width)
|
532
|
+
assert_equal(0, page.height)
|
533
|
+
assert_equal(0, page.x)
|
534
|
+
assert_equal(0, page.y)
|
535
|
+
page = Magick::Rectangle.new(1,2,3,4)
|
536
|
+
assert_nothing_raised { @img.page = page }
|
537
|
+
assert_equal(1, page.width)
|
538
|
+
assert_equal(2, page.height)
|
539
|
+
assert_equal(3, page.x)
|
540
|
+
assert_equal(4, page.y)
|
541
|
+
assert_raise(TypeError) { @img.page = 2 }
|
542
|
+
end
|
543
|
+
|
544
|
+
def test_quality
|
545
|
+
assert_nothing_raised { @hat.quality }
|
546
|
+
assert_equal(75, @hat.quality)
|
547
|
+
assert_raise(NoMethodError) { @img.quality = 80 }
|
548
|
+
end
|
549
|
+
|
550
|
+
def test_quantum_depth
|
551
|
+
assert_nothing_raised { @img.quantum_depth }
|
552
|
+
assert_equal(Magick::MAGICKCORE_QUANTUM_DEPTH, @img.quantum_depth)
|
553
|
+
assert_raise(NoMethodError) { @img.quantum_depth = 8 }
|
554
|
+
end
|
555
|
+
|
556
|
+
def test_rendering_intent
|
557
|
+
assert_nothing_raised { @img.rendering_intent }
|
558
|
+
assert_instance_of(Magick::RenderingIntent, @img.rendering_intent)
|
559
|
+
if IM_VERSION < Gem::Version.new('6.7.5') || (IM_VERSION == Gem::Version.new('6.7.5') && IM_REVISION < Gem::Version.new('5'))
|
560
|
+
assert_equal(Magick::UndefinedIntent, @img.rendering_intent)
|
561
|
+
else
|
562
|
+
assert_equal(Magick::PerceptualIntent, @img.rendering_intent)
|
563
|
+
end
|
564
|
+
assert_nothing_raised { @img.rendering_intent = Magick::SaturationIntent }
|
565
|
+
assert_nothing_raised { @img.rendering_intent = Magick::PerceptualIntent }
|
566
|
+
assert_nothing_raised { @img.rendering_intent = Magick::AbsoluteIntent }
|
567
|
+
assert_nothing_raised { @img.rendering_intent = Magick::RelativeIntent }
|
568
|
+
assert_raise(TypeError) { @img.rendering_intent = 2 }
|
569
|
+
end
|
570
|
+
|
571
|
+
def test_rows
|
572
|
+
assert_nothing_raised { @img.rows }
|
573
|
+
assert_equal(100, @img.rows)
|
574
|
+
assert_raise(NoMethodError) { @img.rows = 2 }
|
575
|
+
end
|
576
|
+
|
577
|
+
def test_scene
|
578
|
+
ilist = Magick::ImageList.new
|
579
|
+
ilist << @img
|
580
|
+
img = @img.copy
|
581
|
+
ilist << img
|
582
|
+
ilist.write('temp.gif')
|
583
|
+
FileUtils.rm('temp.gif')
|
584
|
+
|
585
|
+
assert_nothing_raised { img.scene }
|
586
|
+
assert_equal(0, @img.scene)
|
587
|
+
assert_equal(1, img.scene)
|
588
|
+
assert_raise(NoMethodError) { img.scene = 2 }
|
589
|
+
end
|
590
|
+
|
591
|
+
def test_start_loop
|
592
|
+
assert_nothing_raised { @img.start_loop }
|
593
|
+
assert(! @img.start_loop)
|
594
|
+
assert_nothing_raised { @img.start_loop = true }
|
595
|
+
assert(@img.start_loop)
|
596
|
+
end
|
597
|
+
|
598
|
+
def test_ticks_per_second
|
599
|
+
assert_nothing_raised { @img.ticks_per_second }
|
600
|
+
assert_equal(100, @img.ticks_per_second)
|
601
|
+
assert_nothing_raised { @img.ticks_per_second = 1000 }
|
602
|
+
assert_equal(1000, @img.ticks_per_second)
|
603
|
+
assert_raise(TypeError) { @img.ticks_per_second = 'x' }
|
604
|
+
end
|
605
|
+
|
606
|
+
def test_total_colors
|
607
|
+
assert_nothing_raised { @hat.total_colors }
|
608
|
+
if IM_VERSION < Gem::Version.new('6.7.5') || (IM_VERSION == Gem::Version.new('6.7.5') && IM_REVISION < Gem::Version.new('5'))
|
609
|
+
assert_equal(27980, @hat.total_colors)
|
610
|
+
else
|
611
|
+
assert_equal(27942, @hat.total_colors)
|
612
|
+
end
|
613
|
+
assert_raise(NoMethodError) { @img.total_colors = 2 }
|
614
|
+
end
|
615
|
+
|
616
|
+
def test_units
|
617
|
+
assert_nothing_raised { @img.units }
|
618
|
+
assert_instance_of(Magick::ResolutionType, @img.units)
|
619
|
+
assert_equal(Magick::UndefinedResolution, @img.units)
|
620
|
+
assert_nothing_raised { @img.units = Magick::PixelsPerInchResolution }
|
621
|
+
assert_equal(Magick::PixelsPerInchResolution, @img.units)
|
622
|
+
assert_nothing_raised { @img.units = Magick::PixelsPerCentimeterResolution }
|
623
|
+
assert_raise(TypeError) { @img.units = 2 }
|
624
|
+
end
|
625
|
+
|
626
|
+
def test_virtual_pixel_method
|
627
|
+
assert_nothing_raised { @img.virtual_pixel_method }
|
628
|
+
assert_equal(Magick::UndefinedVirtualPixelMethod, @img.virtual_pixel_method)
|
629
|
+
assert_nothing_raised { @img.virtual_pixel_method = Magick::EdgeVirtualPixelMethod }
|
630
|
+
assert_equal(Magick::EdgeVirtualPixelMethod, @img.virtual_pixel_method)
|
631
|
+
assert_nothing_raised { @img.virtual_pixel_method = Magick::MirrorVirtualPixelMethod }
|
632
|
+
assert_nothing_raised { @img.virtual_pixel_method = Magick::TileVirtualPixelMethod }
|
633
|
+
assert_nothing_raised { @img.virtual_pixel_method = Magick::TransparentVirtualPixelMethod }
|
634
|
+
assert_nothing_raised { @img.virtual_pixel_method = Magick::BackgroundVirtualPixelMethod }
|
635
|
+
assert_raise(TypeError) { @img.virtual_pixel_method = 2 }
|
636
|
+
end
|
637
|
+
|
638
|
+
def test_x_resolution
|
639
|
+
assert_nothing_raised { @img.x_resolution }
|
640
|
+
assert_nothing_raised { @img.x_resolution = 90 }
|
641
|
+
assert_equal(90.0, @img.x_resolution)
|
642
|
+
assert_raise(TypeError) { @img.x_resolution = 'x' }
|
643
|
+
end
|
644
|
+
|
645
|
+
def test_y_resolution
|
646
|
+
assert_nothing_raised { @img.y_resolution }
|
647
|
+
assert_nothing_raised { @img.y_resolution = 90 }
|
648
|
+
assert_equal(90.0, @img.y_resolution)
|
649
|
+
assert_raise(TypeError) { @img.y_resolution = 'x' }
|
650
|
+
end
|
651
|
+
|
652
|
+
def test_frozen
|
653
|
+
@img.freeze
|
654
|
+
assert_raise(FreezeError) { @img.background_color = 'xxx' }
|
655
|
+
assert_raise(FreezeError) { @img.blur = 50 }
|
656
|
+
assert_raise(FreezeError) { @img.border_color = 'xxx' }
|
657
|
+
rp = Magick::Point.new(1,1)
|
658
|
+
gp = Magick::Point.new(1,1)
|
659
|
+
bp = Magick::Point.new(1,1)
|
660
|
+
wp = Magick::Point.new(1,1)
|
661
|
+
assert_raise(FreezeError) { @img.chromaticity = Magick::Chromaticity.new(rp, gp, bp, wp) }
|
662
|
+
assert_raise(FreezeError) { @img.class_type = Magick::DirectClass }
|
663
|
+
assert_raise(FreezeError) { @img.color_profile = 'xxx' }
|
664
|
+
assert_raise(FreezeError) { @img.colorspace = Magick::RGBColorspace }
|
665
|
+
assert_raise(FreezeError) { @img.compose = Magick::OverCompositeOp }
|
666
|
+
assert_raise(FreezeError) { @img.compression = Magick::RLECompression }
|
667
|
+
assert_raise(FreezeError) { @img.delay = 2 }
|
668
|
+
assert_raise(FreezeError) { @img.density = '72.0x72.0' }
|
669
|
+
assert_raise(FreezeError) { @img.dispose = Magick::NoneDispose }
|
670
|
+
assert_raise(FreezeError) { @img.endian = Magick::MSBEndian }
|
671
|
+
assert_raise(FreezeError) { @img.extract_info = Magick::Rectangle.new(1,2,3,4) }
|
672
|
+
assert_raise(FreezeError) { @img.filter = Magick::PointFilter }
|
673
|
+
assert_raise(FreezeError) { @img.format = 'GIF' }
|
674
|
+
assert_raise(FreezeError) { @img.fuzz = 50.0 }
|
675
|
+
assert_raise(FreezeError) { @img.gamma = 2.0 }
|
676
|
+
assert_raise(FreezeError) { @img.geometry = '100x100' }
|
677
|
+
assert_raise(FreezeError) { @img.interlace = Magick::NoInterlace }
|
678
|
+
assert_raise(FreezeError) { @img.iptc_profile = 'xxx' }
|
679
|
+
assert_raise(FreezeError) { @img.mask = @img }
|
680
|
+
assert_raise(FreezeError) { @img.matte = true }
|
681
|
+
assert_raise(FreezeError) { @img.monitor = proc { |name, q, s| puts name } }
|
682
|
+
assert_raise(FreezeError) { @img.offset = 100 }
|
683
|
+
assert_raise(FreezeError) { @img.opacity = 100 }
|
684
|
+
assert_raise(FreezeError) { @img.page = Magick::Rectangle.new(1,2,3,4) }
|
685
|
+
assert_raise(FreezeError) { @img.rendering_intent = Magick::SaturationIntent }
|
686
|
+
assert_raise(FreezeError) { @img.start_loop = true }
|
687
|
+
assert_raise(FreezeError) { @img.ticks_per_second = 1000 }
|
688
|
+
assert_raise(FreezeError) { @img.units = Magick::PixelsPerInchResolution }
|
689
|
+
assert_raise(FreezeError) { @img.x_resolution = 72.0 }
|
690
|
+
assert_raise(FreezeError) { @img.y_resolution = 72.0 }
|
691
|
+
end
|
692
692
|
end # class Image_Attributes_UT
|
693
693
|
|
694
694
|
if __FILE__ == $PROGRAM_NAME
|