Skip to content

Commit 655d2d0

Browse files
committed
Add test case for width 2
1 parent 23b3ed7 commit 655d2d0

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

src/lib.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,4 +731,26 @@ mod tests {
731731
b"startxref\n34\n%%EOF",
732732
)
733733
}
734+
735+
#[test]
736+
fn test_xref_width2() {
737+
let mut w = Pdf::new();
738+
w.stream(Ref::new(1), &[b'0'; 256]);
739+
w.indirect(Ref::new(2)).primitive(1);
740+
test!(
741+
w.finish_with_xref_stream(Ref::new(3), None),
742+
b"%PDF-1.7\n%\x80\x80\x80\x80\n",
743+
b"1 0 obj\n<<\n /Length 256\n>>\nstream",
744+
b"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
745+
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
746+
000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
747+
b"endstream\nendobj\n",
748+
b"2 0 obj\n1\nendobj\n",
749+
b"3 0 obj\n<<\n /Length 20\n /Type /XRef\n /Size 4\n /W [1 2 2]\n>>\nstream",
750+
// [0, 0, 0, 255, 255], [1, 0, 16, 0, 0], [1, 0, 34, 0, 0], [1, 1, 32, 0, 0]
751+
b"\x00\x00\x00\xFF\xFF\x01\x00\x10\x00\x00\x01\x01\x46\x00\x00\x01\x01\x58\x00\x00",
752+
b"endstream\nendobj\n",
753+
b"startxref\n344\n%%EOF",
754+
)
755+
}
734756
}

0 commit comments

Comments
 (0)