summaryrefslogtreecommitdiff
path: root/dev/main.c
blob: 77c408ba9715483821e2af756d7e8b6d3d8af335 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 * This file is part of LibNSLayout's tests
 * Licensed under the ISC License, http://opensource.org/licenses/ISC
 * Copyright 2015 Michael Drake <tlsa@netsurf-browser.org>
 */

#include "../test/test-loader.c"

/*
 * cd ../ && make && make install && cd dev/ && gcc -Wall -Wextra -Werror `pkg-config libnslayout --cflags` main.c `pkg-config libnslayout --libs` && ./a.out ; cd ~/dev-netsurf/workspace/libnslayout/dev
 */


static void nsl_test_lwc_iterator(lwc_string *str, void *pw)
{
	UNUSED(pw);

	printf("  [%3u] %.*s\n", str->refcnt,
			(int)lwc_string_length(str),
			lwc_string_data(str));
}

int main(void)
{
	struct test_loader_buffer *buffer;
	bool ok;

	ok = test_loader_load_path_to_buffer(
			"test-writing-mode.html",
			&buffer);
	if (!ok) return EXIT_FAILURE;

	nslayout_init();

	ok = test_loader(buffer, CSS_MEDIA_ALL, 15);
	if (!ok) return EXIT_FAILURE;

	nslayout_fini();

	test_loader_free_buffer(buffer);

	printf("Remaining lwc strings:\n");
	lwc_iterate_strings(nsl_test_lwc_iterator, NULL);

	return EXIT_SUCCESS;
}