diff --git a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/ContrastPixelTest.java b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/ContrastPixelTest.java index 9186f68a30..84d481fee7 100644 --- a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/ContrastPixelTest.java +++ b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/ContrastPixelTest.java @@ -22,7 +22,7 @@ import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createA import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createArgb8888BitmapWithSolidColor; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createGlTextureFromBitmap; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.getBitmapAveragePixelAbsoluteDifferenceArgb8888; -import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.maybeSaveTestBitmapToCacheDirectory; +import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.maybeSaveTestBitmap; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.readBitmap; import static com.google.android.exoplayer2.util.Assertions.checkNotNull; import static com.google.common.truth.Truth.assertThat; @@ -109,7 +109,7 @@ public class ContrastPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -133,7 +133,7 @@ public class ContrastPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -153,7 +153,7 @@ public class ContrastPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -173,7 +173,7 @@ public class ContrastPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -192,7 +192,7 @@ public class ContrastPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); diff --git a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/CropPixelTest.java b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/CropPixelTest.java index 840e42de86..581d718ecf 100644 --- a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/CropPixelTest.java +++ b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/CropPixelTest.java @@ -20,7 +20,7 @@ import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.MAXIMUM import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createGlTextureFromBitmap; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.getBitmapAveragePixelAbsoluteDifferenceArgb8888; -import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.maybeSaveTestBitmapToCacheDirectory; +import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.maybeSaveTestBitmap; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.readBitmap; import static com.google.android.exoplayer2.util.Assertions.checkNotNull; import static com.google.common.truth.Truth.assertThat; @@ -105,7 +105,7 @@ public final class CropPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); // TODO(b/207848601): Switch to using proper tooling for testing against golden data. float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); @@ -126,7 +126,7 @@ public final class CropPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); // TODO(b/207848601): Switch to using proper tooling for testing against golden data. float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); @@ -147,7 +147,7 @@ public final class CropPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); // TODO(b/207848601): Switch to using proper tooling for testing against golden data. float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); diff --git a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/DefaultShaderProgramPixelTest.java b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/DefaultShaderProgramPixelTest.java index 8b681464af..500ff5fa31 100644 --- a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/DefaultShaderProgramPixelTest.java +++ b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/DefaultShaderProgramPixelTest.java @@ -20,7 +20,7 @@ import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.MAXIMUM import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createGlTextureFromBitmap; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.getBitmapAveragePixelAbsoluteDifferenceArgb8888; -import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.maybeSaveTestBitmapToCacheDirectory; +import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.maybeSaveTestBitmap; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.readBitmap; import static com.google.common.truth.Truth.assertThat; @@ -108,7 +108,7 @@ public final class DefaultShaderProgramPixelTest { defaultShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(inputWidth, inputHeight); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); // TODO(b/207848601): Switch to using proper tooling for testing against golden data. float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); @@ -130,7 +130,7 @@ public final class DefaultShaderProgramPixelTest { defaultShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(inputWidth, inputHeight); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); // TODO(b/207848601): Switch to using proper tooling for testing against golden data. float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); @@ -151,7 +151,7 @@ public final class DefaultShaderProgramPixelTest { defaultShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(inputWidth, inputHeight); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); // TODO(b/207848601): Switch to using proper tooling for testing against golden data. float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); @@ -171,7 +171,7 @@ public final class DefaultShaderProgramPixelTest { defaultShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(inputWidth, inputHeight); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); // TODO(b/207848601): Switch to using proper tooling for testing against golden data. float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); diff --git a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/HslAdjustmentPixelTest.java b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/HslAdjustmentPixelTest.java index 8df755420e..ddfcc46e56 100644 --- a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/HslAdjustmentPixelTest.java +++ b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/HslAdjustmentPixelTest.java @@ -22,7 +22,7 @@ import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createA import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createArgb8888BitmapWithSolidColor; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createGlTextureFromBitmap; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.getBitmapAveragePixelAbsoluteDifferenceArgb8888; -import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.maybeSaveTestBitmapToCacheDirectory; +import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.maybeSaveTestBitmap; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.readBitmap; import static com.google.common.truth.Truth.assertThat; @@ -119,7 +119,7 @@ public final class HslAdjustmentPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -137,7 +137,7 @@ public final class HslAdjustmentPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -155,7 +155,7 @@ public final class HslAdjustmentPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -173,7 +173,7 @@ public final class HslAdjustmentPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -191,7 +191,7 @@ public final class HslAdjustmentPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -210,7 +210,7 @@ public final class HslAdjustmentPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -228,7 +228,7 @@ public final class HslAdjustmentPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -247,7 +247,7 @@ public final class HslAdjustmentPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -265,7 +265,7 @@ public final class HslAdjustmentPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -283,7 +283,7 @@ public final class HslAdjustmentPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -302,7 +302,7 @@ public final class HslAdjustmentPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -321,7 +321,7 @@ public final class HslAdjustmentPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); diff --git a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/OverlayShaderProgramPixelTest.java b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/OverlayShaderProgramPixelTest.java index 339e6d547c..11b013eed3 100644 --- a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/OverlayShaderProgramPixelTest.java +++ b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/OverlayShaderProgramPixelTest.java @@ -20,7 +20,7 @@ import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.MAXIMUM import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createGlTextureFromBitmap; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.getBitmapAveragePixelAbsoluteDifferenceArgb8888; -import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.maybeSaveTestBitmapToCacheDirectory; +import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.maybeSaveTestBitmap; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.readBitmap; import static com.google.android.exoplayer2.util.Assertions.checkNotNull; import static com.google.common.truth.Truth.assertThat; @@ -122,7 +122,7 @@ public class OverlayShaderProgramPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -144,7 +144,7 @@ public class OverlayShaderProgramPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -189,7 +189,7 @@ public class OverlayShaderProgramPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -216,7 +216,7 @@ public class OverlayShaderProgramPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -240,7 +240,7 @@ public class OverlayShaderProgramPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -269,7 +269,7 @@ public class OverlayShaderProgramPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -296,7 +296,7 @@ public class OverlayShaderProgramPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -328,7 +328,7 @@ public class OverlayShaderProgramPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -362,7 +362,7 @@ public class OverlayShaderProgramPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -399,7 +399,7 @@ public class OverlayShaderProgramPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); diff --git a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/PresentationPixelTest.java b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/PresentationPixelTest.java index c43ee9c4a4..f7c1a0326b 100644 --- a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/PresentationPixelTest.java +++ b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/PresentationPixelTest.java @@ -20,7 +20,7 @@ import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.MAXIMUM import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createGlTextureFromBitmap; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.getBitmapAveragePixelAbsoluteDifferenceArgb8888; -import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.maybeSaveTestBitmapToCacheDirectory; +import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.maybeSaveTestBitmap; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.readBitmap; import static com.google.android.exoplayer2.util.Assertions.checkNotNull; import static com.google.common.truth.Truth.assertThat; @@ -114,7 +114,7 @@ public final class PresentationPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); // TODO(b/207848601): Switch to using proper tooling for testing against golden data. float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); @@ -135,7 +135,7 @@ public final class PresentationPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); // TODO(b/207848601): Switch to using proper tooling for testing against golden data. float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); @@ -156,7 +156,7 @@ public final class PresentationPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); // TODO(b/207848601): Switch to using proper tooling for testing against golden data. float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); @@ -179,7 +179,7 @@ public final class PresentationPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); // TODO(b/207848601): Switch to using proper tooling for testing against golden data. float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); @@ -202,7 +202,7 @@ public final class PresentationPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); // TODO(b/207848601): Switch to using proper tooling for testing against golden data. float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); @@ -223,7 +223,7 @@ public final class PresentationPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); // TODO(b/207848601): Switch to using proper tooling for testing against golden data. float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); @@ -244,7 +244,7 @@ public final class PresentationPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); // TODO(b/207848601): Switch to using proper tooling for testing against golden data. float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); diff --git a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/RgbAdjustmentPixelTest.java b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/RgbAdjustmentPixelTest.java index 01e017065a..d20fed11cd 100644 --- a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/RgbAdjustmentPixelTest.java +++ b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/RgbAdjustmentPixelTest.java @@ -22,7 +22,7 @@ import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createA import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createArgb8888BitmapWithSolidColor; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createGlTextureFromBitmap; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.getBitmapAveragePixelAbsoluteDifferenceArgb8888; -import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.maybeSaveTestBitmapToCacheDirectory; +import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.maybeSaveTestBitmap; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.readBitmap; import static com.google.android.exoplayer2.util.Assertions.checkNotNull; import static com.google.common.truth.Truth.assertThat; @@ -118,7 +118,7 @@ public final class RgbAdjustmentPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -139,7 +139,7 @@ public final class RgbAdjustmentPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -157,7 +157,7 @@ public final class RgbAdjustmentPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -175,7 +175,7 @@ public final class RgbAdjustmentPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -194,7 +194,7 @@ public final class RgbAdjustmentPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -221,7 +221,7 @@ public final class RgbAdjustmentPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -245,7 +245,7 @@ public final class RgbAdjustmentPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -271,7 +271,7 @@ public final class RgbAdjustmentPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); diff --git a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/RgbFilterPixelTest.java b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/RgbFilterPixelTest.java index 946740ee76..a0be0d80d0 100644 --- a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/RgbFilterPixelTest.java +++ b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/RgbFilterPixelTest.java @@ -21,7 +21,7 @@ import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.MAXIMUM import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createGlTextureFromBitmap; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.getBitmapAveragePixelAbsoluteDifferenceArgb8888; -import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.maybeSaveTestBitmapToCacheDirectory; +import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.maybeSaveTestBitmap; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.readBitmap; import static com.google.android.exoplayer2.util.Assertions.checkNotNull; import static com.google.common.truth.Truth.assertThat; @@ -113,7 +113,7 @@ public final class RgbFilterPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -131,7 +131,7 @@ public final class RgbFilterPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); + maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); diff --git a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/SingleColorLutPixelTest.java b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/SingleColorLutPixelTest.java index 881e07cdd0..de8467c3e0 100644 --- a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/SingleColorLutPixelTest.java +++ b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/SingleColorLutPixelTest.java @@ -21,7 +21,7 @@ import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.MAXIMUM import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.createGlTextureFromBitmap; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.getBitmapAveragePixelAbsoluteDifferenceArgb8888; -import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.maybeSaveTestBitmapToCacheDirectory; +import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.maybeSaveTestBitmap; import static com.google.android.exoplayer2.testutil.BitmapPixelTestUtil.readBitmap; import static com.google.android.exoplayer2.util.Assertions.checkNotNull; import static com.google.common.truth.Truth.assertThat; @@ -110,7 +110,7 @@ public class SingleColorLutPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, "actual", actualBitmap); + maybeSaveTestBitmap(testId, "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -131,7 +131,7 @@ public class SingleColorLutPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, "actual", actualBitmap); + maybeSaveTestBitmap(testId, "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -151,7 +151,7 @@ public class SingleColorLutPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, "actual", actualBitmap); + maybeSaveTestBitmap(testId, "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -171,7 +171,7 @@ public class SingleColorLutPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, "actual", actualBitmap); + maybeSaveTestBitmap(testId, "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -191,7 +191,7 @@ public class SingleColorLutPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, "actual", actualBitmap); + maybeSaveTestBitmap(testId, "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -214,7 +214,7 @@ public class SingleColorLutPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, "actual", actualBitmap); + maybeSaveTestBitmap(testId, "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -235,7 +235,7 @@ public class SingleColorLutPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, "actual", actualBitmap); + maybeSaveTestBitmap(testId, "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); @@ -256,7 +256,7 @@ public class SingleColorLutPixelTest { Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); - maybeSaveTestBitmapToCacheDirectory(testId, "actual", actualBitmap); + maybeSaveTestBitmap(testId, "actual", actualBitmap, /* path= */ null); float averagePixelAbsoluteDifference = getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId); assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE); diff --git a/testutils/src/main/java/com/google/android/exoplayer2/testutil/BitmapPixelTestUtil.java b/testutils/src/main/java/com/google/android/exoplayer2/testutil/BitmapPixelTestUtil.java index ea512be77d..f4cebc05e8 100644 --- a/testutils/src/main/java/com/google/android/exoplayer2/testutil/BitmapPixelTestUtil.java +++ b/testutils/src/main/java/com/google/android/exoplayer2/testutil/BitmapPixelTestUtil.java @@ -16,6 +16,7 @@ package com.google.android.exoplayer2.testutil; import static androidx.test.core.app.ApplicationProvider.getApplicationContext; +import static com.google.android.exoplayer2.util.Assertions.checkState; import static com.google.common.truth.Truth.assertThat; import static java.lang.Math.abs; import static java.lang.Math.max; @@ -126,11 +127,16 @@ public class BitmapPixelTestUtil { * @param actual The actual {@link Bitmap} produced by the test. * @param testId The name of the test that produced the {@link Bitmap}, or {@code null} if the * differences bitmap should not be saved to cache. + * @param differencesBitmapPath Folder path for the produced pixel-wise difference {@link Bitmap} + * to be saved in or {@code null} if the assumed default save path should be used. * @return The average of the maximum absolute pixel-wise differences between the expected and * actual bitmaps. */ public static float getBitmapAveragePixelAbsoluteDifferenceArgb8888( - Bitmap expected, Bitmap actual, @Nullable String testId) { + Bitmap expected, + Bitmap actual, + @Nullable String testId, + @Nullable String differencesBitmapPath) { int width = actual.getWidth(); int height = actual.getHeight(); assertThat(width).isEqualTo(expected.getWidth()); @@ -162,13 +168,32 @@ public class BitmapPixelTestUtil { } } if (testId != null) { - maybeSaveTestBitmapToCacheDirectory(testId, "diff", differencesBitmap); + maybeSaveTestBitmap( + testId, /* bitmapLabel= */ "diff", differencesBitmap, differencesBitmapPath); } return (float) sumMaximumAbsoluteDifferences / (width * height); } /** - * Tries to save the {@link Bitmap} to the {@link Context#getCacheDir() cache directory} as a PNG. + * Returns the average difference between the expected and actual bitmaps, calculated using the + * maximum difference across all color channels for each pixel, then divided by the total number + * of pixels in the image, without saving the difference bitmap. See {@link + * BitmapPixelTestUtil#getBitmapAveragePixelAbsoluteDifferenceArgb8888(Bitmap, Bitmap, String, + * String)}. + * + *
This method is the overloaded version of {@link
+ * BitmapPixelTestUtil#getBitmapAveragePixelAbsoluteDifferenceArgb8888(Bitmap, Bitmap, String,
+ * String)} without a specified saved path.
+ */
+ public static float getBitmapAveragePixelAbsoluteDifferenceArgb8888(
+ Bitmap expected, Bitmap actual, @Nullable String testId) {
+ return getBitmapAveragePixelAbsoluteDifferenceArgb8888(
+ expected, actual, testId, /* differencesBitmapPath= */ null);
+ }
+
+ /**
+ * Tries to save the {@link Bitmap} as a PNG to the {@code File name will be {@code