test_thumbnail.rb 614 B

12345678910111213141516171819
  1. require "test_helper"
  2. class TestThumbnail < Minitest::Test
  3. def setup
  4. @jpg_path = File.expand_path("../fixtures/cockapoo.jpg", __FILE__)
  5. @heic_path = File.expand_path("../fixtures/mammoth.heic", __FILE__)
  6. @jpg_asset = Fotos::Asset.new(@jpg_path)
  7. @heic_asset = Fotos::Asset.new(@heic_path)
  8. end
  9. def test_create_thumbnail_from_jpg
  10. target_path = Fotos::Thumbnail.new(@jpg_asset).create()
  11. thumbnail = Fotos::Asset.new(target_path)
  12. assert_equal Fotos::Thumbnail::WIDTH, thumbnail.image.get('width')
  13. # clean up previously created thumbnail
  14. File.unlink thumbnail.path
  15. end
  16. end