|
2 | 2 | require "image_processing/mini_magick" |
3 | 3 | require "pathname" |
4 | 4 |
|
5 | | -MiniMagick.cli = :graphicsmagick if ENV["GM"] |
6 | | - |
7 | 5 | describe "ImageProcessing::MiniMagick" do |
8 | 6 | before do |
9 | 7 | @portrait = fixture_image("portrait.jpg") |
|
85 | 83 | refute_equal 0, File.size(path) |
86 | 84 | File.delete(path) |
87 | 85 | end |
88 | | - end unless ENV["GM"] |
| 86 | + end |
89 | 87 |
|
90 | 88 | it "allows resizing images without extension" do |
91 | 89 | result1 = Tempfile.new("image") # no file extension |
|
105 | 103 | it "accepts geometry" do |
106 | 104 | pipeline = ImageProcessing::MiniMagick.source(@portrait) |
107 | 105 | assert_dimensions [300, 400], pipeline.loader(geometry: "400x400").call |
108 | | - end unless ENV["GM"] |
| 106 | + end |
109 | 107 |
|
110 | 108 | it "auto orients by default" do |
111 | 109 | result = ImageProcessing::MiniMagick.call(fixture_image("rotated.jpg")) |
|
120 | 118 | assert_type "JPEG", result |
121 | 119 |
|
122 | 120 | result = ImageProcessing::MiniMagick.loader(define: { jpeg: { size: "100x100" } }).call(@portrait) |
123 | | - assert_dimensions [150, 200], result unless ENV["GM"] |
| 121 | + assert_dimensions [150, 200], result |
124 | 122 |
|
125 | 123 | result = ImageProcessing::MiniMagick.loader(strip: true).call(@portrait) |
126 | 124 | assert_empty MiniMagick::Image.new(result.path).exif |
|
132 | 130 | assert_empty MiniMagick::Image.new(result.path).exif |
133 | 131 |
|
134 | 132 | result = ImageProcessing::MiniMagick.loader(colorspace: "Gray").call(@portrait) |
135 | | - assert_equal "Gray", MiniMagick::Image.new(result.path).data["colorspace"] unless ENV["GM"] |
| 133 | + assert_equal "Gray", MiniMagick::Image.new(result.path).data["colorspace"] |
136 | 134 |
|
137 | 135 | result = ImageProcessing::MiniMagick.loader(set: ["comment", "This is a comment"]).call(@portrait) |
138 | | - assert_equal "This is a comment", MiniMagick::Image.new(result.path).data["properties"]["comment"] unless ENV["GM"] |
| 136 | + assert_equal "This is a comment", MiniMagick::Image.new(result.path).data["properties"]["comment"] |
139 | 137 | end |
140 | 138 |
|
141 | 139 | it "applies saver options" do |
142 | 140 | result = ImageProcessing::MiniMagick.saver(define: { jpeg: { fancy_unsampling: "off", extent: "20KB" } }).call(@portrait) |
143 | | - assert_operator result.size, :<, 20*1024 unless ENV["GM"] |
| 141 | + assert_operator result.size, :<, 20*1024 |
144 | 142 |
|
145 | 143 | result = ImageProcessing::MiniMagick.saver(strip: true).call(@portrait) |
146 | 144 | assert_empty MiniMagick::Image.new(result.path).exif |
|
152 | 150 | assert_empty MiniMagick::Image.new(result.path).exif |
153 | 151 |
|
154 | 152 | result = ImageProcessing::MiniMagick.saver(colorspace: "Gray").call(@portrait) |
155 | | - assert_equal "Gray", MiniMagick::Image.new(result.path).data["colorspace"] unless ENV["GM"] |
| 153 | + assert_equal "Gray", MiniMagick::Image.new(result.path).data["colorspace"] |
156 | 154 |
|
157 | 155 | result = ImageProcessing::MiniMagick.saver(set: ["comment", "This is a comment"]).call(@portrait) |
158 | | - assert_equal "This is a comment", MiniMagick::Image.new(result.path).data["properties"]["comment"] unless ENV["GM"] |
| 156 | + assert_equal "This is a comment", MiniMagick::Image.new(result.path).data["properties"]["comment"] |
159 | 157 | end |
160 | 158 |
|
161 | 159 | it "applies blocks to operations" do |
|
234 | 232 |
|
235 | 233 | it "doesn't require both dimensions" do |
236 | 234 | assert_dimensions [300, 400], @pipeline.resize_to_fit!(300, nil) |
237 | | - assert_dimensions [750, 1000], @pipeline.resize_to_fit!(750, nil) unless ENV["GM"] |
| 235 | + assert_dimensions [750, 1000], @pipeline.resize_to_fit!(750, nil) |
238 | 236 |
|
239 | 237 | assert_dimensions [300, 400], @pipeline.resize_to_fit!(nil, 400) |
240 | | - assert_dimensions [750, 1000], @pipeline.resize_to_fit!(nil, 1000) unless ENV["GM"] |
| 238 | + assert_dimensions [750, 1000], @pipeline.resize_to_fit!(nil, 1000) |
241 | 239 | end |
242 | 240 |
|
243 | 241 | it "produces correct image" do |
|
534 | 532 |
|
535 | 533 | assert_similar result1, result2 |
536 | 534 | end |
537 | | - end unless ENV["GM"] |
| 535 | + end |
538 | 536 |
|
539 | 537 | describe "#define" do |
540 | 538 | it "adds -define options from a Hash" do |
|
0 commit comments