| 34 | } |
| 35 | |
| 36 | void TestDecode(uint8_t* data, size_t size, uint32_t expect_width, |
| 37 | uint32_t expect_height, bool expect_alpha = false) { |
| 38 | ASSERT_EQ(avifDecoderSetIOMemory(decoder_.get(), data, size), |
| 39 | AVIF_RESULT_OK); |
| 40 | ASSERT_EQ(avifDecoderParse(decoder_.get()), AVIF_RESULT_OK); |
| 41 | ASSERT_EQ(decoder_->progressiveState, AVIF_PROGRESSIVE_STATE_ACTIVE); |
| 42 | ASSERT_EQ(static_cast<uint32_t>(decoder_->imageCount), |
| 43 | encoder_->extraLayerCount + 1); |
| 44 | EXPECT_EQ(decoder_->alphaPresent, expect_alpha); |
| 45 | |
| 46 | for (uint32_t layer = 0; layer < encoder_->extraLayerCount + 1; ++layer) { |
| 47 | ASSERT_EQ(avifDecoderNextImage(decoder_.get()), AVIF_RESULT_OK); |
| 48 | // libavif scales frame automatically. |
| 49 | ASSERT_EQ(decoder_->image->width, expect_width); |
| 50 | ASSERT_EQ(decoder_->image->height, expect_height); |
| 51 | if (expect_alpha) { |
| 52 | ASSERT_NE(decoder_->image->alphaPlane, nullptr); |
| 53 | } |
| 54 | // TODO(wtc): Check avifDecoderNthImageMaxExtent(). |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | void TestDecode(uint32_t expect_width, uint32_t expect_height, |
| 59 | bool expect_alpha = false) { |
nothing calls this directly
no test coverage detected