[librsvg: 1/2] Move 'librsvg::surface_utils::compare_surfaces' to the tests




commit 510c90fb6549a5eb31bcd340f333d7a52c6b35aa
Author: Sven Neumann <sven svenfoo org>
Date:   Thu Feb 4 14:02:49 2021 +0100

    Move 'librsvg::surface_utils::compare_surfaces' to the tests
    
    This module is only used from the tests, so it doesn't need to be
    in the library at all.

 Makefile.am                                          |  1 -
 src/surface_utils/mod.rs                             |  1 -
 tests/Makefile.am                                    | 13 +++++++------
 tests/README.md                                      |  3 ++-
 {src/surface_utils => tests/src}/compare_surfaces.rs |  2 +-
 tests/src/main.rs                                    |  3 +++
 tests/src/predicates/png.rs                          |  2 +-
 tests/src/reference_utils.rs                         |  3 ++-
 8 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index a4f50489..e9dc3347 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -95,7 +95,6 @@ LIBRSVG_SRC =                                 \
        src/space.rs                            \
        src/structure.rs                        \
        src/style.rs                            \
-       src/surface_utils/compare_surfaces.rs   \
        src/surface_utils/iterators.rs          \
        src/surface_utils/mod.rs                \
        src/surface_utils/shared_surface.rs     \
diff --git a/src/surface_utils/mod.rs b/src/surface_utils/mod.rs
index 97ddef65..cbd93058 100644
--- a/src/surface_utils/mod.rs
+++ b/src/surface_utils/mod.rs
@@ -4,7 +4,6 @@ use std::mem;
 use std::ops::DerefMut;
 use std::slice;
 
-pub mod compare_surfaces;
 pub mod iterators;
 pub mod shared_surface;
 pub mod srgb;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d6b643f3..297c06a1 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -4,21 +4,22 @@ test_sources =                                \
        build.rs                        \
        src/api.rs                      \
        src/bugs.rs                     \
-       src/cmdline/mod.rs              \
-       src/cmdline/rsvg_convert.rs     \
+       src/compare_surfaces.rs         \
        src/errors.rs                   \
        src/intrinsic_dimensions.rs     \
        src/loading_crash.rs            \
        src/main.rs                     \
-       src/predicates/file.rs          \
-       src/predicates/mod.rs           \
-       src/predicates/pdf.rs           \
-       src/predicates/png.rs           \
        src/primitives.rs               \
        src/reference.rs                \
        src/reference_utils.rs          \
        src/render_crash.rs             \
        src/utils.rs                    \
+       src/cmdline/mod.rs              \
+       src/cmdline/rsvg_convert.rs     \
+       src/predicates/file.rs          \
+       src/predicates/mod.rs           \
+       src/predicates/pdf.rs           \
+       src/predicates/png.rs           \
        $(NULL)
 
 test_programs = api
diff --git a/tests/README.md b/tests/README.md
index 83c442f1..4e9f7abf 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -71,7 +71,8 @@ These are built as a Rust binary in this tests/ directory, and are
 runnable with `cargo test`.
 
 Note that this test binary includes tests for the rsvg-convert
-program.  It needs to be compiled before running the tests with a plain `cargo test`.
+program.  It needs to be compiled before running the tests with a
+plain `cargo test`.
 
 To just run the integration tests without testing rsvg-convert, you
 can use this:
diff --git a/src/surface_utils/compare_surfaces.rs b/tests/src/compare_surfaces.rs
similarity index 98%
rename from src/surface_utils/compare_surfaces.rs
rename to tests/src/compare_surfaces.rs
index 13b702e4..7a8c87f5 100644
--- a/src/surface_utils/compare_surfaces.rs
+++ b/tests/src/compare_surfaces.rs
@@ -1,6 +1,6 @@
 use std::fmt;
 
-use super::{
+use librsvg::surface_utils::{
     iterators::Pixels,
     shared_surface::{SharedImageSurface, SurfaceType},
     ImageSurfaceDataExt, Pixel, PixelOps,
diff --git a/tests/src/main.rs b/tests/src/main.rs
index f56696ad..4041ce40 100644
--- a/tests/src/main.rs
+++ b/tests/src/main.rs
@@ -11,6 +11,9 @@ mod bugs;
 #[cfg(test)]
 mod cmdline;
 
+#[cfg(test)]
+mod compare_surfaces;
+
 #[cfg(test)]
 mod errors;
 
diff --git a/tests/src/predicates/png.rs b/tests/src/predicates/png.rs
index c4375d7e..22767b2f 100644
--- a/tests/src/predicates/png.rs
+++ b/tests/src/predicates/png.rs
@@ -6,9 +6,9 @@ use std::fmt;
 use std::io::BufReader;
 use std::path::{Path, PathBuf};
 
-use librsvg::surface_utils::compare_surfaces::BufferDiff;
 use librsvg::surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
 
+use crate::compare_surfaces::BufferDiff;
 use crate::reference_utils::{surface_from_png, Compare, Deviation, Reference};
 
 /// Checks that the variable of type [u8] can be parsed as a PNG file.
diff --git a/tests/src/reference_utils.rs b/tests/src/reference_utils.rs
index 2558eb0e..4dfc8308 100644
--- a/tests/src/reference_utils.rs
+++ b/tests/src/reference_utils.rs
@@ -10,9 +10,10 @@ use std::io::{BufReader, Read};
 use std::path::{Path, PathBuf};
 use std::sync::Once;
 
-use librsvg::surface_utils::compare_surfaces::{compare_surfaces, BufferDiff, Diff};
 use librsvg::surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
 
+use crate::compare_surfaces::{compare_surfaces, BufferDiff, Diff};
+
 pub struct Reference(SharedImageSurface);
 
 impl Reference {


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