[cairo-commit] 2 commits - test/pthread-same-source.c test/reference

Uli Schlachter psychon at kemper.freedesktop.org
Thu Apr 17 02:34:20 PDT 2014

 dev/null                                           |binary
 test/pthread-same-source.c                         |   25 ++++++++++++++++++---
 test/reference/pthread-same-source.image16.ref.png |binary
 test/reference/pthread-same-source.ref.png         |binary
 4 files changed, 22 insertions(+), 3 deletions(-)

New commits:
commit 3e22a8580a8045e450a2f2e47c8ac36abf8882ae
Author: Uli Schlachter <psychon at znc.in>
Date:   Fri Apr 11 10:39:39 2014 +0200

    pthread-same-source: Refresh reference images
    These reference images are generated by the new GENERATE_REFERENCE mode that the
    previous commit introduced.
    I have no idea what the "base" images. From my reading of the code in
    boilerplate/, these images will be used by the test-XXX targets. However, these
    seem to generate the same result than e.g. the image backend. Thus, I deleted
    these files.
    There is still pthread-same-source.quartz.xfail.png. This file was created in
    commit b6e16b8d and touched in commit 5a1e590b1. No idea if this is still valid
    and since I don't have a Mac, I won't touch it.
    The test is still broken on the following backends (out of the backends I have
    compiled in). This mostly seems to be differences in image scaling, but I
    couldn't figure out an easy way to tell the test suite that the new results are
    test-paginated, ps2, ps3, xcb, xcb-window, xcb-window&, xcb-fallback, xlib,
    xlib-window, xlib-fallback, recording
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/test/reference/pthread-same-source.base.argb32.ref.png b/test/reference/pthread-same-source.base.argb32.ref.png
deleted file mode 100644
index cfb519d..0000000
Binary files a/test/reference/pthread-same-source.base.argb32.ref.png and /dev/null differ
diff --git a/test/reference/pthread-same-source.base.rgb24.ref.png b/test/reference/pthread-same-source.base.rgb24.ref.png
deleted file mode 100644
index cfb519d..0000000
Binary files a/test/reference/pthread-same-source.base.rgb24.ref.png and /dev/null differ
diff --git a/test/reference/pthread-same-source.image16.ref.png b/test/reference/pthread-same-source.image16.ref.png
index 196c4ac..67eb22f 100644
Binary files a/test/reference/pthread-same-source.image16.ref.png and b/test/reference/pthread-same-source.image16.ref.png differ
diff --git a/test/reference/pthread-same-source.ref.png b/test/reference/pthread-same-source.ref.png
index cfb519d..c1c186b 100644
Binary files a/test/reference/pthread-same-source.ref.png and b/test/reference/pthread-same-source.ref.png differ
commit ddd344fb0f5a0e9a0e9a34306598a777ffb7667a
Author: Uli Schlachter <psychon at znc.in>
Date:   Sat Apr 12 12:07:23 2014 +0200

    pthread-same-source: Add ref image generation
    When the new GENERATE_REFERENCE symbol is defined to 1, no threads are involved
    at all. In this case, all operations are done sequentially by the main thread.
    Thus, in this mode no thread issues can occur and the result must be usable as
    reference images.
    Signed-off-by: Uli Schlachter <psychon at znc.in>
    Reviewed-by: Bryce Harrington <b.harrington at samsung.com>

diff --git a/test/pthread-same-source.c b/test/pthread-same-source.c
index d0eda4a..2b26d18 100644
--- a/test/pthread-same-source.c
+++ b/test/pthread-same-source.c
@@ -24,8 +24,12 @@
  * Author: Benjamin Otte <otte at gnome.org>
 #include "cairo-test.h"
 #include <pthread.h>
 #define N_THREADS 8
@@ -110,7 +114,9 @@ create_source (cairo_surface_t *similar)
 static cairo_test_status_t
 draw (cairo_t *cr, int width, int height)
     pthread_t threads[N_THREADS];
     thread_data_t thread_data[N_THREADS];
     cairo_test_status_t test_status = CAIRO_TEST_SUCCESS;
     cairo_surface_t *source;
@@ -125,12 +131,16 @@ draw (cairo_t *cr, int width, int height)
+    cairo_set_source_rgb (cr, 0.5, 0.5, 0.5);
+    cairo_paint (cr);
     for (i = 0; i < N_THREADS; i++) {
         thread_data[i].target = cairo_surface_create_similar (cairo_get_target (cr),
                                                               4 * WIDTH, 4 * HEIGHT);
         thread_data[i].source = cairo_surface_reference (source);
         thread_data[i].id = i;
         if (pthread_create (&threads[i], NULL, draw_thread, &thread_data[i]) != 0) {
 	    threads[i] = pthread_self (); /* to indicate error */
             cairo_surface_destroy (thread_data[i].target);
@@ -138,13 +148,21 @@ draw (cairo_t *cr, int width, int height)
             test_status = CAIRO_TEST_FAILURE;
+	{
+	    cairo_surface_t *surface = draw_thread(&thread_data[i]);
+	    cairo_set_source_surface (cr, surface, 0, 0);
+	    cairo_surface_destroy (surface);
+	    cairo_paint (cr);
+	    cairo_translate (cr, 0, 4 * HEIGHT);
+	}
     cairo_surface_destroy (source);
-    cairo_set_source_rgb (cr, 0.5, 0.5, 0.5);
-    cairo_paint (cr);
     for (i = 0; i < N_THREADS; i++) {
 	void *surface;
@@ -161,6 +179,7 @@ draw (cairo_t *cr, int width, int height)
             test_status = CAIRO_TEST_FAILURE;
     return test_status;

More information about the cairo-commit mailing list