From fa062caea951c5e2bf622dc152878b9cb939cc7e Mon Sep 17 00:00:00 2001 From: albert Date: Fri, 16 Sep 2011 15:25:18 -0400 Subject: [PATCH] added test for transparent image resizer --- test/files/alpha.png | Bin 0 -> 1136 bytes test/unit/upload_test.rb | 10 ++++++++++ 2 files changed, 10 insertions(+) create mode 100644 test/files/alpha.png diff --git a/test/files/alpha.png b/test/files/alpha.png new file mode 100644 index 0000000000000000000000000000000000000000..7fec549c90008fc98c77fc1367b9416dea80ee95 GIT binary patch literal 1136 zcmeAS@N?(olHy`uVBq!ia0y~yUoCQl(tl6+-$DRX6PMo=L<;I-{PhPzF@a4xJ1{Mw;0TBrq z1r-e)0}~4ydg~89cW^QT1Ea8~i(^Q|oMa0h?gIrs7-VkTzIiJmIx=d;?3uG9q$Qziej^$NtebmmHPK|p+XbZ~5FWMEuaR8UMv#Dw|NXHT9xb>_r*(`HSYGi8Q= zytuTmtf-`*oS2l5jEKa8_s?HHe*5(0!*|bKJ$m!x1p_;hiG8!YjDz_P9{g8Z{r%0o zt;NT`uch+79IVR>OEa2ZcD+zKb6JL&&)F|KK3Ouc)8C!lR~HZ z_vy_#Aq3iwW!>3s1r-MokPgg&ebxsLQ0Ozz5 AZ2$lO literal 0 HcmV?d00001 diff --git a/test/unit/upload_test.rb b/test/unit/upload_test.rb index 271783bb3..115de4a4b 100644 --- a/test/unit/upload_test.rb +++ b/test/unit/upload_test.rb @@ -87,6 +87,16 @@ class UploadTest < ActiveSupport::TestCase assert_equal(28086, File.size(@upload.file_path)) assert_equal("jpg", @upload.file_ext) end + + should "process a transparent png" do + FileUtils.cp("#{Rails.root}/test/files/alpha.png", "#{Rails.root}/tmp") + @upload = Upload.new(:file => upload_file("#{Rails.root}/tmp/alpha.png", "image/png", "alpha.png")) + assert_nothing_raised {@upload.convert_cgi_file} + assert_equal("image/png", @upload.content_type) + assert(File.exists?(@upload.file_path)) + assert_equal(1136, File.size(@upload.file_path)) + assert_equal("png", @upload.file_ext) + end end context "hash calculator" do