mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 00:57:26 +00:00
Merge pull request #3121 from aiongg/next-lost-tests
Build the integration tests next lost in the syncs (craft-pdf, craft-cms, craft-prepress)
This commit is contained in:
@@ -4,6 +4,7 @@ mod bench;
|
||||
mod cms;
|
||||
mod constructors;
|
||||
mod fogra39;
|
||||
mod gpu_matrix_shaper;
|
||||
mod named;
|
||||
mod profile_id;
|
||||
mod regen;
|
||||
|
||||
@@ -216,7 +216,7 @@ fn unencrypted_metadata_is_left_readable() {
|
||||
/// silent skip would cost the most -- see `oracle.rs`, which makes absence loud.
|
||||
#[test]
|
||||
fn qpdf_agrees() {
|
||||
let qpdf = crate::oracle::or_skip!(crate::oracle::qpdf());
|
||||
let qpdf = super::oracle::or_skip!(super::oracle::qpdf());
|
||||
let dir = private_temp_dir("pdfcraft-enc");
|
||||
for alg in ALL {
|
||||
let path = dir.join(format!("{alg:?}.pdf"));
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::testkit::Pdf;
|
||||
use super::testkit::Pdf;
|
||||
use craft_pdf::cos::{Algorithm, Document, NewEncryption, Object, PdfString, SaveOptions, write_full, write_incremental};
|
||||
|
||||
const ID_HEX: &str = "/ID [<00112233445566778899AABBCCDDEEFF> <00112233445566778899AABBCCDDEEFF>]";
|
||||
@@ -261,7 +261,7 @@ fn separate_fresh_processes_get_different_identifiers() {
|
||||
let path = std::env::temp_dir().join(format!("craft-pdf-id-probe-{}-{name}.pdf", std::process::id()));
|
||||
let out = std::process::Command::new(&exe)
|
||||
// The test binary holds every `cos` test module, so the child test is named by its path.
|
||||
.args(["--exact", "file_identifier::stand_in_for_a_fresh_process", "--nocapture", "--"])
|
||||
.args(["--exact", "integration::cos::file_identifier::stand_in_for_a_fresh_process", "--nocapture", "--"])
|
||||
.env(ID_PROBE, &path)
|
||||
.output()
|
||||
.expect("run this test's own binary as a child");
|
||||
|
||||
@@ -12,6 +12,6 @@ mod oracle;
|
||||
mod proptests;
|
||||
mod serialize_format;
|
||||
mod shared_streams;
|
||||
#[path = "../../src/cos/testkit.rs"]
|
||||
mod testkit;
|
||||
mod writer;
|
||||
|
||||
use crate::cos::testkit;
|
||||
|
||||
@@ -147,8 +147,8 @@ macro_rules! or_skip {
|
||||
match $probe {
|
||||
::core::result::Result::Ok(oracle) => oracle,
|
||||
::core::result::Result::Err(absent) => {
|
||||
let absent: $crate::oracle::Absent = absent;
|
||||
::core::assert!(!$crate::oracle::Absent::required(&absent), "{absent}");
|
||||
let absent: $crate::integration::cos::oracle::Absent = absent;
|
||||
::core::assert!(!$crate::integration::cos::oracle::Absent::required(&absent), "{absent}");
|
||||
::std::eprintln!("{absent}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::testkit::Pdf;
|
||||
use super::testkit::Pdf;
|
||||
use craft_pdf::cos::{Dict, Document, ObjRef, Object, SaveOptions, Stream, write_full, write_incremental};
|
||||
|
||||
/// Four pages, a shared font, document info with a non-ASCII title.
|
||||
@@ -150,7 +150,7 @@ fn classic_table() -> Vec<u8> {
|
||||
bytes
|
||||
}
|
||||
|
||||
fn qpdf_check(qpdf: &crate::oracle::Oracle, bytes: &[u8]) -> std::process::Output {
|
||||
fn qpdf_check(qpdf: &super::oracle::Oracle, bytes: &[u8]) -> std::process::Output {
|
||||
static NEXT: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
|
||||
let n = NEXT.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
|
||||
let path = std::env::temp_dir().join(format!("pdfcraft-xref-{}-{n}.pdf", std::process::id()));
|
||||
@@ -168,7 +168,7 @@ fn page(doc: &Document) -> Dict {
|
||||
}
|
||||
|
||||
fn assert_qpdf_clean(bytes: &[u8]) {
|
||||
let qpdf = crate::oracle::or_skip!(crate::oracle::qpdf());
|
||||
let qpdf = super::oracle::or_skip!(super::oracle::qpdf());
|
||||
let check = qpdf_check(&qpdf, bytes);
|
||||
let report = format!("{}{}", String::from_utf8_lossy(&check.stdout), String::from_utf8_lossy(&check.stderr));
|
||||
assert!(check.status.success() && !report.contains("WARNING"), "{report}");
|
||||
@@ -299,7 +299,7 @@ fn incremental_save_leaves_out_additions_nothing_refers_to() {
|
||||
|
||||
#[test]
|
||||
fn qpdf_accepts_object_stream_output() {
|
||||
let qpdf = crate::oracle::or_skip!(crate::oracle::qpdf());
|
||||
let qpdf = super::oracle::or_skip!(super::oracle::qpdf());
|
||||
let doc = Document::open(Arc::new(fixture())).unwrap();
|
||||
let packed = write_full(&doc, &SaveOptions::default()).unwrap();
|
||||
let path = std::env::temp_dir().join(format!("pdfcraft-objstm-{}.pdf", std::process::id()));
|
||||
|
||||
@@ -2,6 +2,13 @@
|
||||
|
||||
mod cancellation;
|
||||
mod contracts;
|
||||
#[path = "cos/main.rs"]
|
||||
mod cos;
|
||||
#[path = "crypt/main.rs"]
|
||||
mod crypt;
|
||||
#[path = "filters/main.rs"]
|
||||
mod filters;
|
||||
mod font_tables;
|
||||
mod interpretation;
|
||||
mod knockout;
|
||||
mod knockout_backdrop;
|
||||
|
||||
@@ -4,5 +4,7 @@ mod flatten_document;
|
||||
mod flatten_pdf;
|
||||
mod flatten_plates;
|
||||
mod flatten_raster;
|
||||
mod flatten_timings;
|
||||
mod flatten_write;
|
||||
mod marks;
|
||||
mod plates;
|
||||
|
||||
Reference in New Issue
Block a user