OSDN Git Service

* Added test code of the <hr color> attribute for CHTML2.0 converter.
authorkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Thu, 24 Apr 2008 10:09:45 +0000 (10:09 +0000)
committerkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Thu, 24 Apr 2008 10:09:45 +0000 (10:09 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/branches/RELEASE_0_12_0@2459 1a406e8e-add9-4483-a2c8-d8cac5b7c224

test/chxj_chtml20/test_chxj_chtml20.c

index 3e23aff..64599a5 100644 (file)
@@ -208,6 +208,8 @@ void test_chtml20_hr_tag_015();
 void test_chtml20_hr_tag_016();
 void test_chtml20_hr_tag_017();
 void test_chtml20_hr_tag_018();
+void test_chtml20_hr_tag_018_1();
+void test_chtml20_hr_tag_018_2();
 
 void test_chtml20_html_tag_001();
 
@@ -623,7 +625,9 @@ main()
   CU_add_test(chtml20_suite, "test <hr width> with non numeric value.",           test_chtml20_hr_tag_015);
   CU_add_test(chtml20_suite, "test <hr width> with numeric value.",               test_chtml20_hr_tag_016);
   CU_add_test(chtml20_suite, "test <hr noshade>.",                                test_chtml20_hr_tag_017);
-  CU_add_test(chtml20_suite, "test <hr color>.",                                  test_chtml20_hr_tag_018);
+  CU_add_test(chtml20_suite, "test <hr color> 1.",                                test_chtml20_hr_tag_018);
+  CU_add_test(chtml20_suite, "test <hr color> 2.",                                test_chtml20_hr_tag_018_1);
+  CU_add_test(chtml20_suite, "test <hr color> 3.",                                test_chtml20_hr_tag_018_2);
 
   CU_add_test(chtml20_suite, "test <html>.",                                      test_chtml20_html_tag_001);
 
@@ -5216,6 +5220,62 @@ void test_chtml20_hr_tag_018()
 #undef TEST_STRING
 #undef RESULT_STRING
 }
+void test_chtml20_hr_tag_018_1() 
+{
+#define  TEST_STRING "<hr width=\"10\" color=\"\">"
+#define  RESULT_STRING "<hr width=\"10\">"
+  char  *ret;
+  char  *tmp;
+  device_table spec;
+  chxjconvrule_entry entry;
+  cookie_t cookie;
+  apr_size_t destlen;
+  APR_INIT;
+
+  COOKIE_INIT(cookie);
+
+  SPEC_INIT(spec);
+  destlen = sizeof(TEST_STRING)-1;
+
+  tmp = chxj_encoding(&r, TEST_STRING, &destlen);
+  ret = chxj_convert_chtml20(&r, &spec, tmp, destlen, &destlen, &entry, &cookie);
+  ret = chxj_rencoding(&r, ret, &destlen);
+  CU_ASSERT(ret != NULL);
+  CU_ASSERT(strcmp(RESULT_STRING, ret) == 0);
+  CU_ASSERT(destlen == sizeof(RESULT_STRING)-1);
+
+  APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
+void test_chtml20_hr_tag_018_2() 
+{
+#define  TEST_STRING "<hr width=\"10\" color>"
+#define  RESULT_STRING "<hr width=\"10\">"
+  char  *ret;
+  char  *tmp;
+  device_table spec;
+  chxjconvrule_entry entry;
+  cookie_t cookie;
+  apr_size_t destlen;
+  APR_INIT;
+
+  COOKIE_INIT(cookie);
+
+  SPEC_INIT(spec);
+  destlen = sizeof(TEST_STRING)-1;
+
+  tmp = chxj_encoding(&r, TEST_STRING, &destlen);
+  ret = chxj_convert_chtml20(&r, &spec, tmp, destlen, &destlen, &entry, &cookie);
+  ret = chxj_rencoding(&r, ret, &destlen);
+  CU_ASSERT(ret != NULL);
+  CU_ASSERT(strcmp(RESULT_STRING, ret) == 0);
+  CU_ASSERT(destlen == sizeof(RESULT_STRING)-1);
+
+  APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
 /*============================================================================*/
 /* <HTML>                                                                     */
 /*============================================================================*/