rdp-rmagick 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (388) hide show
  1. data/ChangeLog +769 -0
  2. data/Doxyfile +1514 -0
  3. data/README-Mac-OSX.txt +1 -0
  4. data/README.md +231 -0
  5. data/build_tarball.rake +215 -0
  6. data/doc/comtasks.html +287 -0
  7. data/doc/constants.html +1581 -0
  8. data/doc/css/doc.css +299 -0
  9. data/doc/css/popup.css +34 -0
  10. data/doc/css/ref.css +67 -0
  11. data/doc/draw.html +3269 -0
  12. data/doc/ex/InitialCoords.rb +23 -0
  13. data/doc/ex/NewCoordSys.rb +32 -0
  14. data/doc/ex/OrigCoordSys.rb +18 -0
  15. data/doc/ex/PreserveAspectRatio.rb +205 -0
  16. data/doc/ex/RotateScale.rb +37 -0
  17. data/doc/ex/Skew.rb +38 -0
  18. data/doc/ex/Use01.rb +16 -0
  19. data/doc/ex/Use02.rb +21 -0
  20. data/doc/ex/Use03.rb +16 -0
  21. data/doc/ex/ViewBox.rb +33 -0
  22. data/doc/ex/adaptive_threshold.rb +10 -0
  23. data/doc/ex/add_noise.rb +17 -0
  24. data/doc/ex/affine.rb +48 -0
  25. data/doc/ex/affine_transform.rb +20 -0
  26. data/doc/ex/arc.rb +49 -0
  27. data/doc/ex/arcpath.rb +33 -0
  28. data/doc/ex/arcs01.rb +28 -0
  29. data/doc/ex/arcs02.rb +61 -0
  30. data/doc/ex/average.rb +15 -0
  31. data/doc/ex/axes.rb +64 -0
  32. data/doc/ex/baseline_shift01.rb +18 -0
  33. data/doc/ex/bilevel_channel.rb +9 -0
  34. data/doc/ex/blur_image.rb +12 -0
  35. data/doc/ex/border.rb +10 -0
  36. data/doc/ex/bounding_box.rb +44 -0
  37. data/doc/ex/cbezier1.rb +42 -0
  38. data/doc/ex/cbezier2.rb +42 -0
  39. data/doc/ex/cbezier3.rb +42 -0
  40. data/doc/ex/cbezier4.rb +43 -0
  41. data/doc/ex/cbezier5.rb +43 -0
  42. data/doc/ex/cbezier6.rb +53 -0
  43. data/doc/ex/channel.rb +26 -0
  44. data/doc/ex/charcoal.rb +12 -0
  45. data/doc/ex/chop.rb +29 -0
  46. data/doc/ex/circle.rb +33 -0
  47. data/doc/ex/circle01.rb +17 -0
  48. data/doc/ex/clip_path.rb +60 -0
  49. data/doc/ex/coalesce.rb +60 -0
  50. data/doc/ex/color_fill_to_border.rb +29 -0
  51. data/doc/ex/color_floodfill.rb +28 -0
  52. data/doc/ex/color_histogram.rb +48 -0
  53. data/doc/ex/color_reset.rb +11 -0
  54. data/doc/ex/colorize.rb +16 -0
  55. data/doc/ex/colors.rb +64 -0
  56. data/doc/ex/compose_mask.rb +23 -0
  57. data/doc/ex/composite.rb +135 -0
  58. data/doc/ex/composite_layers.rb +53 -0
  59. data/doc/ex/composite_tiled.rb +23 -0
  60. data/doc/ex/contrast.rb +36 -0
  61. data/doc/ex/crop.rb +31 -0
  62. data/doc/ex/crop_with_gravity.rb +46 -0
  63. data/doc/ex/cubic01.rb +45 -0
  64. data/doc/ex/cubic02.rb +94 -0
  65. data/doc/ex/cycle_colormap.rb +21 -0
  66. data/doc/ex/dissolve.rb +13 -0
  67. data/doc/ex/drawcomp.rb +42 -0
  68. data/doc/ex/drop_shadow.rb +60 -0
  69. data/doc/ex/edge.rb +11 -0
  70. data/doc/ex/ellipse.rb +45 -0
  71. data/doc/ex/ellipse01.rb +22 -0
  72. data/doc/ex/emboss.rb +11 -0
  73. data/doc/ex/enhance.rb +28 -0
  74. data/doc/ex/equalize.rb +11 -0
  75. data/doc/ex/evenodd.rb +43 -0
  76. data/doc/ex/fill_pattern.rb +26 -0
  77. data/doc/ex/flatten_images.rb +36 -0
  78. data/doc/ex/flip.rb +11 -0
  79. data/doc/ex/flop.rb +11 -0
  80. data/doc/ex/font_styles.rb +34 -0
  81. data/doc/ex/fonts.rb +20 -0
  82. data/doc/ex/frame.rb +12 -0
  83. data/doc/ex/gaussian_blur.rb +11 -0
  84. data/doc/ex/get_multiline_type_metrics.rb +42 -0
  85. data/doc/ex/get_pixels.rb +48 -0
  86. data/doc/ex/get_type_metrics.rb +146 -0
  87. data/doc/ex/gradientfill.rb +27 -0
  88. data/doc/ex/grav.rb +46 -0
  89. data/doc/ex/gravity.rb +79 -0
  90. data/doc/ex/group.rb +26 -0
  91. data/doc/ex/hatchfill.rb +27 -0
  92. data/doc/ex/image.rb +46 -0
  93. data/doc/ex/images/Apple.miff +0 -0
  94. data/doc/ex/images/Ballerina.jpg +0 -0
  95. data/doc/ex/images/Ballerina3.jpg +0 -0
  96. data/doc/ex/images/Button_0.gif +0 -0
  97. data/doc/ex/images/Button_1.gif +0 -0
  98. data/doc/ex/images/Button_2.gif +0 -0
  99. data/doc/ex/images/Button_3.gif +0 -0
  100. data/doc/ex/images/Button_4.gif +0 -0
  101. data/doc/ex/images/Button_5.gif +0 -0
  102. data/doc/ex/images/Button_6.gif +0 -0
  103. data/doc/ex/images/Button_7.gif +0 -0
  104. data/doc/ex/images/Button_8.gif +0 -0
  105. data/doc/ex/images/Button_9.gif +0 -0
  106. data/doc/ex/images/Button_A.gif +0 -0
  107. data/doc/ex/images/Button_B.gif +0 -0
  108. data/doc/ex/images/Button_C.gif +0 -0
  109. data/doc/ex/images/Button_D.gif +0 -0
  110. data/doc/ex/images/Button_E.gif +0 -0
  111. data/doc/ex/images/Button_F.gif +0 -0
  112. data/doc/ex/images/Button_G.gif +0 -0
  113. data/doc/ex/images/Button_H.gif +0 -0
  114. data/doc/ex/images/Button_I.gif +0 -0
  115. data/doc/ex/images/Button_J.gif +0 -0
  116. data/doc/ex/images/Button_K.gif +0 -0
  117. data/doc/ex/images/Button_L.gif +0 -0
  118. data/doc/ex/images/Button_M.gif +0 -0
  119. data/doc/ex/images/Button_N.gif +0 -0
  120. data/doc/ex/images/Button_O.gif +0 -0
  121. data/doc/ex/images/Button_P.gif +0 -0
  122. data/doc/ex/images/Button_Q.gif +0 -0
  123. data/doc/ex/images/Button_R.gif +0 -0
  124. data/doc/ex/images/Button_S.gif +0 -0
  125. data/doc/ex/images/Button_T.gif +0 -0
  126. data/doc/ex/images/Button_U.gif +0 -0
  127. data/doc/ex/images/Button_V.gif +0 -0
  128. data/doc/ex/images/Button_W.gif +0 -0
  129. data/doc/ex/images/Button_X.gif +0 -0
  130. data/doc/ex/images/Button_Y.gif +0 -0
  131. data/doc/ex/images/Button_Z.gif +0 -0
  132. data/doc/ex/images/Cheetah.jpg +0 -0
  133. data/doc/ex/images/Coffee.wmf +0 -0
  134. data/doc/ex/images/Flower_Hat.jpg +0 -0
  135. data/doc/ex/images/Gold_Statue.jpg +0 -0
  136. data/doc/ex/images/Hot_Air_Balloons.jpg +0 -0
  137. data/doc/ex/images/Hot_Air_Balloons_H.jpg +0 -0
  138. data/doc/ex/images/Leaf.miff +0 -0
  139. data/doc/ex/images/No.wmf +0 -0
  140. data/doc/ex/images/Polynesia.jpg +0 -0
  141. data/doc/ex/images/Red_Rocks.jpg +0 -0
  142. data/doc/ex/images/Rocks_On_Beach.miff +0 -0
  143. data/doc/ex/images/Shorts.jpg +0 -0
  144. data/doc/ex/images/Snake.wmf +0 -0
  145. data/doc/ex/images/Violin.jpg +0 -0
  146. data/doc/ex/images/Yellow_Rose.miff +0 -0
  147. data/doc/ex/images/big-duck.gif +0 -0
  148. data/doc/ex/images/duck.gif +0 -0
  149. data/doc/ex/images/duck0.gif +0 -0
  150. data/doc/ex/images/duck1.gif +0 -0
  151. data/doc/ex/images/duck10.gif +0 -0
  152. data/doc/ex/images/duck11.gif +0 -0
  153. data/doc/ex/images/duck12.gif +0 -0
  154. data/doc/ex/images/duck13.gif +0 -0
  155. data/doc/ex/images/duck14.gif +0 -0
  156. data/doc/ex/images/duck15.gif +0 -0
  157. data/doc/ex/images/duck2.gif +0 -0
  158. data/doc/ex/images/duck3.gif +0 -0
  159. data/doc/ex/images/duck4.gif +0 -0
  160. data/doc/ex/images/duck5.gif +0 -0
  161. data/doc/ex/images/duck6.gif +0 -0
  162. data/doc/ex/images/duck7.gif +0 -0
  163. data/doc/ex/images/duck8.gif +0 -0
  164. data/doc/ex/images/duck9.gif +0 -0
  165. data/doc/ex/images/graydient230x6.gif +0 -0
  166. data/doc/ex/images/logo400x83.gif +0 -0
  167. data/doc/ex/images/model.miff +0 -0
  168. data/doc/ex/images/notimplemented.gif +0 -0
  169. data/doc/ex/images/smile.miff +0 -0
  170. data/doc/ex/images/spin.gif +0 -0
  171. data/doc/ex/implode.rb +34 -0
  172. data/doc/ex/level.rb +11 -0
  173. data/doc/ex/level_colors.rb +11 -0
  174. data/doc/ex/line.rb +42 -0
  175. data/doc/ex/line01.rb +23 -0
  176. data/doc/ex/mask.rb +36 -0
  177. data/doc/ex/matte_fill_to_border.rb +40 -0
  178. data/doc/ex/matte_floodfill.rb +33 -0
  179. data/doc/ex/matte_replace.rb +40 -0
  180. data/doc/ex/median_filter.rb +28 -0
  181. data/doc/ex/modulate.rb +11 -0
  182. data/doc/ex/mono.rb +23 -0
  183. data/doc/ex/morph.rb +26 -0
  184. data/doc/ex/mosaic.rb +35 -0
  185. data/doc/ex/motion_blur.rb +11 -0
  186. data/doc/ex/negate.rb +11 -0
  187. data/doc/ex/negate_channel.rb +9 -0
  188. data/doc/ex/nested_rvg.rb +21 -0
  189. data/doc/ex/nonzero.rb +43 -0
  190. data/doc/ex/normalize.rb +11 -0
  191. data/doc/ex/oil_paint.rb +11 -0
  192. data/doc/ex/opacity.rb +37 -0
  193. data/doc/ex/ordered_dither.rb +11 -0
  194. data/doc/ex/path.rb +64 -0
  195. data/doc/ex/pattern1.rb +25 -0
  196. data/doc/ex/pattern2.rb +26 -0
  197. data/doc/ex/polaroid.rb +28 -0
  198. data/doc/ex/polygon.rb +24 -0
  199. data/doc/ex/polygon01.rb +23 -0
  200. data/doc/ex/polyline.rb +23 -0
  201. data/doc/ex/polyline01.rb +23 -0
  202. data/doc/ex/posterize.rb +8 -0
  203. data/doc/ex/preview.rb +9 -0
  204. data/doc/ex/qbezierpath.rb +52 -0
  205. data/doc/ex/quad01.rb +36 -0
  206. data/doc/ex/quantize-m.rb +25 -0
  207. data/doc/ex/radial_blur.rb +9 -0
  208. data/doc/ex/raise.rb +8 -0
  209. data/doc/ex/random_threshold_channel.rb +13 -0
  210. data/doc/ex/rect01.rb +15 -0
  211. data/doc/ex/rect02.rb +22 -0
  212. data/doc/ex/rectangle.rb +35 -0
  213. data/doc/ex/reduce_noise.rb +28 -0
  214. data/doc/ex/remap.rb +12 -0
  215. data/doc/ex/remap_images.rb +21 -0
  216. data/doc/ex/resize_to_fill.rb +10 -0
  217. data/doc/ex/resize_to_fit.rb +10 -0
  218. data/doc/ex/roll.rb +9 -0
  219. data/doc/ex/rotate.rb +45 -0
  220. data/doc/ex/rotate_f.rb +14 -0
  221. data/doc/ex/roundrect.rb +34 -0
  222. data/doc/ex/rubyname.rb +30 -0
  223. data/doc/ex/rvg_clippath.rb +14 -0
  224. data/doc/ex/rvg_linecap.rb +43 -0
  225. data/doc/ex/rvg_linejoin.rb +41 -0
  226. data/doc/ex/rvg_opacity.rb +19 -0
  227. data/doc/ex/rvg_pattern.rb +26 -0
  228. data/doc/ex/rvg_stroke_dasharray.rb +12 -0
  229. data/doc/ex/segment.rb +11 -0
  230. data/doc/ex/sepiatone.rb +8 -0
  231. data/doc/ex/shade.rb +11 -0
  232. data/doc/ex/shadow.rb +31 -0
  233. data/doc/ex/shave.rb +15 -0
  234. data/doc/ex/shear.rb +10 -0
  235. data/doc/ex/sketch.rb +18 -0
  236. data/doc/ex/skewx.rb +52 -0
  237. data/doc/ex/skewy.rb +47 -0
  238. data/doc/ex/smile.rb +125 -0
  239. data/doc/ex/solarize.rb +11 -0
  240. data/doc/ex/sparse_color.rb +55 -0
  241. data/doc/ex/splice.rb +9 -0
  242. data/doc/ex/spread.rb +11 -0
  243. data/doc/ex/stegano.rb +55 -0
  244. data/doc/ex/stroke_dasharray.rb +43 -0
  245. data/doc/ex/stroke_fill.rb +11 -0
  246. data/doc/ex/stroke_linecap.rb +44 -0
  247. data/doc/ex/stroke_linejoin.rb +48 -0
  248. data/doc/ex/stroke_width.rb +49 -0
  249. data/doc/ex/swirl.rb +17 -0
  250. data/doc/ex/text.rb +37 -0
  251. data/doc/ex/text01.rb +17 -0
  252. data/doc/ex/text_align.rb +36 -0
  253. data/doc/ex/text_antialias.rb +38 -0
  254. data/doc/ex/text_styles.rb +21 -0
  255. data/doc/ex/text_undercolor.rb +28 -0
  256. data/doc/ex/texture_fill_to_border.rb +34 -0
  257. data/doc/ex/texture_floodfill.rb +32 -0
  258. data/doc/ex/texturefill.rb +25 -0
  259. data/doc/ex/threshold.rb +13 -0
  260. data/doc/ex/to_blob.rb +14 -0
  261. data/doc/ex/translate.rb +39 -0
  262. data/doc/ex/transparent.rb +38 -0
  263. data/doc/ex/transpose.rb +9 -0
  264. data/doc/ex/transverse.rb +9 -0
  265. data/doc/ex/tref01.rb +25 -0
  266. data/doc/ex/triangle01.rb +16 -0
  267. data/doc/ex/trim.rb +24 -0
  268. data/doc/ex/tspan01.rb +18 -0
  269. data/doc/ex/tspan02.rb +19 -0
  270. data/doc/ex/tspan03.rb +21 -0
  271. data/doc/ex/unsharp_mask.rb +28 -0
  272. data/doc/ex/viewex.rb +35 -0
  273. data/doc/ex/vignette.rb +12 -0
  274. data/doc/ex/watermark.rb +28 -0
  275. data/doc/ex/wave.rb +9 -0
  276. data/doc/ex/wet_floor.rb +59 -0
  277. data/doc/ex/writing_mode01.rb +27 -0
  278. data/doc/ex/writing_mode02.rb +26 -0
  279. data/doc/ilist.html +2056 -0
  280. data/doc/image1.html +4680 -0
  281. data/doc/image2.html +3665 -0
  282. data/doc/image3.html +4522 -0
  283. data/doc/imageattrs.html +1638 -0
  284. data/doc/imusage.html +514 -0
  285. data/doc/index.html +416 -0
  286. data/doc/info.html +1499 -0
  287. data/doc/magick.html +565 -0
  288. data/doc/optequiv.html +2435 -0
  289. data/doc/rvg.html +975 -0
  290. data/doc/rvgclip.html +248 -0
  291. data/doc/rvggroup.html +305 -0
  292. data/doc/rvgimage.html +289 -0
  293. data/doc/rvgpattern.html +475 -0
  294. data/doc/rvgshape.html +406 -0
  295. data/doc/rvgstyle.html +270 -0
  296. data/doc/rvgtext.html +465 -0
  297. data/doc/rvgtspan.html +238 -0
  298. data/doc/rvgtut.html +530 -0
  299. data/doc/rvguse.html +145 -0
  300. data/doc/rvgxform.html +294 -0
  301. data/doc/scripts/doc.js +22 -0
  302. data/doc/scripts/stripeTables.js +23 -0
  303. data/doc/struct.html +1339 -0
  304. data/doc/usage.html +1621 -0
  305. data/examples/constitute.rb +7 -0
  306. data/examples/crop_with_gravity.rb +46 -0
  307. data/examples/demo.rb +324 -0
  308. data/examples/describe.rb +44 -0
  309. data/examples/find_similar_region.rb +34 -0
  310. data/examples/histogram.rb +325 -0
  311. data/examples/identify.rb +187 -0
  312. data/examples/image_opacity.rb +29 -0
  313. data/examples/import_export.rb +31 -0
  314. data/examples/pattern_fill.rb +38 -0
  315. data/examples/rotating_text.rb +45 -0
  316. data/examples/spinner.rb +50 -0
  317. data/examples/thumbnail.rb +65 -0
  318. data/examples/vignette.rb +79 -0
  319. data/ext/RMagick/Makefile +180 -0
  320. data/ext/RMagick/RMagick2.so +0 -0
  321. data/ext/RMagick/extconf.h +119 -0
  322. data/ext/RMagick/extconf.rb +406 -0
  323. data/ext/RMagick/mkmf.log +3022 -0
  324. data/ext/RMagick/rmagick.c +394 -0
  325. data/ext/RMagick/rmagick.h +1307 -0
  326. data/ext/RMagick/rmagick.o +0 -0
  327. data/ext/RMagick/rmdraw.c +1991 -0
  328. data/ext/RMagick/rmdraw.o +0 -0
  329. data/ext/RMagick/rmenum.c +1224 -0
  330. data/ext/RMagick/rmenum.o +0 -0
  331. data/ext/RMagick/rmfill.c +717 -0
  332. data/ext/RMagick/rmfill.o +0 -0
  333. data/ext/RMagick/rmilist.c +1217 -0
  334. data/ext/RMagick/rmilist.o +0 -0
  335. data/ext/RMagick/rmimage.c +15099 -0
  336. data/ext/RMagick/rmimage.o +0 -0
  337. data/ext/RMagick/rminfo.c +2567 -0
  338. data/ext/RMagick/rminfo.o +0 -0
  339. data/ext/RMagick/rmmain.c +1705 -0
  340. data/ext/RMagick/rmmain.o +0 -0
  341. data/ext/RMagick/rmmontage.c +511 -0
  342. data/ext/RMagick/rmmontage.o +0 -0
  343. data/ext/RMagick/rmpixel.c +1103 -0
  344. data/ext/RMagick/rmpixel.o +0 -0
  345. data/ext/RMagick/rmstruct.c +1047 -0
  346. data/ext/RMagick/rmstruct.o +0 -0
  347. data/ext/RMagick/rmutil.c +1730 -0
  348. data/ext/RMagick/rmutil.o +0 -0
  349. data/lib/RMagick.rb +1962 -0
  350. data/lib/rvg/clippath.rb +48 -0
  351. data/lib/rvg/container.rb +131 -0
  352. data/lib/rvg/deep_equal.rb +56 -0
  353. data/lib/rvg/describable.rb +53 -0
  354. data/lib/rvg/embellishable.rb +417 -0
  355. data/lib/rvg/misc.rb +740 -0
  356. data/lib/rvg/paint.rb +55 -0
  357. data/lib/rvg/pathdata.rb +131 -0
  358. data/lib/rvg/rvg.rb +283 -0
  359. data/lib/rvg/stretchable.rb +168 -0
  360. data/lib/rvg/stylable.rb +124 -0
  361. data/lib/rvg/text.rb +187 -0
  362. data/lib/rvg/to_c.rb +103 -0
  363. data/lib/rvg/transformable.rb +133 -0
  364. data/lib/rvg/units.rb +66 -0
  365. data/metaconfig +7 -0
  366. data/post-clean.rb +12 -0
  367. data/post-install.rb +50 -0
  368. data/post-setup.rb +254 -0
  369. data/rmagick.gemspec +20 -0
  370. data/setup.rb +1585 -0
  371. data/test/Draw.rb +121 -0
  372. data/test/Image1.rb +762 -0
  373. data/test/Image2.rb +1308 -0
  374. data/test/Image3.rb +1001 -0
  375. data/test/ImageList1.rb +808 -0
  376. data/test/ImageList2.rb +389 -0
  377. data/test/Image_attributes.rb +682 -0
  378. data/test/Import_Export.rb +116 -0
  379. data/test/Info.rb +349 -0
  380. data/test/Magick.rb +364 -0
  381. data/test/Pixel.rb +120 -0
  382. data/test/Preview.rb +62 -0
  383. data/test/all_basic.rb +39 -0
  384. data/test/cmyk.icm +0 -0
  385. data/test/srgb.icm +0 -0
  386. data/test/test.0 +0 -0
  387. data/uninstall.rb +74 -0
  388. metadata +455 -0
@@ -0,0 +1,808 @@
1
+ #! /usr/local/bin/ruby -w
2
+
3
+ require 'RMagick'
4
+ require 'test/unit'
5
+ require 'test/unit/ui/console/testrunner' if RUBY_VERSION != '1.9.1'
6
+
7
+ class ImageList1_UT < Test::Unit::TestCase
8
+
9
+ def setup
10
+ @list = Magick::ImageList.new(*FILES[0..9])
11
+ @list2 = Magick::ImageList.new # intersection is 5..9
12
+ @list2 << @list[5]
13
+ @list2 << @list[6]
14
+ @list2 << @list[7]
15
+ @list2 << @list[8]
16
+ @list2 << @list[9]
17
+ end
18
+
19
+ def test_delay
20
+ assert_nothing_raised { @list.delay }
21
+ assert_equal(0, @list.delay)
22
+ assert_nothing_raised { @list.delay = 20 }
23
+ assert_equal(20, @list.delay)
24
+ assert_raise(ArgumentError) { @list.delay = 'x' }
25
+ end
26
+
27
+ def test_ticks_per_second
28
+ assert_nothing_raised { @list.ticks_per_second }
29
+ assert_equal(100, @list.ticks_per_second)
30
+ assert_nothing_raised { @list.ticks_per_second = 1000 }
31
+ assert_equal(1000, @list.ticks_per_second)
32
+ assert_raise(ArgumentError) { @list.ticks_per_second = 'x' }
33
+ end
34
+
35
+ def test_iterations
36
+ assert_nothing_raised { @list.iterations }
37
+ assert_equal(1, @list.iterations)
38
+ assert_nothing_raised { @list.iterations = 20 }
39
+ assert_equal(20, @list.iterations)
40
+ assert_raise(ArgumentError) { @list.iterations = 'x' }
41
+ end
42
+
43
+ # also tests #size
44
+ def test_length
45
+ assert_nothing_raised { @list.length }
46
+ assert_equal(10, @list.length)
47
+ assert_raise(NoMethodError) { @list.length = 2 }
48
+ end
49
+
50
+ def test_scene
51
+ assert_nothing_raised { @list.scene }
52
+ assert_equal(9, @list.scene)
53
+ assert_nothing_raised { @list.scene = 0 }
54
+ assert_equal(0, @list.scene)
55
+ assert_nothing_raised { @list.scene = 1 }
56
+ assert_equal(1, @list.scene)
57
+ assert_raise(IndexError) { @list.scene = -1 }
58
+ assert_raise(IndexError) { @list.scene = 1000 }
59
+ assert_raise(IndexError) { @list.scene = nil }
60
+
61
+ # allow nil on empty list
62
+ empty_list = Magick::ImageList.new
63
+ assert_nothing_raised { empty_list.scene = nil }
64
+ end
65
+
66
+ def test_undef_array_methods
67
+ assert_raise(NoMethodError) { @list.assoc }
68
+ assert_raise(NoMethodError) { @list.flatten }
69
+ assert_raise(NoMethodError) { @list.flatten! }
70
+ assert_raise(NoMethodError) { @list.join }
71
+ assert_raise(NoMethodError) { @list.pack }
72
+ assert_raise(NoMethodError) { @list.rassoc }
73
+ end
74
+
75
+ def test_all
76
+ q = nil
77
+ assert_nothing_raised { q = @list.all? { |i| i.class == Magick::Image } }
78
+ assert(q)
79
+ end
80
+
81
+ def test_any
82
+ q = nil
83
+ assert_nothing_raised { q = @list.all? { |i| false } }
84
+ assert(!q)
85
+ assert_nothing_raised { q = @list.all? { |i| i.class == Magick::Image } }
86
+ assert(q)
87
+ end
88
+
89
+ def test_aref
90
+ assert_nothing_raised { @list[0] }
91
+ assert_instance_of(Magick::Image, @list[0])
92
+ assert_instance_of(Magick::Image, @list[-1])
93
+ assert_instance_of(Magick::ImageList, @list[0,1])
94
+ assert_instance_of(Magick::ImageList, @list[0..2])
95
+ assert_nil(@list[20])
96
+ end
97
+
98
+ def test_aset
99
+ img = Magick::Image.new(5,5)
100
+ assert_nothing_raised do
101
+ rv = @list[0] = img
102
+ assert_same(img, rv)
103
+ assert_same(img, @list[0])
104
+ assert_equal(0, @list.scene)
105
+ end
106
+
107
+ # replace 2 images with 1
108
+ assert_nothing_raised do
109
+ img = Magick::Image.new(5,5)
110
+ rv = @list[1,2] = img
111
+ assert_same(img, rv)
112
+ assert_equal(9, @list.length)
113
+ assert_same(img, @list[1])
114
+ assert_equal(1, @list.scene)
115
+ end
116
+
117
+ # replace 1 image with 2
118
+ assert_nothing_raised do
119
+ img = Magick::Image.new(5,5)
120
+ img2 = Magick::Image.new(5,5)
121
+ ary = [img, img2]
122
+ rv = @list[3,1] = ary
123
+ assert_same(ary, rv)
124
+ assert_equal(10, @list.length)
125
+ assert_same(img, @list[3])
126
+ assert_same(img2, @list[4])
127
+ assert_equal(4, @list.scene)
128
+ end
129
+
130
+ assert_nothing_raised do
131
+ img = Magick::Image.new(5,5)
132
+ rv = @list[5..6] = img
133
+ assert_same(img, rv)
134
+ assert_equal(9, @list.length)
135
+ assert_same(img, @list[5])
136
+ assert_equal(5, @list.scene)
137
+ end
138
+
139
+ assert_nothing_raised do
140
+ ary = [img, img]
141
+ rv = @list[7..8] = ary
142
+ assert_same(ary, rv)
143
+ assert_equal(9, @list.length)
144
+ assert_same(img, @list[7])
145
+ assert_same(img, @list[8])
146
+ assert_equal(8, @list.scene)
147
+ end
148
+
149
+ assert_nothing_raised do
150
+ rv = @list[-1] = img
151
+ assert_same(img, rv)
152
+ assert_equal(9, @list.length)
153
+ assert_same(img, @list[8])
154
+ assert_equal(8, @list.scene)
155
+ end
156
+
157
+ assert_raise(ArgumentError) { @list[0] = 1 }
158
+ assert_raise(ArgumentError) { @list[0,1] = [1,2] }
159
+ assert_raise(ArgumentError) { @list[2..3] = 'x' }
160
+ end
161
+
162
+ def test_and
163
+ @list.scene = 7
164
+ cur = @list.cur_image
165
+ assert_nothing_raised do
166
+ res = @list & @list2
167
+ assert_instance_of(Magick::ImageList, res)
168
+ assert_not_same(res, @list)
169
+ assert_not_same(res, @list2)
170
+ assert_equal(5, res.length)
171
+ assert_equal(2, res.scene)
172
+ assert_same(cur, res.cur_image)
173
+ end
174
+
175
+ # current scene not in the result, set result scene to last image in result
176
+ @list.scene = 2
177
+ assert_nothing_raised do
178
+ res = @list & @list2
179
+ assert_instance_of(Magick::ImageList, res)
180
+ assert_equal(4, res.scene)
181
+ end
182
+
183
+ assert_raise(ArgumentError) { @list & 2 }
184
+ end
185
+
186
+ def test_at
187
+ assert_nothing_raised do
188
+ cur = @list.cur_image
189
+ img = @list.at(7)
190
+ assert_same(img, @list[7])
191
+ assert_same(cur, @list.cur_image)
192
+ img = @list.at(10)
193
+ assert_nil(img)
194
+ assert_same(cur, @list.cur_image)
195
+ img = @list.at(-1)
196
+ assert_same(img, @list[9])
197
+ assert_same(cur, @list.cur_image)
198
+ end
199
+ end
200
+
201
+ def test_star
202
+ @list.scene = 7
203
+ cur = @list.cur_image
204
+ assert_nothing_raised do
205
+ res = @list * 2
206
+ assert_instance_of(Magick::ImageList, res)
207
+ assert_equal(20, res.length)
208
+ assert_not_same(res, @list)
209
+ assert_same(cur, res.cur_image)
210
+ end
211
+
212
+ assert_raise(ArgumentError) { @list * 'x' }
213
+ end
214
+
215
+ def test_plus
216
+ @list.scene = 7
217
+ cur = @list.cur_image
218
+ assert_nothing_raised do
219
+ res = @list + @list2
220
+ assert_instance_of(Magick::ImageList, res)
221
+ assert_equal(15, res.length)
222
+ assert_not_same(res, @list)
223
+ assert_not_same(res, @list2)
224
+ assert_same(cur, res.cur_image)
225
+ end
226
+
227
+ assert_raise(ArgumentError) { @list + [2] }
228
+ end
229
+
230
+ def test_minus
231
+ @list.scene = 0
232
+ cur = @list.cur_image
233
+ assert_nothing_raised do
234
+ res = @list - @list2
235
+ assert_instance_of(Magick::ImageList, res)
236
+ assert_equal(5, res.length)
237
+ assert_not_same(res, @list)
238
+ assert_not_same(res, @list2)
239
+ assert_same(cur, res.cur_image)
240
+ end
241
+
242
+ # current scene not in result - set result scene to last image in result
243
+ @list.scene = 7
244
+ cur = @list.cur_image
245
+ assert_nothing_raised do
246
+ res = @list - @list2
247
+ assert_instance_of(Magick::ImageList, res)
248
+ assert_equal(5, res.length)
249
+ assert_equal(4, res.scene)
250
+ end
251
+ end
252
+
253
+ def test_catenate
254
+ assert_nothing_raised do
255
+ @list2.each { |img| @list << img }
256
+ assert_equal(15, @list.length)
257
+ assert_equal(14, @list.scene)
258
+ end
259
+
260
+ assert_raise(ArgumentError) { @list << 2 }
261
+ assert_raise(ArgumentError) { @list << [2] }
262
+ end
263
+
264
+ def test_or
265
+ assert_nothing_raised do
266
+ @list.scene = 7
267
+ # The or of these two lists should be the same as @list
268
+ # but not be the *same* list
269
+ res = @list | @list2
270
+ assert_instance_of(Magick::ImageList, res)
271
+ assert_not_same(res, @list)
272
+ assert_not_same(res, @list2)
273
+ assert_equal(res, @list)
274
+ end
275
+
276
+ # Try or'ing disjoint lists
277
+ temp_list = Magick::ImageList.new(*FILES[10..14])
278
+ res = @list | temp_list
279
+ assert_instance_of(Magick::ImageList, res)
280
+ assert_equal(15, res.length)
281
+ assert_equal(7, res.scene)
282
+
283
+ assert_raise(ArgumentError) { @list | 2 }
284
+ assert_raise(ArgumentError) { @list | [2] }
285
+ end
286
+
287
+ def test_clear
288
+ assert_nothing_raised { @list.clear }
289
+ assert_instance_of(Magick::ImageList, @list)
290
+ assert_equal(0, @list.length)
291
+ assert_nil(@list.scene)
292
+ end
293
+
294
+ def test_collect
295
+ assert_nothing_raised do
296
+ cur = @list.cur_image
297
+ scene = @list.scene
298
+ res = @list.collect { |img| img.negate }
299
+ assert_instance_of(Magick::ImageList, res)
300
+ assert_not_same(res, @list)
301
+ assert_equal(scene, res.scene)
302
+ end
303
+ assert_nothing_raised do
304
+ scene = @list.scene
305
+ @list.collect! { |img| img.negate }
306
+ assert_instance_of(Magick::ImageList, @list)
307
+ assert_equal(scene, @list.scene)
308
+ end
309
+ end
310
+
311
+ def test_compact
312
+ assert_nothing_raised do
313
+ res = @list.compact
314
+ assert_not_same(res, @list)
315
+ assert_equal(res, @list)
316
+ end
317
+ assert_nothing_raised do
318
+ res = @list
319
+ @list.compact!
320
+ assert_instance_of(Magick::ImageList, @list)
321
+ assert_equal(res, @list)
322
+ assert_same(res, @list)
323
+ end
324
+ end
325
+
326
+ def test_concat
327
+ assert_nothing_raised do
328
+ res = @list.concat(@list2)
329
+ assert_instance_of(Magick::ImageList, res)
330
+ assert_equal(15, res.length)
331
+ assert_same(res[14], res.cur_image)
332
+ end
333
+ assert_raise(ArgumentError) { res = @list.concat(2) }
334
+ assert_raise(ArgumentError) { res = @list.concat([2]) }
335
+ end
336
+
337
+ def test_delete
338
+ assert_nothing_raised do
339
+ cur = @list.cur_image
340
+ img = @list[7]
341
+ assert_same(img, @list.delete(img))
342
+ assert_equal(9, @list.length)
343
+ assert_same(cur, @list.cur_image)
344
+
345
+ # Try deleting the current image.
346
+ assert_same(cur, @list.delete(cur))
347
+ assert_same(@list[-1], @list.cur_image)
348
+
349
+ assert_raise(ArgumentError) { @list.delete(2) }
350
+ assert_raise(ArgumentError) { @list.delete([2]) }
351
+
352
+ # Try deleting something that isn't in the list.
353
+ # Should return the value of the block.
354
+ assert_nothing_raised do
355
+ img = Magick::Image.read(FILES[10]).first
356
+ res = @list.delete(img) { 1 }
357
+ assert_equal(1, res)
358
+ end
359
+ end
360
+ end
361
+
362
+ def test_delete_at
363
+ @list.scene = 7
364
+ cur = @list.cur_image
365
+ assert_nothing_raised { @list.delete_at(9) }
366
+ assert_same(cur, @list.cur_image)
367
+ assert_nothing_raised { @list.delete_at(7) }
368
+ assert_same(@list[-1], @list.cur_image)
369
+ end
370
+
371
+ def test_delete_if
372
+ @list.scene = 7
373
+ cur = @list.cur_image
374
+ assert_nothing_raised do
375
+ @list.delete_if { |img| img.filename =~ /5/ }
376
+ assert_instance_of(Magick::ImageList, @list)
377
+ assert_equal(9, @list.length)
378
+ assert_same(cur, @list.cur_image)
379
+ end
380
+
381
+ # Delete the current image
382
+ assert_nothing_raised do
383
+ @list.delete_if { |img| img.filename =~ /7/ }
384
+ assert_instance_of(Magick::ImageList, @list)
385
+ assert_equal(8, @list.length)
386
+ assert_same(@list[-1], @list.cur_image)
387
+ end
388
+ end
389
+
390
+ # defined by Enumerable
391
+ def test_enumerables
392
+ assert_nothing_raised { @list.detect { true } }
393
+ assert_nothing_raised do
394
+ @list.each_with_index { |img, n| assert_instance_of(Magick::Image, img) }
395
+ end
396
+ assert_nothing_raised { @list.entries }
397
+ assert_nothing_raised { @list.include?(@list[0]) }
398
+ assert_nothing_raised { @list.inject(0) { 0 } }
399
+ assert_nothing_raised { @list.max }
400
+ assert_nothing_raised { @list.min }
401
+ assert_nothing_raised { @list.sort }
402
+ assert_nothing_raised { @list.sort_by {|img| img.signature} }
403
+ assert_nothing_raised { @list.zip }
404
+ end
405
+
406
+ def test_eql?
407
+ list2 = @list
408
+ assert(@list.eql?(list2))
409
+ list2 = @list.copy
410
+ assert(! @list.eql?(list2))
411
+ end
412
+
413
+ def test_fill
414
+ list = @list.copy
415
+ img = list[0].copy
416
+ assert_nothing_raised do
417
+ assert_instance_of(Magick::ImageList, list.fill(img))
418
+ end
419
+ list.each {|el| assert_same(el, img) }
420
+
421
+ list = @list.copy
422
+ list.fill(img, 0, 3)
423
+ 0.upto(2) {|i| assert_same(img, list[i]) }
424
+
425
+ list = @list.copy
426
+ list.fill(img, 4..7)
427
+ 4.upto(7) {|i| assert_same(img, list[i]) }
428
+
429
+ list = @list.copy
430
+ list.fill { |i| list[i] = img }
431
+ list.each {|el| assert_same(el, img) }
432
+
433
+ list = @list.copy
434
+ list.fill(0, 3) { |i| list[i] = img }
435
+ 0.upto(2) {|i| assert_same(img, list[i]) }
436
+
437
+ assert_raise(ArgumentError) { list.fill('x', 0) }
438
+ end
439
+
440
+ def test_find
441
+ assert_nothing_raised { @list.find { true } }
442
+ end
443
+
444
+ def find_all
445
+ assert_nothing_raised do
446
+ res = @list.select { |img| img.filename =~ /Button_2/ }
447
+ assert_instance_of(Magick::ImageList, res)
448
+ assert_equal(1, res.length)
449
+ assert_same(res[0], @list[2])
450
+ end
451
+ end
452
+
453
+ def test_insert
454
+ assert_nothing_raised do
455
+ @list.scene = 7
456
+ cur = @list.cur_image
457
+ assert_instance_of(Magick::ImageList, @list.insert(1, @list[2]))
458
+ assert_same(cur, @list.cur_image)
459
+ @list.insert(1, @list[2], @list[3], @list[4])
460
+ assert_same(cur, @list.cur_image)
461
+ end
462
+
463
+ assert_raise(ArgumentError) { @list.insert(0, 'x') }
464
+ assert_raise(ArgumentError) { @list.insert(0, 'x', 'y') }
465
+ end
466
+
467
+ def test_last
468
+ img = Magick::Image.new(5,5)
469
+ @list << img
470
+ img2 = nil
471
+ assert_nothing_raised { img2 = @list.last }
472
+ assert_instance_of(Magick::Image, img2)
473
+ assert_equal(img2, img)
474
+ img2 = Magick::Image.new(5,5)
475
+ @list << img2
476
+ ilist = nil
477
+ assert_nothing_raised { ilist = @list.last(2) }
478
+ assert_instance_of(Magick::ImageList, ilist)
479
+ assert_equal(2, ilist.length)
480
+ assert_equal(1, ilist.scene)
481
+ assert_equal(img, ilist[0])
482
+ assert_equal(img2, ilist[1])
483
+ end
484
+
485
+ def test___map__
486
+ img = @list[0]
487
+ assert_nothing_raised do
488
+ @list.__map__ { |x| img }
489
+ end
490
+ assert_instance_of(Magick::ImageList, @list)
491
+ assert_raise(ArgumentError) { @list.__map__ { 2 } }
492
+ end
493
+
494
+ def test_map!
495
+ img = @list[0]
496
+ assert_nothing_raised do
497
+ @list.map! { img }
498
+ end
499
+ assert_instance_of(Magick::ImageList, @list)
500
+ assert_raise(ArgumentError) { @list.map! { 2 } }
501
+ end
502
+
503
+ if RUBY_VERSION != '1.9.1'
504
+ def test_nitems
505
+ n = nil
506
+ assert_nothing_raised { n = @list.nitems }
507
+ assert_equal(10, n)
508
+ end
509
+ end
510
+
511
+ def test_partition
512
+ a = nil
513
+ n = -1
514
+ assert_nothing_raised { a = @list.partition { n += 1; (n&1).zero? } }
515
+ assert_instance_of(Array, a)
516
+ assert_equal(2, a.size)
517
+ assert_instance_of(Magick::ImageList, a[0])
518
+ assert_instance_of(Magick::ImageList, a[1])
519
+ assert_equal(4, a[0].scene)
520
+ assert_equal(5, a[0].length)
521
+ assert_equal(4, a[1].scene)
522
+ assert_equal(5, a[1].length)
523
+ end
524
+
525
+ def test_pop
526
+ @list.scene = 8
527
+ cur = @list.cur_image
528
+ last = @list[-1]
529
+ assert_nothing_raised do
530
+ assert_same(last, @list.pop)
531
+ assert_same(cur, @list.cur_image)
532
+ end
533
+
534
+ assert_same(cur, @list.pop)
535
+ assert_same(@list[-1], @list.cur_image)
536
+ end
537
+
538
+ def test_push
539
+ list = @list
540
+ img1 = @list[0]
541
+ img2 = @list[1]
542
+ assert_nothing_raised { @list.push(img1, img2) }
543
+ assert_same(list, @list) # push returns self
544
+ assert_same(img2, @list.cur_image)
545
+ end
546
+
547
+ def test_reject
548
+ @list.scene = 7
549
+ cur = @list.cur_image
550
+ list = @list
551
+ assert_nothing_raised do
552
+ res = @list.reject {|img| img.filename =~ /Button_9/ }
553
+ assert_equal(9, res.length)
554
+ assert_instance_of(Magick::ImageList, res)
555
+ assert_same(cur, res.cur_image)
556
+ end
557
+ assert_same(list, @list)
558
+ assert_same(cur, @list.cur_image)
559
+
560
+ # Omit current image from result list - result cur_image s/b last image
561
+ res = @list.reject {|img| img.filename =~ /Button_7/}
562
+ assert_equal(9, res.length)
563
+ assert_same(res[-1], res.cur_image)
564
+ assert_same(cur, @list.cur_image)
565
+ end
566
+
567
+ def test_reject!
568
+ @list.scene = 7
569
+ cur = @list.cur_image
570
+ assert_nothing_raised do
571
+ @list.reject! { |img| img.filename =~ /5/ }
572
+ assert_instance_of(Magick::ImageList, @list)
573
+ assert_equal(9, @list.length)
574
+ assert_same(cur, @list.cur_image)
575
+ end
576
+
577
+ # Delete the current image
578
+ assert_nothing_raised do
579
+ @list.reject! { |img| img.filename =~ /7/ }
580
+ assert_instance_of(Magick::ImageList, @list)
581
+ assert_equal(8, @list.length)
582
+ assert_same(@list[-1], @list.cur_image)
583
+ end
584
+
585
+ # returns nil if no changes are made
586
+ assert_nil(@list.reject! { false })
587
+ end
588
+
589
+ def test_replace1
590
+ # Replace with empty list
591
+ assert_nothing_raised do
592
+ res = @list.replace([])
593
+ assert_same(res, @list)
594
+ assert_equal(0, @list.length)
595
+ assert_nil(@list.scene)
596
+ end
597
+
598
+ # Replace empty list with non-empty list
599
+ temp = Magick::ImageList.new
600
+ assert_nothing_raised do
601
+ temp.replace(@list2)
602
+ assert_equal(5, temp.length)
603
+ assert_equal(4, temp.scene)
604
+ end
605
+
606
+ # Try to replace with illegal values
607
+ assert_raise(ArgumentError) { @list.replace([1, 2, 3]) }
608
+ end
609
+
610
+ def test_replace2
611
+ # Replace with shorter list
612
+ assert_nothing_raised do
613
+ @list.scene = 7
614
+ cur = @list.cur_image
615
+ res = @list.replace(@list2)
616
+ assert_same(res, @list)
617
+ assert_equal(5, @list.length)
618
+ assert_equal(2, @list.scene)
619
+ assert_same(cur, @list.cur_image)
620
+ end
621
+ end
622
+
623
+ def test_replace3
624
+ # Replace with longer list
625
+ assert_nothing_raised do
626
+ @list2.scene = 2
627
+ cur = @list2.cur_image
628
+ res = @list2.replace(@list)
629
+ assert_same(res, @list2)
630
+ assert_equal(10, @list2.length)
631
+ assert_equal(7, @list2.scene)
632
+ assert_same(cur, @list2.cur_image)
633
+ end
634
+ end
635
+
636
+ def test_reverse
637
+ list = nil
638
+ cur = @list.cur_image
639
+ assert_nothing_raised { list = @list.reverse }
640
+ assert_equal(list.length, @list.length)
641
+ assert_same(cur, @list.cur_image)
642
+ end
643
+
644
+ def test_reverse!
645
+ list = @list
646
+ cur = @list.cur_image
647
+ assert_nothing_raised { @list.reverse! }
648
+ assert_same(list, @list)
649
+ assert_same(cur, @list.cur_image)
650
+ end
651
+
652
+ # Just validate its existence
653
+ def test_reverse_each
654
+ assert_nothing_raised do
655
+ @list.reverse_each { |img| assert_instance_of(Magick::Image, img) }
656
+ end
657
+ end
658
+
659
+ def test_rindex
660
+ img = @list.last
661
+ n = nil
662
+ assert_nothing_raised { n = @list.rindex(img) }
663
+ assert_equal(9, n)
664
+ end
665
+
666
+ def test_select
667
+ assert_nothing_raised do
668
+ res = @list.select { |img| img.filename =~ /Button_2/ }
669
+ assert_instance_of(Magick::ImageList, res)
670
+ assert_equal(1, res.length)
671
+ assert_same(res[0], @list[2])
672
+ end
673
+ end
674
+
675
+ def test_shift
676
+ assert_nothing_raised do
677
+ @list.scene = 0
678
+ res = @list[0]
679
+ img = @list.shift
680
+ assert_same(res, img)
681
+ assert_equal(8, @list.scene)
682
+ end
683
+ res = @list[0]
684
+ img = @list.shift
685
+ assert_same(res, img)
686
+ assert_equal(7, @list.scene)
687
+ end
688
+
689
+ def test_slice
690
+ assert_nothing_raised { @list.slice(0) }
691
+ assert_nothing_raised { @list.slice(-1) }
692
+ assert_nothing_raised { @list.slice(0,1) }
693
+ assert_nothing_raised { @list.slice(0..2) }
694
+ assert_nothing_raised { @list.slice(20) }
695
+ end
696
+
697
+ def test_slice!
698
+ @list.scene = 7
699
+ assert_nothing_raised do
700
+ img0 = @list[0]
701
+ img = @list.slice!(0)
702
+ assert_same(img0, img)
703
+ assert_equal(9, @list.length)
704
+ assert_equal(6, @list.scene)
705
+ end
706
+ cur = @list.cur_image
707
+ img = @list.slice!(6)
708
+ assert_same(cur, img)
709
+ assert_equal(8, @list.length)
710
+ assert_equal(7, @list.scene)
711
+ assert_nothing_raised { @list.slice!(-1) }
712
+ assert_nothing_raised { @list.slice!(0,1) }
713
+ assert_nothing_raised { @list.slice!(0..2) }
714
+ assert_nothing_raised { @list.slice!(20) }
715
+ end
716
+
717
+ # simply ensure existence
718
+ def test_sort
719
+ assert_nothing_raised { @list.sort }
720
+ assert_nothing_raised { @list.sort! }
721
+ end
722
+
723
+ def test_to_a
724
+ a = nil
725
+ assert_nothing_raised { a = @list.to_a }
726
+ assert_instance_of(Array, a)
727
+ assert_equal(10, a.length)
728
+ end
729
+
730
+ def test_uniq
731
+ assert_nothing_raised { @list.uniq }
732
+ assert_instance_of(Magick::ImageList, @list.uniq)
733
+ @list[1] = @list[0]
734
+ @list.scene = 7
735
+ list = @list.uniq
736
+ assert_equal(9, list.length)
737
+ assert_equal(6, list.scene)
738
+ assert_equal(7, @list.scene)
739
+ @list[6] = @list[7]
740
+ list = @list.uniq
741
+ assert_equal(8, list.length)
742
+ assert_equal(5, list.scene)
743
+ assert_equal(7, @list.scene)
744
+ end
745
+
746
+ def test_uniq!
747
+ assert_nothing_raised do
748
+ assert_nil(@list.uniq!)
749
+ end
750
+ @list[1] = @list[0]
751
+ @list.scene = 7
752
+ cur = @list.cur_image
753
+ list = @list
754
+ @list.uniq!
755
+ assert_same(list, @list)
756
+ assert_same(cur, @list.cur_image)
757
+ assert_equal(6, @list.scene)
758
+ @list[5] = @list[6]
759
+ @list.uniq!
760
+ assert_same(cur, @list.cur_image)
761
+ assert_equal(5, @list.scene)
762
+ end
763
+
764
+ def test_unshift
765
+ img = @list[9]
766
+ @list.scene = 7
767
+ @list.unshift(img)
768
+ assert_equal(0, @list.scene)
769
+ assert_raise(ArgumentError) { @list.unshift(2) }
770
+ assert_raise(ArgumentError) { @list.unshift([1,2]) }
771
+ end
772
+
773
+ def test_values_at
774
+ ilist = nil
775
+ assert_nothing_raised { ilist = @list.values_at(1,3,5) }
776
+ assert_instance_of(Magick::ImageList, ilist)
777
+ assert_equal(3, ilist.length)
778
+ assert_equal(2, ilist.scene)
779
+ end
780
+
781
+ def test_spaceship
782
+ list2 = @list.copy
783
+ assert_equal(@list.scene, list2.scene)
784
+ assert_equal(@list, list2)
785
+ list2.scene = 0
786
+ assert_not_equal(@list, list2)
787
+ list2 = @list.copy
788
+ list2[9] = list2[0]
789
+ assert_not_equal(@list, list2)
790
+ list2 = @list.copy
791
+ list2 << @list[9]
792
+ assert_not_equal(@list, list2)
793
+
794
+ assert_raise(TypeError) { @list <=> 2 }
795
+ list = Magick::ImageList.new
796
+ list2 = Magick::ImageList.new
797
+ assert_raise(TypeError) { list2 <=> @list }
798
+ assert_raise(TypeError) { @list <=> list2 }
799
+ assert_nothing_raised(TypeError) { list <=> list2 }
800
+ end
801
+
802
+ end
803
+
804
+ if __FILE__ == $0
805
+ IMAGES_DIR = '../doc/ex/images'
806
+ FILES = Dir[IMAGES_DIR+'/Button_*.gif'].sort
807
+ Test::Unit::UI::Console::TestRunner.run(ImageList1_UT) if RUBY_VERSION != '1.9.1'
808
+ end