Add very simple test to generate PDF output, (no automated verification yet).

Track PNG interface changes, (no more include of cairo-png.h, cairo_surface_write_png renamed to cairo_surface_write_to_png).
This commit is contained in:
Carl Worth 2005-04-26 09:43:39 +00:00
parent a5f734455c
commit 618792c8c0
9 changed files with 84 additions and 8 deletions

View file

@ -1,3 +1,17 @@
2005-04-26 Carl Worth <cworth@cworth.org>
* test/.cvsignore:
* test/Makefile.am:
* test/cairo-test.h:
* test/pdf-surface.c: (main): Add very simple test to generate PDF
output, (no automated verification yet).
* test/cairo-test.c: (cairo_test):
* test/create-for-png.c: (draw):
* test/pixman-rotate.c: Track PNG interface changes, (no more
include of cairo-png.h, cairo_surface_write_png renamed to
cairo_surface_write_to_png).
2005-04-26 Kristian Høgsberg <krh@redhat.com>
* src/cairo-png.h: Prototypes moved to cairo.h, this file removed.

View file

@ -15,6 +15,7 @@ line-width
linear-gradient
move-to-show-surface
path-data
pdf-surface
pixman-rotate
set-source
select-font-no-show-text

View file

@ -12,6 +12,7 @@ line-width \
linear-gradient \
move-to-show-surface \
path-data \
pdf-surface \
pixman-rotate \
select-font-no-show-text\
set-source \
@ -104,6 +105,7 @@ line_width_LDADD = $(LDADDS)
linear_gradient_LDADD = $(LDADDS)
move_to_show_surface_LDADD = $(LDADDS)
path_data_LDADD = $(LDADDS)
pdf_surface_LDADD = $(LDADDS)
pixman_rotate_LDADD = $(LDADDS)
select_font_no_show_text_LDADD = $(LDADDS)
set_source_LDADD = $(LDADDS)

View file

@ -32,8 +32,6 @@
#include "cairo-test.h"
#include <cairo-png.h>
#include "buffer-diff.h"
#include "read-png.h"
#include "write-png.h"
@ -169,7 +167,7 @@ cairo_test (cairo_test_t *test, cairo_test_draw_function_t draw)
return CAIRO_TEST_SUCCESS;
}
cairo_surface_write_png (cairo_get_target_surface (cr), png_name);
cairo_surface_write_to_png (cairo_get_target_surface (cr), png_name);
cairo_destroy (cr);

View file

@ -28,6 +28,7 @@
#include <math.h>
#include <cairo.h>
#include <cairo-pdf.h>
typedef enum cairo_test_status {
CAIRO_TEST_SUCCESS = 0,

View file

@ -26,7 +26,6 @@
#include "cairo-test.h"
#include <stdlib.h>
#include <cairo-png.h>
#define WIDTH 2
#define HEIGHT 2
@ -42,7 +41,6 @@ draw (cairo_t *cr, int width, int height)
{
char *srcdir = getenv ("srcdir");
char *filename;
FILE *file;
cairo_surface_t *surface;
int png_width, png_height;

View file

@ -26,7 +26,6 @@
#include "cairo-test.h"
#include <stdlib.h>
#include <cairo-png.h>
#define WIDTH 2
#define HEIGHT 2
@ -42,7 +41,6 @@ draw (cairo_t *cr, int width, int height)
{
char *srcdir = getenv ("srcdir");
char *filename;
FILE *file;
cairo_surface_t *surface;
int png_width, png_height;

65
test/pdf-surface.c Normal file
View file

@ -0,0 +1,65 @@
/*
* 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 <stdio.h>
#include "cairo-test.h"
/* Pretty boring test just to make sure things aren't crashing ---
* no verification that we're getting good results yet.
*/
int
main (void)
{
cairo_t *cr;
const char *filename = "pdf-surface.pdf";
FILE *file;
file = fopen (filename, "w");
if (!file) {
fprintf (stderr, "Failed to open file %s\n", filename);
return CAIRO_TEST_FAILURE;
}
cr = cairo_create ();
cairo_set_target_pdf (cr, file,
297 / 25.4,
210 / 25.4,
300.0, 300.0);
cairo_rectangle (cr, 10, 10, 100, 100);
cairo_set_source_rgb (cr, 1, 0, 0);
cairo_fill (cr);
cairo_show_page (cr);
cairo_destroy (cr);
fclose (file);
return 0;
}

View file

@ -4,7 +4,6 @@
#include <math.h>
#include <cairo.h>
#include <cairo-png.h>
#include <cairo-pdf.h>
#include "cairo-test.h"