[librsvg/rustify-rsvg-convert] tests: disable some tests if cairo surface backends are missing



commit 2870c86b95732bffaf199ab5c7774552f384452a
Author: Sven Neumann <sven svenfoo org>
Date:   Wed Feb 3 15:46:14 2021 +0100

    tests: disable some tests if cairo surface backends are missing
    
    Some tests for rsvg-convert require the PS, PDF or SVG cairo surface
    backends and should not be run if the backends are missing.

 tests/src/cmdline/rsvg_convert.rs | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/tests/src/cmdline/rsvg_convert.rs b/tests/src/cmdline/rsvg_convert.rs
index db3b71a3..5a7910c8 100644
--- a/tests/src/cmdline/rsvg_convert.rs
+++ b/tests/src/cmdline/rsvg_convert.rs
@@ -8,6 +8,7 @@ use crate::predicates::file;
 
 use assert_cmd::assert::IntoOutputPredicate;
 use assert_cmd::Command;
+#[cfg(have_cairo_pdf)]
 use chrono::{TimeZone, Utc};
 use predicates::boolean::*;
 use predicates::prelude::*;
@@ -22,7 +23,7 @@ use url::Url;
 //  - command-line options that affect size (width, height, zoom, resolution) ✔
 //  - pixel dimensions of the output (should be sufficient to do that for PNG) ✔
 //  - limit on output size (32767 pixels) ✔
-//  - output formats (PNG, PDF, PS, EPS, SVG), okay to ignore XML and recording ✔
+//  - output formats (PNG, PDF, PS, EPS, SVG) ✔
 //  - multi-page output (for PDF) ✔
 //  - output file option ✔
 //  - SOURCE_DATA_EPOCH environment variable for PDF output ✔
@@ -115,6 +116,7 @@ fn output_format_png() {
         .stdout(file::is_png());
 }
 
+#[cfg(have_cairo_ps)]
 #[test]
 fn output_format_ps() {
     RsvgConvert::new_with_input("tests/fixtures/dimensions/521-with-viewbox.svg")
@@ -124,6 +126,7 @@ fn output_format_ps() {
         .stdout(file::is_ps());
 }
 
+#[cfg(have_cairo_ps)]
 #[test]
 fn output_format_eps() {
     RsvgConvert::new_with_input("tests/fixtures/dimensions/521-with-viewbox.svg")
@@ -133,6 +136,7 @@ fn output_format_eps() {
         .stdout(file::is_eps());
 }
 
+#[cfg(have_cairo_pdf)]
 #[test]
 fn output_format_pdf() {
     RsvgConvert::new_with_input("tests/fixtures/dimensions/521-with-viewbox.svg")
@@ -142,6 +146,7 @@ fn output_format_pdf() {
         .stdout(file::is_pdf());
 }
 
+#[cfg(have_cairo_svg)]
 #[test]
 fn output_format_svg_short_option() {
     RsvgConvert::new_with_input("tests/fixtures/dimensions/521-with-viewbox.svg")
@@ -242,6 +247,7 @@ fn multiple_input_files_not_allowed_for_png_output() {
         ));
 }
 
+#[cfg(have_cairo_ps)]
 #[test]
 fn multiple_input_files_accepted_for_eps_output() {
     let one = Path::new("tests/fixtures/dimensions/521-with-viewbox.svg");
@@ -255,6 +261,7 @@ fn multiple_input_files_accepted_for_eps_output() {
         .stdout(file::is_eps());
 }
 
+#[cfg(have_cairo_ps)]
 #[test]
 fn multiple_input_files_accepted_for_ps_output() {
     let one = Path::new("tests/fixtures/dimensions/521-with-viewbox.svg");
@@ -268,6 +275,7 @@ fn multiple_input_files_accepted_for_ps_output() {
         .stdout(file::is_ps());
 }
 
+#[cfg(have_cairo_pdf)]
 #[test]
 fn multiple_input_files_create_multi_page_pdf_output() {
     let one = Path::new("tests/fixtures/dimensions/521-with-viewbox.svg");
@@ -283,6 +291,7 @@ fn multiple_input_files_create_multi_page_pdf_output() {
         .stdout(file::is_pdf().with_page_count(3));
 }
 
+#[cfg(have_cairo_pdf)]
 #[test]
 fn env_source_data_epoch_controls_pdf_creation_date() {
     let input = Path::new("tests/fixtures/dimensions/521-with-viewbox.svg");
@@ -296,6 +305,7 @@ fn env_source_data_epoch_controls_pdf_creation_date() {
         .stdout(file::is_pdf().with_creation_date(Utc.timestamp(date, 0)));
 }
 
+#[cfg(have_cairo_pdf)]
 #[test]
 fn env_source_data_epoch_no_digits() {
     // intentionally not testing for the full error string here
@@ -309,6 +319,7 @@ fn env_source_data_epoch_no_digits() {
         .stderr(starts_with("Environment variable $SOURCE_DATE_EPOCH"));
 }
 
+#[cfg(have_cairo_pdf)]
 #[test]
 fn env_source_data_epoch_trailing_garbage() {
     // intentionally not testing for the full error string here
@@ -322,6 +333,7 @@ fn env_source_data_epoch_trailing_garbage() {
         .stderr(starts_with("Environment variable $SOURCE_DATE_EPOCH"));
 }
 
+#[cfg(have_cairo_pdf)]
 #[test]
 fn env_source_data_epoch_empty() {
     // intentionally not testing for the full error string here
@@ -519,6 +531,7 @@ fn negative_resolution_is_invalid() {
         .stderr(contains("Invalid resolution"));
 }
 
+#[cfg(have_cairo_pdf)]
 #[test]
 fn pdf_page_size() {
     RsvgConvert::new_with_input("tests/fixtures/dimensions/521-with-viewbox.svg")


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