Commit e28d434c by huangdarwin Committed by Rohit Singh

Effect: Automatically save bitmaps in pixel test.

Also, omit the "actual" label from output files, as this boilerplate isn't necessary
(it doesn't disambiguate between any other saved filename like "expected").

PiperOrigin-RevId: 502378188
parent 9789b39c
...@@ -23,7 +23,7 @@ To generate new "expected" assets: ...@@ -23,7 +23,7 @@ To generate new "expected" assets:
```shell ```shell
adb pull \ adb pull \
/sdcard/Android/data/com.google.android.exoplayer2.effect.test/cache/drawFrame_rotate90_actual.png \ /sdcard/Android/data/com.google.android.exoplayer2.effect.test/cache/drawFrame_rotate90.png \
third_party/java_src/android_libs/media/libraries/test_data/src/test/assets/media/bitmap/sample_mp4_first_frame/electrical_colors/rotate90.png third_party/java_src/android_libs/media/libraries/test_data/src/test/assets/media/bitmap/sample_mp4_first_frame/electrical_colors/rotate90.png
``` ```
......
...@@ -177,9 +177,8 @@ public class BitmapPixelTestUtil { ...@@ -177,9 +177,8 @@ public class BitmapPixelTestUtil {
*/ */
public static void maybeSaveTestBitmapToCacheDirectory( public static void maybeSaveTestBitmapToCacheDirectory(
String testId, String bitmapLabel, Bitmap bitmap) { String testId, String bitmapLabel, Bitmap bitmap) {
File file = String fileName = testId + (bitmapLabel.isEmpty() ? "" : "_" + bitmapLabel) + ".png";
new File( File file = new File(getApplicationContext().getExternalCacheDir(), fileName);
getApplicationContext().getExternalCacheDir(), testId + "_" + bitmapLabel + ".png");
try (FileOutputStream outputStream = new FileOutputStream(file)) { try (FileOutputStream outputStream = new FileOutputStream(file)) {
bitmap.compress(Bitmap.CompressFormat.PNG, /* quality= */ 100, outputStream); bitmap.compress(Bitmap.CompressFormat.PNG, /* quality= */ 100, outputStream);
} catch (IOException e) { } catch (IOException e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment