diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ShareHelper.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ShareHelper.kt index 4be867651..02592b6a0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ShareHelper.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ShareHelper.kt @@ -22,6 +22,7 @@ package com.vitorpamplona.amethyst.ui.components import android.content.Context import android.net.Uri +import androidx.annotation.VisibleForTesting import androidx.core.content.FileProvider import com.vitorpamplona.amethyst.Amethyst import com.vitorpamplona.quartz.utils.Log @@ -85,10 +86,13 @@ object ShareHelper { } ?: throw IOException("Unable to open snapshot for: $imageUrl") } + @VisibleForTesting internal fun getImageExtension(file: File): String = getMediaExtension(file, isVideo = false) + @VisibleForTesting internal fun getVideoExtension(file: File): String = getMediaExtension(file, isVideo = true) + @VisibleForTesting internal fun getMediaExtension( file: File, isVideo: Boolean, diff --git a/amethyst/src/test/java/com/vitorpamplona/amethyst/ui/components/ShareHelperTest.kt b/amethyst/src/test/java/com/vitorpamplona/amethyst/ui/components/ShareHelperTest.kt index e86d33789..8bbc8a29a 100644 --- a/amethyst/src/test/java/com/vitorpamplona/amethyst/ui/components/ShareHelperTest.kt +++ b/amethyst/src/test/java/com/vitorpamplona/amethyst/ui/components/ShareHelperTest.kt @@ -159,7 +159,6 @@ class ShareHelperTest { private fun createTempFileWithBytes(bytes: ByteArray): File { val file = File.createTempFile("sharehelpertest", ".tmp") - file.deleteOnExit() file.writeBytes(bytes) return file }