summaryrefslogtreecommitdiffstats
path: root/test/unit/attachment_test.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-02-05 13:50:20 +0000
committerGo MAEDA <maeda@farend.jp>2019-02-05 13:50:20 +0000
commit4c38f461849e641a36023f24c8d8293ee2dba572 (patch)
treef2980b30477240e08eeff891080471588a78f127 /test/unit/attachment_test.rb
parent29063283da5d333b990e2ce3a8c6221133f305c9 (diff)
downloadredmine-4c38f461849e641a36023f24c8d8293ee2dba572.tar.gz
redmine-4c38f461849e641a36023f24c8d8293ee2dba572.zip
Makes sure the generated thumbnail is always of at least the requested size (#13688).
Patch by Jens Krämer and Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@17850 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/attachment_test.rb')
-rw-r--r--test/unit/attachment_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/unit/attachment_test.rb b/test/unit/attachment_test.rb
index 9491fae98..bccb2c6c4 100644
--- a/test/unit/attachment_test.rb
+++ b/test/unit/attachment_test.rb
@@ -480,6 +480,24 @@ class AttachmentTest < ActiveSupport::TestCase
attachment = Attachment.find(16)
assert_nil attachment.thumbnail
end
+
+ def test_thumbnail_should_be_at_least_of_requested_size
+ set_fixtures_attachments_directory
+ attachment = Attachment.find(16)
+ Attachment.clear_thumbnails
+ [
+ [0, 100],
+ [49, 50],
+ [50, 50],
+ [51, 100],
+ [100, 100],
+ [101, 150],
+ ].each do |size, generated_size|
+ thumbnail = attachment.thumbnail(size: size)
+ assert_equal "8e0294de2441577c529f170b6fb8f638_2654_#{generated_size}.thumb",
+ File.basename(thumbnail)
+ end
+ end
else
puts '(ImageMagick convert not available)'
end