|
@@ -0,0 +1,19 @@
|
|
|
|
|
+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
|
|
|
|
|
+end
|