From 94ff706d99220d915be8cedcda6b93ead998f5b8 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Wed, 1 Jul 2009 10:35:37 +0000 Subject: Make all URIs absolute svn path=/trunk/libcss/; revision=8228 --- test/css21.c | 18 ++++++++++++++++-- test/parse-auto.c | 16 ++++++++++++++-- test/parse2-auto.c | 14 +++++++++++++- test/select-auto.c | 14 +++++++++++++- 4 files changed, 56 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/css21.c b/test/css21.c index d3bf96d..f288720 100644 --- a/test/css21.c +++ b/test/css21.c @@ -20,6 +20,18 @@ static void *myrealloc(void *ptr, size_t len, void *pw) return realloc(ptr, len); } +static css_error resolve_url(void *pw, lwc_context *dict, + const char *base, lwc_string *rel, lwc_string **abs) +{ + UNUSED(pw); + UNUSED(base); + + /* About as useless as possible */ + *abs = lwc_context_string_ref(dict, rel); + + return CSS_OK; +} + int main(int argc, char **argv) { css_stylesheet *sheet; @@ -47,7 +59,8 @@ int main(int argc, char **argv) assert(css_stylesheet_create(CSS_LEVEL_21, "UTF-8", argv[2], NULL, CSS_ORIGIN_AUTHOR, CSS_MEDIA_ALL, false, - false, ctx, myrealloc, NULL, &sheet) == CSS_OK); + false, ctx, myrealloc, NULL, + resolve_url, NULL, &sheet) == CSS_OK); fp = fopen(argv[2], "rb"); if (fp == NULL) { @@ -104,7 +117,8 @@ int main(int argc, char **argv) assert(css_stylesheet_create(CSS_LEVEL_21, "UTF-8", buf, NULL, CSS_ORIGIN_AUTHOR, media, false, false, ctx, myrealloc, - NULL, &import) == CSS_OK); + NULL, resolve_url, NULL, + &import) == CSS_OK); assert(css_stylesheet_data_done(import) == CSS_OK); diff --git a/test/parse-auto.c b/test/parse-auto.c index ebbc5e7..135696b 100644 --- a/test/parse-auto.c +++ b/test/parse-auto.c @@ -68,6 +68,18 @@ static void *myrealloc(void *data, size_t len, void *pw) return realloc(data, len); } +static css_error resolve_url(void *pw, lwc_context *dict, + const char *base, lwc_string *rel, lwc_string **abs) +{ + UNUSED(pw); + UNUSED(base); + + /* About as useless as possible */ + *abs = lwc_context_string_ref(dict, rel); + + return CSS_OK; +} + int main(int argc, char **argv) { line_ctx ctx; @@ -313,7 +325,7 @@ void run_test(const uint8_t *data, size_t len, exp_entry *exp, size_t explen) assert(css_stylesheet_create(CSS_LEVEL_21, "UTF-8", "foo", NULL, CSS_ORIGIN_AUTHOR, CSS_MEDIA_ALL, false, false, ctx, - myrealloc, NULL, &sheet) == CSS_OK); + myrealloc, NULL, resolve_url, NULL, &sheet) == CSS_OK); error = css_stylesheet_append_data(sheet, data, len); if (error != CSS_OK && error != CSS_NEEDDATA) { @@ -343,7 +355,7 @@ void run_test(const uint8_t *data, size_t len, exp_entry *exp, size_t explen) assert(css_stylesheet_create(CSS_LEVEL_21, "UTF-8", buf, NULL, CSS_ORIGIN_AUTHOR, media, false, false, ctx, myrealloc, NULL, - &import) == CSS_OK); + resolve_url, NULL, &import) == CSS_OK); assert(css_stylesheet_register_import(sheet, import) == CSS_OK); diff --git a/test/parse2-auto.c b/test/parse2-auto.c index ace1d6c..57b1688 100644 --- a/test/parse2-auto.c +++ b/test/parse2-auto.c @@ -41,6 +41,18 @@ static void *myrealloc(void *data, size_t len, void *pw) return realloc(data, len); } +static css_error resolve_url(void *pw, lwc_context *dict, + const char *base, lwc_string *rel, lwc_string **abs) +{ + UNUSED(pw); + UNUSED(base); + + /* About as useless as possible */ + *abs = lwc_context_string_ref(dict, rel); + + return CSS_OK; +} + int main(int argc, char **argv) { line_ctx ctx; @@ -177,7 +189,7 @@ void run_test(const uint8_t *data, size_t len, const char *exp, size_t explen) assert(css_stylesheet_create(CSS_LEVEL_21, "UTF-8", "foo", NULL, CSS_ORIGIN_AUTHOR, CSS_MEDIA_ALL, false, false, ctx, - myrealloc, NULL, &sheet) == CSS_OK); + myrealloc, NULL, resolve_url, NULL, &sheet) == CSS_OK); error = css_stylesheet_append_data(sheet, data, len); if (error != CSS_OK && error != CSS_NEEDDATA) { diff --git a/test/select-auto.c b/test/select-auto.c index 3f82433..e884a18 100644 --- a/test/select-auto.c +++ b/test/select-auto.c @@ -145,6 +145,18 @@ static void *myrealloc(void *data, size_t len, void *pw) return realloc(data, len); } +static css_error resolve_url(void *pw, lwc_context *dict, + const char *base, lwc_string *rel, lwc_string **abs) +{ + UNUSED(pw); + UNUSED(base); + + /* About as useless as possible */ + *abs = lwc_context_string_ref(dict, rel); + + return CSS_OK; +} + int main(int argc, char **argv) { line_ctx ctx; @@ -451,7 +463,7 @@ void parse_sheet(line_ctx *ctx, const char *data, size_t len) /** \todo How are we going to handle @import? */ assert(css_stylesheet_create(CSS_LEVEL_21, "UTF-8", "foo", "foo", origin, media, false, false, ctx->dict, - myrealloc, NULL, &sheet) == CSS_OK); + myrealloc, NULL, resolve_url, NULL, &sheet) == CSS_OK); /* Extend array of sheets and append new sheet to it */ temp = realloc(ctx->sheets, -- cgit v1.2.3