From 52fb56b43862a12048b2996b7f82534f0f76d9b5 Mon Sep 17 00:00:00 2001 From: aiongg Date: Mon, 26 Oct 2026 18:26:58 +0000 Subject: [PATCH] refactor(text): move tests_*.rs to tests/.rs --- crates/text/src/lib.rs | 44 ------------------- crates/text/src/tests.rs | 23 ++++++++++ .../text/src/{tests_axes.rs => tests/axes.rs} | 4 +- .../text/src/{tests_bidi.rs => tests/bidi.rs} | 2 +- .../{tests_bitmaps.rs => tests/bitmaps.rs} | 10 ++--- .../text/src/{tests_colr.rs => tests/colr.rs} | 20 ++++----- .../src/{tests_combos.rs => tests/combos.rs} | 2 +- .../devanagari.rs} | 2 +- .../src/{tests_embed.rs => tests/embed.rs} | 6 +-- .../text/src/{tests_fit.rs => tests/fit.rs} | 2 +- .../text/src/{tests_hang.rs => tests/hang.rs} | 2 +- .../src/{tests_inline.rs => tests/inline.rs} | 2 +- .../{tests_joiners.rs => tests/joiners.rs} | 2 +- .../{tests_justify.rs => tests/justify.rs} | 2 +- .../path_joins.rs} | 2 +- .../text/src/{tests_ruby.rs => tests/ruby.rs} | 2 +- .../{tests_scripts.rs => tests/scripts.rs} | 2 +- .../text/src/{tests_snap.rs => tests/snap.rs} | 2 +- .../svg_glyphs.rs} | 10 ++--- .../{tests_sysfonts.rs => tests/sysfonts.rs} | 2 +- .../text/src/{tests_typo.rs => tests/typo.rs} | 2 +- .../{tests_variable.rs => tests/variable.rs} | 4 +- .../{tests_versions.rs => tests/versions.rs} | 4 +- .../{tests_vertical.rs => tests/vertical.rs} | 2 +- 24 files changed, 67 insertions(+), 88 deletions(-) rename crates/text/src/{tests_axes.rs => tests/axes.rs} (99%) rename crates/text/src/{tests_bidi.rs => tests/bidi.rs} (99%) rename crates/text/src/{tests_bitmaps.rs => tests/bitmaps.rs} (95%) rename crates/text/src/{tests_colr.rs => tests/colr.rs} (97%) rename crates/text/src/{tests_combos.rs => tests/combos.rs} (99%) rename crates/text/src/{tests_devanagari.rs => tests/devanagari.rs} (99%) rename crates/text/src/{tests_embed.rs => tests/embed.rs} (97%) rename crates/text/src/{tests_fit.rs => tests/fit.rs} (99%) rename crates/text/src/{tests_hang.rs => tests/hang.rs} (99%) rename crates/text/src/{tests_inline.rs => tests/inline.rs} (99%) rename crates/text/src/{tests_joiners.rs => tests/joiners.rs} (99%) rename crates/text/src/{tests_justify.rs => tests/justify.rs} (99%) rename crates/text/src/{tests_path_joins.rs => tests/path_joins.rs} (99%) rename crates/text/src/{tests_ruby.rs => tests/ruby.rs} (99%) rename crates/text/src/{tests_scripts.rs => tests/scripts.rs} (99%) rename crates/text/src/{tests_snap.rs => tests/snap.rs} (99%) rename crates/text/src/{tests_svg_glyphs.rs => tests/svg_glyphs.rs} (96%) rename crates/text/src/{tests_sysfonts.rs => tests/sysfonts.rs} (99%) rename crates/text/src/{tests_typo.rs => tests/typo.rs} (99%) rename crates/text/src/{tests_variable.rs => tests/variable.rs} (99%) rename crates/text/src/{tests_versions.rs => tests/versions.rs} (96%) rename crates/text/src/{tests_vertical.rs => tests/vertical.rs} (99%) diff --git a/crates/text/src/lib.rs b/crates/text/src/lib.rs index 6c913280a..4299e61d2 100644 --- a/crates/text/src/lib.rs +++ b/crates/text/src/lib.rs @@ -699,49 +699,5 @@ pub fn logical_order(visual: &str) -> Option<(Vec, bool)> { #[cfg(test)] mod tests; #[cfg(test)] -mod tests_axes; -#[cfg(test)] -mod tests_bidi; -#[cfg(test)] -mod tests_bitmaps; -#[cfg(test)] -mod tests_colr; -#[cfg(test)] -mod tests_combos; -#[cfg(test)] -mod tests_devanagari; -#[cfg(test)] -mod tests_embed; -#[cfg(test)] -mod tests_fit; -#[cfg(test)] -mod tests_hang; -#[cfg(test)] -mod tests_inline; -#[cfg(test)] -mod tests_joiners; -#[cfg(test)] -mod tests_justify; -#[cfg(test)] -mod tests_path_joins; -#[cfg(test)] -mod tests_ruby; -#[cfg(test)] -mod tests_scripts; -#[cfg(test)] -mod tests_snap; -#[cfg(test)] -mod tests_svg_glyphs; -#[cfg(test)] -mod tests_sysfonts; -#[cfg(test)] -mod tests_typo; -#[cfg(test)] -mod tests_variable; -#[cfg(test)] -mod tests_versions; -#[cfg(test)] -mod tests_vertical; -#[cfg(test)] #[path = "../build/web_fonts.rs"] mod web_fonts_build; diff --git a/crates/text/src/tests.rs b/crates/text/src/tests.rs index 7373db683..79ce4f566 100644 --- a/crates/text/src/tests.rs +++ b/crates/text/src/tests.rs @@ -3,6 +3,29 @@ use kurbo::{Affine, Shape}; use vectorcraft_doc::{CharStyle, Justify, TextKind, TextRun}; use vectorcraft_geom::PathData; +mod axes; +mod bidi; +mod bitmaps; +mod colr; +mod combos; +mod devanagari; +mod embed; +mod fit; +mod hang; +mod inline; +mod joiners; +mod justify; +mod path_joins; +mod ruby; +mod scripts; +mod snap; +mod svg_glyphs; +mod sysfonts; +mod typo; +mod variable; +mod versions; +mod vertical; + /// The bundled fonts only: what these tests measure doesn't change with the fonts installed. fn db() -> &'static FontDb { static DB: std::sync::OnceLock = std::sync::OnceLock::new(); diff --git a/crates/text/src/tests_axes.rs b/crates/text/src/tests/axes.rs similarity index 99% rename from crates/text/src/tests_axes.rs rename to crates/text/src/tests/axes.rs index 7bfc57e5a..27b23b6df 100644 --- a/crates/text/src/tests_axes.rs +++ b/crates/text/src/tests/axes.rs @@ -9,8 +9,8 @@ use skrifa::instance::{LocationRef, Size}; use skrifa::raw::TableProvider; use vectorcraft_doc::CharStyle; -use super::test_fonts::{TWO_AXIS_FAMILY as FAMILY, TWO_AXIS_NARROW, VARIABLE_CHARS, VARIABLE_WIDEN, two_axis_font}; -use super::*; +use crate::test_fonts::{TWO_AXIS_FAMILY as FAMILY, TWO_AXIS_NARROW, VARIABLE_CHARS, VARIABLE_WIDEN, two_axis_font}; +use crate::*; /// A database of the bundled fonts and the two-axis test font. fn db() -> FontDb { diff --git a/crates/text/src/tests_bidi.rs b/crates/text/src/tests/bidi.rs similarity index 99% rename from crates/text/src/tests_bidi.rs rename to crates/text/src/tests/bidi.rs index d7738c501..af67365b0 100644 --- a/crates/text/src/tests_bidi.rs +++ b/crates/text/src/tests/bidi.rs @@ -1,5 +1,5 @@ //! Direction, source-cluster and editing regressions; no RTL font assets required. -use super::*; +use crate::*; use kurbo::{Affine, BezPath, Point, Rect, Shape}; use std::ops::Range; use std::sync::Arc; diff --git a/crates/text/src/tests_bitmaps.rs b/crates/text/src/tests/bitmaps.rs similarity index 95% rename from crates/text/src/tests_bitmaps.rs rename to crates/text/src/tests/bitmaps.rs index f28656d4a..96661534b 100644 --- a/crates/text/src/tests_bitmaps.rs +++ b/crates/text/src/tests/bitmaps.rs @@ -6,8 +6,8 @@ use skrifa::MetadataProvider; use skrifa::instance::{LocationRef, Size}; use vectorcraft_doc::CharStyle; -use super::test_fonts::{COLOUR_CBDT_BEARINGS, COLOUR_CHAR, COLOUR_PPEM, colour_bitmap_family, colour_bitmap_font}; -use super::*; +use crate::test_fonts::{COLOUR_CBDT_BEARINGS, COLOUR_CHAR, COLOUR_PPEM, colour_bitmap_family, colour_bitmap_font}; +use crate::*; fn db(sbix: bool) -> FontDb { let db = FontDb::with_font_dirs(vec![]); @@ -32,7 +32,7 @@ fn assert_near(a: Rect, b: Rect) { /// The left side bearing of [`COLOUR_CHAR`] in the bundled Source Sans 3 (font units of 1000). fn lsb() -> f64 { - let font = skrifa::FontRef::new(include_bytes!("../../../assets/fonts/SourceSans3-Regular.ttf")).unwrap(); + let font = skrifa::FontRef::new(include_bytes!("../../../../assets/fonts/SourceSans3-Regular.ttf")).unwrap(); let gid = font.charmap().map(COLOUR_CHAR).unwrap(); f64::from(font.glyph_metrics(Size::unscaled(), LocationRef::default()).left_side_bearing(gid).unwrap()) } @@ -95,8 +95,8 @@ fn other_glyphs_of_a_colour_font_keep_their_outlines() { /// decoded (a font is untrusted input). #[test] fn a_bitmap_past_the_caps_or_without_a_header_is_no_image() { - use super::bitmap::{MAX_PNG_BYTES, MAX_SIDE}; - use super::test_fonts::{COLOUR_LARGE, colour_bitmap_font_with, solid_png}; + use crate::bitmap::{MAX_PNG_BYTES, MAX_SIDE}; + use crate::test_fonts::{COLOUR_LARGE, colour_bitmap_font_with, solid_png}; let good = solid_png(COLOUR_PPEM.into(), COLOUR_LARGE); // A header claiming a side past the cap (the IHDR width). let mut wide = good.clone(); diff --git a/crates/text/src/tests_colr.rs b/crates/text/src/tests/colr.rs similarity index 97% rename from crates/text/src/tests_colr.rs rename to crates/text/src/tests/colr.rs index 9f51e0d9e..212882ce7 100644 --- a/crates/text/src/tests_colr.rs +++ b/crates/text/src/tests/colr.rs @@ -4,7 +4,7 @@ use skrifa::MetadataProvider; use skrifa::color::ColorGlyphFormat; -use super::test_fonts::{COLOUR_CHAR, COLR_SWEEP_CHAR, colr_font}; +use crate::test_fonts::{COLOUR_CHAR, COLR_SWEEP_CHAR, colr_font}; #[test] fn colr_fonts_build_and_read() { @@ -24,8 +24,8 @@ use skrifa::instance::LocationRef; use vectorcraft_doc::color::{BlendMode, Color, GradientKind, Paint}; use vectorcraft_doc::{Node, NodeKind}; -use super::colr::{ColourContent, colour_glyph}; -use super::test_fonts::{COLR_GREEN, COLR_RED}; +use crate::colr::{ColourContent, colour_glyph}; +use crate::test_fonts::{COLR_GREEN, COLR_RED}; const FOREGROUND: Color = Color::Rgb { r: 0.25, g: 0.5, b: 0.75 }; @@ -120,7 +120,7 @@ fn a_colr_graph_that_paints_itself_is_no_colour_glyph() { let base = GlyphId16::new(u16::try_from(base).unwrap()); let mut colr = Colr::new(0, None, None, 0); colr.base_glyph_list = Some(BaseGlyphList::new(1, vec![BaseGlyphPaint::new(base, Paint::colr_glyph(base))])).into(); - let font = super::test_fonts::colr_font_with("Colrtest Loop", &colr).unwrap(); + let font = crate::test_fonts::colr_font_with("Colrtest Loop", &colr).unwrap(); assert!(content(&font, COLOUR_CHAR).is_none()); } @@ -136,7 +136,7 @@ fn a_colr_graph_nested_past_the_cap_is_no_colour_glyph() { } let mut colr = Colr::new(0, None, None, 0); colr.base_glyph_list = Some(BaseGlyphList::new(1, vec![BaseGlyphPaint::new(base, paint)])).into(); - let font = super::test_fonts::colr_font_with("Colrtest Deep", &colr).unwrap(); + let font = crate::test_fonts::colr_font_with("Colrtest Deep", &colr).unwrap(); assert!(content(&font, COLOUR_CHAR).is_none()); } @@ -145,8 +145,8 @@ fn a_colr_graph_nested_past_the_cap_is_no_colour_glyph() { use kurbo::Point as KPoint; use vectorcraft_doc::{CharStyle, TextObject}; -use super::test_fonts::colr_family; -use super::{FontDb, layout}; +use crate::test_fonts::colr_family; +use crate::{FontDb, layout}; fn colr_db(v1: bool) -> FontDb { let db = FontDb::with_font_dirs(vec![]); @@ -223,7 +223,7 @@ fn a_face_with_colr_and_sbix_draws_colr() { use write_fonts::FontBuilder; use write_fonts::types::Tag; let colr = colr_font(false).unwrap(); - let sbix = super::test_fonts::colour_bitmap_font(true).unwrap(); + let sbix = crate::test_fonts::colour_bitmap_font(true).unwrap(); let sbix = skrifa::FontRef::new(&sbix).unwrap(); let font = skrifa::FontRef::new(&colr).unwrap(); let mut builder = FontBuilder::new(); @@ -251,7 +251,7 @@ fn v1_font(family: &str, base: char, paint: impl Fn(write_fonts::types::GlyphId1 let mut colr = Colr::new(0, None, None, 0); colr.base_glyph_list = Some(BaseGlyphList::new(1, vec![BaseGlyphPaint::new(gid(base), paint(gid('O')))])).into(); colr.layer_list = Some(LayerList::new(1, vec![solid(0)])).into(); - super::test_fonts::colr_font_with(family, &colr).unwrap() + crate::test_fonts::colr_font_with(family, &colr).unwrap() } use write_fonts::tables::colr::Paint as ColrPaint; @@ -312,7 +312,7 @@ fn a_collapsed_sweep_glyph_draws_nothing() { // A clip box, so the image is made. let clip = ClipBox::format_1(FWord::new(0), FWord::new(0), FWord::new(500), FWord::new(500)); colr.clip_list = Some(ClipList::new(1, 1, vec![Clip::new(gid(COLOUR_CHAR), gid(COLOUR_CHAR), clip)])).into(); - let font = super::test_fonts::colr_font_with("Colrtest Flat", &colr).unwrap(); + let font = crate::test_fonts::colr_font_with("Colrtest Flat", &colr).unwrap(); let Some(ColourContent::Image(image)) = content(&font, COLOUR_CHAR) else { panic!("an image") }; assert!(image.blob.bytes.starts_with(b"\x89PNG")); } diff --git a/crates/text/src/tests_combos.rs b/crates/text/src/tests/combos.rs similarity index 99% rename from crates/text/src/tests_combos.rs rename to crates/text/src/tests/combos.rs index d61dccc51..02fdd6d79 100644 --- a/crates/text/src/tests_combos.rs +++ b/crates/text/src/tests/combos.rs @@ -3,7 +3,7 @@ //! per-paragraph attributes and inline graphics. Each feature has its own tests; these check that //! one doesn't undo or skip another (as vertical alignment once left inline art behind). -use super::*; +use crate::*; use kurbo::Shape; use vectorcraft_doc::{AreaFit, CharStyle, Composer, InlineArt, Justify, TextKind, TextRun, VerticalAlign}; use vectorcraft_geom::PathData; diff --git a/crates/text/src/tests_devanagari.rs b/crates/text/src/tests/devanagari.rs similarity index 99% rename from crates/text/src/tests_devanagari.rs rename to crates/text/src/tests/devanagari.rs index 37c21ac5a..f7cca3093 100644 --- a/crates/text/src/tests_devanagari.rs +++ b/crates/text/src/tests/devanagari.rs @@ -3,7 +3,7 @@ //! (https://learn.microsoft.com/en-us/typography/script-development/devanagari) and the Unicode //! Standard's Devanagari section (https://www.unicode.org/versions/latest/core-spec/chapter-12/). //! No font is committed: the tests use an installed face and print SKIPPED when none is found. -use super::*; +use crate::*; use kurbo::{BezPath, Point}; use std::sync::Arc; use vectorcraft_doc::{CharStyle, TextKind}; diff --git a/crates/text/src/tests_embed.rs b/crates/text/src/tests/embed.rs similarity index 97% rename from crates/text/src/tests_embed.rs rename to crates/text/src/tests/embed.rs index 8490bfd97..9dd8543e0 100644 --- a/crates/text/src/tests_embed.rs +++ b/crates/text/src/tests/embed.rs @@ -5,8 +5,8 @@ use skrifa::instance::{LocationRef, Size}; use skrifa::raw::types::Tag; use skrifa::raw::{FontData, FontRead, TableProvider}; -use super::embed::Embedding; -use super::*; +use crate::embed::Embedding; +use crate::*; #[test] fn fs_type_flags_decide_the_embedding() { @@ -22,7 +22,7 @@ fn fs_type_flags_decide_the_embedding() { /// The bundled Source Sans 3 Regular renamed `family` (13 characters, as long as the original /// name) with OS/2 `fsType` set to `fs_type`. fn licensed_font(family: &str, fs_type: u16) -> Vec { - let mut data = include_bytes!("../../../assets/fonts/SourceSans3-Regular.ttf").to_vec(); + let mut data = include_bytes!("../../../../assets/fonts/SourceSans3-Regular.ttf").to_vec(); let table = |data: &[u8], tag: &[u8; 4]| { let f = skrifa::FontRef::new(data).unwrap(); let r = f.table_directory.table_records().iter().find(|r| r.tag().to_be_bytes() == *tag).unwrap(); diff --git a/crates/text/src/tests_fit.rs b/crates/text/src/tests/fit.rs similarity index 99% rename from crates/text/src/tests_fit.rs rename to crates/text/src/tests/fit.rs index f0ede1003..415ddc90a 100644 --- a/crates/text/src/tests_fit.rs +++ b/crates/text/src/tests/fit.rs @@ -1,6 +1,6 @@ //! Area type fitting: Shrink Text to Fit. -use super::*; +use crate::*; use kurbo::Shape; use vectorcraft_doc::{AreaFit, CharStyle, TextKind}; use vectorcraft_geom::PathData; diff --git a/crates/text/src/tests_hang.rs b/crates/text/src/tests/hang.rs similarity index 99% rename from crates/text/src/tests_hang.rs rename to crates/text/src/tests/hang.rs index e59d89062..5ccb79a5c 100644 --- a/crates/text/src/tests_hang.rs +++ b/crates/text/src/tests/hang.rs @@ -3,7 +3,7 @@ //! paragraphs" › Hanging punctuation, //! ). -use super::*; +use crate::*; use kurbo::{Affine, Shape}; use vectorcraft_doc::{CharStyle, Composer, Justify, TextKind}; use vectorcraft_geom::PathData; diff --git a/crates/text/src/tests_inline.rs b/crates/text/src/tests/inline.rs similarity index 99% rename from crates/text/src/tests_inline.rs rename to crates/text/src/tests/inline.rs index 495555381..ebc90351d 100644 --- a/crates/text/src/tests_inline.rs +++ b/crates/text/src/tests/inline.rs @@ -1,6 +1,6 @@ //! Inline graphics in text: a symbol's art laid out like a glyph. -use super::*; +use crate::*; use kurbo::{Affine, Shape}; use vectorcraft_doc::text::INLINE_CHAR; use vectorcraft_doc::{CharStyle, InlineArt, Justify, TextKind, TextRun}; diff --git a/crates/text/src/tests_joiners.rs b/crates/text/src/tests/joiners.rs similarity index 99% rename from crates/text/src/tests_joiners.rs rename to crates/text/src/tests/joiners.rs index 6c23cedff..041294394 100644 --- a/crates/text/src/tests_joiners.rs +++ b/crates/text/src/tests/joiners.rs @@ -7,7 +7,7 @@ //! https://learn.microsoft.com/en-us/typography/script-development/bengali). //! No font is committed: the tests use installed faces and print SKIPPED when none is found, except //! the check of the half-form test's face filter, which builds its faces in code. -use super::*; +use crate::*; use kurbo::Point; use std::sync::Arc; use vectorcraft_doc::CharStyle; diff --git a/crates/text/src/tests_justify.rs b/crates/text/src/tests/justify.rs similarity index 99% rename from crates/text/src/tests_justify.rs rename to crates/text/src/tests/justify.rs index 0a15520dc..6cb9e7718 100644 --- a/crates/text/src/tests_justify.rs +++ b/crates/text/src/tests/justify.rs @@ -1,7 +1,7 @@ //! Paragraph panel menu › Justification…: word spacing, letter spacing, glyph scaling, Single Word //! Justification and Auto Leading in layout. -use super::*; +use crate::*; use kurbo::{Affine, Shape}; use vectorcraft_doc::text::Kashida; use vectorcraft_doc::{CharStyle, JustificationOptions, Justify, SingleWordJustify, TextKind}; diff --git a/crates/text/src/tests_path_joins.rs b/crates/text/src/tests/path_joins.rs similarity index 99% rename from crates/text/src/tests_path_joins.rs rename to crates/text/src/tests/path_joins.rs index a796490f8..1ac96e3f0 100644 --- a/crates/text/src/tests_path_joins.rs +++ b/crates/text/src/tests/path_joins.rs @@ -2,7 +2,7 @@ //! between one glyph's edge and the next one's, at the baseline and at the height of the joining //! stroke, is the measure. Fonts are installed ones (none is kept in the repository): the tests //! that need an Arabic font say so and stop without one. -use super::*; +use crate::*; use kurbo::{Affine, BezPath, Point, Shape}; use std::sync::Arc; use vectorcraft_doc::{CharStyle, TextKind}; diff --git a/crates/text/src/tests_ruby.rs b/crates/text/src/tests/ruby.rs similarity index 99% rename from crates/text/src/tests_ruby.rs rename to crates/text/src/tests/ruby.rs index 5e3a66b0a..e7a7cfc1f 100644 --- a/crates/text/src/tests_ruby.rs +++ b/crates/text/src/tests/ruby.rs @@ -1,7 +1,7 @@ //! Ruby (furigana) tests: geometry over the base text in horizontal and vertical type, line //! growth, overhang/squeeze, splitting over a line break, and the byte ranges following edits. -use super::*; +use crate::*; use kurbo::{Affine, Point, Rect, Shape}; use vectorcraft_doc::{CharStyle, RubyAlign, RubyPosition, RubySpan, TextKind}; use vectorcraft_geom::PathData; diff --git a/crates/text/src/tests_scripts.rs b/crates/text/src/tests/scripts.rs similarity index 99% rename from crates/text/src/tests_scripts.rs rename to crates/text/src/tests/scripts.rs index 1ba84a220..17a6ab6e8 100644 --- a/crates/text/src/tests_scripts.rs +++ b/crates/text/src/tests/scripts.rs @@ -3,7 +3,7 @@ use kurbo::Shape; use vectorcraft_doc::{CharPosition, CharStyle, ScriptMetrics, TextObject}; -use super::*; +use crate::*; fn layout_of(text: &str, st: CharStyle) -> TextLayout { layout(FontDb::global(), &TextObject::point(kurbo::Point::ZERO, text, st)) diff --git a/crates/text/src/tests_snap.rs b/crates/text/src/tests/snap.rs similarity index 99% rename from crates/text/src/tests_snap.rs rename to crates/text/src/tests/snap.rs index a5c65dd59..b288f5e9f 100644 --- a/crates/text/src/tests_snap.rs +++ b/crates/text/src/tests/snap.rs @@ -3,7 +3,7 @@ use kurbo::{Affine, Shape}; use vectorcraft_doc::CharStyle; -use super::*; +use crate::*; fn text_at(x: f64, y: f64) -> TextObject { TextObject::point(Point::new(x, y), "Hill", CharStyle { size: 9.0, ..CharStyle::default() }) diff --git a/crates/text/src/tests_svg_glyphs.rs b/crates/text/src/tests/svg_glyphs.rs similarity index 96% rename from crates/text/src/tests_svg_glyphs.rs rename to crates/text/src/tests/svg_glyphs.rs index dcb729ca1..d82ff9052 100644 --- a/crates/text/src/tests_svg_glyphs.rs +++ b/crates/text/src/tests/svg_glyphs.rs @@ -8,11 +8,11 @@ use vectorcraft_doc::color::{Color, Paint}; use vectorcraft_doc::{Appearance, CharStyle, Node, NodeId, TextObject}; use vectorcraft_geom::PathData; -use super::test_fonts::{SVG_CHAR, source_sans_gid, svg_font}; +use crate::test_fonts::{SVG_CHAR, source_sans_gid, svg_font}; /// The family of the SVG test fonts here (each database holds one). const FAMILY: &str = "Svgtest Glyphs"; -use super::{FontDb, layout, set_svg_glyph_reader}; +use crate::{FontDb, layout, set_svg_glyph_reader}; /// Stands in for the SVG importer, which this crate can't use (it is a layer up): a square one em /// wide in the fill, stroked when there is a stroke, for a document that has the glyph's element. @@ -88,7 +88,7 @@ fn colr_comes_before_svg() { use write_fonts::FontBuilder; use write_fonts::types::Tag; set_svg_glyph_reader(reader); - let colr = super::test_fonts::colr_font(false).unwrap(); + let colr = crate::test_fonts::colr_font(false).unwrap(); let colr = skrifa::FontRef::new(&colr).unwrap(); let g = gid(SVG_CHAR); let svg = svg_font(FAMILY, &[(g, g, &document(""))]).unwrap(); @@ -103,7 +103,7 @@ fn colr_comes_before_svg() { } let db = FontDb::with_font_dirs(vec![]); assert_eq!(db.add_font(builder.build()), 1); - let st = CharStyle { font_family: super::test_fonts::colr_family(false).into(), size: 100.0, ..CharStyle::default() }; + let st = CharStyle { font_family: crate::test_fonts::colr_family(false).into(), size: 100.0, ..CharStyle::default() }; let l = layout(&db, &TextObject::point(Point::ZERO, &SVG_CHAR.to_string(), st)); // The COLR glyph has two layers; the reader's art one path. let colour = l.glyphs[0].colour.clone().unwrap(); @@ -122,7 +122,7 @@ fn a_glyph_whose_colr_layers_dont_read_keeps_its_outline() { let g = gid(SVG_CHAR); let mut colr = Colr::new(0, None, None, 0); colr.base_glyph_list = Some(BaseGlyphList::new(1, vec![BaseGlyphPaint::new(GlyphId16::new(g), Paint::colr_glyph(GlyphId16::new(g)))])).into(); - let looped = super::test_fonts::colr_font_with(FAMILY, &colr).unwrap(); + let looped = crate::test_fonts::colr_font_with(FAMILY, &colr).unwrap(); let looped = skrifa::FontRef::new(&looped).unwrap(); let svg = svg_font(FAMILY, &[(g, g, &document(""))]).unwrap(); let svg = skrifa::FontRef::new(&svg).unwrap(); diff --git a/crates/text/src/tests_sysfonts.rs b/crates/text/src/tests/sysfonts.rs similarity index 99% rename from crates/text/src/tests_sysfonts.rs rename to crates/text/src/tests/sysfonts.rs index 40cce9f06..5571d5185 100644 --- a/crates/text/src/tests_sysfonts.rs +++ b/crates/text/src/tests/sysfonts.rs @@ -3,7 +3,7 @@ use std::path::{Path, PathBuf}; use std::sync::Arc; -use super::*; +use crate::*; use crate::fontdb::fonts_outside; const FAMILY: &str = "Sysfont Sans3"; diff --git a/crates/text/src/tests_typo.rs b/crates/text/src/tests/typo.rs similarity index 99% rename from crates/text/src/tests_typo.rs rename to crates/text/src/tests/typo.rs index 7e9a6448c..c06396a1e 100644 --- a/crates/text/src/tests_typo.rs +++ b/crates/text/src/tests/typo.rs @@ -1,7 +1,7 @@ //! Typography tests: rich-text editing, caret navigation, selection, area flow, composer, //! hyphenation, OpenType features, area type options. -use super::*; +use crate::*; use kurbo::{Affine, Circle, Shape}; use vectorcraft_doc::{CharStyle, Justify, TextKind, TextRun}; use vectorcraft_geom::PathData; diff --git a/crates/text/src/tests_variable.rs b/crates/text/src/tests/variable.rs similarity index 99% rename from crates/text/src/tests_variable.rs rename to crates/text/src/tests/variable.rs index d17e163ad..8e087f68e 100644 --- a/crates/text/src/tests_variable.rs +++ b/crates/text/src/tests/variable.rs @@ -7,8 +7,8 @@ use skrifa::instance::{LocationRef, Size}; use skrifa::raw::TableProvider; use vectorcraft_doc::CharStyle; -use super::test_fonts::{VARIABLE_CHARS, VARIABLE_FAMILY as FAMILY, VARIABLE_WIDEN, name_table, variable_font}; -use super::*; +use crate::test_fonts::{VARIABLE_CHARS, VARIABLE_FAMILY as FAMILY, VARIABLE_WIDEN, name_table, variable_font}; +use crate::*; fn font() -> Vec { variable_font().expect("the test font builds") diff --git a/crates/text/src/tests_versions.rs b/crates/text/src/tests/versions.rs similarity index 96% rename from crates/text/src/tests_versions.rs rename to crates/text/src/tests/versions.rs index 91250fddf..a721e435b 100644 --- a/crates/text/src/tests_versions.rs +++ b/crates/text/src/tests/versions.rs @@ -5,8 +5,8 @@ use kurbo::Point; use vectorcraft_doc::CharStyle; -use super::test_fonts::{TWIN_FAMILY as FAMILY, TWIN_VERSIONS as VERSIONS, twin_font}; -use super::*; +use crate::test_fonts::{TWIN_FAMILY as FAMILY, TWIN_VERSIONS as VERSIONS, twin_font}; +use crate::*; /// A database of the bundled fonts, the newer version of the test family loaded first. fn db() -> FontDb { diff --git a/crates/text/src/tests_vertical.rs b/crates/text/src/tests/vertical.rs similarity index 99% rename from crates/text/src/tests_vertical.rs rename to crates/text/src/tests/vertical.rs index 97154feef..d69b5df29 100644 --- a/crates/text/src/tests_vertical.rs +++ b/crates/text/src/tests/vertical.rs @@ -1,6 +1,6 @@ //! Vertical type (bundled fonts: `§` and `×` stand upright like CJK, letters lie on their side; //! Japanese text only with craft-fonts' faces, skipped without them). -use super::*; +use crate::*; use kurbo::Shape; use vectorcraft_doc::{CharStyle, Justify, TextKind, TextRun}; use vectorcraft_geom::PathData;