From 587a5db67f7e9f17bc32ea7e724b55e1465a97e4 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Tue, 25 Apr 2023 11:39:07 -0600 Subject: Copy a utility function to the librsvg-c tests to avoid having a test-utils feature The only thing that librsvg-c's tests use from rsvg::test_utils is the load_svg() function. That function is trivial enough that we can just copy it to librsvg-c's tests, and thus avoid having a whole feature specification just for that. Part-of: --- librsvg-c/Cargo.toml | 2 +- librsvg-c/tests/legacy_sizing.rs | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'librsvg-c') diff --git a/librsvg-c/Cargo.toml b/librsvg-c/Cargo.toml index c8be41dc..8fed395b 100644 --- a/librsvg-c/Cargo.toml +++ b/librsvg-c/Cargo.toml @@ -25,7 +25,7 @@ url = "2" regex = "1.7.1" [dev-dependencies] -librsvg = { path = "../rsvg", features = ["c-api", "test-utils"] } +librsvg = { path = "../rsvg", features = ["c-api"] } [lib] crate-type = [ "staticlib", "rlib" ] diff --git a/librsvg-c/tests/legacy_sizing.rs b/librsvg-c/tests/legacy_sizing.rs index e47859f4..d059aed5 100644 --- a/librsvg-c/tests/legacy_sizing.rs +++ b/librsvg-c/tests/legacy_sizing.rs @@ -1,8 +1,14 @@ use cairo; use librsvg_c::sizing::LegacySize; -use rsvg::test_utils::load_svg; -use rsvg::CairoRenderer; +use rsvg::{CairoRenderer, Loader, LoadingError, SvgHandle}; + +fn load_svg(input: &'static [u8]) -> Result { + let bytes = glib::Bytes::from_static(input); + let stream = gio::MemoryInputStream::from_bytes(&bytes); + + Loader::new().read_stream(&stream, None::<&gio::File>, None::<&gio::Cancellable>) +} #[test] fn just_viewbox_uses_viewbox_size() { -- cgit v1.2.1