| 1234567891011121314151617181920212223242526272829 |
- require "test_helper"
- class TestThumbnail < Minitest::Test
- def setup
- @jpg_path = File.expand_path("../fixtures/cockapoo.jpg", __FILE__)
- @heic_path = File.expand_path("../fixtures/mammoth.heic", __FILE__)
- @jpg_asset = Fotos::Asset.new(@jpg_path)
- @heic_asset = Fotos::Asset.new(@heic_path)
- end
- def test_create_thumbnail_from_jpg
- target_path = Fotos::Thumbnail.new(@jpg_asset).create()
- thumbnail = Fotos::Asset.new(target_path)
- assert_equal Fotos::Thumbnail::WIDTH, thumbnail.image.get('width')
- # clean up previously created thumbnail
- File.unlink thumbnail.path
- end
- def test_create_thumbnail_from_heic
- target_path = Fotos::Thumbnail.new(@heic_asset).create()
- thumbnail = Fotos::Asset.new(target_path)
- assert Fotos::Thumbnail::WIDTH >= thumbnail.image.get('width')
- # clean up previously created thumbnail
- File.unlink thumbnail.path
- end
- end
|