Ignore decoding test cases when library not available

#minor-release

PiperOrigin-RevId: 452043577
This commit is contained in:
bachinger 2022-05-31 14:41:24 +00:00 committed by Marc Baechinger
parent 208a9114a9
commit 55a194c575

View File

@ -16,6 +16,7 @@
package androidx.media3.decoder.opus;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assume.assumeTrue;
import androidx.annotation.Nullable;
import androidx.media3.common.C;
@ -26,7 +27,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.common.collect.ImmutableList;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -69,11 +69,6 @@ public final class OpusDecoderTest {
private static final ImmutableList<byte[]> FULL_INITIALIZATION_DATA =
ImmutableList.of(HEADER, CUSTOM_PRE_SKIP_BYTES, CUSTOM_SEEK_PRE_ROLL_BYTES);
@Before
public void setUp() {
assertThat(LOADER.isAvailable()).isTrue();
}
@Test
public void getChannelCount() {
int channelCount = OpusDecoder.getChannelCount(HEADER);
@ -120,6 +115,7 @@ public final class OpusDecoderTest {
@Test
public void decode_removesPreSkipFromOutput() throws OpusDecoderException {
assumeTrue(LOADER.isAvailable());
OpusDecoder decoder =
new OpusDecoder(
/* numInputBuffers= */ 0,
@ -139,6 +135,7 @@ public final class OpusDecoderTest {
@Test
public void decode_whenDiscardPaddingDisabled_returnsDiscardPadding()
throws OpusDecoderException {
assumeTrue(LOADER.isAvailable());
OpusDecoder decoder =
new OpusDecoder(
/* numInputBuffers= */ 0,
@ -159,6 +156,7 @@ public final class OpusDecoderTest {
@Test
public void decode_whenDiscardPaddingEnabled_removesDiscardPadding() throws OpusDecoderException {
assumeTrue(LOADER.isAvailable());
OpusDecoder decoder =
new OpusDecoder(
/* numInputBuffers= */ 0,