mirror of
https://github.com/samsonjs/media.git
synced 2026-04-11 12:15:47 +00:00
Test: Save test bitmaps in a separate loop from assertions.
This means all bitmaps will save even if an assertion fails somewhere in the test method PiperOrigin-RevId: 603067528
This commit is contained in:
parent
61603f90f3
commit
1163660918
1 changed files with 6 additions and 3 deletions
|
|
@ -101,15 +101,18 @@ public final class SequenceEffectTestUtil {
|
|||
public static void assertBitmapsMatchExpectedAndSave(List<Bitmap> actualBitmaps, String testId)
|
||||
throws IOException {
|
||||
for (int i = 0; i < actualBitmaps.size(); i++) {
|
||||
Bitmap actualBitmap = actualBitmaps.get(i);
|
||||
maybeSaveTestBitmap(
|
||||
testId, /* bitmapLabel= */ String.valueOf(i), actualBitmap, /* path= */ null);
|
||||
testId, /* bitmapLabel= */ String.valueOf(i), actualBitmaps.get(i), /* path= */ null);
|
||||
}
|
||||
|
||||
for (int i = 0; i < actualBitmaps.size(); i++) {
|
||||
String subTestId = testId + "_" + i;
|
||||
String expectedPath = Util.formatInvariant("%s/%s.png", PNG_ASSET_BASE_PATH, subTestId);
|
||||
Bitmap expectedBitmap = readBitmap(expectedPath);
|
||||
|
||||
float averagePixelAbsoluteDifference =
|
||||
getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, subTestId);
|
||||
getBitmapAveragePixelAbsoluteDifferenceArgb8888(
|
||||
expectedBitmap, actualBitmaps.get(i), subTestId);
|
||||
assertWithMessage("For expected bitmap " + expectedPath)
|
||||
.that(averagePixelAbsoluteDifference)
|
||||
.isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE_LUMA);
|
||||
|
|
|
|||
Loading…
Reference in a new issue