Skip to content

Debloat your Android TV, install apps, browse and transfer files on it, all from your phone. Just 3 MB, no tracking, no root, no PC.

Screenshot test: fetch streaming logos from tellyscope-devices

jesse-agent-2324ec0f1fb058a
diff --git a/NOTICE b/NOTICE
index 4e8241f..9a04331 100644
--- a/NOTICE
+++ b/NOTICE
@@ -94,10 +94,3 @@ App icon in app/src/test/resources/dock-icons/ (screenshot tests only, not in
the app)
The YouTube name and logo belong to its owner. It is shown only to illustrate
the Apps list in a screenshot.
-
---------------------------------------------------------------------------------
-Streaming service logos in app/src/test/resources/streaming-logos/ (screenshot
-tests only, not in the app)
-Copies of tellyscope-devices' YouTube, Netflix and Jellyfin logos, under the
-same terms as the streaming service logos above, shown only to illustrate the
-Remote in a screenshot.
diff --git a/app/src/test/java/app/tellyscope/ScreenshotTest.kt b/app/src/test/java/app/tellyscope/ScreenshotTest.kt
index d251490..e4d6170 100644
--- a/app/src/test/java/app/tellyscope/ScreenshotTest.kt
+++ b/app/src/test/java/app/tellyscope/ScreenshotTest.kt
@@ -136,7 +136,6 @@ import java.io.File
import java.io.IOException
import java.io.RandomAccessFile
import java.nio.file.Files
-import java.security.MessageDigest
import kotlin.random.Random
import kotlinx.coroutines.runBlocking
import org.junit.Assert.assertEquals
@@ -1146,21 +1145,18 @@ class ScreenshotTest {
private fun realIcon(pkg: String): ByteArray? = javaClass.classLoader?.getResourceAsStream("dock-icons/$pkg.png")?.use { it.readBytes() }
/**
- * [body] with the Remote's lists offline but holding these services' real logos, as on a phone
- * that has downloaded them; test resources only (see NOTICE). The lists go back to none after.
+ * [body] with the Remote's lists offline but holding these services' logos, fetched from
+ * tellyscope-devices into a temp cache as a phone would; without the network the buttons show
+ * their names instead. The lists go back to none after.
*/
private fun withLogos(vararg names: String, body: () -> Unit) {
- fun sha256(b: ByteArray) = MessageDigest.getInstance("SHA-256").digest(b).joinToString("") { "%02x".format(it) }
val offline: suspend (String) -> ByteArray = { throw IOException("offline") }
val dir = Files.createTempDirectory("logos").toFile()
- val logos = names.joinToString { n ->
- val png = javaClass.classLoader!!.getResourceAsStream("streaming-logos/$n.png")!!.use { it.readBytes() }
- File(dir, "logos").mkdirs()
- File(dir, "logos/$n.png").writeBytes(png)
- """"$n": {"file": "logos/$n.png", "sha256": "${sha256(png)}"}"""
+ runBlocking {
+ val online = DeviceLists(dir)
+ if (online.index() != null) names.forEach { online.logo(it) }
+ SharedLists.load(DeviceLists(dir, offline))
}
- File(dir, "index.json").writeText("""{"schema": 1, "devices": [], "logos": {$logos}}""")
- runBlocking { SharedLists.load(DeviceLists(dir, offline)) }
try { body() } finally {
runBlocking { SharedLists.load(DeviceLists(Files.createTempDirectory("none").toFile(), offline)) }
dir.deleteRecursively()
diff --git a/app/src/test/resources/streaming-logos/jellyfin.png b/app/src/test/resources/streaming-logos/jellyfin.png
deleted file mode 100644
index 6861719..0000000
Binary files a/app/src/test/resources/streaming-logos/jellyfin.png and /dev/null differ
diff --git a/app/src/test/resources/streaming-logos/netflix.png b/app/src/test/resources/streaming-logos/netflix.png
deleted file mode 100644
index 3f5e710..0000000
Binary files a/app/src/test/resources/streaming-logos/netflix.png and /dev/null differ
diff --git a/app/src/test/resources/streaming-logos/youtube.png b/app/src/test/resources/streaming-logos/youtube.png
deleted file mode 100644
index b6f6980..0000000
Binary files a/app/src/test/resources/streaming-logos/youtube.png and /dev/null differ