mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-01 03:40:13 +01:00
Rip out cairo_set_error_notfiy function as it is clear that it is not the right approach.
Remove error-notify test.
This commit is contained in:
parent
3b8da5f213
commit
f15ec64e7f
8 changed files with 12 additions and 179 deletions
12
ChangeLog
12
ChangeLog
|
|
@ -1,3 +1,15 @@
|
|||
2005-06-20 Carl Worth <cworth@cworth.org>
|
||||
|
||||
* src/cairo.h:
|
||||
* src/cairo-private.h:
|
||||
* src/cairo.c: (_cairo_error), (cairo_create): Rip out
|
||||
cairo_set_error_notfiy function as it is clear that it is not the
|
||||
right approach.
|
||||
|
||||
* test/.cvsignore:
|
||||
* test/Makefile.am:
|
||||
* test/error-notify.c: Remove error-notify test.
|
||||
|
||||
2005-06-17 Carl Worth <cworth@cworth.org>
|
||||
|
||||
* src/cairo-xcb-surface.c (_get_image_surface): Remove references
|
||||
|
|
|
|||
|
|
@ -977,25 +977,6 @@ Drawing contexts.
|
|||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### USER_FUNCTION cairo_error_notify_func_t ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@closure:
|
||||
@status:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION cairo_set_error_notify ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@cr:
|
||||
@error_notify:
|
||||
@closure:
|
||||
|
||||
|
||||
<!-- ##### ENUM cairo_filter_t ##### -->
|
||||
<para>
|
||||
|
||||
|
|
|
|||
|
|
@ -44,9 +44,6 @@ struct _cairo {
|
|||
|
||||
cairo_status_t status;
|
||||
|
||||
cairo_error_notify_func_t error_notify;
|
||||
void *error_notify_closure;
|
||||
|
||||
cairo_path_fixed_t path;
|
||||
|
||||
cairo_gstate_t *gstate;
|
||||
|
|
|
|||
32
src/cairo.c
32
src/cairo.c
|
|
@ -46,8 +46,6 @@
|
|||
static const cairo_t cairo_nil = {
|
||||
(unsigned int)-1, /* ref_count */
|
||||
CAIRO_STATUS_NO_MEMORY, /* status */
|
||||
NULL, /* error_notify */
|
||||
NULL, /* error_notify_closure */
|
||||
{ /* path */
|
||||
NULL, NULL, /* op_buf_head, op_buf_tail */
|
||||
NULL, NULL, /* arg_buf_head, arg_buf_tail */
|
||||
|
|
@ -92,9 +90,6 @@ _cairo_error (cairo_t *cr, cairo_status_t status)
|
|||
status <= CAIRO_STATUS_LAST_STATUS);
|
||||
|
||||
cr->status = status;
|
||||
|
||||
if (cr->error_notify)
|
||||
(cr->error_notify) (cr->error_notify_closure, status);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -143,9 +138,6 @@ cairo_create (cairo_surface_t *target)
|
|||
|
||||
cr->status = CAIRO_STATUS_SUCCESS;
|
||||
|
||||
cr->error_notify = NULL;
|
||||
cr->error_notify_closure = NULL;
|
||||
|
||||
_cairo_path_fixed_init (&cr->path);
|
||||
|
||||
if (target == NULL) {
|
||||
|
|
@ -2329,30 +2321,6 @@ cairo_status_to_string (cairo_status_t status)
|
|||
return "<unknown error status>";
|
||||
}
|
||||
|
||||
/**
|
||||
* cairo_set_error_notify:
|
||||
* @cr: a cairo context
|
||||
* @error_notify: an function to be called when an error occurs
|
||||
* @closure: a closure argument to be passed to @error_notify
|
||||
*
|
||||
* Installs an error notifier within @cr. If an error is set within
|
||||
* @cr, (eg. such that cairo_status(@cr) would return something other
|
||||
* than CAIRO_STATUS_SUCCESS), then @error_notify will be called with
|
||||
* the given @closure value as well as the #cairo_status_t value of
|
||||
* the error.
|
||||
*
|
||||
* An error notifier can be cleared by passing NULL for @error_notify
|
||||
* and for @closure.
|
||||
**/
|
||||
void
|
||||
cairo_set_error_notify (cairo_t *cr,
|
||||
cairo_error_notify_func_t error_notify,
|
||||
void *closure)
|
||||
{
|
||||
cr->error_notify = error_notify;
|
||||
cr->error_notify_closure = closure;
|
||||
}
|
||||
|
||||
void
|
||||
_cairo_restrict_value (double *value, double min, double max)
|
||||
{
|
||||
|
|
|
|||
14
src/cairo.h
14
src/cairo.h
|
|
@ -884,20 +884,6 @@ cairo_status (cairo_t *cr);
|
|||
const char *
|
||||
cairo_status_to_string (cairo_status_t status);
|
||||
|
||||
/**
|
||||
* cairo_error_notify_func_t
|
||||
*
|
||||
* #cairo_error_notify_func_t the type of function which is called
|
||||
* when an error is detected by cairo. It is passed a closure and the
|
||||
* #cairo_status_t value of the error.
|
||||
*/
|
||||
typedef void (*cairo_error_notify_func_t) (void *closure, cairo_status_t status);
|
||||
|
||||
void
|
||||
cairo_set_error_notify (cairo_t *cr,
|
||||
cairo_error_notify_func_t error_notify,
|
||||
void *closure);
|
||||
|
||||
/* Surface manipulation */
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ clip-nesting
|
|||
clip-twice
|
||||
coverage
|
||||
create-for-png
|
||||
error-notify
|
||||
fill-and-stroke
|
||||
fill-rule
|
||||
filter-nearest-offset
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ TESTS = \
|
|||
clip-nesting \
|
||||
clip-twice \
|
||||
create-for-png \
|
||||
error-notify \
|
||||
fill-and-stroke \
|
||||
fill-rule \
|
||||
filter-nearest-offset \
|
||||
|
|
@ -135,7 +134,6 @@ LDADDS = libcairotest.la $(top_builddir)/src/libcairo.la
|
|||
clip_nesting_LDADD = $(LDADDS)
|
||||
clip_twice_LDADD = $(LDADDS)
|
||||
create_for_png_LDADD = $(LDADDS)
|
||||
error_notify_LDADD = $(LDADDS)
|
||||
fill_and_stroke_LDADD = $(LDADDS)
|
||||
fill_rule_LDADD = $(LDADDS)
|
||||
filter_nearest_offset_LDADD = $(LDADDS)
|
||||
|
|
|
|||
|
|
@ -1,108 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2005 Red Hat, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software
|
||||
* and its documentation for any purpose is hereby granted without
|
||||
* fee, provided that the above copyright notice appear in all copies
|
||||
* and that both that copyright notice and this permission notice
|
||||
* appear in supporting documentation, and that the name of
|
||||
* Red Hat, Inc. not be used in advertising or publicity pertaining to
|
||||
* distribution of the software without specific, written prior
|
||||
* permission. Red Hat, Inc. makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
||||
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Author: Carl D. Worth <cworth@cworth.org>
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "cairo-test.h"
|
||||
|
||||
cairo_test_t test = {
|
||||
"error-notify",
|
||||
"Tests calls to cairo_error_notify",
|
||||
0, 0
|
||||
};
|
||||
|
||||
typedef struct test_result {
|
||||
cairo_test_status_t status;
|
||||
} test_result_t;
|
||||
|
||||
static void
|
||||
toggle_status (void *closure, cairo_status_t status)
|
||||
{
|
||||
test_result_t *result = closure;
|
||||
|
||||
if (result->status == CAIRO_TEST_SUCCESS)
|
||||
result->status = CAIRO_TEST_FAILURE;
|
||||
else
|
||||
result->status = CAIRO_TEST_SUCCESS;
|
||||
}
|
||||
|
||||
static cairo_test_status_t
|
||||
do_test (cairo_t *cr, int width, int height)
|
||||
{
|
||||
cairo_t *cr2;
|
||||
test_result_t result;
|
||||
|
||||
/* We do all our testing in an alternate cr so that we don't leave
|
||||
* an error in the original. */
|
||||
|
||||
cr2 = cairo_create (cairo_get_target (cr));
|
||||
|
||||
cairo_set_error_notify (cr2, toggle_status, &result);
|
||||
|
||||
cairo_test_log (" Testing that error notify function is called:\t\t");
|
||||
{
|
||||
result.status = CAIRO_TEST_FAILURE;
|
||||
/* Trigger an error by trying to set a NULL source. */
|
||||
cairo_set_source (cr2, NULL);
|
||||
if (result.status != CAIRO_TEST_SUCCESS) {
|
||||
cairo_test_log ("FAIL\n");
|
||||
return CAIRO_TEST_FAILURE;
|
||||
} else {
|
||||
cairo_test_log ("PASS\n");
|
||||
}
|
||||
}
|
||||
|
||||
cairo_test_log (" Testing that cr remains in an error state:\t\t");
|
||||
{
|
||||
result.status = CAIRO_TEST_FAILURE;
|
||||
cairo_move_to (cr2, 0.0, 0.0);
|
||||
if (result.status != CAIRO_TEST_SUCCESS) {
|
||||
cairo_test_log ("FAIL\n");
|
||||
return CAIRO_TEST_FAILURE;
|
||||
} else {
|
||||
cairo_test_log ("PASS\n");
|
||||
}
|
||||
}
|
||||
|
||||
cairo_test_log (" Testing that error notify function can be cleared:\t");
|
||||
{
|
||||
cairo_set_error_notify (cr2, NULL, NULL);
|
||||
cairo_set_source (cr2, NULL);
|
||||
if (result.status != CAIRO_TEST_SUCCESS) {
|
||||
cairo_test_log ("FAIL\n");
|
||||
return CAIRO_TEST_FAILURE;
|
||||
} else {
|
||||
cairo_test_log ("PASS\n");
|
||||
}
|
||||
}
|
||||
|
||||
return CAIRO_TEST_SUCCESS;
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
return cairo_test (&test, do_test);
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue