Skip to content

Commit

Permalink
Merge pull request #409 from takahirom/takahirom/add-robolectric.pixe…
Browse files Browse the repository at this point in the history
…lCopyRenderMode-to-README/2024-06-16

Add robolectric.pixelCopyRenderMode to README
  • Loading branch information
takahirom authored Jun 16, 2024
2 parents 19dcf54 + cb558e8 commit 11a9dd1
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 12 deletions.
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1168,11 +1168,11 @@ The sample image
<div name="topic_gradle_properties_options">
<!-- Generated by docs/topics/gradle_properties_options.md. Do not edit this file. -->
# Roborazzi gradle.properties Options
# Roborazzi gradle.properties Options and Recommendations
You can configure the following options in your `gradle.properties` file:
### roborazzi.test
## roborazzi.test
This option enables you to configure the behavior of Roborazzi. By default, all settings are set to false.
For additional configuration options, please refer to the 'Apply Roborazzi Gradle Plugin' section.
Expand All @@ -1183,25 +1183,25 @@ roborazzi.test.record=true
# roborazzi.test.verify=true
```
### roborazzi.record
## roborazzi.record
#### roborazzi.record.resizeScale
### roborazzi.record.resizeScale
This option lets you set the resize scale for the image being recorded. The default value is 1.0.
```
roborazzi.record.resizeScale=0.5
```
#### roborazzi.record.filePathStrategy
### roborazzi.record.filePathStrategy
This setting allows you to specify the file path strategy for the recorded image. The default strategy is `relativePathFromCurrentDirectory`. If you choose `relativePathFromRoborazziContextOutputDirectory`, the file will be saved in the output directory specified by `RoborazziRule.Options.outputDirectoryPath`.
```
roborazzi.record.filePathStrategy=relativePathFromRoborazziContextOutputDirectory
```
#### roborazzi.record.namingStrategy
### roborazzi.record.namingStrategy
This option enables you to define the naming strategy for the recorded image. The default strategy is `testPackageAndClassAndMethod`.
Expand All @@ -1213,6 +1213,23 @@ This option enables you to define the naming strategy for the recorded image. Th
roborazzi.record.namingStrategy=testClassAndMethod
```
## Robolectric Options
### robolectric.pixelCopyRenderMode
I recommend setting `it.systemProperties["robolectric.pixelCopyRenderMode"] = "hardware"` in your `build.gradle` file to enhance the accuracy of your screenshots. For more details, please refer to the [issue](https://github.com/takahirom/roborazzi/issues/296)."
```
android {
testOptions {
...
unitTests {
isIncludeAndroidResources = true
isReturnDefaultValues = true
all {
it.systemProperties["robolectric.pixelCopyRenderMode"] = "hardware"
}
```
</div>
<div name="topic_faq">
Expand Down
30 changes: 24 additions & 6 deletions docs/topics/gradle_properties_options.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Roborazzi gradle.properties Options
# Roborazzi gradle.properties Options and Recommendations

You can configure the following options in your `gradle.properties` file:

### roborazzi.test
## roborazzi.test

This option enables you to configure the behavior of Roborazzi. By default, all settings are set to false.
For additional configuration options, please refer to the 'Apply Roborazzi Gradle Plugin' section.
Expand All @@ -13,25 +13,25 @@ roborazzi.test.record=true
# roborazzi.test.verify=true
```

### roborazzi.record
## roborazzi.record

#### roborazzi.record.resizeScale
### roborazzi.record.resizeScale

This option lets you set the resize scale for the image being recorded. The default value is 1.0.

```
roborazzi.record.resizeScale=0.5
```

#### roborazzi.record.filePathStrategy
### roborazzi.record.filePathStrategy

This setting allows you to specify the file path strategy for the recorded image. The default strategy is `relativePathFromCurrentDirectory`. If you choose `relativePathFromRoborazziContextOutputDirectory`, the file will be saved in the output directory specified by `RoborazziRule.Options.outputDirectoryPath`.

```
roborazzi.record.filePathStrategy=relativePathFromRoborazziContextOutputDirectory
```

#### roborazzi.record.namingStrategy
### roborazzi.record.namingStrategy

This option enables you to define the naming strategy for the recorded image. The default strategy is `testPackageAndClassAndMethod`.

Expand All @@ -42,3 +42,21 @@ This option enables you to define the naming strategy for the recorded image. Th
```
roborazzi.record.namingStrategy=testClassAndMethod
```

## Robolectric Options

### robolectric.pixelCopyRenderMode

I recommend setting `it.systemProperties["robolectric.pixelCopyRenderMode"] = "hardware"` in your `build.gradle` file to enhance the accuracy of your screenshots. For more details, please refer to the [issue](https://github.com/takahirom/roborazzi/issues/296)."

```
android {
testOptions {
...
unitTests {
isIncludeAndroidResources = true
isReturnDefaultValues = true
all {
it.systemProperties["robolectric.pixelCopyRenderMode"] = "hardware"
}
```

0 comments on commit 11a9dd1

Please sign in to comment.