Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update roborazzi to v1.37.0 #760

Merged
merged 1 commit into from
Dec 16, 2024
Merged

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Dec 8, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
io.github.takahirom.roborazzi 1.34.0 -> 1.37.0 age adoption passing confidence
io.github.takahirom.roborazzi:roborazzi-compose-preview-scanner-support 1.34.0 -> 1.37.0 age adoption passing confidence
io.github.takahirom.roborazzi:roborazzi-junit-rule 1.34.0 -> 1.37.0 age adoption passing confidence
io.github.takahirom.roborazzi:roborazzi-compose 1.34.0 -> 1.37.0 age adoption passing confidence
io.github.takahirom.roborazzi:roborazzi 1.34.0 -> 1.37.0 age adoption passing confidence

Release Notes

takahirom/roborazzi (io.github.takahirom.roborazzi)

v1.37.0

Compare Source

Bug Fixes and Workarounds
Compose AlertDialog Support

Support for capturing Alert Dialogs has been fixed, ensuring correct screenshot display. captureScreenRoboImage(), which merges all windows, is now used only when multiple windows are present. Thanks to @​ashughes for reporting this and to @​mhidaka and @​hiroaki404 for bringing it to my attention at a Japan Android testing event.

image
Workaround for Overlap Handling for SDK 35 Compose Screenshots
Problem

When updating to SDK 35 and using the default theme, the ActionBar is included in screenshots, leading to overlap when using createComposeRule(). This occurs because createComposeRule() uses the default theme by default. Thank you for letting me know about this, @​keyboardsurfer!

I have filed an issue for this: https://issuetracker.google.com/issues/383368165

Why this happens

SDK 35 enforces edge-to-edge display, which means it does not provide automatic padding for the ActionBar.

How Roborazzi currently workarounds this

Roborazzi now automatically hides the ActionBar when taking screenshots on SDK 35 and higher. This functions similarly to view.getActivity()?.actionBar?.hide(). However, this workaround may cause performance issues and should not be relied upon. Roborazzi outputs warning logs with alternative suggestions. Thank you to @​sergio-sastre for advising on this workaround!

If you need to include the ActionBar in screenshots, Roborazzi provides a flag, roborazzi.compose.actionbar.overlap.fix=false, that can be added to your gradle.properties file.

What should we do?

A permanent solution will likely require changes from Google. In the meantime, adding <application android:theme="@&#8203;style/Theme.AppCompat.Light.NoActionBar" /> to the module's src/test/AndroidManifest.xml file changes the Activity's default theme and resolves the issue. Thank you to @​mattinger for finding this!

https://github.com/takahirom/roborazzi/issues/598#issuecomment-2533372700

Stabilized Output for Dump Screenshots

Thanks to @​siarhei-luskanau for contributing an improvement that reduces unnecessary diffs for the Roborazzi dump feature.

New Features
Add inspectionMode() for Compose Previews

Thanks to @​YusukeMoriJapan's contribution, inspectionMode() is now available in RoborazziComposeOptions. This is particularly useful when working with libraries that have specific preview implementations. This mode is off by default to maintain high fidelity.

Here's how to enable it:

captureRoboImage(
    roborazziComposeOptions = RoborazziComposeOptions {
        inspectionMode(true)
    }
) {
    ...
}

What's Changed
New Contributors

Full Changelog: takahirom/roborazzi@1.36.0...1.37.0

v1.36.0

Compare Source

Behavior Changes to roborazzi.outputDir.set(file("somedir")) in build.gradle

Previously, when modifying roborazzi.outputDir, such as setting it to src/screenshots, this option also affected the paths for comparison images, like foo_compare.png. This behavior often caused issues, such as unintentionally saving comparison images to version control systems (e.g., Git). To address this, we have discontinued this behavior. Comparison images are now saved in build/outputs/roborazzi by default, while the behavior for reference images remains unchanged.

For users who wish to customize the path for comparison images, we have introduced a new option: roborazzi.compare.outputDir.

While I don't believe there are strong use cases for this, if you want to save the comparison images in a custom directory as you did before, you can specify roborazzi.compare.outputDir as follows:

roborazzi {
  outputDir.set(file("src/screenshots"))
  compare {
    outputDir.set(file("src/screenshots"))
  }
}

I believe this adjustment will be highly beneficial for most use cases involving changes to outputDir.

[!NOTE]
By default, when you use captureRoboImage("image.png"), the image will be saved as module/image.png.
You can customize the file path strategy for the recorded image. The default strategy is relativePathFromCurrentDirectory. If you select relativePathFromRoborazziContextOutputDirectory, the file will be saved in the output directory specified by roborazzi.outputDir.
This can be configured in your gradle.properties file:

roborazzi.record.filePathStrategy=relativePathFromRoborazziContextOutputDirectory
What's Changed

Full Changelog: takahirom/roborazzi@1.35.0...1.36.0

v1.35.0

Compare Source

Add support for heightDp, widthDp, showBackground, and backgroundColor of Compose Preview parameters

We have introduced Experimental Compose Preview Support in 1.22.0, but it does not yet support all parameters of the @Preview annotation. Thanks to @​sergio-sastre 's pull request, the Experimental Compose Preview Support now includes support for heightDp, widthDp, showBackground, and backgroundColor.

Introduce RoborazziComposeOptions

To accommodate the changes in preview parameters, we’ve made the API more flexible.

We’ve added the RoborazziComposeOptions parameter to ComposablePreview<AndroidPreviewInfo>.captureRoboImage() and the composable function version, captureRoboImage{}. Previously, the API was limited; for example, you couldn’t access the ActivityScenario or the composable function directly. Now, you have full control over these components. Thank you for your code review @​sergio-sastre

Here’s an example of a custom option:

    captureRoboImage(
      roborazziComposeOptions = RoborazziComposeOptions {
        // We have several options to configure the test environment.
        fontScale(2f)
        // We can also configure the activity scenario and the composable content.
        addOption(
          object : RoborazziComposeComposableOption,
            RoborazziComposeActivityScenarioOption {
            override fun configureWithActivityScenario(scenario: ActivityScenario<out Activity>) {
              scenario.onActivity {
                it.window.decorView.setBackgroundColor(Color.BLUE)
              }
            }

            override fun configureWithComposable(content: @&#8203;Composable () -> Unit): @&#8203;Composable () -> Unit {
              return {
                Box(Modifier
                  .padding(10.dp)
                  .background(color = androidx.compose.ui.graphics.Color.Red)
                  .padding(10.dp)
                ) {
                  content()
                }
              }
            }
          }
        )
      },
    ) {
      Text("Hello Compose!")
    }

image

Breaking Change: fun ComposablePreview<AndroidPreviewInfo>.applyToRobolectricConfiguration() is now deprecated and marked as an error

As part of our updates to how composables are configured, the applyToRobolectricConfiguration() function is now deprecated and marked as an error. Instead, you can use one of the following alternatives:

  • previewInfo.toRoborazziComposeOptions().apply(scenario, composeContent)
  • ComposablePreview<AndroidPreviewInfo>.captureRoboImage(roborazziComposeOptions)

We believe this feature is not widely used, and the migration should be straightforward. However, if you encounter any issues, please don’t hesitate to reach out.

Breaking Change: Composable captureRoboImage{} Behavior Change

We intended to use a transparent background for the Compose captureRoboImage function, but it was not applied due to Robolectric's resource merging mechanism. We have fixed this behavior; however, this change will result in altered screenshots. You can now specify the background in the new RoborazziComposeOptions as we had previously.

@&#8203;Test
fun captureComposeLambdaImage() {
    captureRoboImage(
        roborazziComposeOptions = RoborazziComposeOptions {
            background(
                showBackground = true
            )
        }
    ) {
        Text("Hello Compose!")
    }
}
What's Changed

Full Changelog: takahirom/roborazzi@1.34.0...1.35.0


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - "every 4 hour after 00:00 and before 23:59 every day" in timezone Asia/Tokyo.

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@KSNDBOT
Copy link
Collaborator

KSNDBOT commented Dec 8, 2024

Snapshot diff report

File name Image

@renovate renovate bot force-pushed the renovate/roborazzi branch from 014e56d to be472cc Compare December 9, 2024 11:19
@renovate renovate bot changed the title chore(deps): update roborazzi to v1.35.0 chore(deps): update roborazzi to v1.36.0 Dec 9, 2024
@renovate renovate bot changed the title chore(deps): update roborazzi to v1.36.0 fix(deps): update roborazzi to v1.36.0 Dec 10, 2024
@renovate renovate bot force-pushed the renovate/roborazzi branch from be472cc to 24c1653 Compare December 15, 2024 12:23
@renovate renovate bot changed the title fix(deps): update roborazzi to v1.36.0 fix(deps): update roborazzi to v1.37.0 Dec 15, 2024
@KSNDBOT
Copy link
Collaborator

KSNDBOT commented Dec 15, 2024

JaCoCo Code Coverage 78.75% ✅

Class Covered Meta Status

Generated by 🚫 Danger

@kosenda kosenda merged commit 1de4dd7 into develop Dec 16, 2024
5 checks passed
@kosenda kosenda deleted the renovate/roborazzi branch December 16, 2024 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants