OSDN Git Service

* Added test code for <center> tag to CHTML1.0 converter.
authorkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Sat, 5 Apr 2008 15:43:35 +0000 (15:43 +0000)
committerkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Sat, 5 Apr 2008 15:43:35 +0000 (15:43 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/branches/RELEASE_0_11_0@2000 1a406e8e-add9-4483-a2c8-d8cac5b7c224

test/chxj_chtml10/test_chxj_chtml10.c

index a350bf8..9d73a79 100644 (file)
@@ -78,26 +78,28 @@ void test_chtml10_br_tag_005();
 void test_chtml10_br_tag_006(); 
 void test_chtml10_br_tag_007(); 
 
+void test_chtml10_center_tag_001(); 
+
 int
 main()
 {
   CU_pSuite chtml10_suite;
   CU_initialize_registry();
   chtml10_suite = CU_add_suite("test chxj_exchange_chtml10()", NULL, NULL);
-  CU_add_test(chtml10_suite, "test void src1",                             test_chtml10_001);
-  CU_add_test(chtml10_suite, "test void src2",                             test_chtml10_002);
-  CU_add_test(chtml10_suite, "test comment tag1",                          test_chtml10_comment_tag_001);
-  CU_add_test(chtml10_suite, "test a tag name attr1",                      test_chtml10_a_tag_name_attribute_001); 
-  CU_add_test(chtml10_suite, "test a tag name attr2",                      test_chtml10_a_tag_name_attribute_002); 
-  CU_add_test(chtml10_suite, "test a tag name attr3 with japanese.",       test_chtml10_a_tag_name_attribute_003); 
-  CU_add_test(chtml10_suite, "test a tag name attr4 with japanese.",       test_chtml10_a_tag_name_attribute_004); 
-  CU_add_test(chtml10_suite, "test a tag href attr1 with void attribute.", test_chtml10_a_tag_href_attribute_001); 
-  CU_add_test(chtml10_suite, "test a tag href attr2 with other site link.", test_chtml10_a_tag_href_attribute_002); 
-  CU_add_test(chtml10_suite, "test a tag href attr3 with local link.",      test_chtml10_a_tag_href_attribute_003); 
-  CU_add_test(chtml10_suite, "test a tag href attr4 with maker.",           test_chtml10_a_tag_href_attribute_004); 
-  CU_add_test(chtml10_suite, "test a tag href attr5 with void maker.",      test_chtml10_a_tag_href_attribute_005); 
-  CU_add_test(chtml10_suite, "test a tag href attr6 with no cookie.",      test_chtml10_a_tag_href_attribute_006); 
-  CU_add_test(chtml10_suite, "test a tag accesskey attribute.",             test_chtml10_a_tag_accesskey_attribute_001); 
+  CU_add_test(chtml10_suite, "test void src1",                                    test_chtml10_001);
+  CU_add_test(chtml10_suite, "test void src2",                                    test_chtml10_002);
+  CU_add_test(chtml10_suite, "test comment tag1",                                 test_chtml10_comment_tag_001);
+  CU_add_test(chtml10_suite, "test a tag name attr1",                             test_chtml10_a_tag_name_attribute_001); 
+  CU_add_test(chtml10_suite, "test a tag name attr2",                             test_chtml10_a_tag_name_attribute_002); 
+  CU_add_test(chtml10_suite, "test a tag name attr3 with japanese.",              test_chtml10_a_tag_name_attribute_003); 
+  CU_add_test(chtml10_suite, "test a tag name attr4 with japanese.",              test_chtml10_a_tag_name_attribute_004); 
+  CU_add_test(chtml10_suite, "test a tag href attr1 with void attribute.",        test_chtml10_a_tag_href_attribute_001); 
+  CU_add_test(chtml10_suite, "test a tag href attr2 with other site link.",       test_chtml10_a_tag_href_attribute_002); 
+  CU_add_test(chtml10_suite, "test a tag href attr3 with local link.",            test_chtml10_a_tag_href_attribute_003); 
+  CU_add_test(chtml10_suite, "test a tag href attr4 with maker.",                 test_chtml10_a_tag_href_attribute_004); 
+  CU_add_test(chtml10_suite, "test a tag href attr5 with void maker.",            test_chtml10_a_tag_href_attribute_005); 
+  CU_add_test(chtml10_suite, "test a tag href attr6 with no cookie.",             test_chtml10_a_tag_href_attribute_006); 
+  CU_add_test(chtml10_suite, "test a tag accesskey attribute.",                   test_chtml10_a_tag_accesskey_attribute_001); 
   CU_add_test(chtml10_suite, "test a tag accesskey attribute with void char.",    test_chtml10_a_tag_accesskey_attribute_002); 
   CU_add_test(chtml10_suite, "test a tag accesskey attribute with no value",      test_chtml10_a_tag_accesskey_attribute_003); 
   CU_add_test(chtml10_suite, "test base tag no attribute.",                       test_chtml10_base_tag_001); 
@@ -123,6 +125,7 @@ main()
   CU_add_test(chtml10_suite, "test <br> with clear attribute(void).",             test_chtml10_br_tag_005); 
   CU_add_test(chtml10_suite, "test <br> with clear attribute(no value).",         test_chtml10_br_tag_006); 
   CU_add_test(chtml10_suite, "test <br> with clear attribute(unknown value).",    test_chtml10_br_tag_007); 
+  CU_add_test(chtml10_suite, "test <center>.",                                    test_chtml10_center_tag_001); 
   CU_basic_run_tests();
   CU_cleanup_registry();
 
@@ -1284,6 +1287,34 @@ void test_chtml10_br_tag_007()
 #undef TEST_STRING
 #undef RESULT_STRING
 }
+void test_chtml10_center_tag_001() 
+{
+#define  TEST_STRING "<html><head></head><body><center>あいうえお</center></body></html>"
+#define  RESULT_STRING "<html><head></head><body><center>あいうえお</center></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_exchange_chtml10(&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
+}
 /*
  * vim:ts=2 et
  */