=== modified file 'torture/unit/base/text/pdf-text-dup.c' --- torture/unit/base/text/pdf-text-dup.c 2008-09-09 01:41:01 +0000 +++ torture/unit/base/text/pdf-text-dup.c 2009-06-14 02:32:27 +0000 @@ -231,6 +231,20 @@ } END_TEST +/* + * Test: pdf_text_dup_005 + * Description: + * Duplicate text without initializing the context + * Success conditions: + * 1. The call to @code{pdf_text_dup} should return a null pointer + */ +START_TEST(pdf_text_dup_005) +{ + pdf_text_t newtext = NULL; + + fail_unless(pdf_text_dup (&newtext) == NULL); +} +END_TEST /* * Test case creation function @@ -243,6 +257,7 @@ tcase_add_test(tc, pdf_text_dup_002); tcase_add_test(tc, pdf_text_dup_003); tcase_add_test(tc, pdf_text_dup_004); + tcase_add_test(tc, pdf_text_dup_005); return tc; } === modified file 'torture/unit/base/text/pdf-text-new-destroy.c' --- torture/unit/base/text/pdf-text-new-destroy.c 2008-09-09 01:41:01 +0000 +++ torture/unit/base/text/pdf-text-new-destroy.c 2009-06-14 02:24:18 +0000 @@ -66,7 +66,20 @@ } END_TEST +/* + * Test: pdf_text_new_destroy_002 + * Description: + * Create an text object without initializing the context + * Success conditions: + * 1. The call to @code{pdf_text_new} should return PDF_EBADCONTEXT + */ +START_TEST(pdf_text_new_destroy_002) +{ + pdf_text_t newtext = NULL; + fail_unless(pdf_text_new (&newtext) == PDF_EBADCONTEXT); +} +END_TEST /* * Test case creation function @@ -76,6 +89,7 @@ { TCase *tc = tcase_create("pdf_text_new_destroy"); tcase_add_test(tc, pdf_text_new_destroy_001); + tcase_add_test(tc, pdf_text_new_destroy_002); return tc; } === modified file 'torture/unit/base/text/pdf-text-new-from-host.c' --- torture/unit/base/text/pdf-text-new-from-host.c 2008-12-28 01:55:54 +0000 +++ torture/unit/base/text/pdf-text-new-from-host.c 2009-06-14 03:54:04 +0000 @@ -186,6 +186,61 @@ } END_TEST +/* + * Test: pdf_text_new_from_host_004 + * Description: + * Create a text object with invalid input string + * Success conditions: + * 1. The call to pdf_text_new_from_host should return PDF_EBADDATA + */ +START_TEST(pdf_text_new_from_host_004) +{ + pdf_text_t text = NULL; + pdf_text_host_encoding_t host_enc; + const pdf_char_t *sample_usascii = NULL; + + /* Create, without using the API, a valid pdf_text_host_encoding_t */ +#ifdef PDF_HOST_WIN32 + strcpy((char *)(&(host_enc.name[0])), "CP20127"); /* us-ascii */ +#else + strcpy((char *)(&(host_enc.name[0])), "us-ascii"); +#endif + + fail_unless(pdf_text_new_from_host(sample_usascii, + 1, + host_enc, + &text) == PDF_EBADDATA); + +} +END_TEST + +/* + * Test: pdf_text_new_from_host_005 + * Description: + * Create a text object with invalid input string length + * Success conditions: + * 1. The call to pdf_text_new_from_host should return PDF_EBADDATA + */ +START_TEST(pdf_text_new_from_host_005) +{ + pdf_text_t text = NULL; + pdf_text_host_encoding_t host_enc; + const pdf_char_t *sample_usascii = (pdf_char_t *)"GNU's not Unix"; + + /* Create, without using the API, a valid pdf_text_host_encoding_t */ +#ifdef PDF_HOST_WIN32 + strcpy((char *)(&(host_enc.name[0])), "CP20127"); /* us-ascii */ +#else + strcpy((char *)(&(host_enc.name[0])), "us-ascii"); +#endif + + fail_unless(pdf_text_new_from_host(sample_usascii, + 0, + host_enc, + &text) == PDF_EBADDATA); + +} +END_TEST /* @@ -198,6 +253,8 @@ tcase_add_test(tc, pdf_text_new_from_host_001); tcase_add_test(tc, pdf_text_new_from_host_002); tcase_add_test(tc, pdf_text_new_from_host_003); + tcase_add_test(tc, pdf_text_new_from_host_004); + tcase_add_test(tc, pdf_text_new_from_host_005); return tc; }