From cb558e83de750fa3e96da7b94bf2e0d030fd0bb5 Mon Sep 17 00:00:00 2001 From: takahirom Date: Sun, 16 Jun 2024 18:03:34 +0900 Subject: [PATCH] Add robolectric.pixelCopyRenderMode to README --- README.md | 29 ++++++++++++++++++----- docs/topics/gradle_properties_options.md | 30 +++++++++++++++++++----- 2 files changed, 47 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 4aae9a5d0..0d89d8998 100644 --- a/README.md +++ b/README.md @@ -1168,11 +1168,11 @@ The sample image
-# 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. @@ -1183,9 +1183,9 @@ 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. @@ -1193,7 +1193,7 @@ This option lets you set the resize scale for the image being recorded. The defa 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`. @@ -1201,7 +1201,7 @@ This setting allows you to specify the file path strategy for the recorded image 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`. @@ -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" + } +```
diff --git a/docs/topics/gradle_properties_options.md b/docs/topics/gradle_properties_options.md index 20c3c69e6..681e1ac44 100644 --- a/docs/topics/gradle_properties_options.md +++ b/docs/topics/gradle_properties_options.md @@ -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. @@ -13,9 +13,9 @@ 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. @@ -23,7 +23,7 @@ This option lets you set the resize scale for the image being recorded. The defa 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`. @@ -31,7 +31,7 @@ This setting allows you to specify the file path strategy for the recorded image 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`. @@ -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" + } +``` \ No newline at end of file