From 0d1b35477d04de26d62c6c69f531ee77236b4698 Mon Sep 17 00:00:00 2001 From: huangdarwin Date: Thu, 22 Feb 2024 07:26:03 -0800 Subject: [PATCH] Test: Use testId throughout media3 tests. No more instances of this codesearch query after this CL in non-parameterized tests: `String\ testId\ \=\ \" f:media3` PiperOrigin-RevId: 609364413 --- .../media3/effect/HslAdjustmentPixelTest.java | 21 +++++------ .../effect/ThumbnailStripEffectPixelTest.java | 19 ++++++---- .../transformer/ForceEndOfStreamTest.java | 13 +++++-- .../transformer/TransformerEndToEndTest.java | 36 ++++++------------- .../TransformerMixedInputEndToEndTest.java | 17 +++++---- ...ansformerMultiSequenceCompositionTest.java | 14 ++++++-- .../TransformerPauseResumeTest.java | 16 +++++---- .../TransformerSequenceEffectTest.java | 16 ++++++--- ...ocessorMultipleTextureOutputPixelTest.java | 16 +++++++-- ...oFrameProcessorTextureOutputPixelTest.java | 24 ++++++------- .../media3/transformer/mh/ExportTest.java | 25 ++++++------- .../mh/ForceInterpretHdrVideoAsSdrTest.java | 13 +++++-- .../media3/transformer/mh/HdrEditingTest.java | 19 ++++++---- .../ToneMapHdrToSdrUsingMediaCodecTest.java | 15 +++++--- .../ToneMapHdrToSdrUsingOpenGlPixelTest.java | 15 +++++--- .../mh/ToneMapHdrToSdrUsingOpenGlTest.java | 15 +++++--- .../transformer/mh/TranscodeQualityTest.java | 15 ++++++-- ...TransformerWithInAppMuxerEndToEndTest.java | 13 ++++++- 18 files changed, 202 insertions(+), 120 deletions(-) diff --git a/libraries/effect/src/androidTest/java/androidx/media3/effect/HslAdjustmentPixelTest.java b/libraries/effect/src/androidTest/java/androidx/media3/effect/HslAdjustmentPixelTest.java index 08869b68c7..01933a1c38 100644 --- a/libraries/effect/src/androidTest/java/androidx/media3/effect/HslAdjustmentPixelTest.java +++ b/libraries/effect/src/androidTest/java/androidx/media3/effect/HslAdjustmentPixelTest.java @@ -41,7 +41,9 @@ import java.io.IOException; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.junit.After; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; import org.junit.runner.RunWith; /** @@ -72,7 +74,9 @@ public final class HslAdjustmentPixelTest { "media/bitmap/sample_mp4_first_frame/linear_colors/adjust_all_hsl_settings.png"; private final Context context = getApplicationContext(); + @Rule public final TestName testName = new TestName(); + private String testId; private @MonotonicNonNull EGLDisplay eglDisplay; private @MonotonicNonNull EGLContext eglContext; private @MonotonicNonNull BaseGlShaderProgram hslProcessor; @@ -81,6 +85,11 @@ public final class HslAdjustmentPixelTest { private int inputWidth; private int inputHeight; + @Before + public void setUpTestId() { + testId = testName.getMethodName(); + } + @Before public void createGlObjects() throws IOException, GlUtil.GlException { eglDisplay = GlUtil.getDefaultEglDisplay(); @@ -109,7 +118,6 @@ public final class HslAdjustmentPixelTest { @Test public void drawFrame_noOpAdjustment_leavesFrameUnchanged() throws Exception { - String testId = "drawFrame_noOpAdjustment"; HslAdjustment noOpAdjustment = new HslAdjustment.Builder().build(); hslProcessor = noOpAdjustment.toGlShaderProgram(context, /* useHdr= */ false); Size outputSize = hslProcessor.configure(inputWidth, inputHeight); @@ -127,7 +135,6 @@ public final class HslAdjustmentPixelTest { @Test public void drawFrame_minimumSaturation_producesGrayFrame() throws Exception { - String testId = "drawFrame_minimumSaturation"; HslAdjustment minimumSaturation = new HslAdjustment.Builder().adjustSaturation(-100).build(); hslProcessor = minimumSaturation.toGlShaderProgram(context, /* useHdr= */ false); Size outputSize = hslProcessor.configure(inputWidth, inputHeight); @@ -145,7 +152,6 @@ public final class HslAdjustmentPixelTest { @Test public void drawFrame_maximumSaturation_producesHighlySaturatedFrame() throws Exception { - String testId = "drawFrame_maximumSaturation"; HslAdjustment maximumSaturation = new HslAdjustment.Builder().adjustSaturation(100).build(); hslProcessor = maximumSaturation.toGlShaderProgram(context, /* useHdr= */ false); Size outputSize = hslProcessor.configure(inputWidth, inputHeight); @@ -163,7 +169,6 @@ public final class HslAdjustmentPixelTest { @Test public void drawFrame_rotateHueByNegative90Degrees_matchesGoldenFile() throws Exception { - String testId = "drawFrame_rotateHueByNegative90Degrees"; HslAdjustment negativeHueRotation90Degrees = new HslAdjustment.Builder().adjustHue(-90).build(); hslProcessor = negativeHueRotation90Degrees.toGlShaderProgram(context, /* useHdr= */ false); Size outputSize = hslProcessor.configure(inputWidth, inputHeight); @@ -181,7 +186,6 @@ public final class HslAdjustmentPixelTest { @Test public void drawFrame_rotateHueBy60Degrees_matchesGoldenFile() throws Exception { - String testId = "drawFrame_rotateHueBy60Degrees"; HslAdjustment hueRotation60Degrees = new HslAdjustment.Builder().adjustHue(60).build(); hslProcessor = hueRotation60Degrees.toGlShaderProgram(context, /* useHdr= */ false); Size outputSize = hslProcessor.configure(inputWidth, inputHeight); @@ -200,7 +204,6 @@ public final class HslAdjustmentPixelTest { @Test public void drawFrame_rotateHueByNegative300Degrees_producesSameOutputAsRotateBy60DegreesHue() throws Exception { - String testId = "drawFrame_rotateHueByNegative300Degrees"; HslAdjustment hueRotation420Degrees = new HslAdjustment.Builder().adjustHue(-300).build(); hslProcessor = hueRotation420Degrees.toGlShaderProgram(context, /* useHdr= */ false); Size outputSize = hslProcessor.configure(inputWidth, inputHeight); @@ -218,7 +221,6 @@ public final class HslAdjustmentPixelTest { @Test public void drawFrame_rotateHueBy360Degrees_leavesFrameUnchanged() throws Exception { - String testId = "drawFrame_rotateHueBy360Degrees"; HslAdjustment hueRotation360Degrees = new HslAdjustment.Builder().adjustHue(360).build(); hslProcessor = hueRotation360Degrees.toGlShaderProgram(context, /* useHdr= */ false); Size outputSize = hslProcessor.configure(inputWidth, inputHeight); @@ -236,7 +238,6 @@ public final class HslAdjustmentPixelTest { @Test public void drawFrame_minimumLightness_producesBlackFrame() throws Exception { - String testId = "drawFrame_minimumLightness"; HslAdjustment minimumLightness = new HslAdjustment.Builder().adjustLightness(-100).build(); hslProcessor = minimumLightness.toGlShaderProgram(context, /* useHdr= */ false); Size outputSize = hslProcessor.configure(inputWidth, inputHeight); @@ -255,7 +256,6 @@ public final class HslAdjustmentPixelTest { @Test public void drawFrame_decreaseLightness_producesDarkerFrame() throws Exception { - String testId = "drawFrame_decreaseLightness"; HslAdjustment decreasedLightness = new HslAdjustment.Builder().adjustLightness(-50).build(); hslProcessor = decreasedLightness.toGlShaderProgram(context, /* useHdr= */ false); Size outputSize = hslProcessor.configure(inputWidth, inputHeight); @@ -273,7 +273,6 @@ public final class HslAdjustmentPixelTest { @Test public void drawFrame_increaseLightness_producesBrighterFrame() throws Exception { - String testId = "drawFrame_increaseLightness"; HslAdjustment increasedLightness = new HslAdjustment.Builder().adjustLightness(50).build(); hslProcessor = increasedLightness.toGlShaderProgram(context, /* useHdr= */ false); Size outputSize = hslProcessor.configure(inputWidth, inputHeight); @@ -291,7 +290,6 @@ public final class HslAdjustmentPixelTest { @Test public void drawFrame_maximumLightness_producesWhiteFrame() throws Exception { - String testId = "drawFrame_maximumLightness"; HslAdjustment maximumLightness = new HslAdjustment.Builder().adjustLightness(100).build(); hslProcessor = maximumLightness.toGlShaderProgram(context, /* useHdr= */ false); Size outputSize = hslProcessor.configure(inputWidth, inputHeight); @@ -310,7 +308,6 @@ public final class HslAdjustmentPixelTest { @Test public void drawFrame_adjustAllHslSettings_matchesGoldenFile() throws Exception { - String testId = "drawFrame_adjustAllHslSettings"; HslAdjustment allHslSettingsAdjusted = new HslAdjustment.Builder().adjustHue(60).adjustSaturation(30).adjustLightness(50).build(); hslProcessor = allHslSettingsAdjusted.toGlShaderProgram(context, /* useHdr= */ false); diff --git a/libraries/effect/src/androidTest/java/androidx/media3/effect/ThumbnailStripEffectPixelTest.java b/libraries/effect/src/androidTest/java/androidx/media3/effect/ThumbnailStripEffectPixelTest.java index 6328a8ff17..87a1b68dc4 100644 --- a/libraries/effect/src/androidTest/java/androidx/media3/effect/ThumbnailStripEffectPixelTest.java +++ b/libraries/effect/src/androidTest/java/androidx/media3/effect/ThumbnailStripEffectPixelTest.java @@ -40,7 +40,9 @@ import com.google.common.collect.ImmutableList; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.junit.After; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; import org.junit.runner.RunWith; /** Pixel tests for {@link ThumbnailStripEffect}. */ @@ -50,19 +52,26 @@ public final class ThumbnailStripEffectPixelTest { "media/bitmap/sample_mp4_first_frame/linear_colors/original.png"; private static final String TWO_THUMBNAILS_STRIP_PNG_ASSET_PATH = "media/bitmap/sample_mp4_first_frame/linear_colors/two_thumbnails_strip.png"; - + @Rule public final TestName testName = new TestName(); private final Context context = getApplicationContext(); private @MonotonicNonNull EGLDisplay eglDisplay; private @MonotonicNonNull EGLContext eglContext; private @MonotonicNonNull EGLSurface placeholderEglSurface; private @MonotonicNonNull ThumbnailStripShaderProgram thumbnailStripShaderProgram; + private String testId; + private int inputTexId; private int inputWidth; private int inputHeight; @Before - public void setUp() throws Exception { + public void setUpTestId() { + testId = testName.getMethodName(); + } + + @Before + public void createGlObjects() throws Exception { eglDisplay = GlUtil.getDefaultEglDisplay(); eglContext = GlUtil.createEglContext(eglDisplay); placeholderEglSurface = GlUtil.createFocusedPlaceholderEglSurface(eglContext, eglDisplay); @@ -85,7 +94,7 @@ public final class ThumbnailStripEffectPixelTest { } @After - public void tearDown() throws GlUtil.GlException, VideoFrameProcessingException { + public void releaseGlObjects() throws GlUtil.GlException, VideoFrameProcessingException { if (thumbnailStripShaderProgram != null) { thumbnailStripShaderProgram.release(); } @@ -94,7 +103,6 @@ public final class ThumbnailStripEffectPixelTest { @Test public void drawFrame_withOneTimestampAndOriginalSize_producesOriginalFrame() throws Exception { - String testId = "drawFrame_withOneTimestampAndOriginalSize"; ThumbnailStripEffect thumbnailStripEffect = new ThumbnailStripEffect(inputWidth, inputHeight); thumbnailStripEffect.setTimestampsMs(ImmutableList.of(0L)); thumbnailStripShaderProgram = @@ -112,7 +120,6 @@ public final class ThumbnailStripEffectPixelTest { @Test public void drawFrame_zeroTimestamps_producesEmptyFrame() throws Exception { - String testId = "drawFrame_zeroTimestamps"; ThumbnailStripEffect thumbnailStripEffect = new ThumbnailStripEffect(inputWidth, inputHeight); thumbnailStripEffect.setTimestampsMs(ImmutableList.of()); thumbnailStripShaderProgram = @@ -131,7 +138,6 @@ public final class ThumbnailStripEffectPixelTest { @Test public void drawFrame_lateTimestamp_producesEmptyFrame() throws Exception { - String testId = "drawFrame_lateTimestamp"; ThumbnailStripEffect thumbnailStripEffect = new ThumbnailStripEffect(inputWidth, inputHeight); thumbnailStripEffect.setTimestampsMs(ImmutableList.of(1L)); thumbnailStripShaderProgram = @@ -150,7 +156,6 @@ public final class ThumbnailStripEffectPixelTest { @Test public void drawFrame_twoTimestamps_producesStrip() throws Exception { - String testId = "drawFrame_twoTimestamps"; ThumbnailStripEffect thumbnailStripEffect = new ThumbnailStripEffect(inputWidth, inputHeight); thumbnailStripEffect.setTimestampsMs(ImmutableList.of(0L, 1L)); thumbnailStripShaderProgram = diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/ForceEndOfStreamTest.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/ForceEndOfStreamTest.java index 3bb28d4765..6063548f7d 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/ForceEndOfStreamTest.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/ForceEndOfStreamTest.java @@ -36,7 +36,10 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; import java.io.IOException; import java.nio.ByteBuffer; import org.json.JSONException; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; import org.junit.runner.RunWith; /** @@ -50,10 +53,17 @@ import org.junit.runner.RunWith; public class ForceEndOfStreamTest { private final Context context = ApplicationProvider.getApplicationContext(); + @Rule public final TestName testName = new TestName(); + + private String testId; + + @Before + public void setUpTestId() { + testId = testName.getMethodName(); + } @Test public void transcode_decoderDroppingLastFourFrames_exportSucceeds() throws Exception { - String testId = "transcode_decoderDroppingLastFourFrames_exportSucceeds"; if (skipTestBelowApi29(context, testId)) { return; } @@ -79,7 +89,6 @@ public class ForceEndOfStreamTest { @Test public void transcode_decoderDroppingNoFrame_exportSucceeds() throws Exception { - String testId = "transcode_decoderDroppingNoFrame_exportSucceeds"; if (skipTestBelowApi29(context, testId)) { return; } diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerEndToEndTest.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerEndToEndTest.java index 9f391c8c01..79acca3a04 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerEndToEndTest.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerEndToEndTest.java @@ -86,7 +86,10 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import java.nio.ByteBuffer; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; import org.junit.runner.RunWith; /** @@ -98,12 +101,19 @@ public class TransformerEndToEndTest { private static final GlEffect NO_OP_EFFECT = new Contrast(0f); private final Context context = ApplicationProvider.getApplicationContext(); + @Rule public final TestName testName = new TestName(); + + private String testId; private volatile @MonotonicNonNull TextureAssetLoader textureAssetLoader; + @Before + public void setUpTestId() { + testId = testName.getMethodName(); + } + @Test public void compositionEditing_withThreeSequences_completes() throws Exception { - String testId = "compositionEditing_withThreeSequences_completes"; Transformer transformer = new Transformer.Builder(context).build(); if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, @@ -176,7 +186,6 @@ public class TransformerEndToEndTest { @Test public void videoEditing_withImageInput_completesWithCorrectFrameCountAndDuration() throws Exception { - String testId = "videoEditing_withImageInput_completesWithCorrectFrameCountAndDuration"; Transformer transformer = new Transformer.Builder(context).build(); ImmutableList videoEffects = ImmutableList.of(Presentation.createForHeight(480)); Effects effects = new Effects(/* audioProcessors= */ ImmutableList.of(), videoEffects); @@ -201,7 +210,6 @@ public class TransformerEndToEndTest { @Test public void videoTranscoding_withImageInput_completesWithCorrectFrameCountAndDuration() throws Exception { - String testId = "videoTranscoding_withImageInput_completesWithCorrectFrameCountAndDuration"; Transformer transformer = new Transformer.Builder(context).build(); int expectedFrameCount = 40; EditedMediaItem editedMediaItem = @@ -223,7 +231,6 @@ public class TransformerEndToEndTest { @Test public void videoEditing_withTextureInput_completesWithCorrectFrameCountAndDuration() throws Exception { - String testId = "videoEditing_withTextureInput_completesWithCorrectFrameCountAndDuration"; Bitmap bitmap = new DataSourceBitmapLoader(context).loadBitmap(Uri.parse(PNG_ASSET_URI_STRING)).get(); int expectedFrameCount = 2; @@ -277,7 +284,6 @@ public class TransformerEndToEndTest { @Test public void videoTranscoding_withTextureInput_completesWithCorrectFrameCountAndDuration() throws Exception { - String testId = "videoTranscoding_withTextureInput_completesWithCorrectFrameCountAndDuration"; Bitmap bitmap = new DataSourceBitmapLoader(context).loadBitmap(Uri.parse(PNG_ASSET_URI_STRING)).get(); int expectedFrameCount = 2; @@ -327,7 +333,6 @@ public class TransformerEndToEndTest { @Test public void videoEditing_completesWithConsistentFrameCount() throws Exception { - String testId = "videoEditing_completesWithConsistentFrameCount"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, @@ -359,7 +364,6 @@ public class TransformerEndToEndTest { @Test public void videoEditing_effectsOverTime_completesWithConsistentFrameCount() throws Exception { - String testId = "videoEditing_effectsOverTime_completesWithConsistentFrameCount"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, @@ -400,7 +404,6 @@ public class TransformerEndToEndTest { @Test public void videoOnly_completesWithConsistentDuration() throws Exception { - String testId = "videoOnly_completesWithConsistentDuration"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, @@ -430,7 +433,6 @@ public class TransformerEndToEndTest { @Test public void clippedMedia_completesWithClippedDuration() throws Exception { - String testId = "clippedMedia_completesWithClippedDuration"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, @@ -506,7 +508,6 @@ public class TransformerEndToEndTest { @Test public void clippedMedia_trimOptimizationEnabled_fallbackToNormalExportUponFormatMismatch() throws Exception { - String testId = "clippedMedia_trimOptimizationEnabled_fallbackToNormalExportUponFormatMismatch"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, @@ -672,7 +673,6 @@ public class TransformerEndToEndTest { @Test public void clippedMedia_trimOptimizationEnabled_completesWithOptimizationApplied() throws Exception { - String testId = "clippedMedia_trimOptimizationEnabled_completesWithOptimizationApplied"; if (!isRunningOnEmulator() || Util.SDK_INT != 33) { // The trim optimization is only guaranteed to work on emulator for this (emulator-transcoded) // file. @@ -757,7 +757,6 @@ public class TransformerEndToEndTest { @Test public void videoEditing_trimOptimizationEnabled_fallbackToNormalExport() throws Exception { - String testId = "videoEditing_trimOptimizationEnabled_fallbackToNormalExport"; Transformer transformer = new Transformer.Builder(context).experimentalSetTrimOptimizationEnabled(true).build(); if (!isRunningOnEmulator()) { @@ -794,7 +793,6 @@ public class TransformerEndToEndTest { @Test public void videoEncoderFormatUnsupported_completesWithError() throws Exception { - String testId = "videoEncoderFormatUnsupported_completesWithError"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, @@ -827,7 +825,6 @@ public class TransformerEndToEndTest { @Test public void audioVideoTranscodedFromDifferentSequences_producesExpectedResult() throws Exception { Transformer transformer = new Transformer.Builder(context).build(); - String testId = "audioVideoTranscodedFromDifferentSequences_producesExpectedResult"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, @@ -878,7 +875,6 @@ public class TransformerEndToEndTest { @Test public void loopingTranscodedAudio_producesExpectedResult() throws Exception { Transformer transformer = new Transformer.Builder(context).build(); - String testId = "loopingTranscodedAudio_producesExpectedResult"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, @@ -916,7 +912,6 @@ public class TransformerEndToEndTest { @Test public void loopingTranscodedVideo_producesExpectedResult() throws Exception { Transformer transformer = new Transformer.Builder(context).build(); - String testId = "loopingTranscodedVideo_producesExpectedResult"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, @@ -952,7 +947,6 @@ public class TransformerEndToEndTest { @Test public void loopingImage_producesExpectedResult() throws Exception { Transformer transformer = new Transformer.Builder(context).build(); - String testId = "loopingImage_producesExpectedResult"; EditedMediaItem audioEditedMediaItem = new EditedMediaItem.Builder(MediaItem.fromUri(MP3_ASSET_URI_STRING)).build(); EditedMediaItemSequence audioSequence = @@ -982,7 +976,6 @@ public class TransformerEndToEndTest { @Test public void loopingImage_loopingSequenceIsLongest_producesExpectedResult() throws Exception { Transformer transformer = new Transformer.Builder(context).build(); - String testId = "loopingImage_producesExpectedResult"; EditedMediaItem audioEditedMediaItem = new EditedMediaItem.Builder(MediaItem.fromUri(MP3_ASSET_URI_STRING)).build(); EditedMediaItemSequence audioSequence = new EditedMediaItemSequence(audioEditedMediaItem); @@ -1008,7 +1001,6 @@ public class TransformerEndToEndTest { @Test public void audioTranscode_processesInInt16Pcm() throws Exception { - String testId = "audioTranscode_processesInInt16Pcm"; FormatTrackingAudioBufferSink audioFormatTracker = new FormatTrackingAudioBufferSink(); Transformer transformer = new Transformer.Builder(context).build(); @@ -1032,7 +1024,6 @@ public class TransformerEndToEndTest { @Test public void audioEditing_monoToStereo_outputsStereo() throws Exception { - String testId = "audioEditing_monoToStereo_outputsStereo"; ChannelMixingAudioProcessor channelMixingAudioProcessor = new ChannelMixingAudioProcessor(); channelMixingAudioProcessor.putChannelMixingMatrix( @@ -1056,7 +1047,6 @@ public class TransformerEndToEndTest { @Test public void transcode_withOutputVideoMimeTypeAv1_completesSuccessfully() throws Exception { - String testId = "transcode_withOutputVideoMimeTypeAv1_completesSuccessfully"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, @@ -1089,7 +1079,6 @@ public class TransformerEndToEndTest { @Test public void transcode_withOutputAudioMimeTypeAac_completesSuccessfully() throws Exception { - String testId = "transcode_withOutputAudioMimeTypeAac_completesSuccessfully"; MediaItem mediaItem = MediaItem.fromUri(Uri.parse(MP3_ASSET_URI_STRING)); EditedMediaItem editedMediaItem = new EditedMediaItem.Builder(mediaItem).build(); Transformer transformer = @@ -1111,7 +1100,6 @@ public class TransformerEndToEndTest { @Test public void transmux_audioWithEditList_preservesDuration() throws Exception { - String testId = "transmux_audioWithEditList_preservesDuration"; Context context = ApplicationProvider.getApplicationContext(); Transformer transformer = new Transformer.Builder(context).build(); MediaItem mediaItem = @@ -1151,7 +1139,6 @@ public class TransformerEndToEndTest { @Test public void transmux_audioWithEditListUsingInAppMuxer_preservesDuration() throws Exception { - String testId = "transmux_AudioWithEditListUsingInAppMuxer_preservesDuration"; Context context = ApplicationProvider.getApplicationContext(); Transformer transformer = new Transformer.Builder(context) @@ -1191,7 +1178,6 @@ public class TransformerEndToEndTest { @Test public void transmux_videoWithEditList_trimsFirstIDRFrameDuration() throws Exception { - String testId = "transmux_videoWithEditList_trimsFirstIDRFrameDuration"; Context context = ApplicationProvider.getApplicationContext(); assumeTrue( "MediaMuxer doesn't support B frames reliably on older SDK versions", Util.SDK_INT >= 29); diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerMixedInputEndToEndTest.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerMixedInputEndToEndTest.java index 9f00d5e64a..9cd0ac6bd1 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerMixedInputEndToEndTest.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerMixedInputEndToEndTest.java @@ -33,7 +33,10 @@ import androidx.media3.effect.Presentation; import androidx.test.core.app.ApplicationProvider; import androidx.test.ext.junit.runners.AndroidJUnit4; import com.google.common.collect.ImmutableList; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; import org.junit.runner.RunWith; /** @@ -47,11 +50,18 @@ import org.junit.runner.RunWith; public class TransformerMixedInputEndToEndTest { private final Context context = ApplicationProvider.getApplicationContext(); + @Rule public final TestName testName = new TestName(); + + private String testId; + + @Before + public void setUpTestId() { + testId = testName.getMethodName(); + } @Test public void videoEditing_withImageThenVideoInputs_completesWithCorrectFrameCount() throws Exception { - String testId = "videoEditing_withImageThenVideoInputs_completesWithCorrectFrameCount"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, @@ -83,7 +93,6 @@ public class TransformerMixedInputEndToEndTest { @Test public void videoEditing_withVideoThenImageInputs_completesWithCorrectFrameCount() throws Exception { - String testId = "videoEditing_withVideoThenImageInputs_completesWithCorrectFrameCount"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, @@ -115,8 +124,6 @@ public class TransformerMixedInputEndToEndTest { public void videoEditing_withComplexVideoAndImageInputsEndWithVideo_completesWithCorrectFrameCount() throws Exception { - String testId = - "videoEditing_withComplexVideoAndImageInputsEndWithVideo_completesWithCorrectFrameCount"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, @@ -159,8 +166,6 @@ public class TransformerMixedInputEndToEndTest { public void videoEditing_withComplexVideoAndImageInputsEndWithImage_completesWithCorrectFrameCount() throws Exception { - String testId = - "videoEditing_withComplexVideoAndImageInputsEndWithImage_completesWithCorrectFrameCount"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerMultiSequenceCompositionTest.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerMultiSequenceCompositionTest.java index 893050c544..4ec7ab66ff 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerMultiSequenceCompositionTest.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerMultiSequenceCompositionTest.java @@ -46,7 +46,10 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; import com.google.common.collect.ImmutableList; import java.io.IOException; import java.util.List; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; import org.junit.runner.RunWith; /** Tests for using multiple {@link EditedMediaItemSequence} in a composition. */ @@ -65,10 +68,17 @@ public final class TransformerMultiSequenceCompositionTest { private static final int EXPORT_HEIGHT = 240; private final Context context = ApplicationProvider.getApplicationContext(); + @Rule public final TestName testName = new TestName(); + + private String testId; + + @Before + public void setUpTestId() { + testId = testName.getMethodName(); + } @Test public void export_withTwoSequencesEachWithOneVideoMediaItem_succeeds() throws Exception { - String testId = "export_withTwoSequencesEachWithOneVideoMediaItem_succeeds"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, @@ -108,7 +118,6 @@ public final class TransformerMultiSequenceCompositionTest { @Test public void export_withTwoSequencesOneWithVideoOneWithImage_succeeds() throws Exception { - String testId = "export_withTwoSequencesOneWithVideoOneWithImage_succeeds"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, @@ -148,7 +157,6 @@ public final class TransformerMultiSequenceCompositionTest { @Test public void export_withTwoSequencesWithVideoCompositorSettings_succeeds() throws Exception { - String testId = "export_withTwoSequencesWithVideoCompositorSettings_succeeds"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerPauseResumeTest.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerPauseResumeTest.java index 1c9b63137d..b9177151e2 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerPauseResumeTest.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerPauseResumeTest.java @@ -41,9 +41,11 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeoutException; +import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; +import org.junit.rules.TestName; import org.junit.runner.RunWith; /** End-to-end instrumentation tests for {@link Transformer} pause and resume scenarios. */ @@ -56,10 +58,17 @@ public class TransformerPauseResumeTest { private static final int MP4_ASSET_FRAME_COUNT = 932; private final Context context = getApplicationContext(); + @Rule public final TestName testName = new TestName(); + + private String testId; + + @Before + public void setUpTestId() { + testId = testName.getMethodName(); + } @Test public void resume_withSingleMediaItem_outputMatchesExpected() throws Exception { - String testId = "resume_withSingleMediaItem_outputMatchesExpected"; if (shouldSkipDevice(testId)) { return; } @@ -108,7 +117,6 @@ public class TransformerPauseResumeTest { @Test public void resume_withSingleMediaItemAfterImmediateCancellation_restartsExport() throws Exception { - String testId = "resume_withSingleMediaItemAfterImmediateCancellation_restartsExport"; if (shouldSkipDevice(testId)) { return; } @@ -140,7 +148,6 @@ public class TransformerPauseResumeTest { @Test public void resume_withSingleMediaItem_outputMatchesWithoutResume() throws Exception { - String testId = "resume_withSingleMediaItem_outputMatchesWithoutResume"; if (shouldSkipDevice(testId)) { return; } @@ -193,7 +200,6 @@ public class TransformerPauseResumeTest { @Test public void resume_withSingleMediaItemHavingClippingConfig_outputMatchesWithoutResume() throws Exception { - String testId = "resume_withSingleMediaItemHavingClippingConfig_outputMatchesWithoutResume"; if (shouldSkipDevice(testId)) { return; } @@ -243,7 +249,6 @@ public class TransformerPauseResumeTest { @Test public void resume_withTwoMediaItems_outputMatchesExpected() throws Exception { - String testId = "resume_withTwoMediaItems_outputMatchesExpected"; if (shouldSkipDevice(testId)) { return; } @@ -294,7 +299,6 @@ public class TransformerPauseResumeTest { @Test public void resume_withTwoMediaItems_outputMatchesWithoutResume() throws Exception { - String testId = "resume_withTwoMediaItems_outputMatchesWithoutResume"; if (shouldSkipDevice(testId)) { return; } diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerSequenceEffectTest.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerSequenceEffectTest.java index bbc852c3ca..1128765eb3 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerSequenceEffectTest.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerSequenceEffectTest.java @@ -50,7 +50,10 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; import com.google.common.base.Ascii; import com.google.common.collect.ImmutableList; import java.io.IOException; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; import org.junit.runner.RunWith; /** @@ -66,10 +69,17 @@ public final class TransformerSequenceEffectTest { private static final int EXPORT_HEIGHT = 240; private final Context context = ApplicationProvider.getApplicationContext(); + @Rule public final TestName testName = new TestName(); + + private String testId; + + @Before + public void setUpTestId() { + testId = testName.getMethodName(); + } @Test public void export_withNoCompositionPresentationAndWithPerMediaItemEffects() throws Exception { - String testId = "export_withNoCompositionPresentationAndWithPerMediaItemEffects"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, @@ -114,8 +124,6 @@ public final class TransformerSequenceEffectTest { @Test public void export_withCompositionPresentationAndWithPerMediaItemEffects() throws Exception { - String testId = "export_withCompositionPresentationAndWithPerMediaItemEffects"; - // Reference: b/296225823#comment5 assumeFalse( "Some older MediaTek encoders have a pixel alignment of 16, which results in a 360 pixel" @@ -166,7 +174,6 @@ public final class TransformerSequenceEffectTest { @Test public void export_withCompositionPresentationAndNoVideoEffects() throws Exception { - String testId = "export_withCompositionPresentationAndNoVideoEffects"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, @@ -196,7 +203,6 @@ public final class TransformerSequenceEffectTest { @Test public void export_withCompositionPresentationAndNoVideoEffectsForFirstMediaItem() throws Exception { - String testId = "export_withCompositionPresentationAndNoVideoEffectsForFirstMediaItem"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/DefaultVideoFrameProcessorMultipleTextureOutputPixelTest.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/DefaultVideoFrameProcessorMultipleTextureOutputPixelTest.java index 2922552921..336c2a931c 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/DefaultVideoFrameProcessorMultipleTextureOutputPixelTest.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/DefaultVideoFrameProcessorMultipleTextureOutputPixelTest.java @@ -37,7 +37,10 @@ import java.util.List; import java.util.Set; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.junit.After; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; import org.junit.runner.RunWith; /** @@ -48,6 +51,7 @@ import org.junit.runner.RunWith; */ @RunWith(AndroidJUnit4.class) public class DefaultVideoFrameProcessorMultipleTextureOutputPixelTest { + private static final String ORIGINAL_PNG_ASSET_PATH = "media/bitmap/sample_mp4_first_frame/electrical_colors/original.png"; private static final String MEDIA3_TEST_PNG_ASSET_PATH = @@ -57,10 +61,19 @@ public class DefaultVideoFrameProcessorMultipleTextureOutputPixelTest { private static final String SRGB_TO_ELECTRICAL_MEDIA3_TEST_PNG_ASSET_PATH = "media/bitmap/sample_mp4_first_frame/electrical_colors/srgb_to_electrical_media3test.png"; + @Rule public final TestName testName = new TestName(); + private @MonotonicNonNull VideoFrameProcessorTestRunner videoFrameProcessorTestRunner; private @MonotonicNonNull TextureBitmapReader textureBitmapReader; + private String testId; + + @Before + public void setUpTestId() { + testId = testName.getMethodName(); + } + @After public void release() { checkNotNull(videoFrameProcessorTestRunner).release(); @@ -68,7 +81,6 @@ public class DefaultVideoFrameProcessorMultipleTextureOutputPixelTest { @Test public void textureOutput_queueBitmap_matchesGoldenFile() throws Exception { - String testId = "textureOutput_queueBitmap_matchesGoldenFile"; videoFrameProcessorTestRunner = getFrameProcessorTestRunnerBuilder(testId).build(); ImmutableList inputTimestamps = ImmutableList.of(1_000_000L, 2_000_000L, 3_000_000L); @@ -89,7 +101,6 @@ public class DefaultVideoFrameProcessorMultipleTextureOutputPixelTest { @Test public void textureOutput_queueTwoBitmaps_matchesGoldenFiles() throws Exception { - String testId = "textureOutput_queueTwoBitmaps_matchesGoldenFiles"; videoFrameProcessorTestRunner = getFrameProcessorTestRunnerBuilder(testId).build(); ImmutableList inputTimestamps1 = ImmutableList.of(1_000_000L, 1_500_000L); ImmutableList inputTimestamps2 = ImmutableList.of(2_000_000L, 3_000_000L, 4_000_000L); @@ -126,7 +137,6 @@ public class DefaultVideoFrameProcessorMultipleTextureOutputPixelTest { // TODO: b/302695659 - Make this test more deterministic. @Test public void textureOutput_queueFiveBitmapsAndFlush_outputsOnlyAfterFlush() throws Exception { - String testId = "textureOutput_queueFiveBitmapsAndFlush_outputsOnlyAfterFlush"; videoFrameProcessorTestRunner = getFrameProcessorTestRunnerBuilder(testId).build(); ImmutableList inputTimestamps1 = ImmutableList.of(1_000_000L, 2_000_000L, 3_000_000L); ImmutableList inputTimestamps2 = ImmutableList.of(4_000_000L, 5_000_000L, 6_000_000L); diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/DefaultVideoFrameProcessorTextureOutputPixelTest.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/DefaultVideoFrameProcessorTextureOutputPixelTest.java index eec640ab4d..d40e06fced 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/DefaultVideoFrameProcessorTextureOutputPixelTest.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/DefaultVideoFrameProcessorTextureOutputPixelTest.java @@ -54,7 +54,10 @@ import com.google.common.collect.ImmutableList; import java.util.List; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.junit.After; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; import org.junit.runner.RunWith; /** @@ -87,8 +90,17 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest { /** Input HLG video of which we only use the first frame. */ private static final String INPUT_HLG10_MP4_ASSET_STRING = "media/mp4/hlg-1080p.mp4"; + @Rule public final TestName testName = new TestName(); + + private String testId; + private @MonotonicNonNull VideoFrameProcessorTestRunner videoFrameProcessorTestRunner; + @Before + public void setUpTestId() { + testId = testName.getMethodName(); + } + @After public void release() { if (videoFrameProcessorTestRunner != null) { @@ -98,7 +110,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest { @Test public void noEffects_matchesGoldenFile() throws Exception { - String testId = "noEffects_matchesGoldenFile"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( getApplicationContext(), testId, @@ -121,7 +132,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest { @Test public void noEffects_textureInput_matchesGoldenFile() throws Exception { - String testId = "noEffects_textureInput_matchesGoldenFile"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( getApplicationContext(), testId, @@ -152,7 +162,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest { @Test public void bitmapOverlay_matchesGoldenFile() throws Exception { - String testId = "bitmapOverlay_matchesGoldenFile"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( getApplicationContext(), testId, @@ -179,7 +188,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest { @Test public void bitmapOverlay_textureInput_matchesGoldenFile() throws Exception { - String testId = "bitmapOverlay_textureInput_matchesGoldenFile"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( getApplicationContext(), testId, @@ -210,7 +218,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest { @Test public void noEffects_hlg10Input_matchesGoldenFile() throws Exception { - String testId = "noEffects_hlg10Input_matchesGoldenFile"; Context context = getApplicationContext(); Format format = MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT; if (!deviceSupportsHdrEditing(format)) { @@ -242,7 +249,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest { @Test public void noEffects_hlg10TextureInput_matchesGoldenFile() throws Exception { - String testId = "noEffects_hlg10TextureInput_matchesGoldenFile"; Context context = getApplicationContext(); Format format = MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT; if (!deviceSupportsHdrEditing(format)) { @@ -278,7 +284,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest { @Test public void noEffects_hdr10Input_matchesGoldenFile() throws Exception { - String testId = "noEffects_hdr10Input_matchesGoldenFile"; Context context = getApplicationContext(); Format format = MP4_ASSET_720P_4_SECOND_HDR10_FORMAT; if (!deviceSupportsHdrEditing(format)) { @@ -310,7 +315,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest { @Test public void noEffects_hdr10TextureInput_matchesGoldenFile() throws Exception { - String testId = "noEffects_hdr10TextureInput_matchesGoldenFile"; Context context = getApplicationContext(); Format format = MP4_ASSET_720P_4_SECOND_HDR10_FORMAT; if (!deviceSupportsHdrEditing(format)) { @@ -346,7 +350,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest { @Test public void noOpEffect_hlg10Input_matchesGoldenFile() throws Exception { - String testId = "noOpEffect_hlg10Input_matchesGoldenFile"; Context context = getApplicationContext(); Format format = MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT; if (!deviceSupportsHdrEditing(format)) { @@ -379,7 +382,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest { @Test public void noOpEffect_hlg10TextureInput_matchesGoldenFile() throws Exception { - String testId = "noOpEffect_hlg10TextureInput_matchesGoldenFile"; Context context = getApplicationContext(); Format format = MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT; if (!deviceSupportsHdrEditing(format)) { @@ -415,7 +417,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest { @Test public void noOpEffect_hdr10Input_matchesGoldenFile() throws Exception { - String testId = "noOpEffect_hdr10Input_matchesGoldenFile"; Context context = getApplicationContext(); Format format = MP4_ASSET_720P_4_SECOND_HDR10_FORMAT; if (!deviceSupportsHdrEditing(format)) { @@ -448,7 +449,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest { @Test public void noOpEffect_hdr10TextureInput_matchesGoldenFile() throws Exception { - String testId = "noOpEffect_hdr10TextureInput_matchesGoldenFile"; Context context = getApplicationContext(); Format format = MP4_ASSET_720P_4_SECOND_HDR10_FORMAT; if (!deviceSupportsHdrEditing(format)) { diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ExportTest.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ExportTest.java index 591a2dce64..cc66b873c8 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ExportTest.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ExportTest.java @@ -59,18 +59,27 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; import com.google.common.base.Ascii; import com.google.common.collect.ImmutableList; import org.junit.AssumptionViolatedException; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; import org.junit.runner.RunWith; /** {@link Transformer} instrumentation tests. */ @RunWith(AndroidJUnit4.class) public class ExportTest { - private static final String TAG = "ExportTest"; + @Rule public final TestName testName = new TestName(); + + private String testId; + + @Before + public void setUpTestId() { + testId = TAG + "_" + testName.getMethodName(); + } @Test public void export() throws Exception { - String testId = TAG + "_export"; Context context = ApplicationProvider.getApplicationContext(); // Note: throughout this class we only check decoding capability as tests should still run if // Transformer is able to succeed by falling back to a lower resolution. @@ -99,7 +108,6 @@ public class ExportTest { @Test public void exportWithoutDecodeEncode() throws Exception { - String testId = TAG + "_exportWithoutDecodeEncode"; Context context = ApplicationProvider.getApplicationContext(); Transformer transformer = new Transformer.Builder(context).build(); MediaItem mediaItem = @@ -110,7 +118,6 @@ public class ExportTest { @Test public void exportToSpecificBitrate() throws Exception { - String testId = TAG + "_exportToSpecificBitrate"; Context context = ApplicationProvider.getApplicationContext(); if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, @@ -143,7 +150,6 @@ public class ExportTest { @Test public void export4K60() throws Exception { - String testId = TAG + "_export4K60"; Context context = ApplicationProvider.getApplicationContext(); if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, @@ -172,8 +178,6 @@ public class ExportTest { @Test public void export8K24() throws Exception { - String testId = TAG + "_export8K24"; - // Reference: b/244711282#comment5 assumeFalse( "Some devices are capable of instantiating only either one 8K decoder or one 8K encoder", @@ -205,7 +209,6 @@ public class ExportTest { @Test public void export8K24_withDownscaling() throws Exception { // This test is to cover devices that are able to either decode or encode 8K, but not transcode. - String testId = TAG + "_export8K24_withDownscaling"; int downscaledWidth = 320; int downscaledHeight = 240; @@ -241,7 +244,6 @@ public class ExportTest { @Test public void exportNoAudio() throws Exception { - String testId = TAG + "_exportNoAudio"; Context context = ApplicationProvider.getApplicationContext(); if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, @@ -270,7 +272,6 @@ public class ExportTest { @Test public void exportNoVideo() throws Exception { - String testId = TAG + "_exportNoVideo"; Context context = ApplicationProvider.getApplicationContext(); Transformer transformer = new Transformer.Builder(context) @@ -287,7 +288,6 @@ public class ExportTest { @Test public void exportSef() throws Exception { - String testId = TAG + "_exportSef"; Context context = ApplicationProvider.getApplicationContext(); if (SDK_INT < 25) { @@ -313,7 +313,6 @@ public class ExportTest { @Test public void exportSefH265() throws Exception { - String testId = TAG + "_exportSefH265"; Context context = ApplicationProvider.getApplicationContext(); if (SDK_INT < 25) { @@ -335,7 +334,6 @@ public class ExportTest { @Test public void exportFrameRotation() throws Exception { - String testId = TAG + "_exportFrameRotation"; Context context = ApplicationProvider.getApplicationContext(); if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, @@ -361,7 +359,6 @@ public class ExportTest { @Test public void exportTranscodeBt2020Sdr() throws Exception { - String testId = TAG + "exportBt2020Sdr"; Context context = ApplicationProvider.getApplicationContext(); // Reference: b/262732842#comment51 if (SDK_INT <= 27 && Util.MANUFACTURER.equals("samsung")) { diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ForceInterpretHdrVideoAsSdrTest.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ForceInterpretHdrVideoAsSdrTest.java index 7c082b927c..5947cd3cb3 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ForceInterpretHdrVideoAsSdrTest.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ForceInterpretHdrVideoAsSdrTest.java @@ -39,7 +39,10 @@ import androidx.media3.transformer.Transformer; import androidx.media3.transformer.TransformerAndroidTestRunner; import androidx.test.core.app.ApplicationProvider; import androidx.test.ext.junit.runners.AndroidJUnit4; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; import org.junit.runner.RunWith; /** @@ -49,10 +52,17 @@ import org.junit.runner.RunWith; */ @RunWith(AndroidJUnit4.class) public class ForceInterpretHdrVideoAsSdrTest { + @Rule public final TestName testName = new TestName(); + + private String testId; + + @Before + public void setUpTestId() { + testId = testName.getMethodName(); + } @Test public void forceInterpretHdrVideoAsSdrTest_hdr10File_transformsOrThrows() throws Exception { - String testId = "forceInterpretHdrVideoAsSdrTest_hdr10File_transformsOrThrows"; Context context = ApplicationProvider.getApplicationContext(); if (SDK_INT < 29) { @@ -96,7 +106,6 @@ public class ForceInterpretHdrVideoAsSdrTest { @Test public void forceInterpretHdrVideoAsSdrTest_hlg10File_transformsOrThrows() throws Exception { - String testId = "forceInterpretHdrVideoAsSdrTest_hlg10File_transformsOrThrows"; Context context = ApplicationProvider.getApplicationContext(); if (SDK_INT < 29) { diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/HdrEditingTest.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/HdrEditingTest.java index 639ea5baa6..908cf0ec7e 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/HdrEditingTest.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/HdrEditingTest.java @@ -51,7 +51,10 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; import java.util.Objects; import java.util.concurrent.atomic.AtomicBoolean; import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; import org.junit.runner.RunWith; /** @@ -61,9 +64,17 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public final class HdrEditingTest { + @Rule public final TestName testName = new TestName(); + + private String testId; + + @Before + public void setUpTestId() { + testId = testName.getMethodName(); + } + @Test public void export_transmuxHdr10File() throws Exception { - String testId = "export_transmuxHdr10File"; Context context = ApplicationProvider.getApplicationContext(); if (Util.SDK_INT < 24) { @@ -97,7 +108,6 @@ public final class HdrEditingTest { @Test public void export_transmuxHlg10File() throws Exception { - String testId = "export_transmuxHlg10File"; Context context = ApplicationProvider.getApplicationContext(); if (Util.SDK_INT < 24) { @@ -131,7 +141,6 @@ public final class HdrEditingTest { @Test public void exportAndTranscode_hdr10File_whenHdrEditingIsSupported() throws Exception { - String testId = "exportAndTranscode_hdr10File_whenHdrEditingIsSupported"; Context context = ApplicationProvider.getApplicationContext(); Format format = MP4_ASSET_720P_4_SECOND_HDR10_FORMAT; if (!deviceSupportsHdrEditing(VIDEO_H265, format.colorInfo)) { @@ -163,7 +172,6 @@ public final class HdrEditingTest { @Test public void exportAndTranscode_hlg10File_whenHdrEditingIsSupported() throws Exception { - String testId = "exportAndTranscode_hlg10File_whenHdrEditingIsSupported"; Context context = ApplicationProvider.getApplicationContext(); Format format = MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT; if (!deviceSupportsHdrEditing(VIDEO_H265, format.colorInfo)) { @@ -195,7 +203,6 @@ public final class HdrEditingTest { @Test public void exportAndTranscode_dolbyVisionFile_whenHdrEditingIsSupported() throws Exception { - String testId = "exportAndTranscode_dolbyVisionFile_whenHdrEditingIsSupported"; Context context = ApplicationProvider.getApplicationContext(); Format format = MP4_ASSET_DOLBY_VISION_HDR_FORMAT; if (!deviceSupportsHdrEditing(VIDEO_H265, format.colorInfo)) { @@ -228,7 +235,6 @@ public final class HdrEditingTest { @Test public void exportAndTranscode_hdr10File_whenHdrEditingUnsupported_toneMapsOrThrows() throws Exception { - String testId = "exportAndTranscode_hdr10File_whenHdrEditingUnsupported_toneMapsOrThrows"; Context context = ApplicationProvider.getApplicationContext(); Format format = MP4_ASSET_720P_4_SECOND_HDR10_FORMAT; if (deviceSupportsHdrEditing(VIDEO_H265, format.colorInfo)) { @@ -294,7 +300,6 @@ public final class HdrEditingTest { @Test public void exportAndTranscode_hlg10File_whenHdrEditingUnsupported_toneMapsOrThrows() throws Exception { - String testId = "exportAndTranscode_hlg10File_whenHdrEditingUnsupported_toneMapsOrThrows"; Context context = ApplicationProvider.getApplicationContext(); Format format = MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT; if (deviceSupportsHdrEditing(VIDEO_H265, format.colorInfo)) { diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ToneMapHdrToSdrUsingMediaCodecTest.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ToneMapHdrToSdrUsingMediaCodecTest.java index 78a53074a6..487e9ac8ed 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ToneMapHdrToSdrUsingMediaCodecTest.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ToneMapHdrToSdrUsingMediaCodecTest.java @@ -39,7 +39,10 @@ import androidx.media3.transformer.TransformerAndroidTestRunner; import androidx.test.core.app.ApplicationProvider; import androidx.test.ext.junit.runners.AndroidJUnit4; import java.util.Objects; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; import org.junit.runner.RunWith; /** @@ -48,10 +51,17 @@ import org.junit.runner.RunWith; */ @RunWith(AndroidJUnit4.class) public class ToneMapHdrToSdrUsingMediaCodecTest { + @Rule public final TestName testName = new TestName(); + + private String testId; + + @Before + public void setUpTestId() { + testId = testName.getMethodName(); + } @Test public void export_toneMapNoRequestedTranscode_hdr10File_toneMapsOrThrows() throws Exception { - String testId = "export_toneMapNoRequestedTranscode_hdr10File_toneMapsOrThrows"; Context context = ApplicationProvider.getApplicationContext(); if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( @@ -114,7 +124,6 @@ public class ToneMapHdrToSdrUsingMediaCodecTest { @Test public void export_toneMapNoRequestedTranscode_hlg10File_toneMapsOrThrows() throws Exception { - String testId = "export_toneMapNoRequestedTranscode_hlg10File_toneMapsOrThrows"; Context context = ApplicationProvider.getApplicationContext(); if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( @@ -177,7 +186,6 @@ public class ToneMapHdrToSdrUsingMediaCodecTest { @Test public void export_toneMapAndTranscode_hdr10File_toneMapsOrThrows() throws Exception { - String testId = "export_toneMapAndTranscode_hdr10File_toneMapsOrThrows"; Context context = ApplicationProvider.getApplicationContext(); if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( @@ -241,7 +249,6 @@ public class ToneMapHdrToSdrUsingMediaCodecTest { @Test public void export_toneMapAndTranscode_hlg10File_toneMapsOrThrows() throws Exception { - String testId = "export_toneMapAndTranscode_hlg10File_toneMapsOrThrows"; Context context = ApplicationProvider.getApplicationContext(); if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ToneMapHdrToSdrUsingOpenGlPixelTest.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ToneMapHdrToSdrUsingOpenGlPixelTest.java index c33cc88f08..8f093fb92b 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ToneMapHdrToSdrUsingOpenGlPixelTest.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ToneMapHdrToSdrUsingOpenGlPixelTest.java @@ -36,7 +36,10 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; import com.google.common.collect.ImmutableList; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.junit.After; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; import org.junit.runner.RunWith; /** @@ -110,8 +113,16 @@ public final class ToneMapHdrToSdrUsingOpenGlPixelTest { .setColorTransfer(C.COLOR_TRANSFER_GAMMA_2_2) .build(); + @Rule public final TestName testName = new TestName(); + + private String testId; private @MonotonicNonNull VideoFrameProcessorTestRunner videoFrameProcessorTestRunner; + @Before + public void setUpTestId() { + testId = testName.getMethodName(); + } + @After public void release() { if (videoFrameProcessorTestRunner != null) { @@ -121,7 +132,6 @@ public final class ToneMapHdrToSdrUsingOpenGlPixelTest { @Test public void toneMap_hlgFrame_matchesGoldenFile() throws Exception { - String testId = "toneMap_hlgFrame_matchesGoldenFile"; if (skipAndLogIfOpenGlToneMappingUnsupported(testId, HLG_ASSET_FORMAT)) { return; } @@ -159,7 +169,6 @@ public final class ToneMapHdrToSdrUsingOpenGlPixelTest { @Test public void toneMapWithNoOpEffect_hlgFrame_matchesGoldenFile() throws Exception { - String testId = "toneMapWithNoOpEffect_hlgFrame_matchesGoldenFile"; if (skipAndLogIfOpenGlToneMappingUnsupported(testId, HLG_ASSET_FORMAT)) { return; } @@ -198,7 +207,6 @@ public final class ToneMapHdrToSdrUsingOpenGlPixelTest { @Test public void toneMap_pqFrame_matchesGoldenFile() throws Exception { - String testId = "toneMap_pqFrame_matchesGoldenFile"; if (skipAndLogIfOpenGlToneMappingUnsupported(testId, PQ_ASSET_FORMAT)) { return; } @@ -237,7 +245,6 @@ public final class ToneMapHdrToSdrUsingOpenGlPixelTest { @Test public void toneMapWithNoOpEffect_pqFrame_matchesGoldenFile() throws Exception { - String testId = "toneMapWithNoOpEffect_pqFrame_matchesGoldenFile"; if (skipAndLogIfOpenGlToneMappingUnsupported(testId, PQ_ASSET_FORMAT)) { return; } diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ToneMapHdrToSdrUsingOpenGlTest.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ToneMapHdrToSdrUsingOpenGlTest.java index bf9b5acf2d..d169d85c7d 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ToneMapHdrToSdrUsingOpenGlTest.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ToneMapHdrToSdrUsingOpenGlTest.java @@ -36,7 +36,10 @@ import androidx.media3.transformer.Transformer; import androidx.media3.transformer.TransformerAndroidTestRunner; import androidx.test.core.app.ApplicationProvider; import androidx.test.ext.junit.runners.AndroidJUnit4; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; import org.junit.runner.RunWith; /** @@ -45,12 +48,18 @@ import org.junit.runner.RunWith; */ @RunWith(AndroidJUnit4.class) public class ToneMapHdrToSdrUsingOpenGlTest { - + @Rule public final TestName testName = new TestName(); private final Context context = ApplicationProvider.getApplicationContext(); + private String testId; + + @Before + public void setUpTestId() { + testId = testName.getMethodName(); + } + @Test public void export_toneMap_hlg10File_toneMaps() throws Exception { - String testId = "export_glToneMap_hlg10File_toneMaps"; if (skipAndLogIfOpenGlToneMappingUnsupported( testId, /* inputFormat= */ MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT)) { return; @@ -61,7 +70,6 @@ public class ToneMapHdrToSdrUsingOpenGlTest { @Test public void export_toneMap_hdr10File_toneMaps() throws Exception { - String testId = "export_glToneMap_hdr10File_toneMaps"; if (skipAndLogIfOpenGlToneMappingUnsupported( testId, /* inputFormat= */ MP4_ASSET_720P_4_SECOND_HDR10_FORMAT)) { return; @@ -72,7 +80,6 @@ public class ToneMapHdrToSdrUsingOpenGlTest { @Test public void export_toneMap_dolbyVisionFile_toneMaps() throws Exception { - String testId = "export_toneMap_dolbyVisionFile_toneMaps"; if (skipAndLogIfOpenGlToneMappingUnsupported( testId, /* inputFormat= */ MP4_ASSET_DOLBY_VISION_HDR_FORMAT)) { return; diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/TranscodeQualityTest.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/TranscodeQualityTest.java index abc963893d..89f05259f5 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/TranscodeQualityTest.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/TranscodeQualityTest.java @@ -33,17 +33,28 @@ import androidx.media3.transformer.TransformerAndroidTestRunner; import androidx.media3.transformer.VideoEncoderSettings; import androidx.test.core.app.ApplicationProvider; import androidx.test.ext.junit.runners.AndroidJUnit4; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; import org.junit.runner.RunWith; /** Checks transcoding quality. */ @RunWith(AndroidJUnit4.class) public final class TranscodeQualityTest { + @Rule public final TestName testName = new TestName(); + + private String testId; + + @Before + public void setUpTestId() { + testId = testName.getMethodName(); + } + @Test public void exportHighQualityTargetingAvcToAvc1920x1080_ssimIsGreaterThan95Percent() throws Exception { Context context = ApplicationProvider.getApplicationContext(); - String testId = "transformHighQualityTargetingAvcToAvc1920x1080_ssim"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, @@ -89,7 +100,6 @@ public final class TranscodeQualityTest { @Test public void transcodeAvcToHevc_ssimIsGreaterThan90Percent() throws Exception { Context context = ApplicationProvider.getApplicationContext(); - String testId = "transcodeAvcToHevc_ssim"; if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, @@ -126,7 +136,6 @@ public final class TranscodeQualityTest { @Test public void transcodeAvcToAvc320x240_ssimIsGreaterThan90Percent() throws Exception { Context context = ApplicationProvider.getApplicationContext(); - String testId = "transcodeAvcToAvc320x240_ssim"; // Don't skip based on format support as input and output formats should be within CDD // requirements on all supported API versions, except for wearable devices. diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/TransformerWithInAppMuxerEndToEndTest.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/TransformerWithInAppMuxerEndToEndTest.java index dc91cd7cd8..6ad9d978fa 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/TransformerWithInAppMuxerEndToEndTest.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/TransformerWithInAppMuxerEndToEndTest.java @@ -34,15 +34,26 @@ import androidx.media3.transformer.TransformerAndroidTestRunner; import androidx.test.core.app.ApplicationProvider; import androidx.test.ext.junit.runners.AndroidJUnit4; import com.google.common.collect.ImmutableList; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; import org.junit.runner.RunWith; /** End-to-end instrumentation test for {@link Transformer} with {@link InAppMuxer}. */ @RunWith(AndroidJUnit4.class) public class TransformerWithInAppMuxerEndToEndTest { + @Rule public final TestName testName = new TestName(); + + private String testId; + + @Before + public void setUpTestId() { + testId = testName.getMethodName(); + } + @Test public void videoEditing_forAv1Video_completesSuccessfully() throws Exception { - String testId = "videoEditing_forAv1Video_completesSuccessfully"; Context context = ApplicationProvider.getApplicationContext(); if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( context, testId, /* inputFormat= */ MP4_ASSET_AV1_VIDEO_FORMAT, /* outputFormat= */ null)) {