Skip to content

Commit c386644

Browse files
Ignore decoding test cases when library not available
#minor-release PiperOrigin-RevId: 452043577
1 parent 14ed32c commit c386644

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

extensions/opus/src/test/java/com/google/android/exoplayer2/ext/opus/OpusDecoderTest.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package com.google.android.exoplayer2.ext.opus;
1717

1818
import static com.google.common.truth.Truth.assertThat;
19+
import static org.junit.Assume.assumeTrue;
1920

2021
import androidx.annotation.Nullable;
2122
import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -26,7 +27,6 @@
2627
import com.google.common.collect.ImmutableList;
2728
import java.nio.ByteBuffer;
2829
import java.nio.ByteOrder;
29-
import org.junit.Before;
3030
import org.junit.Test;
3131
import org.junit.runner.RunWith;
3232

@@ -69,11 +69,6 @@ protected void loadLibrary(String name) {
6969
private static final ImmutableList<byte[]> FULL_INITIALIZATION_DATA =
7070
ImmutableList.of(HEADER, CUSTOM_PRE_SKIP_BYTES, CUSTOM_SEEK_PRE_ROLL_BYTES);
7171

72-
@Before
73-
public void setUp() {
74-
assertThat(LOADER.isAvailable()).isTrue();
75-
}
76-
7772
@Test
7873
public void getChannelCount() {
7974
int channelCount = OpusDecoder.getChannelCount(HEADER);
@@ -120,6 +115,7 @@ public void getDiscardPaddingSamples_negativeSampleLength_returnZero() {
120115

121116
@Test
122117
public void decode_removesPreSkipFromOutput() throws OpusDecoderException {
118+
assumeTrue(LOADER.isAvailable());
123119
OpusDecoder decoder =
124120
new OpusDecoder(
125121
/* numInputBuffers= */ 0,
@@ -139,6 +135,7 @@ public void decode_removesPreSkipFromOutput() throws OpusDecoderException {
139135
@Test
140136
public void decode_whenDiscardPaddingDisabled_returnsDiscardPadding()
141137
throws OpusDecoderException {
138+
assumeTrue(LOADER.isAvailable());
142139
OpusDecoder decoder =
143140
new OpusDecoder(
144141
/* numInputBuffers= */ 0,
@@ -159,6 +156,7 @@ public void decode_whenDiscardPaddingDisabled_returnsDiscardPadding()
159156

160157
@Test
161158
public void decode_whenDiscardPaddingEnabled_removesDiscardPadding() throws OpusDecoderException {
159+
assumeTrue(LOADER.isAvailable());
162160
OpusDecoder decoder =
163161
new OpusDecoder(
164162
/* numInputBuffers= */ 0,

0 commit comments

Comments
 (0)