Gitweb links:
...log
http://git.netsurf-browser.org/libnslayout.git/shortlog/91366856f641dc74b...
...commit
http://git.netsurf-browser.org/libnslayout.git/commit/91366856f641dc74b6a...
...tree
http://git.netsurf-browser.org/libnslayout.git/tree/91366856f641dc74b6ad0...
The branch, master has been updated
via 91366856f641dc74b6ad05168b65e4c38976d48a (commit)
from 0aa5a727b3739a47a5a37741eb72b691e8b8fe57 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/libnslayout.git/commit/?id=91366856f641dc7...
commit 91366856f641dc74b6ad05168b65e4c38976d48a
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Add nslayout_layout_destroy basic API testing.
diff --git a/src/layout.c b/src/layout.c
index 773996a..43570fb 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -49,6 +49,7 @@ nslayout_error nslayout_layout_destroy(
nslayout_layout *layout)
{
/* TODO: free/unref the stuff we own in the layout */
+ assert(layout != NULL);
free(layout);
return NSLAYOUT_OK;
diff --git a/test/assert-tests.c b/test/assert-tests.c
index 4fca036..1b97814 100644
--- a/test/assert-tests.c
+++ b/test/assert-tests.c
@@ -22,16 +22,27 @@ START_TEST (test_nslayout_layout_create_aborts1)
}
END_TEST
+/* TODO: Test for each individual param being NULL. */
+START_TEST (test_nslayout_layout_destroy_aborts1)
+{
+ (void) nslayout_layout_destroy(NULL);
+}
+END_TEST
+
void nslayout_assert_suite(SRunner *sr)
{
Suite *s = suite_create("libnslayout: API Assert tests");
- TCase *tc_assert = tcase_create("Creation/Destruction");
+ TCase *tc_assert = tcase_create("Creation/Destruction");
tcase_add_test_raise_signal(
tc_assert,
test_nslayout_layout_create_aborts1,
SIGABRT);
+ tcase_add_test_raise_signal(
+ tc_assert,
+ test_nslayout_layout_destroy_aborts1,
+ SIGABRT);
suite_add_tcase(s, tc_assert);
srunner_add_suite(sr, s);
diff --git a/test/basic-layout-tests.c b/test/basic-layout-tests.c
index 84611a9..6dec991 100644
--- a/test/basic-layout-tests.c
+++ b/test/basic-layout-tests.c
@@ -52,11 +52,15 @@ START_TEST (test_nslayout_layout_create_ok)
nslayout_test_callback,
&pw,
&layout);
- fail_unless(error == NSLAYOUT_OK,
+ fail_unless(error == NSLAYOUT_OK,
"Unable to create layout");
- fail_unless(layout != NULL,
+ fail_unless(layout != NULL,
"Returned OK but str was still NULL");
+ error = nslayout_layout_destroy(layout);
+ fail_unless(error == NSLAYOUT_OK,
+ "Unable to destroy layout");
+
css_err = css_select_ctx_destroy(css_ctx);
ck_assert(css_err == CSS_OK);
@@ -68,10 +72,9 @@ END_TEST
void nslayout_basic_layout_suite(SRunner *sr)
{
Suite *s = suite_create("libnslayout: basic layout tests");
- TCase *tc_layout_basic = tcase_create("Creation/Destruction");
+ TCase *tc_layout_basic = tcase_create("Creation/Destruction");
- tcase_add_test(tc_layout_basic,
- test_nslayout_layout_create_ok);
+ tcase_add_test(tc_layout_basic, test_nslayout_layout_create_ok);
suite_add_tcase(s, tc_layout_basic);
srunner_add_suite(sr, s);
-----------------------------------------------------------------------
Summary of changes:
src/layout.c | 1 +
test/assert-tests.c | 13 ++++++++++++-
test/basic-layout-tests.c | 13 ++++++++-----
3 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/src/layout.c b/src/layout.c
index 773996a..43570fb 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -49,6 +49,7 @@ nslayout_error nslayout_layout_destroy(
nslayout_layout *layout)
{
/* TODO: free/unref the stuff we own in the layout */
+ assert(layout != NULL);
free(layout);
return NSLAYOUT_OK;
diff --git a/test/assert-tests.c b/test/assert-tests.c
index 4fca036..1b97814 100644
--- a/test/assert-tests.c
+++ b/test/assert-tests.c
@@ -22,16 +22,27 @@ START_TEST (test_nslayout_layout_create_aborts1)
}
END_TEST
+/* TODO: Test for each individual param being NULL. */
+START_TEST (test_nslayout_layout_destroy_aborts1)
+{
+ (void) nslayout_layout_destroy(NULL);
+}
+END_TEST
+
void nslayout_assert_suite(SRunner *sr)
{
Suite *s = suite_create("libnslayout: API Assert tests");
- TCase *tc_assert = tcase_create("Creation/Destruction");
+ TCase *tc_assert = tcase_create("Creation/Destruction");
tcase_add_test_raise_signal(
tc_assert,
test_nslayout_layout_create_aborts1,
SIGABRT);
+ tcase_add_test_raise_signal(
+ tc_assert,
+ test_nslayout_layout_destroy_aborts1,
+ SIGABRT);
suite_add_tcase(s, tc_assert);
srunner_add_suite(sr, s);
diff --git a/test/basic-layout-tests.c b/test/basic-layout-tests.c
index 84611a9..6dec991 100644
--- a/test/basic-layout-tests.c
+++ b/test/basic-layout-tests.c
@@ -52,11 +52,15 @@ START_TEST (test_nslayout_layout_create_ok)
nslayout_test_callback,
&pw,
&layout);
- fail_unless(error == NSLAYOUT_OK,
+ fail_unless(error == NSLAYOUT_OK,
"Unable to create layout");
- fail_unless(layout != NULL,
+ fail_unless(layout != NULL,
"Returned OK but str was still NULL");
+ error = nslayout_layout_destroy(layout);
+ fail_unless(error == NSLAYOUT_OK,
+ "Unable to destroy layout");
+
css_err = css_select_ctx_destroy(css_ctx);
ck_assert(css_err == CSS_OK);
@@ -68,10 +72,9 @@ END_TEST
void nslayout_basic_layout_suite(SRunner *sr)
{
Suite *s = suite_create("libnslayout: basic layout tests");
- TCase *tc_layout_basic = tcase_create("Creation/Destruction");
+ TCase *tc_layout_basic = tcase_create("Creation/Destruction");
- tcase_add_test(tc_layout_basic,
- test_nslayout_layout_create_ok);
+ tcase_add_test(tc_layout_basic, test_nslayout_layout_create_ok);
suite_add_tcase(s, tc_layout_basic);
srunner_add_suite(sr, s);
--
NetSurf Layout Engine