Project

General

Profile

Defect #32289 » 32289-v2.patch

Go MAEDA, 2019-10-30 16:02

View differences:

app/models/attachment.rb
201 201
  end
202 202

  
203 203
  def thumbnailable?
204
    image? || (is_pdf? && Redmine::Thumbnail.gs_available?)
204
    Redmine::Thumbnail.convert_available? && (
205
      image? || (is_pdf? && Redmine::Thumbnail.gs_available?)
206
    )
205 207
  end
206 208

  
207 209
  # Returns the full path the attachment thumbnail, or nil
test/unit/attachment_test.rb
420 420
    assert_equal true, Attachment.new(:filename => 'test.jpg').thumbnailable?
421 421
  end
422 422

  
423
  def test_thumbnailable_should_be_true_for_non_images
423
  def test_thumbnailable_should_be_false_for_images_if_convert_is_unavailable
424
    Redmine::Thumbnail.stubs(:convert_available?).returns(false)
425
    assert_equal false, Attachment.new(:filename => 'test.jpg').thumbnailable?
426
  end
427

  
428
  def test_thumbnailable_should_be_false_for_non_images
424 429
    assert_equal false, Attachment.new(:filename => 'test.txt').thumbnailable?
425 430
  end
426 431

  
(3-3/3)