OSDN Git Service

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

test/chxj_chtml40/test_chxj_chtml40.c

index bac1a02..740d9b2 100644 (file)
@@ -210,6 +210,8 @@ void test_chtml40_hr_tag_015();
 void test_chtml40_hr_tag_016();
 void test_chtml40_hr_tag_017();
 void test_chtml40_hr_tag_018();
+void test_chtml40_hr_tag_018_1();
+void test_chtml40_hr_tag_018_2();
 
 void test_chtml40_html_tag_001();
 
@@ -628,7 +630,9 @@ main()
   CU_add_test(chtml40_suite, "test <hr width> with non numeric value.",           test_chtml40_hr_tag_015);
   CU_add_test(chtml40_suite, "test <hr width> with numeric value.",               test_chtml40_hr_tag_016);
   CU_add_test(chtml40_suite, "test <hr noshade>.",                                test_chtml40_hr_tag_017);
-  CU_add_test(chtml40_suite, "test <hr color>.",                                  test_chtml40_hr_tag_018);
+  CU_add_test(chtml40_suite, "test <hr color> 1.",                                test_chtml40_hr_tag_018);
+  CU_add_test(chtml40_suite, "test <hr color> 2.",                                test_chtml40_hr_tag_018_1);
+  CU_add_test(chtml40_suite, "test <hr color> 3.",                                test_chtml40_hr_tag_018_2);
 
   CU_add_test(chtml40_suite, "test <html>.",                                      test_chtml40_html_tag_001);
 
@@ -5256,7 +5260,36 @@ void test_chtml40_hr_tag_017()
 void test_chtml40_hr_tag_018() 
 {
 #define  TEST_STRING "<html><head></head><body><hr width=\"10\" color=\"#ff0000\"></body></html>"
-#define  RESULT_STRING "<html><head></head><body><hr width=\"10\"></body></html>"
+#define  RESULT_STRING "<html><head></head><body><hr width=\"10\" color=\"#ff0000\"></body></html>"
+  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_chtml40(&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_chtml40_hr_tag_018_1() 
+{
+#define  TEST_STRING "<hr width=\"10\" color>"
+#define  RESULT_STRING "<hr width=\"10\">"
   char  *ret;
   char  *tmp;
   device_table spec;
@@ -5273,6 +5306,36 @@ void test_chtml40_hr_tag_018()
   tmp = chxj_encoding(&r, TEST_STRING, &destlen);
   ret = chxj_convert_chtml40(&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_chtml40_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_chtml40(&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);