A fast, helpful, and open-source document parser
Merge branch 'main' into fix/is-complex-content-filters
Logan69ca7df0e2d6
diff --cc crates/liteparse/tests/integration_test.rsindex bb3b090,6b9a4d4..4212866--- a/crates/liteparse/tests/integration_test.rs+++ b/crates/liteparse/tests/integration_test.rs@@@ -1198,44 -1290,27 +1290,69 @@@ async fn test_orientation_correction_re}}+async fn diagonal_column_count(config: LiteParseConfig) -> usize {+ let stats = LiteParse::new(LiteParseConfig {+ quiet: true,+ ..config+ })+ .is_complex(PdfInput::Path(+ "../../integration_tests_data/diagonal_column.pdf".into(),+ ))+ .await+ .expect("is_complex should succeed");+ stats[0].layout.as_ref().expect("layout stats").column_count+}++/// `is_complex` honors the same content filters as `parse`, so a column of+/// diagonal watermark text only counts when it isn't filtered out.+#[tokio::test]+#[serial]+async fn test_is_complex_applies_content_filters() {+ assert_eq!(diagonal_column_count(LiteParseConfig::default()).await, 2);+ assert_eq!(+ diagonal_column_count(LiteParseConfig {+ skip_diagonal_text: true,+ ..LiteParseConfig::default()+ })+ .await,+ 1+ );+ assert_eq!(+ diagonal_column_count(LiteParseConfig {+ crop_box: Some(CropBox {+ top: 0.0,+ right: 0.5,+ bottom: 0.0,+ left: 0.0,+ }),+ ..LiteParseConfig::default()+ })+ .await,+ 1+ );+}+++ /// Map exports alternate restacked 90° labels with off-axis marker glyphs; the+ /// layout canvas must grow linearly instead of doubling per label.+ #[tokio::test]+ #[serial]+ async fn test_rotated_map_labels_keep_layout_canvas_bounded() {+ let lit = LiteParse::new(LiteParseConfig {+ ocr_enabled: false,+ quiet: true,+ ..LiteParseConfig::default()+ });+ let parsed = lit+ .parse("../../integration_tests_data/rotated_map_labels.pdf")+ .await+ .expect("map-style page should parse");++ let page = &parsed.pages[0];+ let canvas = &page.regions.bbox;+ assert!(+ canvas.height < 50.0 * page.page_height,+ "layout canvas {:.0}pt tall for a {:.0}pt page",+ canvas.height,+ page.page_height+ );+ }