From 564dc11f28ae4ab02430d0854bc83d730f59dcee Mon Sep 17 00:00:00 2001 From: claincly Date: Thu, 28 Apr 2022 11:28:32 +0100 Subject: [PATCH] Add device capability based test skipping. Change test name prefix from `transform` to `transcode` for consistency. PiperOrigin-RevId: 445106224 --- .../transformer/mh/TranscodeQualityTest.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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 db33a2ee19..90279928f9 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 @@ -36,6 +36,16 @@ public final class TranscodeQualityTest { @Test public void transformWithDecodeEncode_ssimIsGreaterThan90Percent() throws Exception { Context context = ApplicationProvider.getApplicationContext(); + String testId = "transformWithDecodeEncode_ssim"; + + if (AndroidTestUtil.skipAndLogIfInsufficientCodecSupport( + context, + testId, + /* decodingFormat= */ AndroidTestUtil.MP4_ASSET_FORMAT, + /* encodingFormat= */ AndroidTestUtil.MP4_ASSET_FORMAT)) { + return; + } + Transformer transformer = new Transformer.Builder(context) .setTransformationRequest( @@ -48,9 +58,7 @@ public final class TranscodeQualityTest { new TransformerAndroidTestRunner.Builder(context, transformer) .setCalculateSsim(true) .build() - .run( - /* testId= */ "transformWithDecodeEncode_ssim", - AndroidTestUtil.MP4_ASSET_URI_STRING); + .run(testId, AndroidTestUtil.MP4_ASSET_URI_STRING); assertThat(result.ssim).isGreaterThan(0.90); }