Skip to content

Commit 48b721d

Browse files
committed
Add an avif alpha test
This test can also help to check different avif files with modifying the IMAGE_AVIF_ALPHA path
1 parent c918d72 commit 48b721d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

mp4parse/tests/bug-1661347.avif

205 KB
Binary file not shown.

mp4parse/tests/public.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ static VIDEO_EME_CBCS_MP4: &str = "tests/bipbop_cbcs_video_init.mp4";
3030
static VIDEO_AV1_MP4: &str = "tests/tiny_av1.mp4";
3131
static IMAGE_AVIF: &str = "av1-avif/testFiles/Microsoft/Monochrome.avif";
3232
static IMAGE_AVIF_EXTENTS: &str = "tests/kodim-extents.avif";
33+
static IMAGE_AVIF_ALPHA: &str = "tests/bug-1661347.avif";
3334
static IMAGE_AVIF_CORRUPT: &str = "tests/corrupt/bug-1655846.avif";
3435
static IMAGE_AVIF_CORRUPT_2: &str = "tests/corrupt/bug-1661347.avif";
3536
static IMAGE_AVIF_CORRUPT_3: &str = "tests/corrupt/bad-ipma-version.avif";
@@ -632,6 +633,14 @@ fn public_avif_primary_item_split_extents() {
632633
assert_eq!(context.primary_item().len(), 4387);
633634
}
634635

636+
#[test]
637+
fn public_avif_alpha_item() {
638+
let input = &mut File::open(IMAGE_AVIF_ALPHA).expect("Unknown file");
639+
let context = mp4::read_avif(input).expect("read_avif failed");
640+
assert!(context.alpha_item().is_some());
641+
assert!(!context.premultiplied_alpha);
642+
}
643+
635644
#[test]
636645
fn public_avif_bug_1655846() {
637646
let input = &mut File::open(IMAGE_AVIF_CORRUPT).expect("Unknown file");

0 commit comments

Comments
 (0)