OSDN Git Service

* Added p tag with CSS for CHTML4.0 converter.
authorkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Tue, 8 Jul 2008 11:13:12 +0000 (11:13 +0000)
committerkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Tue, 8 Jul 2008 11:13:12 +0000 (11:13 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/branches/sandbox@2832 1a406e8e-add9-4483-a2c8-d8cac5b7c224

include/chxj_chtml40.h
src/chxj_chtml30.c
src/chxj_chtml40.c
test/chxj_chtml30/test_chxj_chtml30.c
test/chxj_chtml40/test_chxj_chtml40.c

index 977afd8..c227853 100644 (file)
@@ -44,6 +44,13 @@ struct chtml40_t {
   css_prop_list_stack_t *css_prop_stack;
 };
 
+typedef struct _chtml40_flags_t chtml40_flags_t;
+
+struct _chtml40_flags_t {
+  int with_font_flag;
+  int with_blink_flag;
+};
+
 /*----------------------------------------------------------------------------*/
 /* Prototype                                                                  */
 /*----------------------------------------------------------------------------*/
index f79ba14..54f36cd 100644 (file)
@@ -2092,7 +2092,7 @@ s_chtml30_start_pre_tag(void *pdoc, Node *UNUSED(node))
 /**
  * It is a handler who processes the PRE tag.
  *
- * @param pdoc  [i/o] The pointer to the XHTML structure at the output
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
  *                     destination is specified.
  * @param node   [i]   The PRE tag node is specified.
  * @return The conversion result is returned.
@@ -2113,7 +2113,7 @@ s_chtml30_end_pre_tag(void *pdoc, Node *UNUSED(child))
 /**
  * It is a handler who processes the P tag.
  *
- * @param pdoc  [i/o] The pointer to the XHTML structure at the output
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
  *                     destination is specified.
  * @param node   [i]   The P tag node is specified.
  * @return The conversion result is returned.
index 4544032..ad82b82 100644 (file)
@@ -2133,17 +2133,19 @@ s_chtml40_end_pre_tag(void *pdoc, Node *UNUSED(child))
 static char *
 s_chtml40_start_p_tag(void *pdoc, Node *node) 
 {
-  chtml40_t     *chtml40;
-  Doc           *doc;
-  request_rec   *r;
-  Attr          *attr;
-  char          *align = NULL;
+  chtml40_t   *chtml40;
+  Doc         *doc;
+  request_rec *r;
+  Attr        *attr;
+  char        *attr_align = NULL;
+  char        *attr_style = NULL;
+  char        *attr_color = NULL;
+  char        *attr_blink = NULL;
 
   chtml40 = GET_CHTML40(pdoc);
   doc     = chtml40->doc;
   r       = doc->r;
 
-  W_L("<p");
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
@@ -2154,17 +2156,67 @@ s_chtml40_start_p_tag(void *pdoc, Node *node)
       /* CHTML 1.0 (W3C version 3.2)                                          */
       /*----------------------------------------------------------------------*/
       if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
-        align = apr_pstrdup(doc->buf.pool, val);
+        attr_align = apr_pstrdup(doc->buf.pool, val);
         break;
       }
     }
+    else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
+      attr_style = apr_pstrdup(doc->buf.pool, val);
+    }
   }
-  if (align) {
+  if (IS_CSS_ON(chtml40->entryp)) {
+    css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
+      css_property_t *color_prop      = chxj_css_get_property_value(doc, style, "color");
+      css_property_t *text_deco_prop  = chxj_css_get_property_value(doc, style, "text-decoration");
+      css_property_t *cur;
+      for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
+        if (STRCASEEQ('l','L',"left",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "left");
+        }
+        else if (STRCASEEQ('c','C',"center",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "center");
+        }
+        else if (STRCASEEQ('r','R',"right",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "right");
+        }
+      }
+      for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_color = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
+        if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
+          attr_blink = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+    }
+  }
+  W_L("<p");
+  if (attr_align) {
     W_L(" align=\"");
-    W_V(align);
+    W_V(attr_align);
     W_L("\"");
   }
   W_L(">");
+
+  chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
+  memset(flg, 0, sizeof(*flg));
+  if (attr_color) {
+    attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
+    W_L("<font color=\"");
+    W_V(attr_color);
+    W_L("\">");
+    flg->with_font_flag = 1;
+  }
+  if (attr_blink) {
+    W_L("<blink>");
+    flg->with_blink_flag = 1;
+  }
+  node->userData = (void *)flg;
+
   return chtml40->out;
 }
 
@@ -2178,7 +2230,7 @@ s_chtml40_start_p_tag(void *pdoc, Node *node)
  * @return The conversion result is returned.
  */
 static char *
-s_chtml40_end_p_tag(void *pdoc, Node *UNUSED(child)) 
+s_chtml40_end_p_tag(void *pdoc, Node *node)
 {
   chtml40_t   *chtml40;
   Doc         *doc;
@@ -2186,6 +2238,13 @@ s_chtml40_end_p_tag(void *pdoc, Node *UNUSED(child))
   chtml40 = GET_CHTML40(pdoc);
   doc     = chtml40->doc;
 
+  chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
+  if (flg->with_font_flag) {
+    W_L("</font>");
+  }
+  if (flg->with_blink_flag) {
+    W_L("</blink>");
+  }
   W_L("</p>");
 
   return chtml40->out;
index edd9ba8..65655cd 100644 (file)
@@ -504,6 +504,9 @@ void test_chtml30_textarea_tag_with_css_006();
 void test_chtml30_textarea_tag_with_css_007();
 void test_chtml30_textarea_tag_with_css_008();
 
+void test_chtml30_p_tag_with_css_001();
+void test_chtml30_p_tag_with_css_002();
+void test_chtml30_p_tag_with_css_003();
 void test_chtml30_p_tag_with_css_004();
 void test_chtml30_p_tag_with_css_005();
 void test_chtml30_p_tag_with_css_006();
@@ -980,6 +983,9 @@ main()
   CU_add_test(chtml30_suite, "test textarea with css 007",                         test_chtml30_textarea_tag_with_css_007);
   CU_add_test(chtml30_suite, "test textarea with css 008",                         test_chtml30_textarea_tag_with_css_008);
 
+  CU_add_test(chtml30_suite, "test p with css 001",                                test_chtml30_p_tag_with_css_001);
+  CU_add_test(chtml30_suite, "test p with css 002",                                test_chtml30_p_tag_with_css_002);
+  CU_add_test(chtml30_suite, "test p with css 003",                                test_chtml30_p_tag_with_css_003);
   CU_add_test(chtml30_suite, "test p with css 004",                                test_chtml30_p_tag_with_css_004);
   CU_add_test(chtml30_suite, "test p with css 005",                                test_chtml30_p_tag_with_css_005);
   CU_add_test(chtml30_suite, "test p with css 006",                                test_chtml30_p_tag_with_css_006);
index b74271f..f1189ab 100644 (file)
@@ -512,6 +512,20 @@ void test_chtml40_textarea_tag_with_css_005();
 void test_chtml40_textarea_tag_with_css_006();
 void test_chtml40_textarea_tag_with_css_007();
 void test_chtml40_textarea_tag_with_css_008();
+
+void test_chtml40_p_tag_with_css_001();
+void test_chtml40_p_tag_with_css_002();
+void test_chtml40_p_tag_with_css_003();
+void test_chtml40_p_tag_with_css_004();
+void test_chtml40_p_tag_with_css_005();
+void test_chtml40_p_tag_with_css_006();
+void test_chtml40_p_tag_with_css_007();
+void test_chtml40_p_tag_with_css_008();
+void test_chtml40_p_tag_with_css_009();
+void test_chtml40_p_tag_with_css_010();
+void test_chtml40_p_tag_with_css_011();
+void test_chtml40_p_tag_with_css_012();
+void test_chtml40_p_tag_with_css_013();
 /* pend */
 
 int
@@ -987,6 +1001,19 @@ main()
   CU_add_test(chtml40_suite, "test textarea with css 006",                         test_chtml40_textarea_tag_with_css_006);
   CU_add_test(chtml40_suite, "test textarea with css 007",                         test_chtml40_textarea_tag_with_css_007);
   CU_add_test(chtml40_suite, "test textarea with css 008",                         test_chtml40_textarea_tag_with_css_008);
+
+  CU_add_test(chtml40_suite, "test p with css 001",                                test_chtml40_p_tag_with_css_001);
+  CU_add_test(chtml40_suite, "test p with css 002",                                test_chtml40_p_tag_with_css_002);
+  CU_add_test(chtml40_suite, "test p with css 003",                                test_chtml40_p_tag_with_css_003);
+  CU_add_test(chtml40_suite, "test p with css 004",                                test_chtml40_p_tag_with_css_004);
+  CU_add_test(chtml40_suite, "test p with css 005",                                test_chtml40_p_tag_with_css_005);
+  CU_add_test(chtml40_suite, "test p with css 006",                                test_chtml40_p_tag_with_css_006);
+  CU_add_test(chtml40_suite, "test p with css 007",                                test_chtml40_p_tag_with_css_007);
+  CU_add_test(chtml40_suite, "test p with css 008",                                test_chtml40_p_tag_with_css_008);
+  CU_add_test(chtml40_suite, "test p with css 010",                                test_chtml40_p_tag_with_css_010);
+  CU_add_test(chtml40_suite, "test p with css 011",                                test_chtml40_p_tag_with_css_011);
+  CU_add_test(chtml40_suite, "test p with css 012",                                test_chtml40_p_tag_with_css_012);
+  CU_add_test(chtml40_suite, "test p with css 013",                                test_chtml40_p_tag_with_css_013);
   /* aend */
 
   CU_basic_run_tests();
@@ -13494,6 +13521,515 @@ void test_chtml40_textarea_tag_with_css_008()
 #undef TEST_STRING
 #undef RESULT_STRING
 }
+
+/*===========================================================================*/
+/* p with CSS                                                                */
+/*===========================================================================*/
+char *test_chxj_serf_get008(request_rec *r, apr_pool_t *ppool, const char *uri_path, int ss, apr_size_t *len)
+{
+  static char *css = "a:focus { display: none }\n"
+                     "a:link  { display: none }\n"
+                     "a       { display: none }\n"
+                     "hr      { display: none }\n"
+                     "a:visited { display:none }\n"
+                     "p       { text-align: left }\n";
+  *len = strlen(css);
+  call_check = 1;
+  return css;
+}
+void test_chtml40_p_tag_with_css_001()
+{
+#define  TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\"  type=\"text/css\" />" \
+                     "</head><body><p>あいう</p></body></html>"
+#define  RESULT_STRING "<html><head></head><body><p align=\"left\">あいう</p></body></html>"
+  char  *ret;
+  char  *tmp;
+  device_table spec;
+  chxjconvrule_entry entry;
+  cookie_t cookie;
+  apr_size_t destlen;
+  APR_INIT;
+  chxj_serf_get = test_chxj_serf_get008;
+  call_check = 0;
+
+  COOKIE_INIT(cookie);
+
+  SPEC_INIT(spec);
+  destlen = sizeof(TEST_STRING)-1;
+  entry.action |= CONVRULE_CSS_ON_BIT;
+
+  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);
+  CU_ASSERT(call_check == 1);
+
+  APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
+char *test_chxj_serf_get009(request_rec *r, apr_pool_t *ppool, const char *uri_path, int ss, apr_size_t *len)
+{
+  static char *css = "a:focus { display: none }\n"
+                     "a:link  { display: none }\n"
+                     "a       { display: none }\n"
+                     "hr      { display: none }\n"
+                     "a:visited { display:none }\n"
+                     "p       { text-align: center }\n";
+  *len = strlen(css);
+  call_check = 1;
+  return css;
+}
+void test_chtml40_p_tag_with_css_002()
+{
+#define  TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\"  type=\"text/css\" />" \
+                     "</head><body><p>あいう</p></body></html>"
+#define  RESULT_STRING "<html><head></head><body><p align=\"center\">あいう</p></body></html>"
+  char  *ret;
+  char  *tmp;
+  device_table spec;
+  chxjconvrule_entry entry;
+  cookie_t cookie;
+  apr_size_t destlen;
+  APR_INIT;
+  chxj_serf_get = test_chxj_serf_get009;
+  call_check = 0;
+
+  COOKIE_INIT(cookie);
+
+  SPEC_INIT(spec);
+  destlen = sizeof(TEST_STRING)-1;
+  entry.action |= CONVRULE_CSS_ON_BIT;
+
+  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);
+  CU_ASSERT(call_check == 1);
+
+  APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
+char *test_chxj_serf_get010(request_rec *r, apr_pool_t *ppool, const char *uri_path, int ss, apr_size_t *len)
+{
+  static char *css = "a:focus { display: none }\n"
+                     "a:link  { display: none }\n"
+                     "a       { display: none }\n"
+                     "hr      { display: none }\n"
+                     "a:visited { display:none }\n"
+                     "p       { text-align: right }\n";
+  *len = strlen(css);
+  call_check = 1;
+  return css;
+}
+void test_chtml40_p_tag_with_css_003()
+{
+#define  TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\"  type=\"text/css\" />" \
+                     "</head><body><p>あいう</p></body></html>"
+#define  RESULT_STRING "<html><head></head><body><p align=\"right\">あいう</p></body></html>"
+  char  *ret;
+  char  *tmp;
+  device_table spec;
+  chxjconvrule_entry entry;
+  cookie_t cookie;
+  apr_size_t destlen;
+  APR_INIT;
+  chxj_serf_get = test_chxj_serf_get010;
+  call_check = 0;
+
+  COOKIE_INIT(cookie);
+
+  SPEC_INIT(spec);
+  destlen = sizeof(TEST_STRING)-1;
+  entry.action |= CONVRULE_CSS_ON_BIT;
+
+  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);
+  CU_ASSERT(call_check == 1);
+
+  APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
+
+void test_chtml40_p_tag_with_css_004()
+{
+#define  TEST_STRING "<html><head>" \
+                     "</head><body><p style=\"text-align: left\">あいう</p></body></html>"
+#define  RESULT_STRING "<html><head></head><body><p align=\"left\">あいう</p></body></html>"
+  char  *ret;
+  char  *tmp;
+  device_table spec;
+  chxjconvrule_entry entry;
+  cookie_t cookie;
+  apr_size_t destlen;
+  APR_INIT;
+  chxj_serf_get = test_chxj_serf_get010;
+  call_check = 0;
+
+  COOKIE_INIT(cookie);
+
+  SPEC_INIT(spec);
+  destlen = sizeof(TEST_STRING)-1;
+  entry.action |= CONVRULE_CSS_ON_BIT;
+
+  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);
+  CU_ASSERT(call_check == 0);
+
+  APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
+void test_chtml40_p_tag_with_css_005()
+{
+#define  TEST_STRING "<html><head>" \
+                     "</head><body><p style=\"text-align: center\">あいう</p></body></html>"
+#define  RESULT_STRING "<html><head></head><body><p align=\"center\">あいう</p></body></html>"
+  char  *ret;
+  char  *tmp;
+  device_table spec;
+  chxjconvrule_entry entry;
+  cookie_t cookie;
+  apr_size_t destlen;
+  APR_INIT;
+  chxj_serf_get = test_chxj_serf_get010;
+  call_check = 0;
+
+  COOKIE_INIT(cookie);
+
+  SPEC_INIT(spec);
+  destlen = sizeof(TEST_STRING)-1;
+  entry.action |= CONVRULE_CSS_ON_BIT;
+
+  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);
+  CU_ASSERT(call_check == 0);
+
+  APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
+void test_chtml40_p_tag_with_css_006()
+{
+#define  TEST_STRING "<html><head>" \
+                     "</head><body><p style=\"text-align: right\">あいう</p></body></html>"
+#define  RESULT_STRING "<html><head></head><body><p align=\"right\">あいう</p></body></html>"
+  char  *ret;
+  char  *tmp;
+  device_table spec;
+  chxjconvrule_entry entry;
+  cookie_t cookie;
+  apr_size_t destlen;
+  APR_INIT;
+  chxj_serf_get = test_chxj_serf_get010;
+  call_check = 0;
+
+  COOKIE_INIT(cookie);
+
+  SPEC_INIT(spec);
+  destlen = sizeof(TEST_STRING)-1;
+  entry.action |= CONVRULE_CSS_ON_BIT;
+
+  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);
+  CU_ASSERT(call_check == 0);
+
+  APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
+void test_chtml40_p_tag_with_css_007()
+{
+#define  TEST_STRING "<html><head>" \
+                     "</head><body><p style=\"text-align: right\"><p>あいう</p></p></body></html>"
+#define  RESULT_STRING "<html><head></head><body><p align=\"right\"><p align=\"right\">あいう</p></p></body></html>"
+  char  *ret;
+  char  *tmp;
+  device_table spec;
+  chxjconvrule_entry entry;
+  cookie_t cookie;
+  apr_size_t destlen;
+  APR_INIT;
+  chxj_serf_get = test_chxj_serf_get010;
+  call_check = 0;
+
+  COOKIE_INIT(cookie);
+
+  SPEC_INIT(spec);
+  destlen = sizeof(TEST_STRING)-1;
+  entry.action |= CONVRULE_CSS_ON_BIT;
+
+  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);
+  CU_ASSERT(call_check == 0);
+
+  APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
+/*=======================*/
+/* p with color property */
+/*=======================*/
+char *test_chxj_serf_get011(request_rec *r, apr_pool_t *ppool, const char *uri_path, int ss, apr_size_t *len)
+{
+  static char *css = "a:focus { display: none }\n"
+                     "a:link  { display: none }\n"
+                     "a       { display: none }\n"
+                     "hr      { display: none }\n"
+                     "a:visited { display:none }\n"
+                     "p       { color: #ff0000 }\n";
+  *len = strlen(css);
+  call_check = 1;
+  return css;
+}
+void test_chtml40_p_tag_with_css_008()
+{
+#define  TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\"  type=\"text/css\" />" \
+                     "</head><body><p>あいう</p></body></html>"
+#define  RESULT_STRING "<html><head></head><body><p><font color=\"#ff0000\">あいう</font></p></body></html>"
+  char  *ret;
+  char  *tmp;
+  device_table spec;
+  chxjconvrule_entry entry;
+  cookie_t cookie;
+  apr_size_t destlen;
+  APR_INIT;
+  chxj_serf_get = test_chxj_serf_get011;
+  call_check = 0;
+
+  COOKIE_INIT(cookie);
+
+  SPEC_INIT(spec);
+  destlen = sizeof(TEST_STRING)-1;
+  entry.action |= CONVRULE_CSS_ON_BIT;
+
+  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);
+  CU_ASSERT(call_check == 1);
+
+  APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
+char *test_chxj_serf_get012(request_rec *r, apr_pool_t *ppool, const char *uri_path, int ss, apr_size_t *len)
+{
+  static char *css = "a:focus { display: none }\n"
+                     "a:link  { display: none }\n"
+                     "a       { display: none }\n"
+                     "hr      { display: none }\n"
+                     "a:visited { display:none }\n"
+                     "p       { color: rgb(100%, 100%, 100%) }\n";
+  *len = strlen(css);
+  call_check = 1;
+  return css;
+}
+void test_chtml40_p_tag_with_css_009()
+{
+#define  TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\"  type=\"text/css\" />" \
+                     "</head><body><p>あいう</p></body></html>"
+#define  RESULT_STRING "<html><head></head><body><p><font color=\"#ffffff\">あいう</font></p></body></html>"
+  char  *ret;
+  char  *tmp;
+  device_table spec;
+  chxjconvrule_entry entry;
+  cookie_t cookie;
+  apr_size_t destlen;
+  APR_INIT;
+  chxj_serf_get = test_chxj_serf_get012;
+  call_check = 0;
+
+  COOKIE_INIT(cookie);
+
+  SPEC_INIT(spec);
+  destlen = sizeof(TEST_STRING)-1;
+  entry.action |= CONVRULE_CSS_ON_BIT;
+
+  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);
+  CU_ASSERT(call_check == 1);
+
+  APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
+void test_chtml40_p_tag_with_css_010()
+{
+#define  TEST_STRING "<html><head>" \
+                     "</head><body><p style=\"color: #ff0000\">あいう</p></body></html>"
+#define  RESULT_STRING "<html><head></head><body><p><font color=\"#ff0000\">あいう</font></p></body></html>"
+  char  *ret;
+  char  *tmp;
+  device_table spec;
+  chxjconvrule_entry entry;
+  cookie_t cookie;
+  apr_size_t destlen;
+  APR_INIT;
+  chxj_serf_get = test_chxj_serf_get011;
+  call_check = 0;
+
+  COOKIE_INIT(cookie);
+
+  SPEC_INIT(spec);
+  destlen = sizeof(TEST_STRING)-1;
+  entry.action |= CONVRULE_CSS_ON_BIT;
+
+  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);
+  CU_ASSERT(call_check == 0);
+
+  APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
+void test_chtml40_p_tag_with_css_011()
+{
+#define  TEST_STRING "<html><head>" \
+                     "</head><body><p style=\"color: rgb(100%, 100%, 100%)\">あいう</p></body></html>"
+#define  RESULT_STRING "<html><head></head><body><p><font color=\"#ffffff\">あいう</font></p></body></html>"
+  char  *ret;
+  char  *tmp;
+  device_table spec;
+  chxjconvrule_entry entry;
+  cookie_t cookie;
+  apr_size_t destlen;
+  APR_INIT;
+  chxj_serf_get = test_chxj_serf_get012;
+  call_check = 0;
+
+  COOKIE_INIT(cookie);
+
+  SPEC_INIT(spec);
+  destlen = sizeof(TEST_STRING)-1;
+  entry.action |= CONVRULE_CSS_ON_BIT;
+
+  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);
+  CU_ASSERT(call_check == 0);
+
+  APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
+char *test_chxj_serf_get013(request_rec *r, apr_pool_t *ppool, const char *uri_path, int ss, apr_size_t *len)
+{
+  static char *css = "a:focus { display: none }\n"
+                     "a:link  { display: none }\n"
+                     "a       { display: none }\n"
+                     "hr      { display: none }\n"
+                     "a:visited { display:none }\n"
+                     "p       { text-decoration: blink }\n";
+  *len = strlen(css);
+  call_check = 1;
+  return css;
+}
+void test_chtml40_p_tag_with_css_012()
+{
+#define  TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\"  type=\"text/css\" />" \
+                     "</head><body><p>あいう</p></body></html>"
+#define  RESULT_STRING "<html><head></head><body><p><blink>あいう</blink></p></body></html>"
+  char  *ret;
+  char  *tmp;
+  device_table spec;
+  chxjconvrule_entry entry;
+  cookie_t cookie;
+  apr_size_t destlen;
+  APR_INIT;
+  chxj_serf_get = test_chxj_serf_get013;
+  call_check = 0;
+
+  COOKIE_INIT(cookie);
+
+  SPEC_INIT(spec);
+  destlen = sizeof(TEST_STRING)-1;
+  entry.action |= CONVRULE_CSS_ON_BIT;
+
+  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);
+  CU_ASSERT(call_check == 1);
+
+  APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
+void test_chtml40_p_tag_with_css_013()
+{
+#define  TEST_STRING "<html><head>" \
+                     "</head><body><p style=\"text-decoration: blink\">あいう</p></body></html>"
+#define  RESULT_STRING "<html><head></head><body><p><blink>あいう</blink></p></body></html>"
+  char  *ret;
+  char  *tmp;
+  device_table spec;
+  chxjconvrule_entry entry;
+  cookie_t cookie;
+  apr_size_t destlen;
+  APR_INIT;
+  chxj_serf_get = test_chxj_serf_get013;
+  call_check = 0;
+
+  COOKIE_INIT(cookie);
+
+  SPEC_INIT(spec);
+  destlen = sizeof(TEST_STRING)-1;
+  entry.action |= CONVRULE_CSS_ON_BIT;
+
+  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);
+  CU_ASSERT(call_check == 0);
+
+  APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
 /*
  * vim:ts=2 et
  */