summaryrefslogtreecommitdiff
path: root/test/css21.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2018-01-20 17:31:20 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2018-01-20 17:31:20 +0000
commit0dd48e83fbc246a881609b4c18ce10001ba1cc1a (patch)
tree7494cc81744799ab88f1503ac5ff044be2fcf4a5 /test/css21.c
parente220b0fc2ede1dcbbe7e6e62c256e2ec297f26a3 (diff)
downloadlibcss-0dd48e83fbc246a881609b4c18ce10001ba1cc1a.tar.gz
libcss-0dd48e83fbc246a881609b4c18ce10001ba1cc1a.tar.bz2
Add support for logging via libnslog.
Release builds minumum compiled level is warning. Debug builds minimum compiled level is debug.
Diffstat (limited to 'test/css21.c')
-rw-r--r--test/css21.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/css21.c b/test/css21.c
index a29fae1..f8d3891 100644
--- a/test/css21.c
+++ b/test/css21.c
@@ -25,6 +25,20 @@ static css_error resolve_url(void *pw,
return CSS_OK;
}
+static void test_logger(
+ void *_ctx, nslog_entry_context_t *ctx,
+ const char *fmt,
+ va_list args)
+{
+ UNUSED(_ctx);
+ fprintf(stderr, "%s: %s: %s:%i: ",
+ nslog_level_name(ctx->level),
+ ctx->category->description,
+ ctx->filename, ctx->lineno);
+ vfprintf(stderr, fmt, args);
+ fprintf(stderr, "\n");
+}
+
int main(int argc, char **argv)
{
css_stylesheet_params params;
@@ -41,6 +55,16 @@ int main(int argc, char **argv)
return 1;
}
+ if (nslog_set_render_callback(test_logger, NULL) != NSLOG_NO_ERROR) {
+ printf("Unable to set log render callback\n");
+ return 1;
+ }
+
+ if (nslog_uncork() != NSLOG_NO_ERROR) {
+ printf("Failed to uncork log.\n");
+ return 1;
+ }
+
params.params_version = CSS_STYLESHEET_PARAMS_VERSION_1;
params.level = CSS_LEVEL_21;
params.charset = "UTF-8";
@@ -153,6 +177,8 @@ int main(int argc, char **argv)
css_stylesheet_destroy(sheet);
}
+ nslog_cleanup();
+
printf("PASS\n");
return 0;