summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/css21.c26
-rw-r--r--test/parse-auto.c29
-rw-r--r--test/parse2-auto.c19
-rw-r--r--test/select-auto.c19
4 files changed, 72 insertions, 21 deletions
diff --git a/test/css21.c b/test/css21.c
index 2ce4ebc..929362e 100644
--- a/test/css21.c
+++ b/test/css21.c
@@ -34,6 +34,7 @@ static css_error resolve_url(void *pw,
int main(int argc, char **argv)
{
+ css_stylesheet_params params;
css_stylesheet *sheet;
FILE *fp;
size_t len, origlen;
@@ -47,11 +48,22 @@ int main(int argc, char **argv)
return 1;
}
+ params.level = CSS_LEVEL_21;
+ params.charset = "UTF-8";
+ params.url = argv[1];
+ params.title = NULL;
+ params.allow_quirks = false;
+ params.inline_style = false;
+ params.resolve = resolve_url;
+ params.resolve_pw = NULL;
+ params.import = NULL;
+ params.import_pw = NULL;
+ params.color = NULL;
+ params.color_pw = NULL;
+
for (count = 0; count < ITERATIONS; count++) {
- assert(css_stylesheet_create(CSS_LEVEL_21, "UTF-8", argv[1],
- NULL, false, false, myrealloc, NULL,
- resolve_url, NULL, NULL, NULL,
+ assert(css_stylesheet_create(&params, myrealloc, NULL,
&sheet) == CSS_OK);
fp = fopen(argv[1], "rb");
@@ -106,10 +118,10 @@ int main(int argc, char **argv)
lwc_string_length(url));
buf[lwc_string_length(url)] = '\0';
- assert(css_stylesheet_create(CSS_LEVEL_21,
- "UTF-8", buf, NULL, false, false,
- myrealloc, NULL, resolve_url, NULL,
- NULL, NULL, &import) == CSS_OK);
+ params.url = buf;
+
+ assert(css_stylesheet_create(&params,
+ myrealloc, 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 84bce9b..e268c3b 100644
--- a/test/parse-auto.c
+++ b/test/parse-auto.c
@@ -363,16 +363,29 @@ static void report_fail(const uint8_t *data, size_t datalen, exp_entry *e)
void run_test(const uint8_t *data, size_t len, exp_entry *exp, size_t explen)
{
+ css_stylesheet_params params;
css_stylesheet *sheet;
css_rule *rule;
css_error error;
size_t e;
static int testnum;
bool failed;
-
- assert(css_stylesheet_create(CSS_LEVEL_21, "UTF-8", "foo", NULL,
- false, false, myrealloc, NULL, resolve_url, NULL,
- NULL, NULL, &sheet) == CSS_OK);
+
+ params.level = CSS_LEVEL_21;
+ params.charset = "UTF-8";
+ params.url = "foo";
+ params.title = NULL;
+ params.allow_quirks = false;
+ params.inline_style = false;
+ params.resolve = resolve_url;
+ params.resolve_pw = NULL;
+ params.import = NULL;
+ params.import_pw = NULL;
+ params.color = NULL;
+ params.color_pw = NULL;
+
+ assert(css_stylesheet_create(&params, myrealloc, NULL,
+ &sheet) == CSS_OK);
error = css_stylesheet_append_data(sheet, data, len);
if (error != CSS_OK && error != CSS_NEEDDATA) {
@@ -399,10 +412,10 @@ void run_test(const uint8_t *data, size_t len, exp_entry *exp, size_t explen)
lwc_string_length(url));
buf[lwc_string_length(url)] = '\0';
- assert(css_stylesheet_create(CSS_LEVEL_21,
- "UTF-8", buf, NULL, false, false,
- myrealloc, NULL, resolve_url, NULL,
- NULL, NULL, &import) == CSS_OK);
+ params.url = buf;
+
+ assert(css_stylesheet_create(&params,
+ myrealloc, 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 877c0f5..cbf6730 100644
--- a/test/parse2-auto.c
+++ b/test/parse2-auto.c
@@ -183,6 +183,7 @@ void css__parse_expected(line_ctx *ctx, const char *data, size_t len)
void run_test(const uint8_t *data, size_t len, const char *exp, size_t explen)
{
+ css_stylesheet_params params;
css_stylesheet *sheet;
css_error error;
char *buf;
@@ -195,9 +196,21 @@ void run_test(const uint8_t *data, size_t len, const char *exp, size_t explen)
}
buflen = 2 * explen;
- assert(css_stylesheet_create(CSS_LEVEL_21, "UTF-8", "foo", NULL,
- false, false, myrealloc, NULL, resolve_url, NULL,
- NULL, NULL, &sheet) == CSS_OK);
+ params.level = CSS_LEVEL_21;
+ params.charset = "UTF-8";
+ params.url = "foo";
+ params.title = NULL;
+ params.allow_quirks = false;
+ params.inline_style = false;
+ params.resolve = resolve_url;
+ params.resolve_pw = NULL;
+ params.import = NULL;
+ params.import_pw = NULL;
+ params.color = NULL;
+ params.color_pw = NULL;
+
+ assert(css_stylesheet_create(&params, myrealloc, 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 c81d097..12fdb5f 100644
--- a/test/select-auto.c
+++ b/test/select-auto.c
@@ -457,6 +457,7 @@ void css__parse_tree_data(line_ctx *ctx, const char *data, size_t len)
void css__parse_sheet(line_ctx *ctx, const char *data, size_t len)
{
+ css_stylesheet_params params;
const char *p;
const char *end = data + len;
css_origin origin = CSS_ORIGIN_AUTHOR;
@@ -491,10 +492,22 @@ void css__parse_sheet(line_ctx *ctx, const char *data, size_t len)
css__parse_media_list(&p, &ignored, &media);
}
+ params.level = CSS_LEVEL_21;
+ params.charset = "UTF-8";
+ params.url = "foo";
+ params.title = "foo";
+ params.allow_quirks = false;
+ params.inline_style = false;
+ params.resolve = resolve_url;
+ params.resolve_pw = NULL;
+ params.import = NULL;
+ params.import_pw = NULL;
+ params.color = NULL;
+ params.color_pw = NULL;
+
/** \todo How are we going to handle @import? */
- assert(css_stylesheet_create(CSS_LEVEL_21, "UTF-8", "foo", "foo",
- false, false, myrealloc, NULL,
- resolve_url, NULL, NULL, NULL, &sheet) == CSS_OK);
+ assert(css_stylesheet_create(&params, myrealloc, NULL,
+ &sheet) == CSS_OK);
/* Extend array of sheets and append new sheet to it */
temp = realloc(ctx->sheets,