refactor(pdf): move tests_*.rs to tests/<topic>.rs

This commit is contained in:
aiongg
2026-10-26 18:26:59 +00:00
parent 7da84565d8
commit 8ded395d49
37 changed files with 42 additions and 76 deletions
+2 -72
View File
@@ -244,77 +244,7 @@ impl From<craft_pdf::write::WriteError> for PdfError {
}
}
#[cfg(test)]
use tests::{import_fidelity as tests_import_fidelity, live_text as tests_live_text, stroke as tests_stroke};
#[cfg(test)]
mod tests;
#[cfg(test)]
mod tests_blend;
#[cfg(test)]
mod tests_charstroke;
#[cfg(test)]
mod tests_cmykblend;
#[cfg(test)]
mod tests_cmykimages;
#[cfg(test)]
mod tests_compression;
#[cfg(test)]
mod tests_dashalign;
#[cfg(test)]
mod tests_editing;
#[cfg(test)]
mod tests_encrypt;
#[cfg(test)]
mod tests_file_info;
#[cfg(test)]
mod tests_focal;
#[cfg(test)]
mod tests_fx;
#[cfg(test)]
mod tests_import_color;
#[cfg(test)]
mod tests_import_fidelity;
#[cfg(test)]
mod tests_import_layers;
#[cfg(test)]
mod tests_import_lines;
#[cfg(test)]
mod tests_import_options;
#[cfg(test)]
mod tests_import_overprint;
#[cfg(test)]
mod tests_layers;
#[cfg(test)]
mod tests_live_text;
#[cfg(test)]
mod tests_marks;
#[cfg(test)]
mod tests_output;
#[cfg(test)]
mod tests_pdf13;
#[cfg(test)]
mod tests_pdfx;
#[cfg(test)]
mod tests_presets;
#[cfg(test)]
mod tests_print;
#[cfg(test)]
mod tests_printadvanced;
#[cfg(test)]
mod tests_realtext;
#[cfg(test)]
mod tests_settings;
#[cfg(test)]
mod tests_stroke;
#[cfg(test)]
mod tests_strokeout;
#[cfg(test)]
mod tests_text_placement;
#[cfg(test)]
mod tests_textstroke;
#[cfg(test)]
mod tests_webview;
#[cfg(test)]
mod tests_reader_streaming;
#[cfg(test)]
mod tests_reader_compat;
+36
View File
@@ -8,6 +8,42 @@ use vectorcraft_geom::{Affine, FillRule, PathData, Point, Rect, shapes};
use crate::*;
mod blend;
mod charstroke;
mod cmykblend;
mod cmykimages;
mod compression;
mod dashalign;
mod editing;
mod encrypt;
mod file_info;
mod focal;
mod fx;
mod import_color;
pub(super) mod import_fidelity;
mod import_layers;
mod import_lines;
mod import_options;
mod import_overprint;
mod layers;
pub(super) mod live_text;
mod marks;
mod output;
mod pdf13;
mod pdfx;
mod presets;
mod print;
mod printadvanced;
mod realtext;
mod settings;
pub(super) mod stroke;
mod strokeout;
mod text_placement;
mod textstroke;
mod webview;
mod reader_streaming;
mod reader_compat;
fn doc(w: f64, h: f64) -> Document {
Document::new(w, h)
}
@@ -9,8 +9,8 @@ use vectorcraft_doc::{Document, NodeKind, TextObject};
use crate::*;
const SOURCE_SANS: &[u8] = include_bytes!("../../../assets/fonts/SourceSans3-Regular.ttf");
const SOURCE_SERIF: &[u8] = include_bytes!("../../../assets/fonts/SourceSerif4-Regular.ttf");
const SOURCE_SANS: &[u8] = include_bytes!("../../../../assets/fonts/SourceSans3-Regular.ttf");
const SOURCE_SERIF: &[u8] = include_bytes!("../../../../assets/fonts/SourceSerif4-Regular.ttf");
/// A 300 × 200 pt page with `lines` of (x, y from the top, size, text) in Source Sans 3, and the
/// same rotated 90° when `rotated`.
@@ -5,7 +5,7 @@ use vectorcraft_doc::{Document, NodeKind};
use crate::{ImportOptions, TextAs, import_with_report};
const INTER: &[u8] = include_bytes!("../../../assets/fonts/Inter-Regular.ttf");
const INTER: &[u8] = include_bytes!("../../../../assets/fonts/Inter-Regular.ttf");
fn stream(dictionary: &str, content: &[u8]) -> Vec<u8> {
let mut bytes = format!("<< {dictionary} /Length {} >>\nstream\n", content.len()).into_bytes();
@@ -14,7 +14,7 @@ use vectorcraft_text::{FontDb, FontFace};
use crate::tests_import_fidelity::stream;
use crate::*;
const SOURCE_SANS: &[u8] = include_bytes!("../../../assets/fonts/SourceSans3-Regular.ttf");
const SOURCE_SANS: &[u8] = include_bytes!("../../../../assets/fonts/SourceSans3-Regular.ttf");
fn sans() -> Arc<FontFace> {
FontDb::global().find_postscript("SourceSans3-Regular").expect("Source Sans 3 is built in")