Test: Remove nullness for testid

This also makes it more consistent with newer testId tests that don't have nullness, so tests don't look inconsistent, and was pretty easy to do :P

PiperOrigin-RevId: 616856888
This commit is contained in:
huangdarwin 2024-03-18 09:44:07 -07:00 committed by Copybara-Service
parent 1adb2b270d
commit e446f20a70
20 changed files with 37 additions and 182 deletions

View File

@ -36,9 +36,7 @@ import androidx.media3.common.util.Size;
import androidx.media3.test.utils.BitmapPixelTestUtil; import androidx.media3.test.utils.BitmapPixelTestUtil;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import java.io.IOException; import java.io.IOException;
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
@ -70,7 +68,7 @@ public final class AlphaScaleShaderProgramPixelTest {
private final Context context = getApplicationContext(); private final Context context = getApplicationContext();
private @MonotonicNonNull String testId; private String testId;
private @MonotonicNonNull EGLDisplay eglDisplay; private @MonotonicNonNull EGLDisplay eglDisplay;
private @MonotonicNonNull EGLContext eglContext; private @MonotonicNonNull EGLContext eglContext;
private @MonotonicNonNull AlphaScaleShaderProgram alphaScaleShaderProgram; private @MonotonicNonNull AlphaScaleShaderProgram alphaScaleShaderProgram;
@ -104,7 +102,6 @@ public final class AlphaScaleShaderProgramPixelTest {
} }
@Before @Before
@EnsuresNonNull("testId")
public void setUpTestId() { public void setUpTestId() {
testId = testName.getMethodName(); testId = testName.getMethodName();
} }
@ -118,7 +115,6 @@ public final class AlphaScaleShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void noOpAlpha_matchesGoldenFile() throws Exception { public void noOpAlpha_matchesGoldenFile() throws Exception {
alphaScaleShaderProgram = new AlphaScale(1.0f).toGlShaderProgram(context, /* useHdr= */ false); alphaScaleShaderProgram = new AlphaScale(1.0f).toGlShaderProgram(context, /* useHdr= */ false);
Size outputSize = alphaScaleShaderProgram.configure(inputWidth, inputHeight); Size outputSize = alphaScaleShaderProgram.configure(inputWidth, inputHeight);
@ -138,7 +134,6 @@ public final class AlphaScaleShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void zeroAlpha_matchesGoldenFile() throws Exception { public void zeroAlpha_matchesGoldenFile() throws Exception {
alphaScaleShaderProgram = new AlphaScale(0.0f).toGlShaderProgram(context, /* useHdr= */ false); alphaScaleShaderProgram = new AlphaScale(0.0f).toGlShaderProgram(context, /* useHdr= */ false);
Size outputSize = alphaScaleShaderProgram.configure(inputWidth, inputHeight); Size outputSize = alphaScaleShaderProgram.configure(inputWidth, inputHeight);
@ -157,7 +152,6 @@ public final class AlphaScaleShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void decreaseAlpha_matchesGoldenFile() throws Exception { public void decreaseAlpha_matchesGoldenFile() throws Exception {
alphaScaleShaderProgram = new AlphaScale(0.5f).toGlShaderProgram(context, /* useHdr= */ false); alphaScaleShaderProgram = new AlphaScale(0.5f).toGlShaderProgram(context, /* useHdr= */ false);
Size outputSize = alphaScaleShaderProgram.configure(inputWidth, inputHeight); Size outputSize = alphaScaleShaderProgram.configure(inputWidth, inputHeight);
@ -176,7 +170,6 @@ public final class AlphaScaleShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void increaseAlpha_matchesGoldenFile() throws Exception { public void increaseAlpha_matchesGoldenFile() throws Exception {
alphaScaleShaderProgram = new AlphaScale(1.5f).toGlShaderProgram(context, /* useHdr= */ false); alphaScaleShaderProgram = new AlphaScale(1.5f).toGlShaderProgram(context, /* useHdr= */ false);
Size outputSize = alphaScaleShaderProgram.configure(inputWidth, inputHeight); Size outputSize = alphaScaleShaderProgram.configure(inputWidth, inputHeight);

View File

@ -38,9 +38,7 @@ import androidx.media3.common.util.GlUtil;
import androidx.media3.common.util.Size; import androidx.media3.common.util.Size;
import androidx.media3.test.utils.BitmapPixelTestUtil; import androidx.media3.test.utils.BitmapPixelTestUtil;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
@ -74,7 +72,7 @@ public class ContrastPixelTest {
private final Context context = getApplicationContext(); private final Context context = getApplicationContext();
private @MonotonicNonNull String testId; private String testId;
private @MonotonicNonNull EGLDisplay eglDisplay; private @MonotonicNonNull EGLDisplay eglDisplay;
private @MonotonicNonNull EGLContext eglContext; private @MonotonicNonNull EGLContext eglContext;
private @MonotonicNonNull EGLSurface placeholderEglSurface; private @MonotonicNonNull EGLSurface placeholderEglSurface;
@ -96,7 +94,6 @@ public class ContrastPixelTest {
} }
@Before @Before
@EnsuresNonNull("testId")
public void setUpTestId() { public void setUpTestId() {
testId = testName.getMethodName(); testId = testName.getMethodName();
} }
@ -110,7 +107,6 @@ public class ContrastPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_noContrastChange_leavesFrameUnchanged() throws Exception { public void drawFrame_noContrastChange_leavesFrameUnchanged() throws Exception {
contrastShaderProgram = contrastShaderProgram =
new Contrast(/* contrast= */ 0.0f).toGlShaderProgram(context, /* useHdr= */ false); new Contrast(/* contrast= */ 0.0f).toGlShaderProgram(context, /* useHdr= */ false);
@ -129,7 +125,6 @@ public class ContrastPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_minimumContrast_producesAllGrayFrame() throws Exception { public void drawFrame_minimumContrast_producesAllGrayFrame() throws Exception {
contrastShaderProgram = contrastShaderProgram =
new Contrast(/* contrast= */ -1.0f).toGlShaderProgram(context, /* useHdr= */ false); new Contrast(/* contrast= */ -1.0f).toGlShaderProgram(context, /* useHdr= */ false);
@ -153,7 +148,6 @@ public class ContrastPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_decreaseContrast_decreasesPixelsGreaterEqual128IncreasesBelow() public void drawFrame_decreaseContrast_decreasesPixelsGreaterEqual128IncreasesBelow()
throws Exception { throws Exception {
contrastShaderProgram = contrastShaderProgram =
@ -173,7 +167,6 @@ public class ContrastPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_increaseContrast_increasesPixelsGreaterEqual128DecreasesBelow() public void drawFrame_increaseContrast_increasesPixelsGreaterEqual128DecreasesBelow()
throws Exception { throws Exception {
contrastShaderProgram = contrastShaderProgram =
@ -193,7 +186,6 @@ public class ContrastPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_maximumContrast_pixelEither0or255() throws Exception { public void drawFrame_maximumContrast_pixelEither0or255() throws Exception {
contrastShaderProgram = contrastShaderProgram =
new Contrast(/* contrast= */ 1.0f).toGlShaderProgram(context, /* useHdr= */ false); new Contrast(/* contrast= */ 1.0f).toGlShaderProgram(context, /* useHdr= */ false);

View File

@ -36,9 +36,7 @@ import androidx.media3.common.util.Size;
import androidx.media3.test.utils.BitmapPixelTestUtil; import androidx.media3.test.utils.BitmapPixelTestUtil;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import java.io.IOException; import java.io.IOException;
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
@ -67,7 +65,7 @@ public final class CropPixelTest {
private final Context context = getApplicationContext(); private final Context context = getApplicationContext();
private @MonotonicNonNull String testId; private String testId;
private @MonotonicNonNull EGLDisplay eglDisplay; private @MonotonicNonNull EGLDisplay eglDisplay;
private @MonotonicNonNull EGLContext eglContext; private @MonotonicNonNull EGLContext eglContext;
private @MonotonicNonNull BaseGlShaderProgram cropShaderProgram; private @MonotonicNonNull BaseGlShaderProgram cropShaderProgram;
@ -89,7 +87,6 @@ public final class CropPixelTest {
} }
@Before @Before
@EnsuresNonNull("testId")
public void setUpTestId() { public void setUpTestId() {
testId = testName.getMethodName(); testId = testName.getMethodName();
} }
@ -105,7 +102,6 @@ public final class CropPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_noEdits_matchesGoldenFile() throws Exception { public void drawFrame_noEdits_matchesGoldenFile() throws Exception {
cropShaderProgram = cropShaderProgram =
new Crop(/* left= */ -1, /* right= */ 1, /* bottom= */ -1, /* top= */ 1) new Crop(/* left= */ -1, /* right= */ 1, /* bottom= */ -1, /* top= */ 1)
@ -126,7 +122,6 @@ public final class CropPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_cropSmaller_matchesGoldenFile() throws Exception { public void drawFrame_cropSmaller_matchesGoldenFile() throws Exception {
cropShaderProgram = cropShaderProgram =
new Crop(/* left= */ -0.9f, /* right= */ 0.1f, /* bottom= */ -1f, /* top= */ 0.5f) new Crop(/* left= */ -0.9f, /* right= */ 0.1f, /* bottom= */ -1f, /* top= */ 0.5f)
@ -147,7 +142,6 @@ public final class CropPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_cropLarger_matchesGoldenFile() throws Exception { public void drawFrame_cropLarger_matchesGoldenFile() throws Exception {
cropShaderProgram = cropShaderProgram =
new Crop(/* left= */ -2f, /* right= */ 2f, /* bottom= */ -1f, /* top= */ 2f) new Crop(/* left= */ -2f, /* right= */ 2f, /* bottom= */ -1f, /* top= */ 2f)

View File

@ -35,9 +35,7 @@ import androidx.media3.common.util.GlUtil;
import androidx.media3.test.utils.BitmapPixelTestUtil; import androidx.media3.test.utils.BitmapPixelTestUtil;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import java.io.IOException; import java.io.IOException;
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
@ -68,7 +66,7 @@ public final class DefaultShaderProgramPixelTest {
private final Context context = getApplicationContext(); private final Context context = getApplicationContext();
private @MonotonicNonNull String testId; private String testId;
private @MonotonicNonNull EGLDisplay eglDisplay; private @MonotonicNonNull EGLDisplay eglDisplay;
private @MonotonicNonNull EGLContext eglContext; private @MonotonicNonNull EGLContext eglContext;
private @MonotonicNonNull BaseGlShaderProgram defaultShaderProgram; private @MonotonicNonNull BaseGlShaderProgram defaultShaderProgram;
@ -95,7 +93,6 @@ public final class DefaultShaderProgramPixelTest {
} }
@Before @Before
@EnsuresNonNull("testId")
public void setUpTestId() { public void setUpTestId() {
testId = testName.getMethodName(); testId = testName.getMethodName();
} }
@ -111,7 +108,6 @@ public final class DefaultShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_noEdits_matchesGoldenFile() throws Exception { public void drawFrame_noEdits_matchesGoldenFile() throws Exception {
Matrix identityMatrix = new Matrix(); Matrix identityMatrix = new Matrix();
MatrixTransformation noEditsTransformation = (long presentationTimeUs) -> identityMatrix; MatrixTransformation noEditsTransformation = (long presentationTimeUs) -> identityMatrix;
@ -130,7 +126,6 @@ public final class DefaultShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_translateRight_matchesGoldenFile() throws Exception { public void drawFrame_translateRight_matchesGoldenFile() throws Exception {
Matrix translateRightMatrix = new Matrix(); Matrix translateRightMatrix = new Matrix();
translateRightMatrix.postTranslate(/* dx= */ 1, /* dy= */ 0); translateRightMatrix.postTranslate(/* dx= */ 1, /* dy= */ 0);
@ -152,7 +147,6 @@ public final class DefaultShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_scaleNarrow_matchesGoldenFile() throws Exception { public void drawFrame_scaleNarrow_matchesGoldenFile() throws Exception {
Matrix scaleNarrowMatrix = new Matrix(); Matrix scaleNarrowMatrix = new Matrix();
scaleNarrowMatrix.postScale(.5f, 1.2f); scaleNarrowMatrix.postScale(.5f, 1.2f);
@ -173,7 +167,6 @@ public final class DefaultShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_rotate90_matchesGoldenFile() throws Exception { public void drawFrame_rotate90_matchesGoldenFile() throws Exception {
Matrix rotate90Matrix = new Matrix(); Matrix rotate90Matrix = new Matrix();
rotate90Matrix.postRotate(/* degrees= */ 90); rotate90Matrix.postRotate(/* degrees= */ 90);

View File

@ -25,9 +25,7 @@ import androidx.media3.common.C;
import androidx.media3.common.VideoFrameProcessingException; import androidx.media3.common.VideoFrameProcessingException;
import androidx.media3.test.utils.VideoFrameProcessorTestRunner; import androidx.media3.test.utils.VideoFrameProcessorTestRunner;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
@ -43,11 +41,10 @@ public class DefaultVideoFrameProcessorFlushTest {
@Rule public final TestName testName = new TestName(); @Rule public final TestName testName = new TestName();
private int outputFrameCount; private int outputFrameCount;
private @MonotonicNonNull String testId; private String testId;
private @MonotonicNonNull VideoFrameProcessorTestRunner videoFrameProcessorTestRunner; private @MonotonicNonNull VideoFrameProcessorTestRunner videoFrameProcessorTestRunner;
@Before @Before
@EnsuresNonNull({"testId"})
public void setUp() { public void setUp() {
testId = testName.getMethodName(); testId = testName.getMethodName();
} }
@ -58,7 +55,6 @@ public class DefaultVideoFrameProcessorFlushTest {
} }
@Test @Test
@RequiresNonNull({"testId"})
public void imageInput_flushBeforeInput_throwsException() throws Exception { public void imageInput_flushBeforeInput_throwsException() throws Exception {
videoFrameProcessorTestRunner = createDefaultVideoFrameProcessorTestRunner(testId); videoFrameProcessorTestRunner = createDefaultVideoFrameProcessorTestRunner(testId);
@ -71,7 +67,6 @@ public class DefaultVideoFrameProcessorFlushTest {
// behavior at all, and in practice has succeeded every time on a 1000-time run. // behavior at all, and in practice has succeeded every time on a 1000-time run.
// TODO: b/302695659 - Make this test more deterministic. // TODO: b/302695659 - Make this test more deterministic.
@Test @Test
@RequiresNonNull({"testId"})
public void imageInput_flushRightAfterInput_outputsPartialFrames() throws Exception { public void imageInput_flushRightAfterInput_outputsPartialFrames() throws Exception {
videoFrameProcessorTestRunner = createDefaultVideoFrameProcessorTestRunner(testId); videoFrameProcessorTestRunner = createDefaultVideoFrameProcessorTestRunner(testId);
Bitmap bitmap = readBitmapUnpremultipliedAlpha(ORIGINAL_PNG_ASSET_PATH); Bitmap bitmap = readBitmapUnpremultipliedAlpha(ORIGINAL_PNG_ASSET_PATH);
@ -91,7 +86,6 @@ public class DefaultVideoFrameProcessorFlushTest {
} }
@Test @Test
@RequiresNonNull({"testId"})
public void imageInput_flushAfterAllFramesOutput_outputsAllFrames() throws Exception { public void imageInput_flushAfterAllFramesOutput_outputsAllFrames() throws Exception {
videoFrameProcessorTestRunner = createDefaultVideoFrameProcessorTestRunner(testId); videoFrameProcessorTestRunner = createDefaultVideoFrameProcessorTestRunner(testId);
Bitmap bitmap = readBitmapUnpremultipliedAlpha(ORIGINAL_PNG_ASSET_PATH); Bitmap bitmap = readBitmapUnpremultipliedAlpha(ORIGINAL_PNG_ASSET_PATH);

View File

@ -51,12 +51,12 @@ public class DefaultVideoFrameProcessorImageFrameOutputTest {
private static final String BITMAP_OVERLAY_PNG_ASSET_PATH = private static final String BITMAP_OVERLAY_PNG_ASSET_PATH =
"test-generated-goldens/sample_mp4_first_frame/electrical_colors/overlay_bitmap_FrameProcessor.png"; "test-generated-goldens/sample_mp4_first_frame/electrical_colors/overlay_bitmap_FrameProcessor.png";
private @MonotonicNonNull String testId; private String testId;
private @MonotonicNonNull VideoFrameProcessorTestRunner videoFrameProcessorTestRunner; private @MonotonicNonNull VideoFrameProcessorTestRunner videoFrameProcessorTestRunner;
private @MonotonicNonNull AtomicInteger framesProduced; private @MonotonicNonNull AtomicInteger framesProduced;
@Before @Before
@EnsuresNonNull({"framesProduced", "testId"}) @EnsuresNonNull({"framesProduced"})
public void setUp() { public void setUp() {
framesProduced = new AtomicInteger(); framesProduced = new AtomicInteger();
testId = testName.getMethodName(); testId = testName.getMethodName();
@ -68,7 +68,7 @@ public class DefaultVideoFrameProcessorImageFrameOutputTest {
} }
@Test @Test
@RequiresNonNull({"framesProduced", "testId"}) @RequiresNonNull({"framesProduced"})
public void imageInput_queueThreeBitmaps_outputsCorrectNumberOfFrames() throws Exception { public void imageInput_queueThreeBitmaps_outputsCorrectNumberOfFrames() throws Exception {
videoFrameProcessorTestRunner = getDefaultFrameProcessorTestRunnerBuilder(testId).build(); videoFrameProcessorTestRunner = getDefaultFrameProcessorTestRunnerBuilder(testId).build();
@ -94,7 +94,7 @@ public class DefaultVideoFrameProcessorImageFrameOutputTest {
} }
@Test @Test
@RequiresNonNull({"framesProduced", "testId"}) @RequiresNonNull({"framesProduced"})
public void imageInput_queueTwentyBitmaps_outputsCorrectNumberOfFrames() throws Exception { public void imageInput_queueTwentyBitmaps_outputsCorrectNumberOfFrames() throws Exception {
videoFrameProcessorTestRunner = getDefaultFrameProcessorTestRunnerBuilder(testId).build(); videoFrameProcessorTestRunner = getDefaultFrameProcessorTestRunnerBuilder(testId).build();
@ -112,7 +112,7 @@ public class DefaultVideoFrameProcessorImageFrameOutputTest {
} }
@Test @Test
@RequiresNonNull({"framesProduced", "testId"}) @RequiresNonNull({"framesProduced"})
public void imageInput_queueOneWithStartOffset_outputsFramesAtTheCorrectPresentationTimesUs() public void imageInput_queueOneWithStartOffset_outputsFramesAtTheCorrectPresentationTimesUs()
throws Exception { throws Exception {
Queue<Long> actualPresentationTimesUs = new ConcurrentLinkedQueue<>(); Queue<Long> actualPresentationTimesUs = new ConcurrentLinkedQueue<>();
@ -134,7 +134,7 @@ public class DefaultVideoFrameProcessorImageFrameOutputTest {
} }
@Test @Test
@RequiresNonNull({"framesProduced", "testId"}) @RequiresNonNull({"framesProduced"})
public void imageInput_queueWithStartOffsets_outputsFramesAtTheCorrectPresentationTimesUs() public void imageInput_queueWithStartOffsets_outputsFramesAtTheCorrectPresentationTimesUs()
throws Exception { throws Exception {
Queue<Long> actualPresentationTimesUs = new ConcurrentLinkedQueue<>(); Queue<Long> actualPresentationTimesUs = new ConcurrentLinkedQueue<>();
@ -166,7 +166,7 @@ public class DefaultVideoFrameProcessorImageFrameOutputTest {
} }
@Test @Test
@RequiresNonNull({"framesProduced", "testId"}) @RequiresNonNull({"framesProduced"})
public void queueBitmapsWithTimestamps_outputsFramesAtTheCorrectPresentationTimesUs() public void queueBitmapsWithTimestamps_outputsFramesAtTheCorrectPresentationTimesUs()
throws Exception { throws Exception {
Queue<Long> actualPresentationTimesUs = new ConcurrentLinkedQueue<>(); Queue<Long> actualPresentationTimesUs = new ConcurrentLinkedQueue<>();

View File

@ -33,9 +33,7 @@ import androidx.media3.test.utils.BitmapPixelTestUtil;
import androidx.media3.test.utils.VideoFrameProcessorTestRunner; import androidx.media3.test.utils.VideoFrameProcessorTestRunner;
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.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
@ -97,11 +95,10 @@ public final class DefaultVideoFrameProcessorPixelTest {
private static final GlEffect NO_OP_EFFECT = private static final GlEffect NO_OP_EFFECT =
new GlEffectWrapper(new ScaleAndRotateTransformation.Builder().build()); new GlEffectWrapper(new ScaleAndRotateTransformation.Builder().build());
private @MonotonicNonNull String testId; private String testId;
private @MonotonicNonNull VideoFrameProcessorTestRunner videoFrameProcessorTestRunner; private @MonotonicNonNull VideoFrameProcessorTestRunner videoFrameProcessorTestRunner;
@Before @Before
@EnsuresNonNull("testId")
public void setUpTestId() { public void setUpTestId() {
testId = testName.getMethodName(); testId = testName.getMethodName();
} }
@ -112,7 +109,6 @@ public final class DefaultVideoFrameProcessorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void noEffects_matchesGoldenFile() throws Exception { public void noEffects_matchesGoldenFile() throws Exception {
videoFrameProcessorTestRunner = getDefaultFrameProcessorTestRunnerBuilder(testId).build(); videoFrameProcessorTestRunner = getDefaultFrameProcessorTestRunnerBuilder(testId).build();
Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH); Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH);
@ -127,7 +123,6 @@ public final class DefaultVideoFrameProcessorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void noEffects_withFrameCache_matchesGoldenFile() throws Exception { public void noEffects_withFrameCache_matchesGoldenFile() throws Exception {
videoFrameProcessorTestRunner = videoFrameProcessorTestRunner =
getDefaultFrameProcessorTestRunnerBuilder(testId) getDefaultFrameProcessorTestRunnerBuilder(testId)
@ -145,7 +140,6 @@ public final class DefaultVideoFrameProcessorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void noEffects_withDisabledColorTransfers_matchesGoldenFile() throws Exception { public void noEffects_withDisabledColorTransfers_matchesGoldenFile() throws Exception {
videoFrameProcessorTestRunner = videoFrameProcessorTestRunner =
getDefaultFrameProcessorTestRunnerBuilder(testId) getDefaultFrameProcessorTestRunnerBuilder(testId)
@ -166,7 +160,6 @@ public final class DefaultVideoFrameProcessorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void noEffects_withImageInput_matchesGoldenFile() throws Exception { public void noEffects_withImageInput_matchesGoldenFile() throws Exception {
videoFrameProcessorTestRunner = getDefaultFrameProcessorTestRunnerBuilder(testId).build(); videoFrameProcessorTestRunner = getDefaultFrameProcessorTestRunnerBuilder(testId).build();
Bitmap originalBitmap = readBitmap(IMAGE_JPG_ASSET_PATH); Bitmap originalBitmap = readBitmap(IMAGE_JPG_ASSET_PATH);
@ -184,7 +177,6 @@ public final class DefaultVideoFrameProcessorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void wrappedCrop_withImageInput_matchesGoldenFile() throws Exception { public void wrappedCrop_withImageInput_matchesGoldenFile() throws Exception {
videoFrameProcessorTestRunner = videoFrameProcessorTestRunner =
getDefaultFrameProcessorTestRunnerBuilder(testId) getDefaultFrameProcessorTestRunnerBuilder(testId)
@ -211,7 +203,6 @@ public final class DefaultVideoFrameProcessorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void noOpEffect_withImageInputAndDisabledColorTransfers_matchesGoldenFile() public void noOpEffect_withImageInputAndDisabledColorTransfers_matchesGoldenFile()
throws Exception { throws Exception {
videoFrameProcessorTestRunner = videoFrameProcessorTestRunner =
@ -238,7 +229,6 @@ public final class DefaultVideoFrameProcessorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void setPixelWidthHeightRatio_matchesGoldenFile() throws Exception { public void setPixelWidthHeightRatio_matchesGoldenFile() throws Exception {
videoFrameProcessorTestRunner = videoFrameProcessorTestRunner =
getDefaultFrameProcessorTestRunnerBuilder(testId).setPixelWidthHeightRatio(2f).build(); getDefaultFrameProcessorTestRunnerBuilder(testId).setPixelWidthHeightRatio(2f).build();
@ -254,7 +244,6 @@ public final class DefaultVideoFrameProcessorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void matrixTransformation_matchesGoldenFile() throws Exception { public void matrixTransformation_matchesGoldenFile() throws Exception {
Matrix translateRightMatrix = new Matrix(); Matrix translateRightMatrix = new Matrix();
translateRightMatrix.postTranslate(/* dx= */ 1, /* dy= */ 0); translateRightMatrix.postTranslate(/* dx= */ 1, /* dy= */ 0);
@ -274,7 +263,6 @@ public final class DefaultVideoFrameProcessorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void matrixAndScaleAndRotateTransformation_matchesGoldenFile() throws Exception { public void matrixAndScaleAndRotateTransformation_matchesGoldenFile() throws Exception {
Matrix translateRightMatrix = new Matrix(); Matrix translateRightMatrix = new Matrix();
translateRightMatrix.postTranslate(/* dx= */ 1, /* dy= */ 0); translateRightMatrix.postTranslate(/* dx= */ 1, /* dy= */ 0);
@ -296,7 +284,6 @@ public final class DefaultVideoFrameProcessorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void bitmapOverlay_matchesGoldenFile() throws Exception { public void bitmapOverlay_matchesGoldenFile() throws Exception {
Bitmap overlayBitmap = readBitmap(OVERLAY_PNG_ASSET_PATH); Bitmap overlayBitmap = readBitmap(OVERLAY_PNG_ASSET_PATH);
BitmapOverlay bitmapOverlay = BitmapOverlay.createStaticBitmapOverlay(overlayBitmap); BitmapOverlay bitmapOverlay = BitmapOverlay.createStaticBitmapOverlay(overlayBitmap);
@ -316,7 +303,6 @@ public final class DefaultVideoFrameProcessorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void scaleAndRotateAndMatrixTransformation_matchesGoldenFile() throws Exception { public void scaleAndRotateAndMatrixTransformation_matchesGoldenFile() throws Exception {
Matrix translateRightMatrix = new Matrix(); Matrix translateRightMatrix = new Matrix();
translateRightMatrix.postTranslate(/* dx= */ 1, /* dy= */ 0); translateRightMatrix.postTranslate(/* dx= */ 1, /* dy= */ 0);
@ -338,7 +324,6 @@ public final class DefaultVideoFrameProcessorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void presentation_createForHeight_matchesGoldenFile() throws Exception { public void presentation_createForHeight_matchesGoldenFile() throws Exception {
videoFrameProcessorTestRunner = videoFrameProcessorTestRunner =
getDefaultFrameProcessorTestRunnerBuilder(testId) getDefaultFrameProcessorTestRunnerBuilder(testId)
@ -356,7 +341,6 @@ public final class DefaultVideoFrameProcessorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void cropThenPresentation_matchesGoldenFile() throws Exception { public void cropThenPresentation_matchesGoldenFile() throws Exception {
videoFrameProcessorTestRunner = videoFrameProcessorTestRunner =
getDefaultFrameProcessorTestRunnerBuilder(testId) getDefaultFrameProcessorTestRunnerBuilder(testId)
@ -378,7 +362,6 @@ public final class DefaultVideoFrameProcessorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void scaleAndRotateTransformation_rotate45_matchesGoldenFile() throws Exception { public void scaleAndRotateTransformation_rotate45_matchesGoldenFile() throws Exception {
videoFrameProcessorTestRunner = videoFrameProcessorTestRunner =
getDefaultFrameProcessorTestRunnerBuilder(testId) getDefaultFrameProcessorTestRunnerBuilder(testId)
@ -396,7 +379,6 @@ public final class DefaultVideoFrameProcessorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void twoWrappedScaleAndRotateTransformations_matchesGoldenFile() throws Exception { public void twoWrappedScaleAndRotateTransformations_matchesGoldenFile() throws Exception {
videoFrameProcessorTestRunner = videoFrameProcessorTestRunner =
getDefaultFrameProcessorTestRunnerBuilder(testId) getDefaultFrameProcessorTestRunnerBuilder(testId)
@ -420,7 +402,6 @@ public final class DefaultVideoFrameProcessorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void manyComposedMatrixEffects_matchesSingleEffect() throws Exception { public void manyComposedMatrixEffects_matchesSingleEffect() throws Exception {
Crop centerCrop = Crop centerCrop =
new Crop(/* left= */ -0.5f, /* right= */ 0.5f, /* bottom= */ -0.5f, /* top= */ 0.5f); new Crop(/* left= */ -0.5f, /* right= */ 0.5f, /* bottom= */ -0.5f, /* top= */ 0.5f);
@ -454,7 +435,6 @@ public final class DefaultVideoFrameProcessorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void increaseBrightness_matchesGoldenFile() throws Exception { public void increaseBrightness_matchesGoldenFile() throws Exception {
videoFrameProcessorTestRunner = videoFrameProcessorTestRunner =
getDefaultFrameProcessorTestRunnerBuilder(testId).setEffects(new Brightness(0.5f)).build(); getDefaultFrameProcessorTestRunnerBuilder(testId).setEffects(new Brightness(0.5f)).build();
@ -470,7 +450,6 @@ public final class DefaultVideoFrameProcessorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void manyComposedMatrixAndRgbEffects_producesSameOutputAsCombinedEffects() public void manyComposedMatrixAndRgbEffects_producesSameOutputAsCombinedEffects()
throws Exception { throws Exception {
Crop centerCrop = Crop centerCrop =
@ -516,7 +495,6 @@ public final class DefaultVideoFrameProcessorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void manyComposedMatrixAndRgbEffects_withFrameCache_producesSameOutputAsCombinedEffects() public void manyComposedMatrixAndRgbEffects_withFrameCache_producesSameOutputAsCombinedEffects()
throws Exception { throws Exception {
Crop centerCrop = Crop centerCrop =
@ -563,7 +541,6 @@ public final class DefaultVideoFrameProcessorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void grayscaleThenIncreaseRedChannel_matchesGoldenFile() throws Exception { public void grayscaleThenIncreaseRedChannel_matchesGoldenFile() throws Exception {
videoFrameProcessorTestRunner = videoFrameProcessorTestRunner =
getDefaultFrameProcessorTestRunnerBuilder(testId) getDefaultFrameProcessorTestRunnerBuilder(testId)

View File

@ -47,9 +47,9 @@ public class FrameDropTest {
private static final String ASSET_PATH = "test-generated-goldens/FrameDropTest"; private static final String ASSET_PATH = "test-generated-goldens/FrameDropTest";
private @MonotonicNonNull TextureBitmapReader textureBitmapReader; private @MonotonicNonNull TextureBitmapReader textureBitmapReader;
private @MonotonicNonNull String testId; private String testId;
@EnsuresNonNull({"textureBitmapReader", "testId"}) @EnsuresNonNull({"textureBitmapReader"})
@Before @Before
public void setUp() { public void setUp() {
textureBitmapReader = new TextureBitmapReader(); textureBitmapReader = new TextureBitmapReader();
@ -57,7 +57,7 @@ public class FrameDropTest {
} }
@Test @Test
@RequiresNonNull({"textureBitmapReader", "testId"}) @RequiresNonNull({"textureBitmapReader"})
public void frameDrop_withDefaultStrategy_outputsFramesAtTheCorrectPresentationTimesUs() public void frameDrop_withDefaultStrategy_outputsFramesAtTheCorrectPresentationTimesUs()
throws Exception { throws Exception {
ImmutableList<Long> frameTimesUs = ImmutableList<Long> frameTimesUs =
@ -73,7 +73,7 @@ public class FrameDropTest {
} }
@Test @Test
@RequiresNonNull({"textureBitmapReader", "testId"}) @RequiresNonNull({"textureBitmapReader"})
public void frameDrop_withSimpleStrategy_outputsFramesAtTheCorrectPresentationTimesUs() public void frameDrop_withSimpleStrategy_outputsFramesAtTheCorrectPresentationTimesUs()
throws Exception { throws Exception {
ImmutableList<Long> frameTimesUs = ImmutableList<Long> frameTimesUs =
@ -90,7 +90,7 @@ public class FrameDropTest {
} }
@Test @Test
@RequiresNonNull({"textureBitmapReader", "testId"}) @RequiresNonNull({"textureBitmapReader"})
public void frameDrop_withSimpleStrategy_outputsAllFrames() throws Exception { public void frameDrop_withSimpleStrategy_outputsAllFrames() throws Exception {
ImmutableList<Long> frameTimesUs = ImmutableList.of(0L, 333_333L, 666_667L); ImmutableList<Long> frameTimesUs = ImmutableList.of(0L, 333_333L, 666_667L);
FrameDropEffect frameDropEffect = FrameDropEffect frameDropEffect =

View File

@ -71,10 +71,10 @@ public class GaussianBlurTest {
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}; };
private @MonotonicNonNull String testId; private String testId;
private @MonotonicNonNull TextureBitmapReader textureBitmapReader; private @MonotonicNonNull TextureBitmapReader textureBitmapReader;
@EnsuresNonNull({"textureBitmapReader", "testId"}) @EnsuresNonNull({"textureBitmapReader"})
@Before @Before
public void setUp() { public void setUp() {
textureBitmapReader = new TextureBitmapReader(); textureBitmapReader = new TextureBitmapReader();
@ -85,7 +85,7 @@ public class GaussianBlurTest {
// different text rendering implementation that leads to a larger pixel difference. // different text rendering implementation that leads to a larger pixel difference.
@Test @Test
@RequiresNonNull({"textureBitmapReader", "testId"}) @RequiresNonNull({"textureBitmapReader"})
public void gaussianBlur_blursFrame() throws Exception { public void gaussianBlur_blursFrame() throws Exception {
ImmutableList<Long> frameTimesUs = ImmutableList.of(22_000L); ImmutableList<Long> frameTimesUs = ImmutableList.of(22_000L);
ImmutableList<Long> actualPresentationTimesUs = ImmutableList<Long> actualPresentationTimesUs =

View File

@ -74,10 +74,10 @@ public class GaussianBlurWithFrameOverlaidTest {
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}; };
private @MonotonicNonNull String testId; private String testId;
private @MonotonicNonNull TextureBitmapReader textureBitmapReader; private @MonotonicNonNull TextureBitmapReader textureBitmapReader;
@EnsuresNonNull({"textureBitmapReader", "testId"}) @EnsuresNonNull({"textureBitmapReader"})
@Before @Before
public void setUp() { public void setUp() {
textureBitmapReader = new TextureBitmapReader(); textureBitmapReader = new TextureBitmapReader();
@ -88,7 +88,7 @@ public class GaussianBlurWithFrameOverlaidTest {
// different text rendering implementation that leads to a larger pixel difference. // different text rendering implementation that leads to a larger pixel difference.
@Test @Test
@RequiresNonNull({"textureBitmapReader", "testId"}) @RequiresNonNull({"textureBitmapReader"})
public void gaussianBlurWithFrameOverlaid_blursFrameAndOverlaysSharpImage() throws Exception { public void gaussianBlurWithFrameOverlaid_blursFrameAndOverlaysSharpImage() throws Exception {
ImmutableList<Long> frameTimesUs = ImmutableList.of(32_000L); ImmutableList<Long> frameTimesUs = ImmutableList.of(32_000L);
ImmutableList<Long> actualPresentationTimesUs = ImmutableList<Long> actualPresentationTimesUs =
@ -106,7 +106,7 @@ public class GaussianBlurWithFrameOverlaidTest {
} }
@Test @Test
@RequiresNonNull({"textureBitmapReader", "testId"}) @RequiresNonNull({"textureBitmapReader"})
public void gaussianBlurWithFrameOverlaid_sigmaChangesWithTime_differentFramesHaveDifferentBlurs() public void gaussianBlurWithFrameOverlaid_sigmaChangesWithTime_differentFramesHaveDifferentBlurs()
throws Exception { throws Exception {
ImmutableList<Long> frameTimesUs = ImmutableList.of(32_000L, 71_000L); ImmutableList<Long> frameTimesUs = ImmutableList.of(32_000L, 71_000L);

View File

@ -42,9 +42,7 @@ import androidx.media3.test.utils.BitmapPixelTestUtil;
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 java.io.IOException; import java.io.IOException;
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
@ -93,7 +91,7 @@ public class OverlayShaderProgramPixelTest {
private final Context context = getApplicationContext(); private final Context context = getApplicationContext();
private @MonotonicNonNull String testId; private String testId;
private @MonotonicNonNull EGLDisplay eglDisplay; private @MonotonicNonNull EGLDisplay eglDisplay;
private @MonotonicNonNull EGLContext eglContext; private @MonotonicNonNull EGLContext eglContext;
private @MonotonicNonNull BaseGlShaderProgram overlayShaderProgram; private @MonotonicNonNull BaseGlShaderProgram overlayShaderProgram;
@ -115,7 +113,6 @@ public class OverlayShaderProgramPixelTest {
} }
@Before @Before
@EnsuresNonNull("testId")
public void setUpTestId() { public void setUpTestId() {
testId = testName.getMethodName(); testId = testName.getMethodName();
} }
@ -129,7 +126,6 @@ public class OverlayShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_noOverlay_leavesFrameUnchanged() throws Exception { public void drawFrame_noOverlay_leavesFrameUnchanged() throws Exception {
overlayShaderProgram = overlayShaderProgram =
new OverlayEffect(/* textureOverlays= */ ImmutableList.of()) new OverlayEffect(/* textureOverlays= */ ImmutableList.of())
@ -149,7 +145,6 @@ public class OverlayShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_bitmapOverlay_blendsBitmapIntoFrame() throws Exception { public void drawFrame_bitmapOverlay_blendsBitmapIntoFrame() throws Exception {
Bitmap overlayBitmap = readBitmap(OVERLAY_PNG_ASSET_PATH); Bitmap overlayBitmap = readBitmap(OVERLAY_PNG_ASSET_PATH);
BitmapOverlay bitmapOverlay = BitmapOverlay.createStaticBitmapOverlay(overlayBitmap); BitmapOverlay bitmapOverlay = BitmapOverlay.createStaticBitmapOverlay(overlayBitmap);
@ -171,7 +166,6 @@ public class OverlayShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_anchoredAndTranslatedBitmapOverlay_blendsBitmapIntoTopLeftOfFrame() public void drawFrame_anchoredAndTranslatedBitmapOverlay_blendsBitmapIntoTopLeftOfFrame()
throws Exception { throws Exception {
Bitmap overlayBitmap = readBitmap(OVERLAY_PNG_ASSET_PATH); Bitmap overlayBitmap = readBitmap(OVERLAY_PNG_ASSET_PATH);
@ -200,7 +194,6 @@ public class OverlayShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void public void
drawFrame_overlayFrameAnchoredOnlyBitmapOverlay_anchorsOverlayFromTopLeftCornerOfFrame() drawFrame_overlayFrameAnchoredOnlyBitmapOverlay_anchorsOverlayFromTopLeftCornerOfFrame()
throws Exception { throws Exception {
@ -227,7 +220,6 @@ public class OverlayShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_rotatedBitmapOverlay_blendsBitmapRotated90degrees() throws Exception { public void drawFrame_rotatedBitmapOverlay_blendsBitmapRotated90degrees() throws Exception {
Bitmap overlayBitmap = readBitmap(OVERLAY_PNG_ASSET_PATH); Bitmap overlayBitmap = readBitmap(OVERLAY_PNG_ASSET_PATH);
OverlaySettings overlaySettings = new OverlaySettings.Builder().setRotationDegrees(90f).build(); OverlaySettings overlaySettings = new OverlaySettings.Builder().setRotationDegrees(90f).build();
@ -251,7 +243,6 @@ public class OverlayShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_translucentBitmapOverlay_blendsBitmapIntoFrame() throws Exception { public void drawFrame_translucentBitmapOverlay_blendsBitmapIntoFrame() throws Exception {
Bitmap bitmap = readBitmap(OVERLAY_PNG_ASSET_PATH); Bitmap bitmap = readBitmap(OVERLAY_PNG_ASSET_PATH);
OverlaySettings overlaySettings = new OverlaySettings.Builder().setAlphaScale(0.5f).build(); OverlaySettings overlaySettings = new OverlaySettings.Builder().setAlphaScale(0.5f).build();
@ -275,7 +266,6 @@ public class OverlayShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_transparentTextOverlay_blendsBitmapIntoFrame() throws Exception { public void drawFrame_transparentTextOverlay_blendsBitmapIntoFrame() throws Exception {
SpannableString overlayText = new SpannableString(/* source= */ "Text styling"); SpannableString overlayText = new SpannableString(/* source= */ "Text styling");
OverlaySettings overlaySettings = new OverlaySettings.Builder().setAlphaScale(0f).build(); OverlaySettings overlaySettings = new OverlaySettings.Builder().setAlphaScale(0f).build();
@ -304,7 +294,6 @@ public class OverlayShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_textOverlay_blendsTextIntoFrame() throws Exception { public void drawFrame_textOverlay_blendsTextIntoFrame() throws Exception {
SpannableString overlayText = new SpannableString(/* source= */ "Text styling"); SpannableString overlayText = new SpannableString(/* source= */ "Text styling");
overlayText.setSpan( overlayText.setSpan(
@ -331,7 +320,6 @@ public class OverlayShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_textOverlayWithRelativeScaleSpan_blendsTextIntoFrame() throws Exception { public void drawFrame_textOverlayWithRelativeScaleSpan_blendsTextIntoFrame() throws Exception {
SpannableString overlayText = new SpannableString(/* source= */ "helllllloooo!!!"); SpannableString overlayText = new SpannableString(/* source= */ "helllllloooo!!!");
overlayText.setSpan( overlayText.setSpan(
@ -358,7 +346,6 @@ public class OverlayShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_anchoredTextOverlay_blendsTextIntoTheTopRightQuadrantOfFrame() public void drawFrame_anchoredTextOverlay_blendsTextIntoTheTopRightQuadrantOfFrame()
throws Exception { throws Exception {
SpannableString overlayText = new SpannableString(/* source= */ "Text styling"); SpannableString overlayText = new SpannableString(/* source= */ "Text styling");
@ -389,7 +376,6 @@ public class OverlayShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_multipleOverlays_blendsBothIntoFrame() throws Exception { public void drawFrame_multipleOverlays_blendsBothIntoFrame() throws Exception {
SpannableString overlayText = new SpannableString(/* source= */ "Overlay 1"); SpannableString overlayText = new SpannableString(/* source= */ "Overlay 1");
overlayText.setSpan( overlayText.setSpan(
@ -421,7 +407,6 @@ public class OverlayShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_overlappingOverlays_blendsOnFifoOrder() throws Exception { public void drawFrame_overlappingOverlays_blendsOnFifoOrder() throws Exception {
SpannableString overlayText = new SpannableString(/* source= */ "Overlapping text"); SpannableString overlayText = new SpannableString(/* source= */ "Overlapping text");
overlayText.setSpan( overlayText.setSpan(
@ -455,7 +440,6 @@ public class OverlayShaderProgramPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_scaledBitmapOverlay_letterboxStretchesOverlay() throws Exception { public void drawFrame_scaledBitmapOverlay_letterboxStretchesOverlay() throws Exception {
Bitmap overlayBitmap = readBitmap(OVERLAY_PNG_ASSET_PATH); Bitmap overlayBitmap = readBitmap(OVERLAY_PNG_ASSET_PATH);
overlayShaderProgram = overlayShaderProgram =

View File

@ -37,9 +37,7 @@ import androidx.media3.common.util.Size;
import androidx.media3.test.utils.BitmapPixelTestUtil; import androidx.media3.test.utils.BitmapPixelTestUtil;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import java.io.IOException; import java.io.IOException;
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
@ -76,7 +74,7 @@ public final class PresentationPixelTest {
private final Context context = getApplicationContext(); private final Context context = getApplicationContext();
private @MonotonicNonNull String testId; private String testId;
private @MonotonicNonNull EGLDisplay eglDisplay; private @MonotonicNonNull EGLDisplay eglDisplay;
private @MonotonicNonNull EGLContext eglContext; private @MonotonicNonNull EGLContext eglContext;
private @MonotonicNonNull BaseGlShaderProgram presentationShaderProgram; private @MonotonicNonNull BaseGlShaderProgram presentationShaderProgram;
@ -98,7 +96,6 @@ public final class PresentationPixelTest {
} }
@Before @Before
@EnsuresNonNull("testId")
public void setUpTestId() { public void setUpTestId() {
testId = testName.getMethodName(); testId = testName.getMethodName();
} }
@ -114,7 +111,6 @@ public final class PresentationPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_noEdits_matchesGoldenFile() throws Exception { public void drawFrame_noEdits_matchesGoldenFile() throws Exception {
presentationShaderProgram = presentationShaderProgram =
Presentation.createForHeight(C.LENGTH_UNSET) Presentation.createForHeight(C.LENGTH_UNSET)
@ -135,7 +131,6 @@ public final class PresentationPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_changeAspectRatio_scaleToFit_narrow_matchesGoldenFile() throws Exception { public void drawFrame_changeAspectRatio_scaleToFit_narrow_matchesGoldenFile() throws Exception {
presentationShaderProgram = presentationShaderProgram =
Presentation.createForAspectRatio(/* aspectRatio= */ 1f, Presentation.LAYOUT_SCALE_TO_FIT) Presentation.createForAspectRatio(/* aspectRatio= */ 1f, Presentation.LAYOUT_SCALE_TO_FIT)
@ -156,7 +151,6 @@ public final class PresentationPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_changeAspectRatio_scaleToFit_wide_matchesGoldenFile() throws Exception { public void drawFrame_changeAspectRatio_scaleToFit_wide_matchesGoldenFile() throws Exception {
presentationShaderProgram = presentationShaderProgram =
Presentation.createForAspectRatio(/* aspectRatio= */ 2f, Presentation.LAYOUT_SCALE_TO_FIT) Presentation.createForAspectRatio(/* aspectRatio= */ 2f, Presentation.LAYOUT_SCALE_TO_FIT)
@ -177,7 +171,6 @@ public final class PresentationPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_changeAspectRatio_scaleToFitWithCrop_narrow_matchesGoldenFile() public void drawFrame_changeAspectRatio_scaleToFitWithCrop_narrow_matchesGoldenFile()
throws Exception { throws Exception {
presentationShaderProgram = presentationShaderProgram =
@ -200,7 +193,6 @@ public final class PresentationPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_changeAspectRatio_scaleToFitWithCrop_wide_matchesGoldenFile() public void drawFrame_changeAspectRatio_scaleToFitWithCrop_wide_matchesGoldenFile()
throws Exception { throws Exception {
presentationShaderProgram = presentationShaderProgram =
@ -223,7 +215,6 @@ public final class PresentationPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_changeAspectRatio_stretchToFit_narrow_matchesGoldenFile() throws Exception { public void drawFrame_changeAspectRatio_stretchToFit_narrow_matchesGoldenFile() throws Exception {
presentationShaderProgram = presentationShaderProgram =
Presentation.createForAspectRatio(/* aspectRatio= */ 1f, Presentation.LAYOUT_STRETCH_TO_FIT) Presentation.createForAspectRatio(/* aspectRatio= */ 1f, Presentation.LAYOUT_STRETCH_TO_FIT)
@ -244,7 +235,6 @@ public final class PresentationPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_changeAspectRatio_stretchToFit_wide_matchesGoldenFile() throws Exception { public void drawFrame_changeAspectRatio_stretchToFit_wide_matchesGoldenFile() throws Exception {
presentationShaderProgram = presentationShaderProgram =
Presentation.createForAspectRatio(/* aspectRatio= */ 2f, Presentation.LAYOUT_STRETCH_TO_FIT) Presentation.createForAspectRatio(/* aspectRatio= */ 2f, Presentation.LAYOUT_STRETCH_TO_FIT)

View File

@ -40,9 +40,7 @@ import androidx.media3.test.utils.BitmapPixelTestUtil;
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 java.io.IOException; import java.io.IOException;
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
@ -73,7 +71,7 @@ public final class RgbAdjustmentPixelTest {
private final Context context = getApplicationContext(); private final Context context = getApplicationContext();
private @MonotonicNonNull String testId; private String testId;
private @MonotonicNonNull EGLDisplay eglDisplay; private @MonotonicNonNull EGLDisplay eglDisplay;
private @MonotonicNonNull EGLContext eglContext; private @MonotonicNonNull EGLContext eglContext;
private @MonotonicNonNull BaseGlShaderProgram defaultShaderProgram; private @MonotonicNonNull BaseGlShaderProgram defaultShaderProgram;
@ -106,7 +104,6 @@ public final class RgbAdjustmentPixelTest {
} }
@Before @Before
@EnsuresNonNull("testId")
public void setUpTestId() { public void setUpTestId() {
testId = testName.getMethodName(); testId = testName.getMethodName();
} }
@ -120,7 +117,6 @@ public final class RgbAdjustmentPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_identityMatrix_leavesFrameUnchanged() throws Exception { public void drawFrame_identityMatrix_leavesFrameUnchanged() throws Exception {
RgbMatrix identityMatrix = new RgbAdjustment.Builder().build(); RgbMatrix identityMatrix = new RgbAdjustment.Builder().build();
defaultShaderProgram = identityMatrix.toGlShaderProgram(context, /* useHdr= */ false); defaultShaderProgram = identityMatrix.toGlShaderProgram(context, /* useHdr= */ false);
@ -138,7 +134,6 @@ public final class RgbAdjustmentPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_removeColors_producesBlackFrame() throws Exception { public void drawFrame_removeColors_producesBlackFrame() throws Exception {
RgbMatrix removeColorMatrix = RgbMatrix removeColorMatrix =
new RgbAdjustment.Builder().setRedScale(0).setGreenScale(0).setBlueScale(0).build(); new RgbAdjustment.Builder().setRedScale(0).setGreenScale(0).setBlueScale(0).build();
@ -159,7 +154,6 @@ public final class RgbAdjustmentPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_redOnlyFilter_removeBlueAndGreenValues() throws Exception { public void drawFrame_redOnlyFilter_removeBlueAndGreenValues() throws Exception {
RgbMatrix redOnlyMatrix = new RgbAdjustment.Builder().setBlueScale(0).setGreenScale(0).build(); RgbMatrix redOnlyMatrix = new RgbAdjustment.Builder().setBlueScale(0).setGreenScale(0).build();
defaultShaderProgram = redOnlyMatrix.toGlShaderProgram(context, /* useHdr= */ false); defaultShaderProgram = redOnlyMatrix.toGlShaderProgram(context, /* useHdr= */ false);
@ -177,7 +171,6 @@ public final class RgbAdjustmentPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_increaseRedChannel_producesBrighterAndRedderFrame() throws Exception { public void drawFrame_increaseRedChannel_producesBrighterAndRedderFrame() throws Exception {
RgbMatrix increaseRedMatrix = new RgbAdjustment.Builder().setRedScale(5).build(); RgbMatrix increaseRedMatrix = new RgbAdjustment.Builder().setRedScale(5).build();
defaultShaderProgram = increaseRedMatrix.toGlShaderProgram(context, /* useHdr= */ false); defaultShaderProgram = increaseRedMatrix.toGlShaderProgram(context, /* useHdr= */ false);
@ -195,7 +188,6 @@ public final class RgbAdjustmentPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_increaseBrightness_increasesAllValues() throws Exception { public void drawFrame_increaseBrightness_increasesAllValues() throws Exception {
RgbMatrix increaseBrightnessMatrix = RgbMatrix increaseBrightnessMatrix =
new RgbAdjustment.Builder().setRedScale(5).setGreenScale(5).setBlueScale(5).build(); new RgbAdjustment.Builder().setRedScale(5).setGreenScale(5).setBlueScale(5).build();
@ -214,7 +206,6 @@ public final class RgbAdjustmentPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_removeRedGreenAndBlueValuesInAChain_producesBlackImage() throws Exception { public void drawFrame_removeRedGreenAndBlueValuesInAChain_producesBlackImage() throws Exception {
RgbMatrix noRed = new RgbAdjustment.Builder().setRedScale(0).build(); RgbMatrix noRed = new RgbAdjustment.Builder().setRedScale(0).build();
RgbMatrix noGreen = new RgbAdjustment.Builder().setGreenScale(0).build(); RgbMatrix noGreen = new RgbAdjustment.Builder().setGreenScale(0).build();
@ -241,7 +232,6 @@ public final class RgbAdjustmentPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_removeBlueAndGreenValuesInAChain_producesOnlyRedImage() throws Exception { public void drawFrame_removeBlueAndGreenValuesInAChain_producesOnlyRedImage() throws Exception {
RgbMatrix noGreen = new RgbAdjustment.Builder().setGreenScale(0).build(); RgbMatrix noGreen = new RgbAdjustment.Builder().setGreenScale(0).build();
RgbMatrix noBlue = new RgbAdjustment.Builder().setBlueScale(0).build(); RgbMatrix noBlue = new RgbAdjustment.Builder().setBlueScale(0).build();
@ -265,7 +255,6 @@ public final class RgbAdjustmentPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_increasesAndDecreasesRed_producesNoChange() throws Exception { public void drawFrame_increasesAndDecreasesRed_producesNoChange() throws Exception {
float redScale = 4; float redScale = 4;
RgbMatrix scaleRedMatrix = new RgbAdjustment.Builder().setRedScale(redScale).build(); RgbMatrix scaleRedMatrix = new RgbAdjustment.Builder().setRedScale(redScale).build();

View File

@ -37,9 +37,7 @@ import androidx.media3.common.util.Size;
import androidx.media3.test.utils.BitmapPixelTestUtil; import androidx.media3.test.utils.BitmapPixelTestUtil;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import java.io.IOException; import java.io.IOException;
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
@ -68,7 +66,7 @@ public final class RgbFilterPixelTest {
private final Context context = getApplicationContext(); private final Context context = getApplicationContext();
private @MonotonicNonNull String testId; private String testId;
private @MonotonicNonNull EGLDisplay eglDisplay; private @MonotonicNonNull EGLDisplay eglDisplay;
private @MonotonicNonNull EGLContext eglContext; private @MonotonicNonNull EGLContext eglContext;
private @MonotonicNonNull BaseGlShaderProgram defaultShaderProgram; private @MonotonicNonNull BaseGlShaderProgram defaultShaderProgram;
@ -101,7 +99,6 @@ public final class RgbFilterPixelTest {
} }
@Before @Before
@EnsuresNonNull("testId")
public void setUpTestId() { public void setUpTestId() {
testId = testName.getMethodName(); testId = testName.getMethodName();
} }
@ -115,7 +112,6 @@ public final class RgbFilterPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_grayscale_producesGrayscaleImage() throws Exception { public void drawFrame_grayscale_producesGrayscaleImage() throws Exception {
RgbMatrix grayscaleMatrix = RgbFilter.createGrayscaleFilter(); RgbMatrix grayscaleMatrix = RgbFilter.createGrayscaleFilter();
defaultShaderProgram = grayscaleMatrix.toGlShaderProgram(context, /* useHdr= */ false); defaultShaderProgram = grayscaleMatrix.toGlShaderProgram(context, /* useHdr= */ false);
@ -133,7 +129,6 @@ public final class RgbFilterPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_inverted_producesInvertedFrame() throws Exception { public void drawFrame_inverted_producesInvertedFrame() throws Exception {
RgbMatrix invertedMatrix = RgbFilter.createInvertedFilter(); RgbMatrix invertedMatrix = RgbFilter.createInvertedFilter();
defaultShaderProgram = invertedMatrix.toGlShaderProgram(context, /* useHdr= */ false); defaultShaderProgram = invertedMatrix.toGlShaderProgram(context, /* useHdr= */ false);

View File

@ -37,9 +37,7 @@ import androidx.media3.common.util.GlUtil;
import androidx.media3.common.util.Size; import androidx.media3.common.util.Size;
import androidx.media3.test.utils.BitmapPixelTestUtil; import androidx.media3.test.utils.BitmapPixelTestUtil;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
@ -76,7 +74,7 @@ public class SingleColorLutPixelTest {
private final Context context = getApplicationContext(); private final Context context = getApplicationContext();
private @MonotonicNonNull String testId; private String testId;
private @MonotonicNonNull EGLDisplay eglDisplay; private @MonotonicNonNull EGLDisplay eglDisplay;
private @MonotonicNonNull EGLContext eglContext; private @MonotonicNonNull EGLContext eglContext;
private @MonotonicNonNull EGLSurface placeholderEglSurface; private @MonotonicNonNull EGLSurface placeholderEglSurface;
@ -98,7 +96,6 @@ public class SingleColorLutPixelTest {
} }
@Before @Before
@EnsuresNonNull("testId")
public void setUpTestId() { public void setUpTestId() {
testId = testName.getMethodName(); testId = testName.getMethodName();
} }
@ -112,7 +109,6 @@ public class SingleColorLutPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_identityCubeLutSize2_leavesFrameUnchanged() throws Exception { public void drawFrame_identityCubeLutSize2_leavesFrameUnchanged() throws Exception {
int[][][] cubeIdentityLut = createIdentityLutCube(/* length= */ 2); int[][][] cubeIdentityLut = createIdentityLutCube(/* length= */ 2);
colorLutShaderProgram = colorLutShaderProgram =
@ -133,7 +129,6 @@ public class SingleColorLutPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_identityCubeLutSize64_leavesFrameUnchanged() throws Exception { public void drawFrame_identityCubeLutSize64_leavesFrameUnchanged() throws Exception {
int[][][] cubeIdentityLut = createIdentityLutCube(/* length= */ 64); int[][][] cubeIdentityLut = createIdentityLutCube(/* length= */ 64);
colorLutShaderProgram = colorLutShaderProgram =
@ -154,7 +149,6 @@ public class SingleColorLutPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_identityBitmapLutSize2_leavesFrameUnchanged() throws Exception { public void drawFrame_identityBitmapLutSize2_leavesFrameUnchanged() throws Exception {
Bitmap bitmapLut = createIdentityLutBitmap(/* length= */ 2); Bitmap bitmapLut = createIdentityLutBitmap(/* length= */ 2);
colorLutShaderProgram = colorLutShaderProgram =
@ -174,7 +168,6 @@ public class SingleColorLutPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_identityBitmapLutSize64_leavesFrameUnchanged() throws Exception { public void drawFrame_identityBitmapLutSize64_leavesFrameUnchanged() throws Exception {
Bitmap bitmapLut = createIdentityLutBitmap(/* length= */ 64); Bitmap bitmapLut = createIdentityLutBitmap(/* length= */ 64);
colorLutShaderProgram = colorLutShaderProgram =
@ -194,7 +187,6 @@ public class SingleColorLutPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_identityLutFromHaldImage_leavesFrameUnchanged() throws Exception { public void drawFrame_identityLutFromHaldImage_leavesFrameUnchanged() throws Exception {
Bitmap bitmapLut = readBitmap(VERTICAL_HALD_IDENTITY_LUT); Bitmap bitmapLut = readBitmap(VERTICAL_HALD_IDENTITY_LUT);
colorLutShaderProgram = colorLutShaderProgram =
@ -214,7 +206,6 @@ public class SingleColorLutPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_mapWhiteToGreen_producesGreenHighlights() throws Exception { public void drawFrame_mapWhiteToGreen_producesGreenHighlights() throws Exception {
int length = 3; int length = 3;
int[][][] mapWhiteToGreen = createIdentityLutCube(length); int[][][] mapWhiteToGreen = createIdentityLutCube(length);
@ -237,7 +228,6 @@ public class SingleColorLutPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_applyInvertedLut_producesInvertedFrame() throws Exception { public void drawFrame_applyInvertedLut_producesInvertedFrame() throws Exception {
Bitmap invertedLutBitmap = readBitmap(VERTICAL_HALD_INVERTED_LUT); Bitmap invertedLutBitmap = readBitmap(VERTICAL_HALD_INVERTED_LUT);
colorLutShaderProgram = colorLutShaderProgram =
@ -258,7 +248,6 @@ public class SingleColorLutPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void drawFrame_applyGrayscaleLut_producesGrayscaleFrame() throws Exception { public void drawFrame_applyGrayscaleLut_producesGrayscaleFrame() throws Exception {
Bitmap grayscaleLutBitmap = readBitmap(VERTICAL_HALD_GRAYSCALE_LUT); Bitmap grayscaleLutBitmap = readBitmap(VERTICAL_HALD_GRAYSCALE_LUT);
colorLutShaderProgram = colorLutShaderProgram =

View File

@ -47,9 +47,9 @@ public class TimestampAdjustmentTest {
private static final String ASSET_PATH = "test-generated-goldens/TimestampAdjustmentTest"; private static final String ASSET_PATH = "test-generated-goldens/TimestampAdjustmentTest";
private @MonotonicNonNull TextureBitmapReader textureBitmapReader; private @MonotonicNonNull TextureBitmapReader textureBitmapReader;
private @MonotonicNonNull String testId; private String testId;
@EnsuresNonNull({"textureBitmapReader", "testId"}) @EnsuresNonNull({"textureBitmapReader"})
@Before @Before
public void setUp() { public void setUp() {
textureBitmapReader = new TextureBitmapReader(); textureBitmapReader = new TextureBitmapReader();
@ -57,7 +57,7 @@ public class TimestampAdjustmentTest {
} }
@Test @Test
@RequiresNonNull({"textureBitmapReader", "testId"}) @RequiresNonNull({"textureBitmapReader"})
public void timestampAdjustmentTest_outputsFramesAtTheCorrectPresentationTimesUs() public void timestampAdjustmentTest_outputsFramesAtTheCorrectPresentationTimesUs()
throws Exception { throws Exception {
ImmutableList<Long> frameTimesUs = ImmutableList.of(0L, 32_000L, 71_000L); ImmutableList<Long> frameTimesUs = ImmutableList.of(0L, 32_000L, 71_000L);

View File

@ -73,10 +73,8 @@ import java.util.Set;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
@ -109,11 +107,10 @@ public final class DefaultVideoCompositorPixelTest {
ImmutableList.of( ImmutableList.of(
new ScaleAndRotateTransformation.Builder().setRotationDegrees(180).build())); new ScaleAndRotateTransformation.Builder().setRotationDegrees(180).build()));
private @MonotonicNonNull String testId; private String testId;
private @MonotonicNonNull VideoCompositorTestRunner compositorTestRunner; private @MonotonicNonNull VideoCompositorTestRunner compositorTestRunner;
@Before @Before
@EnsuresNonNull("testId")
public void setUpTestId() { public void setUpTestId() {
testId = testName.getMethodName(); testId = testName.getMethodName();
} }
@ -128,7 +125,6 @@ public final class DefaultVideoCompositorPixelTest {
// Tests for alpha and frame alpha/occlusion. // Tests for alpha and frame alpha/occlusion.
@Test @Test
@RequiresNonNull("testId")
public void compositeTwoInputs_withOneFrameFromEach_differentTimestamp_matchesExpectedBitmap() public void compositeTwoInputs_withOneFrameFromEach_differentTimestamp_matchesExpectedBitmap()
throws Exception { throws Exception {
compositorTestRunner = compositorTestRunner =
@ -154,7 +150,6 @@ public final class DefaultVideoCompositorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void compositeTwoInputs_withPrimaryTransparent_differentTimestamp_matchesExpectedBitmap() public void compositeTwoInputs_withPrimaryTransparent_differentTimestamp_matchesExpectedBitmap()
throws Exception { throws Exception {
ImmutableList<ImmutableList<Effect>> inputEffectLists = ImmutableList<ImmutableList<Effect>> inputEffectLists =
@ -186,7 +181,6 @@ public final class DefaultVideoCompositorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void compositeTwoInputs_withPrimaryOpaque_differentTimestamp_matchesExpectedBitmap() public void compositeTwoInputs_withPrimaryOpaque_differentTimestamp_matchesExpectedBitmap()
throws Exception { throws Exception {
ImmutableList<ImmutableList<Effect>> inputEffectLists = ImmutableList<ImmutableList<Effect>> inputEffectLists =
@ -218,7 +212,6 @@ public final class DefaultVideoCompositorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void compositeTwoInputs_withSecondaryTransparent_differentTimestamp_matchesExpectedBitmap() public void compositeTwoInputs_withSecondaryTransparent_differentTimestamp_matchesExpectedBitmap()
throws Exception { throws Exception {
ImmutableList<ImmutableList<Effect>> inputEffectLists = ImmutableList<ImmutableList<Effect>> inputEffectLists =
@ -251,7 +244,6 @@ public final class DefaultVideoCompositorPixelTest {
// Tests for mixing different frame rates and timestamps. // Tests for mixing different frame rates and timestamps.
@Test @Test
@RequiresNonNull("testId")
public void compositeTwoInputs_withFiveFramesFromEach_matchesExpectedTimestamps() public void compositeTwoInputs_withFiveFramesFromEach_matchesExpectedTimestamps()
throws Exception { throws Exception {
compositorTestRunner = compositorTestRunner =
@ -276,7 +268,6 @@ public final class DefaultVideoCompositorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void composite_onePrimaryAndFiveSecondaryFrames_matchesExpectedTimestamps() public void composite_onePrimaryAndFiveSecondaryFrames_matchesExpectedTimestamps()
throws Exception { throws Exception {
compositorTestRunner = compositorTestRunner =
@ -302,7 +293,6 @@ public final class DefaultVideoCompositorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void composite_fivePrimaryAndOneSecondaryFrames_matchesExpectedTimestamps() public void composite_fivePrimaryAndOneSecondaryFrames_matchesExpectedTimestamps()
throws Exception { throws Exception {
compositorTestRunner = compositorTestRunner =
@ -329,7 +319,6 @@ public final class DefaultVideoCompositorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void composite_primaryDoubleSecondaryFrameRate_matchesExpectedTimestamps() public void composite_primaryDoubleSecondaryFrameRate_matchesExpectedTimestamps()
throws Exception { throws Exception {
compositorTestRunner = compositorTestRunner =
@ -356,7 +345,6 @@ public final class DefaultVideoCompositorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void composite_primaryHalfSecondaryFrameRate_matchesExpectedTimestamps() throws Exception { public void composite_primaryHalfSecondaryFrameRate_matchesExpectedTimestamps() throws Exception {
compositorTestRunner = compositorTestRunner =
new VideoCompositorTestRunner(testId, useSharedExecutor, TWO_INPUT_COMPOSITOR_EFFECT_LISTS); new VideoCompositorTestRunner(testId, useSharedExecutor, TWO_INPUT_COMPOSITOR_EFFECT_LISTS);
@ -382,7 +370,6 @@ public final class DefaultVideoCompositorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void composite_primaryVariableFrameRateWithOffset_matchesExpectedTimestampsAndBitmaps() public void composite_primaryVariableFrameRateWithOffset_matchesExpectedTimestampsAndBitmaps()
throws Exception { throws Exception {
compositorTestRunner = compositorTestRunner =
@ -409,7 +396,6 @@ public final class DefaultVideoCompositorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void composite_secondaryVariableFrameRateWithOffset_matchesExpectedTimestampsAndBitmaps() public void composite_secondaryVariableFrameRateWithOffset_matchesExpectedTimestampsAndBitmaps()
throws Exception { throws Exception {
compositorTestRunner = compositorTestRunner =
@ -438,7 +424,6 @@ public final class DefaultVideoCompositorPixelTest {
// Tests for "many" inputs/frames. // Tests for "many" inputs/frames.
@Test @Test
@RequiresNonNull("testId")
public void compositeTwoInputs_withTenFramesFromEach_matchesExpectedFrameCount() public void compositeTwoInputs_withTenFramesFromEach_matchesExpectedFrameCount()
throws Exception { throws Exception {
compositorTestRunner = compositorTestRunner =
@ -456,7 +441,6 @@ public final class DefaultVideoCompositorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void compositeFiveInputs_withFiveFramesFromEach_matchesExpectedFrameCount() public void compositeFiveInputs_withFiveFramesFromEach_matchesExpectedFrameCount()
throws Exception { throws Exception {
compositorTestRunner = compositorTestRunner =
@ -480,7 +464,6 @@ public final class DefaultVideoCompositorPixelTest {
// Tests for different amounts of inputs. // Tests for different amounts of inputs.
@Test @Test
@RequiresNonNull("testId")
public void compositeOneInput_matchesExpectedBitmap() throws Exception { public void compositeOneInput_matchesExpectedBitmap() throws Exception {
compositorTestRunner = compositorTestRunner =
new VideoCompositorTestRunner( new VideoCompositorTestRunner(
@ -501,7 +484,6 @@ public final class DefaultVideoCompositorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void compositeThreeInputs_matchesExpectedBitmap() throws Exception { public void compositeThreeInputs_matchesExpectedBitmap() throws Exception {
compositorTestRunner = compositorTestRunner =
new VideoCompositorTestRunner( new VideoCompositorTestRunner(
@ -540,7 +522,6 @@ public final class DefaultVideoCompositorPixelTest {
// Tests for different layouts. // Tests for different layouts.
@Test @Test
@RequiresNonNull("testId")
public void compositeTwoInputs_pictureInPicture_matchesExpectedBitmap() throws Exception { public void compositeTwoInputs_pictureInPicture_matchesExpectedBitmap() throws Exception {
ImmutableList<ImmutableList<Effect>> inputEffectLists = ImmutableList<ImmutableList<Effect>> inputEffectLists =
ImmutableList.of(ImmutableList.of(), ImmutableList.of(RgbFilter.createGrayscaleFilter())); ImmutableList.of(ImmutableList.of(), ImmutableList.of(RgbFilter.createGrayscaleFilter()));
@ -579,7 +560,6 @@ public final class DefaultVideoCompositorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void compositeTwoInputs_differentDimensions_matchesExpectedBitmap() throws Exception { public void compositeTwoInputs_differentDimensions_matchesExpectedBitmap() throws Exception {
ImmutableList<ImmutableList<Effect>> inputEffectLists = ImmutableList<ImmutableList<Effect>> inputEffectLists =
ImmutableList.of( ImmutableList.of(
@ -613,7 +593,6 @@ public final class DefaultVideoCompositorPixelTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void compositeTwoInputs_stacked_matchesExpectedBitmap() throws Exception { public void compositeTwoInputs_stacked_matchesExpectedBitmap() throws Exception {
ImmutableList<ImmutableList<Effect>> inputEffectLists = ImmutableList<ImmutableList<Effect>> inputEffectLists =
ImmutableList.of( ImmutableList.of(

View File

@ -53,9 +53,6 @@ import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
@ -71,10 +68,9 @@ public class TransformerProgressTest {
private final Context context = ApplicationProvider.getApplicationContext(); private final Context context = ApplicationProvider.getApplicationContext();
private @MonotonicNonNull String testId; private String testId;
@Before @Before
@EnsuresNonNull({"testId"})
public void setUp() { public void setUp() {
testId = testName.getMethodName(); testId = testName.getMethodName();
} }
@ -86,7 +82,6 @@ public class TransformerProgressTest {
* long enough for the test thread to collect at least two progress updates. * long enough for the test thread to collect at least two progress updates.
*/ */
@Test @Test
@RequiresNonNull("testId")
@SuppressWarnings("PreferJavaTimeOverload") @SuppressWarnings("PreferJavaTimeOverload")
public void getProgress_monotonicallyIncreasingUpdates() throws InterruptedException { public void getProgress_monotonicallyIncreasingUpdates() throws InterruptedException {
AtomicBoolean completed = new AtomicBoolean(); AtomicBoolean completed = new AtomicBoolean();
@ -168,7 +163,6 @@ public class TransformerProgressTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void getProgress_trimOptimizationEnabledAndApplied_givesIncreasingPercentages() public void getProgress_trimOptimizationEnabledAndApplied_givesIncreasingPercentages()
throws Exception { throws Exception {
// The trim optimization is only guaranteed to work on emulator for this file. // The trim optimization is only guaranteed to work on emulator for this file.
@ -249,7 +243,6 @@ public class TransformerProgressTest {
} }
@Test @Test
@RequiresNonNull("testId")
public void getProgress_trimOptimizationEnabledAndActive_returnsConsistentStates() public void getProgress_trimOptimizationEnabledAndActive_returnsConsistentStates()
throws Exception { throws Exception {
// The trim optimization is only guaranteed to work on emulator for this file. // The trim optimization is only guaranteed to work on emulator for this file.

View File

@ -48,9 +48,6 @@ 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.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
@ -69,16 +66,14 @@ public final class TransformerSequenceEffectTestWithHdr {
private final Context context = ApplicationProvider.getApplicationContext(); private final Context context = ApplicationProvider.getApplicationContext();
private @MonotonicNonNull String testId; private String testId;
@Before @Before
@EnsuresNonNull({"testId"})
public void setUp() { public void setUp() {
testId = testName.getMethodName(); testId = testName.getMethodName();
} }
@Test @Test
@RequiresNonNull("testId")
public void export_withSdrThenHdr() throws Exception { public void export_withSdrThenHdr() throws Exception {
assumeDeviceSupportsOpenGlToneMapping( assumeDeviceSupportsOpenGlToneMapping(
testId, /* inputFormat= */ MP4_ASSET_720P_4_SECOND_HDR10_FORMAT); testId, /* inputFormat= */ MP4_ASSET_720P_4_SECOND_HDR10_FORMAT);
@ -113,7 +108,6 @@ public final class TransformerSequenceEffectTestWithHdr {
* after already being configured for HDR output. * after already being configured for HDR output.
*/ */
@Test @Test
@RequiresNonNull("testId")
public void export_withHdrThenSdr_throws_whenHdrEditingSupported() throws Exception { public void export_withHdrThenSdr_throws_whenHdrEditingSupported() throws Exception {
assumeDeviceSupportsHdrEditing(testId, MP4_ASSET_720P_4_SECOND_HDR10_FORMAT); assumeDeviceSupportsHdrEditing(testId, MP4_ASSET_720P_4_SECOND_HDR10_FORMAT);
assumeFalse( assumeFalse(
@ -153,7 +147,6 @@ public final class TransformerSequenceEffectTestWithHdr {
* will fallback to OpenGL tone-mapping, and configure VideoFrameProcessor for SDR output. * will fallback to OpenGL tone-mapping, and configure VideoFrameProcessor for SDR output.
*/ */
@Test @Test
@RequiresNonNull("testId")
public void export_withHdrThenSdr_whenHdrEditingUnsupported() throws Exception { public void export_withHdrThenSdr_whenHdrEditingUnsupported() throws Exception {
assumeDeviceSupportsHdrEditing(testId, MP4_ASSET_720P_4_SECOND_HDR10_FORMAT); assumeDeviceSupportsHdrEditing(testId, MP4_ASSET_720P_4_SECOND_HDR10_FORMAT);
assumeDeviceSupportsOpenGlToneMapping( assumeDeviceSupportsOpenGlToneMapping(

View File

@ -183,7 +183,7 @@ public class EffectPlaybackTest {
private final Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); private final Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
private @MonotonicNonNull ExoPlayer player; private @MonotonicNonNull ExoPlayer player;
private @MonotonicNonNull ImageReader outputImageReader; private @MonotonicNonNull ImageReader outputImageReader;
private @MonotonicNonNull String testId; private String testId;
@Before @Before
public void setUpTestId() { public void setUpTestId() {