Implement cloud media UI and reliable automatic uploads
This commit is contained in:
+40
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* qsfera Android client application
|
||||
*
|
||||
* Copyright (C) 2026 QSfera.
|
||||
*/
|
||||
package eu.qsfera.android.presentation.settings.automaticuploads
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class AutomaticUploadMediaSourceTest {
|
||||
|
||||
@Test
|
||||
fun `source survives storage round trip`() {
|
||||
val source = AutomaticUploadMediaSource.create(
|
||||
AutomaticUploadMediaKind.IMAGE,
|
||||
"Pictures/Семья",
|
||||
)
|
||||
|
||||
assertEquals(source, AutomaticUploadMediaSource.parse(source.encodedValue))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `camera path is normalized and matched without case sensitivity`() {
|
||||
assertEquals(
|
||||
AutomaticUploadMediaSource.CAMERA_RELATIVE_PATH,
|
||||
AutomaticUploadMediaSource.normalizeRelativePath("/DCIM\\Camera"),
|
||||
)
|
||||
assertTrue(AutomaticUploadMediaSource.isCameraPath("dcim/camera"))
|
||||
assertFalse(AutomaticUploadMediaSource.isCameraPath("Pictures/Camera"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `unrelated configuration value is not parsed as media source`() {
|
||||
assertNull(AutomaticUploadMediaSource.parse("content://tree/primary"))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user