Sha256: 92b538a28ab5542b8358e8073eece24dbe69080215e1deb860c6d16370b1bf7e

Contents?: true

Size: 1.16 KB

Versions: 43

Compression:

Stored size: 1.16 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper'))

class CoreImageTest < Test::Unit::TestCase
  attachment_model CoreImageAttachment

  if Object.const_defined?(:OSX)
    def test_should_resize_image
      attachment = upload_file :filename => '/files/rails.png'
      assert_valid attachment
      assert attachment.image?
      # test core image thumbnail
      assert_equal 42, attachment.width
      assert_equal 55, attachment.height
      
      thumb      = attachment.thumbnails.detect { |t| t.filename =~ /_thumb/ }
      geo        = attachment.thumbnails.detect { |t| t.filename =~ /_geometry/ }
      
      # test exact resize dimensions
      assert_equal 50, thumb.width
      assert_equal 51, thumb.height
      
      # test geometry string
      assert_equal 31, geo.width
      assert_equal 41, geo.height
      
      # This makes sure that we didn't overwrite the original file
      # and will end up with a thumbnail instead of the original
      assert_equal 42, attachment.width
      assert_equal 55, attachment.height
      
    end
  else
    def test_flunk
      puts "CoreImage not loaded, tests not running"
    end
  end
end

Version data entries

43 entries across 43 versions & 10 rubygems

Version Path
artmotion-attachment_fu-0.0.1 test/processors/core_image_test.rb
artmotion-attachment_fu-0.0.2 test/processors/core_image_test.rb
atd-attachment_fu-1.0.20080507 test/processors/core_image_test.rb
atd-attachment_fu-1.0.20081202 test/processors/core_image_test.rb
ioquatix-attachment_fu-1.0.1 test/processors/core_image_test.rb
popel-attachment_fu-1.0.4 test/processors/core_image_test.rb
seamusabshere-attachment_fu-1.1 test/processors/core_image_test.rb
winton-attachment_fu-1.0.5 test/processors/core_image_test.rb
radiant-page_attachments-extension-1.0.2 vendor/plugins/attachment_fu/test/processors/core_image_test.rb
radiant-page_attachments-extension-1.0.0 vendor/plugins/attachment_fu/test/processors/core_image_test.rb
refinerycms-0.9.5.13 vendor/plugins/attachment_fu/test/processors/core_image_test.rb
refinerycms-0.9.5.12 vendor/plugins/attachment_fu/test/processors/core_image_test.rb
refinerycms-0.9.5.11 vendor/plugins/attachment_fu/test/processors/core_image_test.rb
refinerycms-0.9.5.10 vendor/plugins/attachment_fu/test/processors/core_image_test.rb
refinerycms-0.9.5.9 vendor/plugins/attachment_fu/test/processors/core_image_test.rb
refinerycms-0.9.5.8 vendor/plugins/attachment_fu/test/processors/core_image_test.rb
refinerycms-0.9.5.7 vendor/plugins/attachment_fu/test/processors/core_image_test.rb
refinerycms-0.9.5.6 vendor/plugins/attachment_fu/test/processors/core_image_test.rb
refinerycms-0.9.5.5 vendor/plugins/attachment_fu/test/processors/core_image_test.rb
refinerycms-0.9.5.4 vendor/plugins/attachment_fu/test/processors/core_image_test.rb