-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduce paparazzi for ui unit testing
- Loading branch information
Showing
11 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
ui/settings/src/test/kotlin/photos/network/ui/settings/composable/SettingsHeader.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package photos.network.ui.settings.composable | ||
|
||
import app.cash.paparazzi.DeviceConfig | ||
import app.cash.paparazzi.InstantAnimationsRule | ||
import app.cash.paparazzi.Paparazzi | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import com.android.ide.common.rendering.api.SessionParams | ||
import photos.network.api.ServerStatus | ||
import photos.network.ui.common.theme.AppTheme | ||
|
||
class SettingsHeader { | ||
@get:Rule | ||
val instantAnimationsRule = InstantAnimationsRule() | ||
|
||
@get:Rule | ||
val paparazzi = Paparazzi( | ||
deviceConfig = DeviceConfig.PIXEL_5, | ||
showSystemUi = false, | ||
supportsRtl = true, | ||
renderingMode = SessionParams.RenderingMode.SHRINK | ||
) | ||
|
||
@Test | ||
fun unauthorized_dark() { | ||
paparazzi.snapshot { | ||
AppTheme(useDarkTheme = true) { | ||
SettingsHeader(serverStatus = ServerStatus.UNAUTHORIZED) | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
fun unauthorized_light() { | ||
paparazzi.snapshot { | ||
AppTheme(useDarkTheme = false) { | ||
SettingsHeader(serverStatus = ServerStatus.UNAUTHORIZED) | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
fun unavailable_dark() { | ||
paparazzi.snapshot { | ||
AppTheme(useDarkTheme = true) { | ||
SettingsHeader(serverStatus = ServerStatus.UNAVAILABLE) | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
fun unavailable_light() { | ||
paparazzi.snapshot { | ||
AppTheme(useDarkTheme = false) { | ||
SettingsHeader(serverStatus = ServerStatus.UNAVAILABLE) | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
fun progress_dark() { | ||
paparazzi.snapshot { | ||
AppTheme(useDarkTheme = true) { | ||
SettingsHeader(serverStatus = ServerStatus.PROGRESS) | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
fun progress_light() { | ||
paparazzi.snapshot { | ||
AppTheme(useDarkTheme = false) { | ||
SettingsHeader(serverStatus = ServerStatus.PROGRESS) | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
fun available_dark() { | ||
paparazzi.snapshot { | ||
AppTheme(useDarkTheme = true) { | ||
SettingsHeader(serverStatus = ServerStatus.AVAILABLE) | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
fun available_light() { | ||
paparazzi.snapshot { | ||
AppTheme(useDarkTheme = false) { | ||
SettingsHeader(serverStatus = ServerStatus.AVAILABLE) | ||
} | ||
} | ||
} | ||
} |
Binary file added
BIN
+119 KB
.../images/photos.network.ui.settings.composable_SettingsHeader_available_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+109 KB
...images/photos.network.ui.settings.composable_SettingsHeader_available_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+120 KB
...s/images/photos.network.ui.settings.composable_SettingsHeader_progress_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+110 KB
.../images/photos.network.ui.settings.composable_SettingsHeader_progress_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+120 KB
...ages/photos.network.ui.settings.composable_SettingsHeader_unauthorized_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+110 KB
...ges/photos.network.ui.settings.composable_SettingsHeader_unauthorized_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+120 KB
...mages/photos.network.ui.settings.composable_SettingsHeader_unavailable_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+110 KB
...ages/photos.network.ui.settings.composable_SettingsHeader_unavailable_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.