Skip to content

Commit 891df7c

Browse files
committed
Add missing-pixi-permitted feature and tests
1 parent 47bff4c commit 891df7c

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
build:
11-
name: Build Rust ${{ matrix.rust }} on ${{ matrix.os }}, release=${{ matrix.release }}
11+
name: Build Rust ${{ matrix.rust }} on ${{ matrix.os }}, release=${{ matrix.release }} features=${{ matrix.features }}
1212
runs-on: ${{ matrix.os }}
1313
continue-on-error: ${{ matrix.experimental }}
1414
strategy:
@@ -18,6 +18,7 @@ jobs:
1818
rust: [stable]
1919
release: [true, false]
2020
experimental: [false]
21+
features: ["", "missing-pixi-permitted"]
2122
include:
2223
- os: ubuntu-20.04
2324
rust: nightly
@@ -54,12 +55,12 @@ jobs:
5455

5556
- name: Test (release)
5657
shell: bash
57-
run: rustup run ${{ matrix.rust }} cargo test --all --verbose --release
58+
run: rustup run ${{ matrix.rust }} cargo test --all --features "${{ matrix.features }}" --verbose --release
5859
if: matrix.release
5960

6061
- name: Test (debug)
6162
shell: bash
62-
run: rustup run ${{ matrix.rust }} cargo test --all --verbose
63+
run: rustup run ${{ matrix.rust }} cargo test --all --features "${{ matrix.features }}" --verbose
6364
if: ${{ !matrix.release }}
6465

6566
# cargo-fuzz supports x86-64 Linux and x86-64 macOS, but macOS currently fails, see:

mp4parse/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ walkdir = "2.3.1"
4040
criterion = "0.3"
4141

4242
[features]
43+
missing-pixi-permitted = []
4344
3gpp = []
4445
meta-xml = []
4546
unstable-api = []

mp4parse/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1716,7 +1716,11 @@ pub fn read_avif<T: Read>(f: &mut T, strictness: ParseStrictness) -> Result<Avif
17161716
// of that, only give an error in strict mode
17171717
// See https://github.com/MPEGGroup/MIAF/issues/9
17181718
fail_if(
1719-
strictness == ParseStrictness::Strict,
1719+
if cfg!(feature = "missing-pixi-permitted") {
1720+
strictness == ParseStrictness::Strict
1721+
} else {
1722+
strictness != ParseStrictness::Permissive
1723+
},
17201724
"The pixel information property shall be associated with every image \
17211725
that is displayable (not hidden) \
17221726
per MIAF (ISO/IEC 23000-22:2019) specification § 7.3.6.6",

mp4parse/tests/public.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -923,8 +923,14 @@ fn public_avif_pixi_present_for_displayable_images() {
923923
let expected_msg = "The pixel information property shall be associated with every image \
924924
that is displayable (not hidden) \
925925
per MIAF (ISO/IEC 23000-22:2019) specification § 7.3.6.6";
926-
assert_avif_should(IMAGE_AVIF_NO_PIXI, expected_msg);
927-
assert_avif_should(IMAGE_AVIF_NO_ALPHA_PIXI, expected_msg);
926+
let pixi_test = if cfg!(feature = "missing-pixi-permitted") {
927+
assert_avif_should
928+
} else {
929+
assert_avif_shall
930+
};
931+
932+
pixi_test(IMAGE_AVIF_NO_PIXI, expected_msg);
933+
pixi_test(IMAGE_AVIF_NO_ALPHA_PIXI, expected_msg);
928934
}
929935

930936
#[test]

mp4parse_capi/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ num-traits = "0.2.14"
3434
env_logger = "0.8"
3535

3636
[features]
37+
missing-pixi-permitted = ["mp4parse/missing-pixi-permitted"]
3738
3gpp = ["mp4parse/3gpp"]
3839
meta-xml = ["mp4parse/meta-xml"]
3940
mp4v = ["mp4parse/mp4v"]

0 commit comments

Comments
 (0)