For #27055: handle legacy wallpaper naming case
This commit is contained in:
parent
444f663143
commit
5811b06679
|
@ -132,11 +132,14 @@ data class Wallpaper(
|
|||
|
||||
/**
|
||||
* Check if a wallpaper name matches the default. Considers empty strings to be default
|
||||
* since that likely means a wallpaper has never been set.
|
||||
* since that likely means a wallpaper has never been set. The "none" case here is to deal
|
||||
* with a legacy case where the default wallpaper used to be Wallpaper.NONE. See
|
||||
* commit 7a44412, Wallpaper.NONE and Settings.currentWallpaper (legacy name) for context.
|
||||
*
|
||||
* @param name The name to check.
|
||||
*/
|
||||
fun nameIsDefault(name: String): Boolean = name.isEmpty() || name == defaultName
|
||||
fun nameIsDefault(name: String): Boolean =
|
||||
name.isEmpty() || name == defaultName || name.lowercase() == "none"
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,4 +25,11 @@ class WallpaperTest {
|
|||
|
||||
assertFalse(result)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN the legacy wallpaper default name none WHEN checking whether the current wallpaper should be default THEN return true`() {
|
||||
val result = Wallpaper.nameIsDefault("NONE")
|
||||
|
||||
assertTrue(result)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue