test(pdf): pin the O4 inputs where view and logo rasters differ
This commit is contained in:
1 parent
59893c0968
commit
6b7e1da1bc
2 files changed
+19
-2
No files matched your search
@@ -87,7 +87,9 @@ pub fn raster_size_of(view_box: Option<&str>) -> (u32, u32) {
|
|||||||
/// The raster size of a view (owner 2026-11-22, A5): the frame's ratio to half a pixel for
|
/// The raster size of a view (owner 2026-11-22, A5): the frame's ratio to half a pixel for
|
||||||
/// every ratio, so `meet` shows nothing outside the frame (R2). The short side is rounded first
|
/// every ratio, so `meet` shows nothing outside the frame (R2). The short side is rounded first
|
||||||
/// and the long side follows from it; never more pixels than 1 200 x 2 400. From 1:1 to 1:2
|
/// and the long side follows from it; never more pixels than 1 200 x 2 400. From 1:1 to 1:2
|
||||||
/// that is `raster_size_of`, whose rounding already holds the bound. Logos keep
|
/// that is `raster_size_of`, whose rounding already holds the bound. The 0.25 px bound holds
|
||||||
|
/// for frames up to 100:1 either way (the core's MAX_FRAME_ASPECT, which no view frame
|
||||||
|
/// exceeds); beyond about 1:1200 the 1 px minimum side would break it. Logos keep
|
||||||
/// `raster_size_of`.
|
/// `raster_size_of`.
|
||||||
pub fn view_raster_size(view_box: Option<&str>) -> (u32, u32) {
|
pub fn view_raster_size(view_box: Option<&str>) -> (u32, u32) {
|
||||||
let aspect = aspect_of(view_box);
|
let aspect = aspect_of(view_box);
|
||||||
|
|||||||
@@ -80,15 +80,30 @@ fn the_board_frames_get_their_sizes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// For the owner's report (A5: « contrôler les éventuelles différences »): the O4 inputs whose
|
/// For the owner's report (A5: « contrôler les éventuelles différences »): the O4 inputs whose
|
||||||
/// view size differs from the logo rule, printed; none of them is a historical view.
|
/// view size differs from the logo rule, printed and pinned. None is a historical view (main
|
||||||
|
/// and head are pinned in `the_historical_views_keep_their_sizes`).
|
||||||
#[test]
|
#[test]
|
||||||
fn the_o4_inputs_where_views_differ_from_logos_are_listed() {
|
fn the_o4_inputs_where_views_differ_from_logos_are_listed() {
|
||||||
let (_, oracle) = common::oracle_file("r4/text.json");
|
let (_, oracle) = common::oracle_file("r4/text.json");
|
||||||
|
let mut differing = Vec::new();
|
||||||
for case in oracle["rasterSizeOf"]["cases"].as_array().unwrap() {
|
for case in oracle["rasterSizeOf"]["cases"].as_array().unwrap() {
|
||||||
let input = case[0].as_str();
|
let input = case[0].as_str();
|
||||||
let (view, logo) = (view_raster_size(input), raster_size_of(input));
|
let (view, logo) = (view_raster_size(input), raster_size_of(input));
|
||||||
if view != logo {
|
if view != logo {
|
||||||
println!("O4 {input:?}: logo {logo:?}, view {view:?}");
|
println!("O4 {input:?}: logo {logo:?}, view {view:?}");
|
||||||
|
differing.push((input.unwrap().to_string(), view, logo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let expected = [
|
||||||
|
("0 0 100 1000", (240, 2400), (1200, 2400)),
|
||||||
|
("0 0 1000 1", (1000, 1), (1200, 240)),
|
||||||
|
("0 0 5e-324 1", (1, 2400), (1200, 2400)),
|
||||||
|
("0 0 0b11 0o7", (1029, 2400), (1200, 2400)),
|
||||||
|
("0 0 7 3", (1199, 514), (1200, 514)),
|
||||||
|
];
|
||||||
|
let expected: Vec<_> = expected
|
||||||
|
.iter()
|
||||||
|
.map(|(input, view, logo)| (input.to_string(), *view, *logo))
|
||||||
|
.collect();
|
||||||
|
assert_eq!(differing, expected);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user