summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2023-04-25 11:39:07 -0600
committerFederico Mena Quintero <federico@gnome.org>2023-04-25 14:48:49 -0600
commit587a5db67f7e9f17bc32ea7e724b55e1465a97e4 (patch)
tree756e1ed801a01e7e27a9480c16e9fac84791cc7d
parent06e7b9b4a20709e1cb8fea4ea8ec32a90b425e74 (diff)
downloadlibrsvg-587a5db67f7e9f17bc32ea7e724b55e1465a97e4.tar.gz
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: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/822>
-rw-r--r--librsvg-c/Cargo.toml2
-rw-r--r--librsvg-c/tests/legacy_sizing.rs10
2 files changed, 9 insertions, 3 deletions
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<SvgHandle, LoadingError> {
+ 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() {