Sha256: 63733ce5b0298a873cded4874c76805555cd795bcc10467bd9d4877fce81e27a

Contents?: true

Size: 908 Bytes

Versions: 68

Compression:

Stored size: 908 Bytes

Contents

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

class GD2Test < Test::Unit::TestCase
  attachment_model GD2Attachment

  if Object.const_defined?(:GD2)
    def test_should_resize_image
      attachment = upload_file :filename => '/files/rails.png'
      assert_valid attachment
      assert attachment.image?
      # test gd2 thumbnail
      assert_equal 43, 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 40, geo.height
    end
  else
    def test_flunk
      puts "GD2 not loaded, tests not running"
    end
  end
end

Version data entries

68 entries across 68 versions & 2 rubygems

Version Path
refinerycms-0.9.7.15 vendor/plugins/attachment_fu/test/processors/gd2_test.rb
refinerycms-0.9.7.14 vendor/plugins/attachment_fu/test/processors/gd2_test.rb
refinerycms-0.9.7.13 vendor/plugins/attachment_fu/test/processors/gd2_test.rb
refinerycms-0.9.7.11 vendor/plugins/attachment_fu/test/processors/gd2_test.rb
refinerycms-0.9.7.10 vendor/plugins/attachment_fu/test/processors/gd2_test.rb
refinerycms-0.9.7.9 vendor/plugins/attachment_fu/test/processors/gd2_test.rb
refinerycms-0.9.7.8 vendor/plugins/attachment_fu/test/processors/gd2_test.rb
refinerycms-0.9.7.7 vendor/plugins/attachment_fu/test/processors/gd2_test.rb
refinerycms-0.9.7.6 vendor/plugins/attachment_fu/test/processors/gd2_test.rb
refinerycms-0.9.7.5 vendor/plugins/attachment_fu/test/processors/gd2_test.rb
refinerycms-0.9.7.4 vendor/plugins/attachment_fu/test/processors/gd2_test.rb
refinerycms-0.9.7.3 vendor/plugins/attachment_fu/test/processors/gd2_test.rb
refinerycms-0.9.7.2 vendor/plugins/attachment_fu/test/processors/gd2_test.rb
refinerycms-0.9.7.1 vendor/plugins/attachment_fu/test/processors/gd2_test.rb
refinerycms-0.9.7 vendor/plugins/attachment_fu/test/processors/gd2_test.rb
jacobat-refinerycms-0.9.6.14 vendor/plugins/attachment_fu/test/processors/gd2_test.rb
refinerycms-0.9.6.34 vendor/plugins/attachment_fu/test/processors/gd2_test.rb
refinerycms-0.9.6.33 vendor/plugins/attachment_fu/test/processors/gd2_test.rb
refinerycms-0.9.6.32 vendor/plugins/attachment_fu/test/processors/gd2_test.rb
refinerycms-0.9.6.31 vendor/plugins/attachment_fu/test/processors/gd2_test.rb