Add device capability based test skipping.

Change test name prefix from `transform` to `transcode` for consistency.

PiperOrigin-RevId: 445106224
This commit is contained in:
claincly 2022-04-28 11:28:32 +01:00 committed by Ian Baker
parent a16c0b3068
commit 564dc11f28

View File

@ -36,6 +36,16 @@ public final class TranscodeQualityTest {
@Test @Test
public void transformWithDecodeEncode_ssimIsGreaterThan90Percent() throws Exception { public void transformWithDecodeEncode_ssimIsGreaterThan90Percent() throws Exception {
Context context = ApplicationProvider.getApplicationContext(); 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 = Transformer transformer =
new Transformer.Builder(context) new Transformer.Builder(context)
.setTransformationRequest( .setTransformationRequest(
@ -48,9 +58,7 @@ public final class TranscodeQualityTest {
new TransformerAndroidTestRunner.Builder(context, transformer) new TransformerAndroidTestRunner.Builder(context, transformer)
.setCalculateSsim(true) .setCalculateSsim(true)
.build() .build()
.run( .run(testId, AndroidTestUtil.MP4_ASSET_URI_STRING);
/* testId= */ "transformWithDecodeEncode_ssim",
AndroidTestUtil.MP4_ASSET_URI_STRING);
assertThat(result.ssim).isGreaterThan(0.90); assertThat(result.ssim).isGreaterThan(0.90);
} }