[librsvg/rustification] rsvg-test: allow skipping directories that start with "ignore" as well as files



commit 3b80bf96d3a890d196d975569d8f5a1b36cf6481
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Dec 14 10:20:08 2016 -0600

    rsvg-test: allow skipping directories that start with "ignore" as well as files
    
    It turns out that it's more convenient to move the whole set of
    problematic SVGs into an ignore/ subdirectory for now.

 tests/README.md                                    |    7 +-
 .../reftests/svg1.1/ignore-pservers-grad-17-b.svg  |   92 --------------------
 .../reftests/svg1.1/pservers-grad-17-b-ref.png     |  Bin 9478 -> 0 bytes
 tests/rsvg-test.c                                  |   28 ++++--
 4 files changed, 25 insertions(+), 102 deletions(-)
---
diff --git a/tests/README.md b/tests/README.md
index 0e984b3..7abc025 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -63,8 +63,11 @@ directory; the `rsvg-test` program will recursively look inside
 `fixtures/reftests` for all SVG files, render them, and compare them to
 the `-ref.png` reference images.
 
-SVG test files in fixtures/reftests that match "ignore-*.svg" will be
-skipped from the tests.
+SVG test files or entire subdirectories in fixtures/reftests whose
+names begin with "ignore" will be skipped from the tests.  That is,
+anything that matches "fixtures/reftests/ignore*" will not be included
+in the tests.  You can use this to skip a few problematic files
+temporarily.
 
 As of 2016/Nov/03 we have an informal organization of these files:
 
diff --git a/tests/rsvg-test.c b/tests/rsvg-test.c
index ab79b85..7160113 100644
--- a/tests/rsvg-test.c
+++ b/tests/rsvg-test.c
@@ -173,17 +173,29 @@ save_image (cairo_surface_t *surface,
 static gboolean
 is_svg_or_subdir (GFile *file)
 {
-  char *basename;
-  gboolean result;
+    char *basename;
+    gboolean ignore;
+    gboolean result;
 
-  if (g_file_query_file_type (file, 0, NULL) == G_FILE_TYPE_DIRECTORY)
-    return TRUE;
+    result = FALSE;
 
-  basename = g_file_get_basename (file);
-  result = !g_str_has_prefix (basename, "ignore-") && g_str_has_suffix (basename, ".svg");
-  g_free (basename);
+    basename = g_file_get_basename (file);
+    ignore = g_str_has_prefix (basename, "ignore");
 
-  return result;
+    if (ignore)
+       goto out;
+
+    if (g_file_query_file_type (file, 0, NULL) == G_FILE_TYPE_DIRECTORY) {
+       result = TRUE;
+       goto out;
+    }
+
+    result = g_str_has_suffix (basename, ".svg");
+
+out:
+    g_free (basename);
+
+    return result;
 }
 
 static cairo_status_t


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