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
This commit is contained in:
huangdarwin 2024-02-22 07:26:03 -08:00 committed by Copybara-Service
parent d1ae9ffc52
commit 0d1b35477d
18 changed files with 202 additions and 120 deletions

View File

@ -41,7 +41,9 @@ import java.io.IOException;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith; 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"; "media/bitmap/sample_mp4_first_frame/linear_colors/adjust_all_hsl_settings.png";
private final Context context = getApplicationContext(); private final Context context = getApplicationContext();
@Rule public final TestName testName = new TestName();
private String testId;
private @MonotonicNonNull EGLDisplay eglDisplay; private @MonotonicNonNull EGLDisplay eglDisplay;
private @MonotonicNonNull EGLContext eglContext; private @MonotonicNonNull EGLContext eglContext;
private @MonotonicNonNull BaseGlShaderProgram hslProcessor; private @MonotonicNonNull BaseGlShaderProgram hslProcessor;
@ -81,6 +85,11 @@ public final class HslAdjustmentPixelTest {
private int inputWidth; private int inputWidth;
private int inputHeight; private int inputHeight;
@Before
public void setUpTestId() {
testId = testName.getMethodName();
}
@Before @Before
public void createGlObjects() throws IOException, GlUtil.GlException { public void createGlObjects() throws IOException, GlUtil.GlException {
eglDisplay = GlUtil.getDefaultEglDisplay(); eglDisplay = GlUtil.getDefaultEglDisplay();
@ -109,7 +118,6 @@ public final class HslAdjustmentPixelTest {
@Test @Test
public void drawFrame_noOpAdjustment_leavesFrameUnchanged() throws Exception { public void drawFrame_noOpAdjustment_leavesFrameUnchanged() throws Exception {
String testId = "drawFrame_noOpAdjustment";
HslAdjustment noOpAdjustment = new HslAdjustment.Builder().build(); HslAdjustment noOpAdjustment = new HslAdjustment.Builder().build();
hslProcessor = noOpAdjustment.toGlShaderProgram(context, /* useHdr= */ false); hslProcessor = noOpAdjustment.toGlShaderProgram(context, /* useHdr= */ false);
Size outputSize = hslProcessor.configure(inputWidth, inputHeight); Size outputSize = hslProcessor.configure(inputWidth, inputHeight);
@ -127,7 +135,6 @@ public final class HslAdjustmentPixelTest {
@Test @Test
public void drawFrame_minimumSaturation_producesGrayFrame() throws Exception { public void drawFrame_minimumSaturation_producesGrayFrame() throws Exception {
String testId = "drawFrame_minimumSaturation";
HslAdjustment minimumSaturation = new HslAdjustment.Builder().adjustSaturation(-100).build(); HslAdjustment minimumSaturation = new HslAdjustment.Builder().adjustSaturation(-100).build();
hslProcessor = minimumSaturation.toGlShaderProgram(context, /* useHdr= */ false); hslProcessor = minimumSaturation.toGlShaderProgram(context, /* useHdr= */ false);
Size outputSize = hslProcessor.configure(inputWidth, inputHeight); Size outputSize = hslProcessor.configure(inputWidth, inputHeight);
@ -145,7 +152,6 @@ public final class HslAdjustmentPixelTest {
@Test @Test
public void drawFrame_maximumSaturation_producesHighlySaturatedFrame() throws Exception { public void drawFrame_maximumSaturation_producesHighlySaturatedFrame() throws Exception {
String testId = "drawFrame_maximumSaturation";
HslAdjustment maximumSaturation = new HslAdjustment.Builder().adjustSaturation(100).build(); HslAdjustment maximumSaturation = new HslAdjustment.Builder().adjustSaturation(100).build();
hslProcessor = maximumSaturation.toGlShaderProgram(context, /* useHdr= */ false); hslProcessor = maximumSaturation.toGlShaderProgram(context, /* useHdr= */ false);
Size outputSize = hslProcessor.configure(inputWidth, inputHeight); Size outputSize = hslProcessor.configure(inputWidth, inputHeight);
@ -163,7 +169,6 @@ public final class HslAdjustmentPixelTest {
@Test @Test
public void drawFrame_rotateHueByNegative90Degrees_matchesGoldenFile() throws Exception { public void drawFrame_rotateHueByNegative90Degrees_matchesGoldenFile() throws Exception {
String testId = "drawFrame_rotateHueByNegative90Degrees";
HslAdjustment negativeHueRotation90Degrees = new HslAdjustment.Builder().adjustHue(-90).build(); HslAdjustment negativeHueRotation90Degrees = new HslAdjustment.Builder().adjustHue(-90).build();
hslProcessor = negativeHueRotation90Degrees.toGlShaderProgram(context, /* useHdr= */ false); hslProcessor = negativeHueRotation90Degrees.toGlShaderProgram(context, /* useHdr= */ false);
Size outputSize = hslProcessor.configure(inputWidth, inputHeight); Size outputSize = hslProcessor.configure(inputWidth, inputHeight);
@ -181,7 +186,6 @@ public final class HslAdjustmentPixelTest {
@Test @Test
public void drawFrame_rotateHueBy60Degrees_matchesGoldenFile() throws Exception { public void drawFrame_rotateHueBy60Degrees_matchesGoldenFile() throws Exception {
String testId = "drawFrame_rotateHueBy60Degrees";
HslAdjustment hueRotation60Degrees = new HslAdjustment.Builder().adjustHue(60).build(); HslAdjustment hueRotation60Degrees = new HslAdjustment.Builder().adjustHue(60).build();
hslProcessor = hueRotation60Degrees.toGlShaderProgram(context, /* useHdr= */ false); hslProcessor = hueRotation60Degrees.toGlShaderProgram(context, /* useHdr= */ false);
Size outputSize = hslProcessor.configure(inputWidth, inputHeight); Size outputSize = hslProcessor.configure(inputWidth, inputHeight);
@ -200,7 +204,6 @@ public final class HslAdjustmentPixelTest {
@Test @Test
public void drawFrame_rotateHueByNegative300Degrees_producesSameOutputAsRotateBy60DegreesHue() public void drawFrame_rotateHueByNegative300Degrees_producesSameOutputAsRotateBy60DegreesHue()
throws Exception { throws Exception {
String testId = "drawFrame_rotateHueByNegative300Degrees";
HslAdjustment hueRotation420Degrees = new HslAdjustment.Builder().adjustHue(-300).build(); HslAdjustment hueRotation420Degrees = new HslAdjustment.Builder().adjustHue(-300).build();
hslProcessor = hueRotation420Degrees.toGlShaderProgram(context, /* useHdr= */ false); hslProcessor = hueRotation420Degrees.toGlShaderProgram(context, /* useHdr= */ false);
Size outputSize = hslProcessor.configure(inputWidth, inputHeight); Size outputSize = hslProcessor.configure(inputWidth, inputHeight);
@ -218,7 +221,6 @@ public final class HslAdjustmentPixelTest {
@Test @Test
public void drawFrame_rotateHueBy360Degrees_leavesFrameUnchanged() throws Exception { public void drawFrame_rotateHueBy360Degrees_leavesFrameUnchanged() throws Exception {
String testId = "drawFrame_rotateHueBy360Degrees";
HslAdjustment hueRotation360Degrees = new HslAdjustment.Builder().adjustHue(360).build(); HslAdjustment hueRotation360Degrees = new HslAdjustment.Builder().adjustHue(360).build();
hslProcessor = hueRotation360Degrees.toGlShaderProgram(context, /* useHdr= */ false); hslProcessor = hueRotation360Degrees.toGlShaderProgram(context, /* useHdr= */ false);
Size outputSize = hslProcessor.configure(inputWidth, inputHeight); Size outputSize = hslProcessor.configure(inputWidth, inputHeight);
@ -236,7 +238,6 @@ public final class HslAdjustmentPixelTest {
@Test @Test
public void drawFrame_minimumLightness_producesBlackFrame() throws Exception { public void drawFrame_minimumLightness_producesBlackFrame() throws Exception {
String testId = "drawFrame_minimumLightness";
HslAdjustment minimumLightness = new HslAdjustment.Builder().adjustLightness(-100).build(); HslAdjustment minimumLightness = new HslAdjustment.Builder().adjustLightness(-100).build();
hslProcessor = minimumLightness.toGlShaderProgram(context, /* useHdr= */ false); hslProcessor = minimumLightness.toGlShaderProgram(context, /* useHdr= */ false);
Size outputSize = hslProcessor.configure(inputWidth, inputHeight); Size outputSize = hslProcessor.configure(inputWidth, inputHeight);
@ -255,7 +256,6 @@ public final class HslAdjustmentPixelTest {
@Test @Test
public void drawFrame_decreaseLightness_producesDarkerFrame() throws Exception { public void drawFrame_decreaseLightness_producesDarkerFrame() throws Exception {
String testId = "drawFrame_decreaseLightness";
HslAdjustment decreasedLightness = new HslAdjustment.Builder().adjustLightness(-50).build(); HslAdjustment decreasedLightness = new HslAdjustment.Builder().adjustLightness(-50).build();
hslProcessor = decreasedLightness.toGlShaderProgram(context, /* useHdr= */ false); hslProcessor = decreasedLightness.toGlShaderProgram(context, /* useHdr= */ false);
Size outputSize = hslProcessor.configure(inputWidth, inputHeight); Size outputSize = hslProcessor.configure(inputWidth, inputHeight);
@ -273,7 +273,6 @@ public final class HslAdjustmentPixelTest {
@Test @Test
public void drawFrame_increaseLightness_producesBrighterFrame() throws Exception { public void drawFrame_increaseLightness_producesBrighterFrame() throws Exception {
String testId = "drawFrame_increaseLightness";
HslAdjustment increasedLightness = new HslAdjustment.Builder().adjustLightness(50).build(); HslAdjustment increasedLightness = new HslAdjustment.Builder().adjustLightness(50).build();
hslProcessor = increasedLightness.toGlShaderProgram(context, /* useHdr= */ false); hslProcessor = increasedLightness.toGlShaderProgram(context, /* useHdr= */ false);
Size outputSize = hslProcessor.configure(inputWidth, inputHeight); Size outputSize = hslProcessor.configure(inputWidth, inputHeight);
@ -291,7 +290,6 @@ public final class HslAdjustmentPixelTest {
@Test @Test
public void drawFrame_maximumLightness_producesWhiteFrame() throws Exception { public void drawFrame_maximumLightness_producesWhiteFrame() throws Exception {
String testId = "drawFrame_maximumLightness";
HslAdjustment maximumLightness = new HslAdjustment.Builder().adjustLightness(100).build(); HslAdjustment maximumLightness = new HslAdjustment.Builder().adjustLightness(100).build();
hslProcessor = maximumLightness.toGlShaderProgram(context, /* useHdr= */ false); hslProcessor = maximumLightness.toGlShaderProgram(context, /* useHdr= */ false);
Size outputSize = hslProcessor.configure(inputWidth, inputHeight); Size outputSize = hslProcessor.configure(inputWidth, inputHeight);
@ -310,7 +308,6 @@ public final class HslAdjustmentPixelTest {
@Test @Test
public void drawFrame_adjustAllHslSettings_matchesGoldenFile() throws Exception { public void drawFrame_adjustAllHslSettings_matchesGoldenFile() throws Exception {
String testId = "drawFrame_adjustAllHslSettings";
HslAdjustment allHslSettingsAdjusted = HslAdjustment allHslSettingsAdjusted =
new HslAdjustment.Builder().adjustHue(60).adjustSaturation(30).adjustLightness(50).build(); new HslAdjustment.Builder().adjustHue(60).adjustSaturation(30).adjustLightness(50).build();
hslProcessor = allHslSettingsAdjusted.toGlShaderProgram(context, /* useHdr= */ false); hslProcessor = allHslSettingsAdjusted.toGlShaderProgram(context, /* useHdr= */ false);

View File

@ -40,7 +40,9 @@ import com.google.common.collect.ImmutableList;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
/** Pixel tests for {@link ThumbnailStripEffect}. */ /** Pixel tests for {@link ThumbnailStripEffect}. */
@ -50,19 +52,26 @@ public final class ThumbnailStripEffectPixelTest {
"media/bitmap/sample_mp4_first_frame/linear_colors/original.png"; "media/bitmap/sample_mp4_first_frame/linear_colors/original.png";
private static final String TWO_THUMBNAILS_STRIP_PNG_ASSET_PATH = private static final String TWO_THUMBNAILS_STRIP_PNG_ASSET_PATH =
"media/bitmap/sample_mp4_first_frame/linear_colors/two_thumbnails_strip.png"; "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 final Context context = getApplicationContext();
private @MonotonicNonNull EGLDisplay eglDisplay; private @MonotonicNonNull EGLDisplay eglDisplay;
private @MonotonicNonNull EGLContext eglContext; private @MonotonicNonNull EGLContext eglContext;
private @MonotonicNonNull EGLSurface placeholderEglSurface; private @MonotonicNonNull EGLSurface placeholderEglSurface;
private @MonotonicNonNull ThumbnailStripShaderProgram thumbnailStripShaderProgram; private @MonotonicNonNull ThumbnailStripShaderProgram thumbnailStripShaderProgram;
private String testId;
private int inputTexId; private int inputTexId;
private int inputWidth; private int inputWidth;
private int inputHeight; private int inputHeight;
@Before @Before
public void setUp() throws Exception { public void setUpTestId() {
testId = testName.getMethodName();
}
@Before
public void createGlObjects() throws Exception {
eglDisplay = GlUtil.getDefaultEglDisplay(); eglDisplay = GlUtil.getDefaultEglDisplay();
eglContext = GlUtil.createEglContext(eglDisplay); eglContext = GlUtil.createEglContext(eglDisplay);
placeholderEglSurface = GlUtil.createFocusedPlaceholderEglSurface(eglContext, eglDisplay); placeholderEglSurface = GlUtil.createFocusedPlaceholderEglSurface(eglContext, eglDisplay);
@ -85,7 +94,7 @@ public final class ThumbnailStripEffectPixelTest {
} }
@After @After
public void tearDown() throws GlUtil.GlException, VideoFrameProcessingException { public void releaseGlObjects() throws GlUtil.GlException, VideoFrameProcessingException {
if (thumbnailStripShaderProgram != null) { if (thumbnailStripShaderProgram != null) {
thumbnailStripShaderProgram.release(); thumbnailStripShaderProgram.release();
} }
@ -94,7 +103,6 @@ public final class ThumbnailStripEffectPixelTest {
@Test @Test
public void drawFrame_withOneTimestampAndOriginalSize_producesOriginalFrame() throws Exception { public void drawFrame_withOneTimestampAndOriginalSize_producesOriginalFrame() throws Exception {
String testId = "drawFrame_withOneTimestampAndOriginalSize";
ThumbnailStripEffect thumbnailStripEffect = new ThumbnailStripEffect(inputWidth, inputHeight); ThumbnailStripEffect thumbnailStripEffect = new ThumbnailStripEffect(inputWidth, inputHeight);
thumbnailStripEffect.setTimestampsMs(ImmutableList.of(0L)); thumbnailStripEffect.setTimestampsMs(ImmutableList.of(0L));
thumbnailStripShaderProgram = thumbnailStripShaderProgram =
@ -112,7 +120,6 @@ public final class ThumbnailStripEffectPixelTest {
@Test @Test
public void drawFrame_zeroTimestamps_producesEmptyFrame() throws Exception { public void drawFrame_zeroTimestamps_producesEmptyFrame() throws Exception {
String testId = "drawFrame_zeroTimestamps";
ThumbnailStripEffect thumbnailStripEffect = new ThumbnailStripEffect(inputWidth, inputHeight); ThumbnailStripEffect thumbnailStripEffect = new ThumbnailStripEffect(inputWidth, inputHeight);
thumbnailStripEffect.setTimestampsMs(ImmutableList.of()); thumbnailStripEffect.setTimestampsMs(ImmutableList.of());
thumbnailStripShaderProgram = thumbnailStripShaderProgram =
@ -131,7 +138,6 @@ public final class ThumbnailStripEffectPixelTest {
@Test @Test
public void drawFrame_lateTimestamp_producesEmptyFrame() throws Exception { public void drawFrame_lateTimestamp_producesEmptyFrame() throws Exception {
String testId = "drawFrame_lateTimestamp";
ThumbnailStripEffect thumbnailStripEffect = new ThumbnailStripEffect(inputWidth, inputHeight); ThumbnailStripEffect thumbnailStripEffect = new ThumbnailStripEffect(inputWidth, inputHeight);
thumbnailStripEffect.setTimestampsMs(ImmutableList.of(1L)); thumbnailStripEffect.setTimestampsMs(ImmutableList.of(1L));
thumbnailStripShaderProgram = thumbnailStripShaderProgram =
@ -150,7 +156,6 @@ public final class ThumbnailStripEffectPixelTest {
@Test @Test
public void drawFrame_twoTimestamps_producesStrip() throws Exception { public void drawFrame_twoTimestamps_producesStrip() throws Exception {
String testId = "drawFrame_twoTimestamps";
ThumbnailStripEffect thumbnailStripEffect = new ThumbnailStripEffect(inputWidth, inputHeight); ThumbnailStripEffect thumbnailStripEffect = new ThumbnailStripEffect(inputWidth, inputHeight);
thumbnailStripEffect.setTimestampsMs(ImmutableList.of(0L, 1L)); thumbnailStripEffect.setTimestampsMs(ImmutableList.of(0L, 1L));
thumbnailStripShaderProgram = thumbnailStripShaderProgram =

View File

@ -36,7 +36,10 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import org.json.JSONException; import org.json.JSONException;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
/** /**
@ -50,10 +53,17 @@ import org.junit.runner.RunWith;
public class ForceEndOfStreamTest { public class ForceEndOfStreamTest {
private final Context context = ApplicationProvider.getApplicationContext(); private final Context context = ApplicationProvider.getApplicationContext();
@Rule public final TestName testName = new TestName();
private String testId;
@Before
public void setUpTestId() {
testId = testName.getMethodName();
}
@Test @Test
public void transcode_decoderDroppingLastFourFrames_exportSucceeds() throws Exception { public void transcode_decoderDroppingLastFourFrames_exportSucceeds() throws Exception {
String testId = "transcode_decoderDroppingLastFourFrames_exportSucceeds";
if (skipTestBelowApi29(context, testId)) { if (skipTestBelowApi29(context, testId)) {
return; return;
} }
@ -79,7 +89,6 @@ public class ForceEndOfStreamTest {
@Test @Test
public void transcode_decoderDroppingNoFrame_exportSucceeds() throws Exception { public void transcode_decoderDroppingNoFrame_exportSucceeds() throws Exception {
String testId = "transcode_decoderDroppingNoFrame_exportSucceeds";
if (skipTestBelowApi29(context, testId)) { if (skipTestBelowApi29(context, testId)) {
return; return;
} }

View File

@ -86,7 +86,10 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
/** /**
@ -98,12 +101,19 @@ public class TransformerEndToEndTest {
private static final GlEffect NO_OP_EFFECT = new Contrast(0f); private static final GlEffect NO_OP_EFFECT = new Contrast(0f);
private final Context context = ApplicationProvider.getApplicationContext(); private final Context context = ApplicationProvider.getApplicationContext();
@Rule public final TestName testName = new TestName();
private String testId;
private volatile @MonotonicNonNull TextureAssetLoader textureAssetLoader; private volatile @MonotonicNonNull TextureAssetLoader textureAssetLoader;
@Before
public void setUpTestId() {
testId = testName.getMethodName();
}
@Test @Test
public void compositionEditing_withThreeSequences_completes() throws Exception { public void compositionEditing_withThreeSequences_completes() throws Exception {
String testId = "compositionEditing_withThreeSequences_completes";
Transformer transformer = new Transformer.Builder(context).build(); Transformer transformer = new Transformer.Builder(context).build();
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
@ -176,7 +186,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void videoEditing_withImageInput_completesWithCorrectFrameCountAndDuration() public void videoEditing_withImageInput_completesWithCorrectFrameCountAndDuration()
throws Exception { throws Exception {
String testId = "videoEditing_withImageInput_completesWithCorrectFrameCountAndDuration";
Transformer transformer = new Transformer.Builder(context).build(); Transformer transformer = new Transformer.Builder(context).build();
ImmutableList<Effect> videoEffects = ImmutableList.of(Presentation.createForHeight(480)); ImmutableList<Effect> videoEffects = ImmutableList.of(Presentation.createForHeight(480));
Effects effects = new Effects(/* audioProcessors= */ ImmutableList.of(), videoEffects); Effects effects = new Effects(/* audioProcessors= */ ImmutableList.of(), videoEffects);
@ -201,7 +210,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void videoTranscoding_withImageInput_completesWithCorrectFrameCountAndDuration() public void videoTranscoding_withImageInput_completesWithCorrectFrameCountAndDuration()
throws Exception { throws Exception {
String testId = "videoTranscoding_withImageInput_completesWithCorrectFrameCountAndDuration";
Transformer transformer = new Transformer.Builder(context).build(); Transformer transformer = new Transformer.Builder(context).build();
int expectedFrameCount = 40; int expectedFrameCount = 40;
EditedMediaItem editedMediaItem = EditedMediaItem editedMediaItem =
@ -223,7 +231,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void videoEditing_withTextureInput_completesWithCorrectFrameCountAndDuration() public void videoEditing_withTextureInput_completesWithCorrectFrameCountAndDuration()
throws Exception { throws Exception {
String testId = "videoEditing_withTextureInput_completesWithCorrectFrameCountAndDuration";
Bitmap bitmap = Bitmap bitmap =
new DataSourceBitmapLoader(context).loadBitmap(Uri.parse(PNG_ASSET_URI_STRING)).get(); new DataSourceBitmapLoader(context).loadBitmap(Uri.parse(PNG_ASSET_URI_STRING)).get();
int expectedFrameCount = 2; int expectedFrameCount = 2;
@ -277,7 +284,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void videoTranscoding_withTextureInput_completesWithCorrectFrameCountAndDuration() public void videoTranscoding_withTextureInput_completesWithCorrectFrameCountAndDuration()
throws Exception { throws Exception {
String testId = "videoTranscoding_withTextureInput_completesWithCorrectFrameCountAndDuration";
Bitmap bitmap = Bitmap bitmap =
new DataSourceBitmapLoader(context).loadBitmap(Uri.parse(PNG_ASSET_URI_STRING)).get(); new DataSourceBitmapLoader(context).loadBitmap(Uri.parse(PNG_ASSET_URI_STRING)).get();
int expectedFrameCount = 2; int expectedFrameCount = 2;
@ -327,7 +333,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void videoEditing_completesWithConsistentFrameCount() throws Exception { public void videoEditing_completesWithConsistentFrameCount() throws Exception {
String testId = "videoEditing_completesWithConsistentFrameCount";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,
@ -359,7 +364,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void videoEditing_effectsOverTime_completesWithConsistentFrameCount() throws Exception { public void videoEditing_effectsOverTime_completesWithConsistentFrameCount() throws Exception {
String testId = "videoEditing_effectsOverTime_completesWithConsistentFrameCount";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,
@ -400,7 +404,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void videoOnly_completesWithConsistentDuration() throws Exception { public void videoOnly_completesWithConsistentDuration() throws Exception {
String testId = "videoOnly_completesWithConsistentDuration";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,
@ -430,7 +433,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void clippedMedia_completesWithClippedDuration() throws Exception { public void clippedMedia_completesWithClippedDuration() throws Exception {
String testId = "clippedMedia_completesWithClippedDuration";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,
@ -506,7 +508,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void clippedMedia_trimOptimizationEnabled_fallbackToNormalExportUponFormatMismatch() public void clippedMedia_trimOptimizationEnabled_fallbackToNormalExportUponFormatMismatch()
throws Exception { throws Exception {
String testId = "clippedMedia_trimOptimizationEnabled_fallbackToNormalExportUponFormatMismatch";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,
@ -672,7 +673,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void clippedMedia_trimOptimizationEnabled_completesWithOptimizationApplied() public void clippedMedia_trimOptimizationEnabled_completesWithOptimizationApplied()
throws Exception { throws Exception {
String testId = "clippedMedia_trimOptimizationEnabled_completesWithOptimizationApplied";
if (!isRunningOnEmulator() || Util.SDK_INT != 33) { if (!isRunningOnEmulator() || Util.SDK_INT != 33) {
// The trim optimization is only guaranteed to work on emulator for this (emulator-transcoded) // The trim optimization is only guaranteed to work on emulator for this (emulator-transcoded)
// file. // file.
@ -757,7 +757,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void videoEditing_trimOptimizationEnabled_fallbackToNormalExport() throws Exception { public void videoEditing_trimOptimizationEnabled_fallbackToNormalExport() throws Exception {
String testId = "videoEditing_trimOptimizationEnabled_fallbackToNormalExport";
Transformer transformer = Transformer transformer =
new Transformer.Builder(context).experimentalSetTrimOptimizationEnabled(true).build(); new Transformer.Builder(context).experimentalSetTrimOptimizationEnabled(true).build();
if (!isRunningOnEmulator()) { if (!isRunningOnEmulator()) {
@ -794,7 +793,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void videoEncoderFormatUnsupported_completesWithError() throws Exception { public void videoEncoderFormatUnsupported_completesWithError() throws Exception {
String testId = "videoEncoderFormatUnsupported_completesWithError";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,
@ -827,7 +825,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void audioVideoTranscodedFromDifferentSequences_producesExpectedResult() throws Exception { public void audioVideoTranscodedFromDifferentSequences_producesExpectedResult() throws Exception {
Transformer transformer = new Transformer.Builder(context).build(); Transformer transformer = new Transformer.Builder(context).build();
String testId = "audioVideoTranscodedFromDifferentSequences_producesExpectedResult";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,
@ -878,7 +875,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void loopingTranscodedAudio_producesExpectedResult() throws Exception { public void loopingTranscodedAudio_producesExpectedResult() throws Exception {
Transformer transformer = new Transformer.Builder(context).build(); Transformer transformer = new Transformer.Builder(context).build();
String testId = "loopingTranscodedAudio_producesExpectedResult";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,
@ -916,7 +912,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void loopingTranscodedVideo_producesExpectedResult() throws Exception { public void loopingTranscodedVideo_producesExpectedResult() throws Exception {
Transformer transformer = new Transformer.Builder(context).build(); Transformer transformer = new Transformer.Builder(context).build();
String testId = "loopingTranscodedVideo_producesExpectedResult";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,
@ -952,7 +947,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void loopingImage_producesExpectedResult() throws Exception { public void loopingImage_producesExpectedResult() throws Exception {
Transformer transformer = new Transformer.Builder(context).build(); Transformer transformer = new Transformer.Builder(context).build();
String testId = "loopingImage_producesExpectedResult";
EditedMediaItem audioEditedMediaItem = EditedMediaItem audioEditedMediaItem =
new EditedMediaItem.Builder(MediaItem.fromUri(MP3_ASSET_URI_STRING)).build(); new EditedMediaItem.Builder(MediaItem.fromUri(MP3_ASSET_URI_STRING)).build();
EditedMediaItemSequence audioSequence = EditedMediaItemSequence audioSequence =
@ -982,7 +976,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void loopingImage_loopingSequenceIsLongest_producesExpectedResult() throws Exception { public void loopingImage_loopingSequenceIsLongest_producesExpectedResult() throws Exception {
Transformer transformer = new Transformer.Builder(context).build(); Transformer transformer = new Transformer.Builder(context).build();
String testId = "loopingImage_producesExpectedResult";
EditedMediaItem audioEditedMediaItem = EditedMediaItem audioEditedMediaItem =
new EditedMediaItem.Builder(MediaItem.fromUri(MP3_ASSET_URI_STRING)).build(); new EditedMediaItem.Builder(MediaItem.fromUri(MP3_ASSET_URI_STRING)).build();
EditedMediaItemSequence audioSequence = new EditedMediaItemSequence(audioEditedMediaItem); EditedMediaItemSequence audioSequence = new EditedMediaItemSequence(audioEditedMediaItem);
@ -1008,7 +1001,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void audioTranscode_processesInInt16Pcm() throws Exception { public void audioTranscode_processesInInt16Pcm() throws Exception {
String testId = "audioTranscode_processesInInt16Pcm";
FormatTrackingAudioBufferSink audioFormatTracker = new FormatTrackingAudioBufferSink(); FormatTrackingAudioBufferSink audioFormatTracker = new FormatTrackingAudioBufferSink();
Transformer transformer = new Transformer.Builder(context).build(); Transformer transformer = new Transformer.Builder(context).build();
@ -1032,7 +1024,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void audioEditing_monoToStereo_outputsStereo() throws Exception { public void audioEditing_monoToStereo_outputsStereo() throws Exception {
String testId = "audioEditing_monoToStereo_outputsStereo";
ChannelMixingAudioProcessor channelMixingAudioProcessor = new ChannelMixingAudioProcessor(); ChannelMixingAudioProcessor channelMixingAudioProcessor = new ChannelMixingAudioProcessor();
channelMixingAudioProcessor.putChannelMixingMatrix( channelMixingAudioProcessor.putChannelMixingMatrix(
@ -1056,7 +1047,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void transcode_withOutputVideoMimeTypeAv1_completesSuccessfully() throws Exception { public void transcode_withOutputVideoMimeTypeAv1_completesSuccessfully() throws Exception {
String testId = "transcode_withOutputVideoMimeTypeAv1_completesSuccessfully";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,
@ -1089,7 +1079,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void transcode_withOutputAudioMimeTypeAac_completesSuccessfully() throws Exception { public void transcode_withOutputAudioMimeTypeAac_completesSuccessfully() throws Exception {
String testId = "transcode_withOutputAudioMimeTypeAac_completesSuccessfully";
MediaItem mediaItem = MediaItem.fromUri(Uri.parse(MP3_ASSET_URI_STRING)); MediaItem mediaItem = MediaItem.fromUri(Uri.parse(MP3_ASSET_URI_STRING));
EditedMediaItem editedMediaItem = new EditedMediaItem.Builder(mediaItem).build(); EditedMediaItem editedMediaItem = new EditedMediaItem.Builder(mediaItem).build();
Transformer transformer = Transformer transformer =
@ -1111,7 +1100,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void transmux_audioWithEditList_preservesDuration() throws Exception { public void transmux_audioWithEditList_preservesDuration() throws Exception {
String testId = "transmux_audioWithEditList_preservesDuration";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = new Transformer.Builder(context).build(); Transformer transformer = new Transformer.Builder(context).build();
MediaItem mediaItem = MediaItem mediaItem =
@ -1151,7 +1139,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void transmux_audioWithEditListUsingInAppMuxer_preservesDuration() throws Exception { public void transmux_audioWithEditListUsingInAppMuxer_preservesDuration() throws Exception {
String testId = "transmux_AudioWithEditListUsingInAppMuxer_preservesDuration";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = Transformer transformer =
new Transformer.Builder(context) new Transformer.Builder(context)
@ -1191,7 +1178,6 @@ public class TransformerEndToEndTest {
@Test @Test
public void transmux_videoWithEditList_trimsFirstIDRFrameDuration() throws Exception { public void transmux_videoWithEditList_trimsFirstIDRFrameDuration() throws Exception {
String testId = "transmux_videoWithEditList_trimsFirstIDRFrameDuration";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
assumeTrue( assumeTrue(
"MediaMuxer doesn't support B frames reliably on older SDK versions", Util.SDK_INT >= 29); "MediaMuxer doesn't support B frames reliably on older SDK versions", Util.SDK_INT >= 29);

View File

@ -33,7 +33,10 @@ import androidx.media3.effect.Presentation;
import androidx.test.core.app.ApplicationProvider; import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
/** /**
@ -47,11 +50,18 @@ import org.junit.runner.RunWith;
public class TransformerMixedInputEndToEndTest { public class TransformerMixedInputEndToEndTest {
private final Context context = ApplicationProvider.getApplicationContext(); private final Context context = ApplicationProvider.getApplicationContext();
@Rule public final TestName testName = new TestName();
private String testId;
@Before
public void setUpTestId() {
testId = testName.getMethodName();
}
@Test @Test
public void videoEditing_withImageThenVideoInputs_completesWithCorrectFrameCount() public void videoEditing_withImageThenVideoInputs_completesWithCorrectFrameCount()
throws Exception { throws Exception {
String testId = "videoEditing_withImageThenVideoInputs_completesWithCorrectFrameCount";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,
@ -83,7 +93,6 @@ public class TransformerMixedInputEndToEndTest {
@Test @Test
public void videoEditing_withVideoThenImageInputs_completesWithCorrectFrameCount() public void videoEditing_withVideoThenImageInputs_completesWithCorrectFrameCount()
throws Exception { throws Exception {
String testId = "videoEditing_withVideoThenImageInputs_completesWithCorrectFrameCount";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,
@ -115,8 +124,6 @@ public class TransformerMixedInputEndToEndTest {
public void public void
videoEditing_withComplexVideoAndImageInputsEndWithVideo_completesWithCorrectFrameCount() videoEditing_withComplexVideoAndImageInputsEndWithVideo_completesWithCorrectFrameCount()
throws Exception { throws Exception {
String testId =
"videoEditing_withComplexVideoAndImageInputsEndWithVideo_completesWithCorrectFrameCount";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,
@ -159,8 +166,6 @@ public class TransformerMixedInputEndToEndTest {
public void public void
videoEditing_withComplexVideoAndImageInputsEndWithImage_completesWithCorrectFrameCount() videoEditing_withComplexVideoAndImageInputsEndWithImage_completesWithCorrectFrameCount()
throws Exception { throws Exception {
String testId =
"videoEditing_withComplexVideoAndImageInputsEndWithImage_completesWithCorrectFrameCount";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,

View File

@ -46,7 +46,10 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
/** Tests for using multiple {@link EditedMediaItemSequence} in a composition. */ /** 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 static final int EXPORT_HEIGHT = 240;
private final Context context = ApplicationProvider.getApplicationContext(); private final Context context = ApplicationProvider.getApplicationContext();
@Rule public final TestName testName = new TestName();
private String testId;
@Before
public void setUpTestId() {
testId = testName.getMethodName();
}
@Test @Test
public void export_withTwoSequencesEachWithOneVideoMediaItem_succeeds() throws Exception { public void export_withTwoSequencesEachWithOneVideoMediaItem_succeeds() throws Exception {
String testId = "export_withTwoSequencesEachWithOneVideoMediaItem_succeeds";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,
@ -108,7 +118,6 @@ public final class TransformerMultiSequenceCompositionTest {
@Test @Test
public void export_withTwoSequencesOneWithVideoOneWithImage_succeeds() throws Exception { public void export_withTwoSequencesOneWithVideoOneWithImage_succeeds() throws Exception {
String testId = "export_withTwoSequencesOneWithVideoOneWithImage_succeeds";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,
@ -148,7 +157,6 @@ public final class TransformerMultiSequenceCompositionTest {
@Test @Test
public void export_withTwoSequencesWithVideoCompositorSettings_succeeds() throws Exception { public void export_withTwoSequencesWithVideoCompositorSettings_succeeds() throws Exception {
String testId = "export_withTwoSequencesWithVideoCompositorSettings_succeeds";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,

View File

@ -41,9 +41,11 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TemporaryFolder; import org.junit.rules.TemporaryFolder;
import org.junit.rules.TestName;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
/** End-to-end instrumentation tests for {@link Transformer} pause and resume scenarios. */ /** 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 static final int MP4_ASSET_FRAME_COUNT = 932;
private final Context context = getApplicationContext(); private final Context context = getApplicationContext();
@Rule public final TestName testName = new TestName();
private String testId;
@Before
public void setUpTestId() {
testId = testName.getMethodName();
}
@Test @Test
public void resume_withSingleMediaItem_outputMatchesExpected() throws Exception { public void resume_withSingleMediaItem_outputMatchesExpected() throws Exception {
String testId = "resume_withSingleMediaItem_outputMatchesExpected";
if (shouldSkipDevice(testId)) { if (shouldSkipDevice(testId)) {
return; return;
} }
@ -108,7 +117,6 @@ public class TransformerPauseResumeTest {
@Test @Test
public void resume_withSingleMediaItemAfterImmediateCancellation_restartsExport() public void resume_withSingleMediaItemAfterImmediateCancellation_restartsExport()
throws Exception { throws Exception {
String testId = "resume_withSingleMediaItemAfterImmediateCancellation_restartsExport";
if (shouldSkipDevice(testId)) { if (shouldSkipDevice(testId)) {
return; return;
} }
@ -140,7 +148,6 @@ public class TransformerPauseResumeTest {
@Test @Test
public void resume_withSingleMediaItem_outputMatchesWithoutResume() throws Exception { public void resume_withSingleMediaItem_outputMatchesWithoutResume() throws Exception {
String testId = "resume_withSingleMediaItem_outputMatchesWithoutResume";
if (shouldSkipDevice(testId)) { if (shouldSkipDevice(testId)) {
return; return;
} }
@ -193,7 +200,6 @@ public class TransformerPauseResumeTest {
@Test @Test
public void resume_withSingleMediaItemHavingClippingConfig_outputMatchesWithoutResume() public void resume_withSingleMediaItemHavingClippingConfig_outputMatchesWithoutResume()
throws Exception { throws Exception {
String testId = "resume_withSingleMediaItemHavingClippingConfig_outputMatchesWithoutResume";
if (shouldSkipDevice(testId)) { if (shouldSkipDevice(testId)) {
return; return;
} }
@ -243,7 +249,6 @@ public class TransformerPauseResumeTest {
@Test @Test
public void resume_withTwoMediaItems_outputMatchesExpected() throws Exception { public void resume_withTwoMediaItems_outputMatchesExpected() throws Exception {
String testId = "resume_withTwoMediaItems_outputMatchesExpected";
if (shouldSkipDevice(testId)) { if (shouldSkipDevice(testId)) {
return; return;
} }
@ -294,7 +299,6 @@ public class TransformerPauseResumeTest {
@Test @Test
public void resume_withTwoMediaItems_outputMatchesWithoutResume() throws Exception { public void resume_withTwoMediaItems_outputMatchesWithoutResume() throws Exception {
String testId = "resume_withTwoMediaItems_outputMatchesWithoutResume";
if (shouldSkipDevice(testId)) { if (shouldSkipDevice(testId)) {
return; return;
} }

View File

@ -50,7 +50,10 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.common.base.Ascii; import com.google.common.base.Ascii;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import java.io.IOException; import java.io.IOException;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
/** /**
@ -66,10 +69,17 @@ public final class TransformerSequenceEffectTest {
private static final int EXPORT_HEIGHT = 240; private static final int EXPORT_HEIGHT = 240;
private final Context context = ApplicationProvider.getApplicationContext(); private final Context context = ApplicationProvider.getApplicationContext();
@Rule public final TestName testName = new TestName();
private String testId;
@Before
public void setUpTestId() {
testId = testName.getMethodName();
}
@Test @Test
public void export_withNoCompositionPresentationAndWithPerMediaItemEffects() throws Exception { public void export_withNoCompositionPresentationAndWithPerMediaItemEffects() throws Exception {
String testId = "export_withNoCompositionPresentationAndWithPerMediaItemEffects";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,
@ -114,8 +124,6 @@ public final class TransformerSequenceEffectTest {
@Test @Test
public void export_withCompositionPresentationAndWithPerMediaItemEffects() throws Exception { public void export_withCompositionPresentationAndWithPerMediaItemEffects() throws Exception {
String testId = "export_withCompositionPresentationAndWithPerMediaItemEffects";
// Reference: b/296225823#comment5 // Reference: b/296225823#comment5
assumeFalse( assumeFalse(
"Some older MediaTek encoders have a pixel alignment of 16, which results in a 360 pixel" "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 @Test
public void export_withCompositionPresentationAndNoVideoEffects() throws Exception { public void export_withCompositionPresentationAndNoVideoEffects() throws Exception {
String testId = "export_withCompositionPresentationAndNoVideoEffects";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,
@ -196,7 +203,6 @@ public final class TransformerSequenceEffectTest {
@Test @Test
public void export_withCompositionPresentationAndNoVideoEffectsForFirstMediaItem() public void export_withCompositionPresentationAndNoVideoEffectsForFirstMediaItem()
throws Exception { throws Exception {
String testId = "export_withCompositionPresentationAndNoVideoEffectsForFirstMediaItem";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,

View File

@ -37,7 +37,10 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.junit.After; import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
/** /**
@ -48,6 +51,7 @@ import org.junit.runner.RunWith;
*/ */
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class DefaultVideoFrameProcessorMultipleTextureOutputPixelTest { public class DefaultVideoFrameProcessorMultipleTextureOutputPixelTest {
private static final String ORIGINAL_PNG_ASSET_PATH = private static final String ORIGINAL_PNG_ASSET_PATH =
"media/bitmap/sample_mp4_first_frame/electrical_colors/original.png"; "media/bitmap/sample_mp4_first_frame/electrical_colors/original.png";
private static final String MEDIA3_TEST_PNG_ASSET_PATH = 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 = 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"; "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 VideoFrameProcessorTestRunner videoFrameProcessorTestRunner;
private @MonotonicNonNull TextureBitmapReader textureBitmapReader; private @MonotonicNonNull TextureBitmapReader textureBitmapReader;
private String testId;
@Before
public void setUpTestId() {
testId = testName.getMethodName();
}
@After @After
public void release() { public void release() {
checkNotNull(videoFrameProcessorTestRunner).release(); checkNotNull(videoFrameProcessorTestRunner).release();
@ -68,7 +81,6 @@ public class DefaultVideoFrameProcessorMultipleTextureOutputPixelTest {
@Test @Test
public void textureOutput_queueBitmap_matchesGoldenFile() throws Exception { public void textureOutput_queueBitmap_matchesGoldenFile() throws Exception {
String testId = "textureOutput_queueBitmap_matchesGoldenFile";
videoFrameProcessorTestRunner = getFrameProcessorTestRunnerBuilder(testId).build(); videoFrameProcessorTestRunner = getFrameProcessorTestRunnerBuilder(testId).build();
ImmutableList<Long> inputTimestamps = ImmutableList.of(1_000_000L, 2_000_000L, 3_000_000L); ImmutableList<Long> inputTimestamps = ImmutableList.of(1_000_000L, 2_000_000L, 3_000_000L);
@ -89,7 +101,6 @@ public class DefaultVideoFrameProcessorMultipleTextureOutputPixelTest {
@Test @Test
public void textureOutput_queueTwoBitmaps_matchesGoldenFiles() throws Exception { public void textureOutput_queueTwoBitmaps_matchesGoldenFiles() throws Exception {
String testId = "textureOutput_queueTwoBitmaps_matchesGoldenFiles";
videoFrameProcessorTestRunner = getFrameProcessorTestRunnerBuilder(testId).build(); videoFrameProcessorTestRunner = getFrameProcessorTestRunnerBuilder(testId).build();
ImmutableList<Long> inputTimestamps1 = ImmutableList.of(1_000_000L, 1_500_000L); ImmutableList<Long> inputTimestamps1 = ImmutableList.of(1_000_000L, 1_500_000L);
ImmutableList<Long> inputTimestamps2 = ImmutableList.of(2_000_000L, 3_000_000L, 4_000_000L); ImmutableList<Long> 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. // TODO: b/302695659 - Make this test more deterministic.
@Test @Test
public void textureOutput_queueFiveBitmapsAndFlush_outputsOnlyAfterFlush() throws Exception { public void textureOutput_queueFiveBitmapsAndFlush_outputsOnlyAfterFlush() throws Exception {
String testId = "textureOutput_queueFiveBitmapsAndFlush_outputsOnlyAfterFlush";
videoFrameProcessorTestRunner = getFrameProcessorTestRunnerBuilder(testId).build(); videoFrameProcessorTestRunner = getFrameProcessorTestRunnerBuilder(testId).build();
ImmutableList<Long> inputTimestamps1 = ImmutableList.of(1_000_000L, 2_000_000L, 3_000_000L); ImmutableList<Long> inputTimestamps1 = ImmutableList.of(1_000_000L, 2_000_000L, 3_000_000L);
ImmutableList<Long> inputTimestamps2 = ImmutableList.of(4_000_000L, 5_000_000L, 6_000_000L); ImmutableList<Long> inputTimestamps2 = ImmutableList.of(4_000_000L, 5_000_000L, 6_000_000L);

View File

@ -54,7 +54,10 @@ import com.google.common.collect.ImmutableList;
import java.util.List; import java.util.List;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.junit.After; import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
/** /**
@ -87,8 +90,17 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest {
/** Input HLG video of which we only use the first frame. */ /** 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"; 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; private @MonotonicNonNull VideoFrameProcessorTestRunner videoFrameProcessorTestRunner;
@Before
public void setUpTestId() {
testId = testName.getMethodName();
}
@After @After
public void release() { public void release() {
if (videoFrameProcessorTestRunner != null) { if (videoFrameProcessorTestRunner != null) {
@ -98,7 +110,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest {
@Test @Test
public void noEffects_matchesGoldenFile() throws Exception { public void noEffects_matchesGoldenFile() throws Exception {
String testId = "noEffects_matchesGoldenFile";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
getApplicationContext(), getApplicationContext(),
testId, testId,
@ -121,7 +132,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest {
@Test @Test
public void noEffects_textureInput_matchesGoldenFile() throws Exception { public void noEffects_textureInput_matchesGoldenFile() throws Exception {
String testId = "noEffects_textureInput_matchesGoldenFile";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
getApplicationContext(), getApplicationContext(),
testId, testId,
@ -152,7 +162,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest {
@Test @Test
public void bitmapOverlay_matchesGoldenFile() throws Exception { public void bitmapOverlay_matchesGoldenFile() throws Exception {
String testId = "bitmapOverlay_matchesGoldenFile";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
getApplicationContext(), getApplicationContext(),
testId, testId,
@ -179,7 +188,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest {
@Test @Test
public void bitmapOverlay_textureInput_matchesGoldenFile() throws Exception { public void bitmapOverlay_textureInput_matchesGoldenFile() throws Exception {
String testId = "bitmapOverlay_textureInput_matchesGoldenFile";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
getApplicationContext(), getApplicationContext(),
testId, testId,
@ -210,7 +218,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest {
@Test @Test
public void noEffects_hlg10Input_matchesGoldenFile() throws Exception { public void noEffects_hlg10Input_matchesGoldenFile() throws Exception {
String testId = "noEffects_hlg10Input_matchesGoldenFile";
Context context = getApplicationContext(); Context context = getApplicationContext();
Format format = MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT; Format format = MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT;
if (!deviceSupportsHdrEditing(format)) { if (!deviceSupportsHdrEditing(format)) {
@ -242,7 +249,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest {
@Test @Test
public void noEffects_hlg10TextureInput_matchesGoldenFile() throws Exception { public void noEffects_hlg10TextureInput_matchesGoldenFile() throws Exception {
String testId = "noEffects_hlg10TextureInput_matchesGoldenFile";
Context context = getApplicationContext(); Context context = getApplicationContext();
Format format = MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT; Format format = MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT;
if (!deviceSupportsHdrEditing(format)) { if (!deviceSupportsHdrEditing(format)) {
@ -278,7 +284,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest {
@Test @Test
public void noEffects_hdr10Input_matchesGoldenFile() throws Exception { public void noEffects_hdr10Input_matchesGoldenFile() throws Exception {
String testId = "noEffects_hdr10Input_matchesGoldenFile";
Context context = getApplicationContext(); Context context = getApplicationContext();
Format format = MP4_ASSET_720P_4_SECOND_HDR10_FORMAT; Format format = MP4_ASSET_720P_4_SECOND_HDR10_FORMAT;
if (!deviceSupportsHdrEditing(format)) { if (!deviceSupportsHdrEditing(format)) {
@ -310,7 +315,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest {
@Test @Test
public void noEffects_hdr10TextureInput_matchesGoldenFile() throws Exception { public void noEffects_hdr10TextureInput_matchesGoldenFile() throws Exception {
String testId = "noEffects_hdr10TextureInput_matchesGoldenFile";
Context context = getApplicationContext(); Context context = getApplicationContext();
Format format = MP4_ASSET_720P_4_SECOND_HDR10_FORMAT; Format format = MP4_ASSET_720P_4_SECOND_HDR10_FORMAT;
if (!deviceSupportsHdrEditing(format)) { if (!deviceSupportsHdrEditing(format)) {
@ -346,7 +350,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest {
@Test @Test
public void noOpEffect_hlg10Input_matchesGoldenFile() throws Exception { public void noOpEffect_hlg10Input_matchesGoldenFile() throws Exception {
String testId = "noOpEffect_hlg10Input_matchesGoldenFile";
Context context = getApplicationContext(); Context context = getApplicationContext();
Format format = MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT; Format format = MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT;
if (!deviceSupportsHdrEditing(format)) { if (!deviceSupportsHdrEditing(format)) {
@ -379,7 +382,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest {
@Test @Test
public void noOpEffect_hlg10TextureInput_matchesGoldenFile() throws Exception { public void noOpEffect_hlg10TextureInput_matchesGoldenFile() throws Exception {
String testId = "noOpEffect_hlg10TextureInput_matchesGoldenFile";
Context context = getApplicationContext(); Context context = getApplicationContext();
Format format = MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT; Format format = MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT;
if (!deviceSupportsHdrEditing(format)) { if (!deviceSupportsHdrEditing(format)) {
@ -415,7 +417,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest {
@Test @Test
public void noOpEffect_hdr10Input_matchesGoldenFile() throws Exception { public void noOpEffect_hdr10Input_matchesGoldenFile() throws Exception {
String testId = "noOpEffect_hdr10Input_matchesGoldenFile";
Context context = getApplicationContext(); Context context = getApplicationContext();
Format format = MP4_ASSET_720P_4_SECOND_HDR10_FORMAT; Format format = MP4_ASSET_720P_4_SECOND_HDR10_FORMAT;
if (!deviceSupportsHdrEditing(format)) { if (!deviceSupportsHdrEditing(format)) {
@ -448,7 +449,6 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest {
@Test @Test
public void noOpEffect_hdr10TextureInput_matchesGoldenFile() throws Exception { public void noOpEffect_hdr10TextureInput_matchesGoldenFile() throws Exception {
String testId = "noOpEffect_hdr10TextureInput_matchesGoldenFile";
Context context = getApplicationContext(); Context context = getApplicationContext();
Format format = MP4_ASSET_720P_4_SECOND_HDR10_FORMAT; Format format = MP4_ASSET_720P_4_SECOND_HDR10_FORMAT;
if (!deviceSupportsHdrEditing(format)) { if (!deviceSupportsHdrEditing(format)) {

View File

@ -59,18 +59,27 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.common.base.Ascii; import com.google.common.base.Ascii;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import org.junit.AssumptionViolatedException; import org.junit.AssumptionViolatedException;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
/** {@link Transformer} instrumentation tests. */ /** {@link Transformer} instrumentation tests. */
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class ExportTest { public class ExportTest {
private static final String TAG = "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 @Test
public void export() throws Exception { public void export() throws Exception {
String testId = TAG + "_export";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
// Note: throughout this class we only check decoding capability as tests should still run if // 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. // Transformer is able to succeed by falling back to a lower resolution.
@ -99,7 +108,6 @@ public class ExportTest {
@Test @Test
public void exportWithoutDecodeEncode() throws Exception { public void exportWithoutDecodeEncode() throws Exception {
String testId = TAG + "_exportWithoutDecodeEncode";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = new Transformer.Builder(context).build(); Transformer transformer = new Transformer.Builder(context).build();
MediaItem mediaItem = MediaItem mediaItem =
@ -110,7 +118,6 @@ public class ExportTest {
@Test @Test
public void exportToSpecificBitrate() throws Exception { public void exportToSpecificBitrate() throws Exception {
String testId = TAG + "_exportToSpecificBitrate";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
@ -143,7 +150,6 @@ public class ExportTest {
@Test @Test
public void export4K60() throws Exception { public void export4K60() throws Exception {
String testId = TAG + "_export4K60";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
@ -172,8 +178,6 @@ public class ExportTest {
@Test @Test
public void export8K24() throws Exception { public void export8K24() throws Exception {
String testId = TAG + "_export8K24";
// Reference: b/244711282#comment5 // Reference: b/244711282#comment5
assumeFalse( assumeFalse(
"Some devices are capable of instantiating only either one 8K decoder or one 8K encoder", "Some devices are capable of instantiating only either one 8K decoder or one 8K encoder",
@ -205,7 +209,6 @@ public class ExportTest {
@Test @Test
public void export8K24_withDownscaling() throws Exception { public void export8K24_withDownscaling() throws Exception {
// This test is to cover devices that are able to either decode or encode 8K, but not transcode. // 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 downscaledWidth = 320;
int downscaledHeight = 240; int downscaledHeight = 240;
@ -241,7 +244,6 @@ public class ExportTest {
@Test @Test
public void exportNoAudio() throws Exception { public void exportNoAudio() throws Exception {
String testId = TAG + "_exportNoAudio";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
@ -270,7 +272,6 @@ public class ExportTest {
@Test @Test
public void exportNoVideo() throws Exception { public void exportNoVideo() throws Exception {
String testId = TAG + "_exportNoVideo";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = Transformer transformer =
new Transformer.Builder(context) new Transformer.Builder(context)
@ -287,7 +288,6 @@ public class ExportTest {
@Test @Test
public void exportSef() throws Exception { public void exportSef() throws Exception {
String testId = TAG + "_exportSef";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (SDK_INT < 25) { if (SDK_INT < 25) {
@ -313,7 +313,6 @@ public class ExportTest {
@Test @Test
public void exportSefH265() throws Exception { public void exportSefH265() throws Exception {
String testId = TAG + "_exportSefH265";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (SDK_INT < 25) { if (SDK_INT < 25) {
@ -335,7 +334,6 @@ public class ExportTest {
@Test @Test
public void exportFrameRotation() throws Exception { public void exportFrameRotation() throws Exception {
String testId = TAG + "_exportFrameRotation";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
@ -361,7 +359,6 @@ public class ExportTest {
@Test @Test
public void exportTranscodeBt2020Sdr() throws Exception { public void exportTranscodeBt2020Sdr() throws Exception {
String testId = TAG + "exportBt2020Sdr";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
// Reference: b/262732842#comment51 // Reference: b/262732842#comment51
if (SDK_INT <= 27 && Util.MANUFACTURER.equals("samsung")) { if (SDK_INT <= 27 && Util.MANUFACTURER.equals("samsung")) {

View File

@ -39,7 +39,10 @@ import androidx.media3.transformer.Transformer;
import androidx.media3.transformer.TransformerAndroidTestRunner; import androidx.media3.transformer.TransformerAndroidTestRunner;
import androidx.test.core.app.ApplicationProvider; import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
/** /**
@ -49,10 +52,17 @@ import org.junit.runner.RunWith;
*/ */
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class ForceInterpretHdrVideoAsSdrTest { public class ForceInterpretHdrVideoAsSdrTest {
@Rule public final TestName testName = new TestName();
private String testId;
@Before
public void setUpTestId() {
testId = testName.getMethodName();
}
@Test @Test
public void forceInterpretHdrVideoAsSdrTest_hdr10File_transformsOrThrows() throws Exception { public void forceInterpretHdrVideoAsSdrTest_hdr10File_transformsOrThrows() throws Exception {
String testId = "forceInterpretHdrVideoAsSdrTest_hdr10File_transformsOrThrows";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (SDK_INT < 29) { if (SDK_INT < 29) {
@ -96,7 +106,6 @@ public class ForceInterpretHdrVideoAsSdrTest {
@Test @Test
public void forceInterpretHdrVideoAsSdrTest_hlg10File_transformsOrThrows() throws Exception { public void forceInterpretHdrVideoAsSdrTest_hlg10File_transformsOrThrows() throws Exception {
String testId = "forceInterpretHdrVideoAsSdrTest_hlg10File_transformsOrThrows";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (SDK_INT < 29) { if (SDK_INT < 29) {

View File

@ -51,7 +51,10 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
/** /**
@ -61,9 +64,17 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public final class HdrEditingTest { public final class HdrEditingTest {
@Rule public final TestName testName = new TestName();
private String testId;
@Before
public void setUpTestId() {
testId = testName.getMethodName();
}
@Test @Test
public void export_transmuxHdr10File() throws Exception { public void export_transmuxHdr10File() throws Exception {
String testId = "export_transmuxHdr10File";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (Util.SDK_INT < 24) { if (Util.SDK_INT < 24) {
@ -97,7 +108,6 @@ public final class HdrEditingTest {
@Test @Test
public void export_transmuxHlg10File() throws Exception { public void export_transmuxHlg10File() throws Exception {
String testId = "export_transmuxHlg10File";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (Util.SDK_INT < 24) { if (Util.SDK_INT < 24) {
@ -131,7 +141,6 @@ public final class HdrEditingTest {
@Test @Test
public void exportAndTranscode_hdr10File_whenHdrEditingIsSupported() throws Exception { public void exportAndTranscode_hdr10File_whenHdrEditingIsSupported() throws Exception {
String testId = "exportAndTranscode_hdr10File_whenHdrEditingIsSupported";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
Format format = MP4_ASSET_720P_4_SECOND_HDR10_FORMAT; Format format = MP4_ASSET_720P_4_SECOND_HDR10_FORMAT;
if (!deviceSupportsHdrEditing(VIDEO_H265, format.colorInfo)) { if (!deviceSupportsHdrEditing(VIDEO_H265, format.colorInfo)) {
@ -163,7 +172,6 @@ public final class HdrEditingTest {
@Test @Test
public void exportAndTranscode_hlg10File_whenHdrEditingIsSupported() throws Exception { public void exportAndTranscode_hlg10File_whenHdrEditingIsSupported() throws Exception {
String testId = "exportAndTranscode_hlg10File_whenHdrEditingIsSupported";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
Format format = MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT; Format format = MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT;
if (!deviceSupportsHdrEditing(VIDEO_H265, format.colorInfo)) { if (!deviceSupportsHdrEditing(VIDEO_H265, format.colorInfo)) {
@ -195,7 +203,6 @@ public final class HdrEditingTest {
@Test @Test
public void exportAndTranscode_dolbyVisionFile_whenHdrEditingIsSupported() throws Exception { public void exportAndTranscode_dolbyVisionFile_whenHdrEditingIsSupported() throws Exception {
String testId = "exportAndTranscode_dolbyVisionFile_whenHdrEditingIsSupported";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
Format format = MP4_ASSET_DOLBY_VISION_HDR_FORMAT; Format format = MP4_ASSET_DOLBY_VISION_HDR_FORMAT;
if (!deviceSupportsHdrEditing(VIDEO_H265, format.colorInfo)) { if (!deviceSupportsHdrEditing(VIDEO_H265, format.colorInfo)) {
@ -228,7 +235,6 @@ public final class HdrEditingTest {
@Test @Test
public void exportAndTranscode_hdr10File_whenHdrEditingUnsupported_toneMapsOrThrows() public void exportAndTranscode_hdr10File_whenHdrEditingUnsupported_toneMapsOrThrows()
throws Exception { throws Exception {
String testId = "exportAndTranscode_hdr10File_whenHdrEditingUnsupported_toneMapsOrThrows";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
Format format = MP4_ASSET_720P_4_SECOND_HDR10_FORMAT; Format format = MP4_ASSET_720P_4_SECOND_HDR10_FORMAT;
if (deviceSupportsHdrEditing(VIDEO_H265, format.colorInfo)) { if (deviceSupportsHdrEditing(VIDEO_H265, format.colorInfo)) {
@ -294,7 +300,6 @@ public final class HdrEditingTest {
@Test @Test
public void exportAndTranscode_hlg10File_whenHdrEditingUnsupported_toneMapsOrThrows() public void exportAndTranscode_hlg10File_whenHdrEditingUnsupported_toneMapsOrThrows()
throws Exception { throws Exception {
String testId = "exportAndTranscode_hlg10File_whenHdrEditingUnsupported_toneMapsOrThrows";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
Format format = MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT; Format format = MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT;
if (deviceSupportsHdrEditing(VIDEO_H265, format.colorInfo)) { if (deviceSupportsHdrEditing(VIDEO_H265, format.colorInfo)) {

View File

@ -39,7 +39,10 @@ import androidx.media3.transformer.TransformerAndroidTestRunner;
import androidx.test.core.app.ApplicationProvider; import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import java.util.Objects; import java.util.Objects;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
/** /**
@ -48,10 +51,17 @@ import org.junit.runner.RunWith;
*/ */
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class ToneMapHdrToSdrUsingMediaCodecTest { public class ToneMapHdrToSdrUsingMediaCodecTest {
@Rule public final TestName testName = new TestName();
private String testId;
@Before
public void setUpTestId() {
testId = testName.getMethodName();
}
@Test @Test
public void export_toneMapNoRequestedTranscode_hdr10File_toneMapsOrThrows() throws Exception { public void export_toneMapNoRequestedTranscode_hdr10File_toneMapsOrThrows() throws Exception {
String testId = "export_toneMapNoRequestedTranscode_hdr10File_toneMapsOrThrows";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
@ -114,7 +124,6 @@ public class ToneMapHdrToSdrUsingMediaCodecTest {
@Test @Test
public void export_toneMapNoRequestedTranscode_hlg10File_toneMapsOrThrows() throws Exception { public void export_toneMapNoRequestedTranscode_hlg10File_toneMapsOrThrows() throws Exception {
String testId = "export_toneMapNoRequestedTranscode_hlg10File_toneMapsOrThrows";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
@ -177,7 +186,6 @@ public class ToneMapHdrToSdrUsingMediaCodecTest {
@Test @Test
public void export_toneMapAndTranscode_hdr10File_toneMapsOrThrows() throws Exception { public void export_toneMapAndTranscode_hdr10File_toneMapsOrThrows() throws Exception {
String testId = "export_toneMapAndTranscode_hdr10File_toneMapsOrThrows";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
@ -241,7 +249,6 @@ public class ToneMapHdrToSdrUsingMediaCodecTest {
@Test @Test
public void export_toneMapAndTranscode_hlg10File_toneMapsOrThrows() throws Exception { public void export_toneMapAndTranscode_hlg10File_toneMapsOrThrows() throws Exception {
String testId = "export_toneMapAndTranscode_hlg10File_toneMapsOrThrows";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(

View File

@ -36,7 +36,10 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.junit.After; import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
/** /**
@ -110,8 +113,16 @@ public final class ToneMapHdrToSdrUsingOpenGlPixelTest {
.setColorTransfer(C.COLOR_TRANSFER_GAMMA_2_2) .setColorTransfer(C.COLOR_TRANSFER_GAMMA_2_2)
.build(); .build();
@Rule public final TestName testName = new TestName();
private String testId;
private @MonotonicNonNull VideoFrameProcessorTestRunner videoFrameProcessorTestRunner; private @MonotonicNonNull VideoFrameProcessorTestRunner videoFrameProcessorTestRunner;
@Before
public void setUpTestId() {
testId = testName.getMethodName();
}
@After @After
public void release() { public void release() {
if (videoFrameProcessorTestRunner != null) { if (videoFrameProcessorTestRunner != null) {
@ -121,7 +132,6 @@ public final class ToneMapHdrToSdrUsingOpenGlPixelTest {
@Test @Test
public void toneMap_hlgFrame_matchesGoldenFile() throws Exception { public void toneMap_hlgFrame_matchesGoldenFile() throws Exception {
String testId = "toneMap_hlgFrame_matchesGoldenFile";
if (skipAndLogIfOpenGlToneMappingUnsupported(testId, HLG_ASSET_FORMAT)) { if (skipAndLogIfOpenGlToneMappingUnsupported(testId, HLG_ASSET_FORMAT)) {
return; return;
} }
@ -159,7 +169,6 @@ public final class ToneMapHdrToSdrUsingOpenGlPixelTest {
@Test @Test
public void toneMapWithNoOpEffect_hlgFrame_matchesGoldenFile() throws Exception { public void toneMapWithNoOpEffect_hlgFrame_matchesGoldenFile() throws Exception {
String testId = "toneMapWithNoOpEffect_hlgFrame_matchesGoldenFile";
if (skipAndLogIfOpenGlToneMappingUnsupported(testId, HLG_ASSET_FORMAT)) { if (skipAndLogIfOpenGlToneMappingUnsupported(testId, HLG_ASSET_FORMAT)) {
return; return;
} }
@ -198,7 +207,6 @@ public final class ToneMapHdrToSdrUsingOpenGlPixelTest {
@Test @Test
public void toneMap_pqFrame_matchesGoldenFile() throws Exception { public void toneMap_pqFrame_matchesGoldenFile() throws Exception {
String testId = "toneMap_pqFrame_matchesGoldenFile";
if (skipAndLogIfOpenGlToneMappingUnsupported(testId, PQ_ASSET_FORMAT)) { if (skipAndLogIfOpenGlToneMappingUnsupported(testId, PQ_ASSET_FORMAT)) {
return; return;
} }
@ -237,7 +245,6 @@ public final class ToneMapHdrToSdrUsingOpenGlPixelTest {
@Test @Test
public void toneMapWithNoOpEffect_pqFrame_matchesGoldenFile() throws Exception { public void toneMapWithNoOpEffect_pqFrame_matchesGoldenFile() throws Exception {
String testId = "toneMapWithNoOpEffect_pqFrame_matchesGoldenFile";
if (skipAndLogIfOpenGlToneMappingUnsupported(testId, PQ_ASSET_FORMAT)) { if (skipAndLogIfOpenGlToneMappingUnsupported(testId, PQ_ASSET_FORMAT)) {
return; return;
} }

View File

@ -36,7 +36,10 @@ import androidx.media3.transformer.Transformer;
import androidx.media3.transformer.TransformerAndroidTestRunner; import androidx.media3.transformer.TransformerAndroidTestRunner;
import androidx.test.core.app.ApplicationProvider; import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
/** /**
@ -45,12 +48,18 @@ import org.junit.runner.RunWith;
*/ */
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class ToneMapHdrToSdrUsingOpenGlTest { public class ToneMapHdrToSdrUsingOpenGlTest {
@Rule public final TestName testName = new TestName();
private final Context context = ApplicationProvider.getApplicationContext(); private final Context context = ApplicationProvider.getApplicationContext();
private String testId;
@Before
public void setUpTestId() {
testId = testName.getMethodName();
}
@Test @Test
public void export_toneMap_hlg10File_toneMaps() throws Exception { public void export_toneMap_hlg10File_toneMaps() throws Exception {
String testId = "export_glToneMap_hlg10File_toneMaps";
if (skipAndLogIfOpenGlToneMappingUnsupported( if (skipAndLogIfOpenGlToneMappingUnsupported(
testId, /* inputFormat= */ MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT)) { testId, /* inputFormat= */ MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT)) {
return; return;
@ -61,7 +70,6 @@ public class ToneMapHdrToSdrUsingOpenGlTest {
@Test @Test
public void export_toneMap_hdr10File_toneMaps() throws Exception { public void export_toneMap_hdr10File_toneMaps() throws Exception {
String testId = "export_glToneMap_hdr10File_toneMaps";
if (skipAndLogIfOpenGlToneMappingUnsupported( if (skipAndLogIfOpenGlToneMappingUnsupported(
testId, /* inputFormat= */ MP4_ASSET_720P_4_SECOND_HDR10_FORMAT)) { testId, /* inputFormat= */ MP4_ASSET_720P_4_SECOND_HDR10_FORMAT)) {
return; return;
@ -72,7 +80,6 @@ public class ToneMapHdrToSdrUsingOpenGlTest {
@Test @Test
public void export_toneMap_dolbyVisionFile_toneMaps() throws Exception { public void export_toneMap_dolbyVisionFile_toneMaps() throws Exception {
String testId = "export_toneMap_dolbyVisionFile_toneMaps";
if (skipAndLogIfOpenGlToneMappingUnsupported( if (skipAndLogIfOpenGlToneMappingUnsupported(
testId, /* inputFormat= */ MP4_ASSET_DOLBY_VISION_HDR_FORMAT)) { testId, /* inputFormat= */ MP4_ASSET_DOLBY_VISION_HDR_FORMAT)) {
return; return;

View File

@ -33,17 +33,28 @@ import androidx.media3.transformer.TransformerAndroidTestRunner;
import androidx.media3.transformer.VideoEncoderSettings; import androidx.media3.transformer.VideoEncoderSettings;
import androidx.test.core.app.ApplicationProvider; import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
/** Checks transcoding quality. */ /** Checks transcoding quality. */
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public final class TranscodeQualityTest { public final class TranscodeQualityTest {
@Rule public final TestName testName = new TestName();
private String testId;
@Before
public void setUpTestId() {
testId = testName.getMethodName();
}
@Test @Test
public void exportHighQualityTargetingAvcToAvc1920x1080_ssimIsGreaterThan95Percent() public void exportHighQualityTargetingAvcToAvc1920x1080_ssimIsGreaterThan95Percent()
throws Exception { throws Exception {
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
String testId = "transformHighQualityTargetingAvcToAvc1920x1080_ssim";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
@ -89,7 +100,6 @@ public final class TranscodeQualityTest {
@Test @Test
public void transcodeAvcToHevc_ssimIsGreaterThan90Percent() throws Exception { public void transcodeAvcToHevc_ssimIsGreaterThan90Percent() throws Exception {
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
String testId = "transcodeAvcToHevc_ssim";
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
@ -126,7 +136,6 @@ public final class TranscodeQualityTest {
@Test @Test
public void transcodeAvcToAvc320x240_ssimIsGreaterThan90Percent() throws Exception { public void transcodeAvcToAvc320x240_ssimIsGreaterThan90Percent() throws Exception {
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
String testId = "transcodeAvcToAvc320x240_ssim";
// Don't skip based on format support as input and output formats should be within CDD // 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. // requirements on all supported API versions, except for wearable devices.

View File

@ -34,15 +34,26 @@ import androidx.media3.transformer.TransformerAndroidTestRunner;
import androidx.test.core.app.ApplicationProvider; import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
/** End-to-end instrumentation test for {@link Transformer} with {@link InAppMuxer}. */ /** End-to-end instrumentation test for {@link Transformer} with {@link InAppMuxer}. */
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class TransformerWithInAppMuxerEndToEndTest { public class TransformerWithInAppMuxerEndToEndTest {
@Rule public final TestName testName = new TestName();
private String testId;
@Before
public void setUpTestId() {
testId = testName.getMethodName();
}
@Test @Test
public void videoEditing_forAv1Video_completesSuccessfully() throws Exception { public void videoEditing_forAv1Video_completesSuccessfully() throws Exception {
String testId = "videoEditing_forAv1Video_completesSuccessfully";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, testId, /* inputFormat= */ MP4_ASSET_AV1_VIDEO_FORMAT, /* outputFormat= */ null)) { context, testId, /* inputFormat= */ MP4_ASSET_AV1_VIDEO_FORMAT, /* outputFormat= */ null)) {