[librsvg: 9/33] Make the tests build




commit 10270e4bf175a37a7ca40519acba1e231c77b38f
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Oct 29 17:40:27 2020 -0600

    Make the tests build

 Cargo.lock             | 28 ++--------------------------
 Cargo.toml             |  6 ------
 build.rs               | 12 ++++++++++++
 tests/Cargo.toml       | 29 -----------------------------
 tests/src/main.rs      |  1 +
 tests/src/reference.rs |  8 +++++---
 tests/src/utils.rs     |  2 --
 7 files changed, 20 insertions(+), 66 deletions(-)
---
diff --git a/Cargo.lock b/Cargo.lock
index 7069a56c..cf8a8d42 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -833,30 +833,6 @@ dependencies = [
  "yeslogic-fontconfig-sys",
 ]
 
-[[package]]
-name = "librsvg-tests"
-version = "0.1.0"
-dependencies = [
- "assert_cmd",
- "cairo-rs",
- "cast",
- "chrono",
- "float-cmp",
- "glib",
- "libc",
- "librsvg",
- "lopdf",
- "pango",
- "pango-sys",
- "pangocairo",
- "pkg-config",
- "png",
- "predicates",
- "tempfile",
- "test-generator",
- "yeslogic-fontconfig-sys",
-]
-
 [[package]]
 name = "linked-hash-map"
 version = "0.4.2"
@@ -1039,9 +1015,9 @@ dependencies = [
 
 [[package]]
 name = "num-integer"
-version = "0.1.43"
+version = "0.1.44"
 source = "registry+https://github.com/rust-lang/crates.io-index";
-checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b"
+checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
 dependencies = [
  "autocfg",
  "num-traits",
diff --git a/Cargo.toml b/Cargo.toml
index 100e995d..0f12b559 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -107,9 +107,3 @@ harness = false
 [[bench]]
 name = "surface_from_pixbuf"
 harness = false
-
-[workspace]
-members = [
-    ".",
-    "tests",
-]
diff --git a/build.rs b/build.rs
index b8c1dd3a..04c68a3d 100644
--- a/build.rs
+++ b/build.rs
@@ -8,6 +8,7 @@ use pkg_config::{Config, Error};
 
 fn main() {
     find_libxml2();
+    check_for_pangoft2();
     generate_srgb_tables();
 }
 
@@ -67,6 +68,17 @@ fn find(package_name: &str, version: &str, shared_libs: &[&str]) -> Result<(), E
     }
 }
 
+fn check_for_pangoft2() {
+    if pkg_config::Config::new()
+        .atleast_version("1.38")
+        .probe("pangoft2")
+        .is_ok()
+    {
+        println!("cargo:rustc-cfg=have_pangoft2");
+    }
+}
+
+
 /// Converts an sRGB color value to a linear sRGB color value (undoes the gamma correction).
 ///
 /// The input and the output are supposed to be in the [0, 1] range.
diff --git a/tests/src/main.rs b/tests/src/main.rs
index a8a3a6df..cec31e9e 100644
--- a/tests/src/main.rs
+++ b/tests/src/main.rs
@@ -20,6 +20,7 @@ mod reference;
 #[cfg(test)]
 mod render_crash;
 
+#[cfg(test)]
 mod utils;
 
 fn main() {
diff --git a/tests/src/reference.rs b/tests/src/reference.rs
index 856d3285..72e99a1d 100644
--- a/tests/src/reference.rs
+++ b/tests/src/reference.rs
@@ -10,9 +10,11 @@
 use test_generator::test_resources;
 
 use cairo;
-use librsvg::{CairoRenderer, IntrinsicDimensions, Length, Loader};
-use rsvg_internals::surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
-use rsvg_internals::test_utils::compare_to_file;
+use librsvg::{
+    CairoRenderer, IntrinsicDimensions, Length, Loader,
+    surface_utils::shared_surface::{SharedImageSurface, SurfaceType},
+    test_utils::compare_to_file,
+};
 use std::path::PathBuf;
 
 use crate::utils::{fixture_path, setup_font_map, setup_language};
diff --git a/tests/src/utils.rs b/tests/src/utils.rs
index 856a9c14..1914c6c3 100644
--- a/tests/src/utils.rs
+++ b/tests/src/utils.rs
@@ -7,8 +7,6 @@ use std::ffi::CString;
 use std::path::PathBuf;
 use std::sync::Once;
 
-#[cfg(have_pangoft2)]
-
 /// Given a filename from `test_generator::test_resources`, computes the correct fixture filename.
 ///
 /// The `test_resources` procedural macro works by running a filename glob starting on


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]