photos: pump looper for async export failure; fix lint (#tests)
- Commit
97489d643a4f85ef42dd130a2de92439c9bc03f1- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-14 23:24 UTC (21 days ago)
- Parents
4db96e9
Slice2Pass2LogicTest.exportStartFailure asserted onComplete synchronously, but Media3 Transformer reports a bad source asynchronously on the (Robolectric-paused) main looper; pump it until the failure callback lands. Lint (:photos:lintDev, 4 UnrememberedMutableState errors): remember the column-count float state in the two vault tests and the scale/offset states in the wallpaper preview test. Verified: :photos:testDevUnitTest Slice2Pass2LogicTest green; lint verified separately.
Diff
photos/src/test/java/com/vayunmathur/photos/photoslice2/Slice2Pass2LogicTest.kt
diff --git a/photos/src/test/java/com/vayunmathur/photos/photoslice2/Slice2Pass2LogicTest.kt b/photos/src/test/java/com/vayunmathur/photos/photoslice2/Slice2Pass2LogicTest.ktindex dfaa99cc2e..eefa086e55 100644--- a/photos/src/test/java/com/vayunmathur/photos/photoslice2/Slice2Pass2LogicTest.kt+++ b/photos/src/test/java/com/vayunmathur/photos/photoslice2/Slice2Pass2LogicTest.kt@@ -209,6 +209,14 @@ class Slice2Pass2LogicTest { lat = null, long = null, videoData = null, panoData = null, ) vm.export(app, missing, true) { completed = true }+ // Transformer reports a bad source asynchronously on the main+ // looper (paused under Robolectric); pump it until the failure+ // callback lands instead of asserting synchronously.+ val deadline = System.currentTimeMillis() + 15_000+ while (!completed && System.currentTimeMillis() < deadline) {+ org.robolectric.Shadows.shadowOf(android.os.Looper.getMainLooper()).idle()+ if (!completed) Thread.sleep(10)+ } assertTrue(completed, "onComplete must fire on unrecoverable failure") assertFalse(vm.exporting.value) val orphans = app.cacheDir.listFiles { f -> f.name.startsWith("video_edit_") } ?: emptyArray()
photos/src/test/java/com/vayunmathur/photos/util/PhotosSlice1VaultUiTest.kt
diff --git a/photos/src/test/java/com/vayunmathur/photos/util/PhotosSlice1VaultUiTest.kt b/photos/src/test/java/com/vayunmathur/photos/util/PhotosSlice1VaultUiTest.ktindex 352cfd2631..e139826412 100644--- a/photos/src/test/java/com/vayunmathur/photos/util/PhotosSlice1VaultUiTest.kt+++ b/photos/src/test/java/com/vayunmathur/photos/util/PhotosSlice1VaultUiTest.kt@@ -9,6 +9,7 @@ import androidx.test.core.app.ApplicationProvider import com.vayunmathur.library.util.NavBackStack import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.mutableFloatStateOf+import androidx.compose.runtime.remember import com.vayunmathur.photos.LocalColumnCount import com.vayunmathur.photos.Route import com.vayunmathur.photos.data.PhotoDatabase@@ -127,7 +128,7 @@ class PhotosSlice1VaultUiTest { viewModel = SecureFolderViewModel(app) viewModel.setVault(fakeDao(), "pw") composeRule.setContent {- CompositionLocalProvider(LocalColumnCount provides mutableFloatStateOf(3f)) {+ CompositionLocalProvider(LocalColumnCount provides remember { mutableFloatStateOf(3f) }) { SecureFolderPage( backStack = NavBackStack(arrayOf<Route>(Route.SecureFolder)), password = "pw",@@ -145,7 +146,7 @@ class PhotosSlice1VaultUiTest { viewModel = SecureFolderViewModel(app) viewModel.setVault(fakeDao(listOf(vaultPhoto("a.jpg"), vaultPhoto("b.jpg"))), "pw") composeRule.setContent {- CompositionLocalProvider(LocalColumnCount provides mutableFloatStateOf(3f)) {+ CompositionLocalProvider(LocalColumnCount provides remember { mutableFloatStateOf(3f) }) { SecureFolderPage( backStack = NavBackStack(arrayOf<Route>(Route.SecureFolder)), password = "pw",
photos/src/test/java/com/vayunmathur/photos/util/PhotosSlice3WallpaperTest.kt
diff --git a/photos/src/test/java/com/vayunmathur/photos/util/PhotosSlice3WallpaperTest.kt b/photos/src/test/java/com/vayunmathur/photos/util/PhotosSlice3WallpaperTest.ktindex 2bf5408db3..e11ff40cc6 100644--- a/photos/src/test/java/com/vayunmathur/photos/util/PhotosSlice3WallpaperTest.kt+++ b/photos/src/test/java/com/vayunmathur/photos/util/PhotosSlice3WallpaperTest.kt@@ -222,8 +222,8 @@ class PhotosSlice3WallpaperTest { targetAspect = 0.5f, zoomScale = 1f, zoomOffset = androidx.compose.ui.geometry.Offset.Zero,- currentScale = androidx.compose.runtime.mutableStateOf(1f),- currentOffset = androidx.compose.runtime.mutableStateOf(androidx.compose.ui.geometry.Offset.Zero),+ currentScale = androidx.compose.runtime.remember { androidx.compose.runtime.mutableStateOf(1f) },+ currentOffset = androidx.compose.runtime.remember { androidx.compose.runtime.mutableStateOf(androidx.compose.ui.geometry.Offset.Zero) }, onZoomChange = { _, _ -> }, onCoverMin = {}, onSnapshot = {},