Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ navigationCompose = "2.8.3"
okhttp = "4.12.0"
openapi = "7.4.0"
robolectric = "4.12.2"
roborazzi = "1.26.0"
roborazzi = "1.44.0"
startup = "1.1.1"
testCoreKtx = "1.6.1"
turbine = "1.1.0"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ internal fun GravatarQuickEditorBottomSheet(
}

@Composable
private fun GravatarModalBottomSheet(
internal fun GravatarModalBottomSheet(
onDismiss: (dismissReason: GravatarQuickEditorDismissReason) -> Unit = {},
colorScheme: GravatarUiMode,
modalBottomSheetState: ModalBottomSheetState,
Expand Down
6 changes: 6 additions & 0 deletions gravatar-quickeditor/src/test/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application android:theme="@android:style/Theme.Material.NoActionBar" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applying that theme to the test app, we prevent some screenshots from having the top bar:

image


</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package com.gravatar.quickeditor.ui.editor

import androidx.compose.runtime.Composable
import com.composables.core.rememberModalBottomSheetState
import com.gravatar.quickeditor.ui.avatarpicker.AvatarPicker
import com.gravatar.quickeditor.ui.avatarpicker.AvatarPickerUiState
import com.gravatar.quickeditor.ui.avatarpicker.EmailAvatars
import com.gravatar.quickeditor.ui.editor.bottomsheet.GravatarModalBottomSheet
import com.gravatar.quickeditor.ui.editor.bottomsheet.modalDetents
import com.gravatar.quickeditor.ui.gravatarScreenshotTest
import com.gravatar.restapi.models.Avatar
import com.gravatar.types.Email
import com.gravatar.uitestutils.RoborazziTest
import org.junit.Test
import org.robolectric.annotation.Config
import java.net.URI

class GravatarQuickEditorBottomSheetTest : RoborazziTest() {
@Test
fun gravatarModalBottomSheet() = gravatarScreenshotTest {
GravatarModalBottomSheet(
colorScheme = GravatarUiMode.LIGHT,
modalBottomSheetState = rememberModalBottomSheetState(modalDetents().initialDetent),
) {
TestContent()
}
}

@Config(qualifiers = "+night")
@Test
fun gravatarModalBottomSheetDark() = gravatarScreenshotTest {
GravatarModalBottomSheet(
colorScheme = GravatarUiMode.DARK,
modalBottomSheetState = rememberModalBottomSheetState(modalDetents().initialDetent),
) {
TestContent()
}
}

@Composable
private fun TestContent() {
AvatarPicker(
uiState = AvatarPickerUiState(
email = Email("[email protected]"),
avatarPickerContentLayout = AvatarPickerContentLayout.Horizontal,
emailAvatars = EmailAvatars(
avatars = listOf(
Avatar {
imageUrl = URI.create("https://gravatar.com/avatar/test")
imageId = "1"
rating = Avatar.Rating.G
altText = "alt"
updatedDate = ""
},
Avatar {
imageUrl = URI.create("https://gravatar.com/avatar/test2")
imageId = "2"
rating = Avatar.Rating.G
altText = "alt"
updatedDate = ""
},
),
selectedAvatarId = "1",
),
),
onEvent = { },
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import androidx.compose.runtime.Composable
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onRoot
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import coil.Coil
import coil.ImageLoader
import coil.annotation.ExperimentalCoilApi
import coil.test.FakeImageLoaderEngine
import com.dropbox.differ.SimpleImageComparator
import com.github.takahirom.roborazzi.ExperimentalRoborazziApi
import com.github.takahirom.roborazzi.RobolectricDeviceQualifiers
import com.github.takahirom.roborazzi.RoborazziOptions
import com.github.takahirom.roborazzi.RoborazziRule
Expand All @@ -35,7 +35,6 @@ abstract class RoborazziTest {
@get:Rule
val composeRule = createComposeRule()

@OptIn(ExperimentalRoborazziApi::class)
@get:Rule
val roborazziRule = RoborazziRule(
options = RoborazziRule.Options(
Expand All @@ -62,9 +61,10 @@ abstract class RoborazziTest {
}

fun screenshotTest(composable: @Composable () -> Unit) {
captureRoboImage {
composeRule.setContent {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't able to continue using the fun captureRoboImage function. Look like the library does something different 🤷‍♂️

composable()
}
composeRule.onRoot().captureRoboImage()
}
}

Expand Down