OSDN Git Service

* Added input tag with CSS for CHTML5.0 converter.
authorkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Wed, 16 Jul 2008 13:56:19 +0000 (13:56 +0000)
committerkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Wed, 16 Jul 2008 13:56:19 +0000 (13:56 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/branches/sandbox@2966 1a406e8e-add9-4483-a2c8-d8cac5b7c224

src/chxj_chtml30.c
src/chxj_chtml40.c
src/chxj_chtml50.c
test/chxj_chtml50/test_chxj_chtml50.c

index 0890515..5054697 100644 (file)
@@ -1755,7 +1755,7 @@ s_chtml30_end_input_tag(void *pdoc, Node *node)
   Doc         *doc;
   request_rec *r;
 
-  chtml30 = GET_CHTML20(pdoc);
+  chtml30 = GET_CHTML30(pdoc);
   doc     = chtml30->doc;
   r       = doc->r;
 
index c5d69c8..8e1c535 100644 (file)
@@ -1621,7 +1621,7 @@ s_chtml40_start_input_tag(void *pdoc, Node *node)
   char        *attr_checked    = NULL;
   char        *attr_style      = NULL;
 
-  chtml40 = GET_CHTML30(pdoc);
+  chtml40 = GET_CHTML40(pdoc);
   doc     = chtml40->doc;
   r       = doc->r;
 
index e8ccfdf..5398252 100644 (file)
@@ -1677,93 +1677,139 @@ s_chtml50_start_input_tag(void *pdoc, Node *node)
   chtml50_t   *chtml50;
   Doc         *doc;
   request_rec *r;
-  char        *max_length  = NULL;
-  char        *type        = NULL;
-  char        *name        = NULL;
-  char        *value       = NULL;
-  char        *istyle      = NULL;
-  char        *size        = NULL;
-  char        *checked     = NULL;
-  char        *accesskey   = NULL;
-
-  chtml50   = GET_CHTML50(pdoc);
-  doc       = chtml50->doc;
-  r         = doc->r;
-  W_L("<input");
+  Attr        *attr;
+  char        *attr_accesskey  = NULL;
+  char        *attr_max_length = NULL;
+  char        *attr_type       = NULL;
+  char        *attr_name       = NULL;
+  char        *attr_value      = NULL;
+  char        *attr_istyle     = NULL;
+  char        *attr_size       = NULL;
+  char        *attr_checked    = NULL;
+  char        *attr_style      = NULL;
+
+  chtml50 = GET_CHTML50(pdoc);
+  doc     = chtml50->doc;
+  r       = doc->r;
+
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
   /*--------------------------------------------------------------------------*/
-  type       = qs_get_type_attr(doc, node, doc->buf.pool);
-  name       = qs_get_name_attr(doc, node, doc->buf.pool);
-  value      = qs_get_value_attr(doc,node, doc->buf.pool);
-  istyle     = qs_get_istyle_attr(doc,node,doc->buf.pool);
-  max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
-  checked    = qs_get_checked_attr(doc,node,doc->buf.pool);
-  accesskey  = qs_get_accesskey_attr(doc, node, doc->buf.pool);
-  size       = qs_get_size_attr(doc, node, doc->buf.pool);
-
-  if (type) {
-    type = qs_trim_string(doc->buf.pool, type);
-    if (type && (STRCASEEQ('t','T',"text",    type) ||
-                 STRCASEEQ('p','P',"password",type) ||
-                 STRCASEEQ('c','C',"checkbox",type) ||
-                 STRCASEEQ('r','R',"radio",   type) ||
-                 STRCASEEQ('h','H',"hidden",  type) ||
-                 STRCASEEQ('s','S',"submit",  type) ||
-                 STRCASEEQ('r','R',"reset",   type))) {
-      W_L(" type=\"");
-      W_V(type);
-      W_L("\"");
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) {
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
+    if (STRCASEEQ('t','T',"type",name) && value && *value) {
+      char *tmp_type = qs_trim_string(doc->buf.pool, value);
+      if (tmp_type && (STRCASEEQ('t','T',"text",    tmp_type) ||
+                       STRCASEEQ('p','P',"password",tmp_type) ||
+                       STRCASEEQ('c','C',"checkbox",tmp_type) ||
+                       STRCASEEQ('r','R',"radio",   tmp_type) ||
+                       STRCASEEQ('h','H',"hidden",  tmp_type) ||
+                       STRCASEEQ('s','S',"submit",  tmp_type) ||
+                       STRCASEEQ('r','R',"reset",   tmp_type))) {
+        attr_type = tmp_type;
+      }
+    }
+    else if (STRCASEEQ('n','N',"name",name) && value && *value) {
+      attr_name = value;
+    }
+    else if (STRCASEEQ('v','V',"value",name) && value && *value) {
+      attr_value = value;
+    }
+    else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
+      attr_istyle = value;
+    }
+    else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
+      attr_max_length = value;
+    }
+    else if (STRCASEEQ('c','C',"checked", name)) {
+      attr_checked = value;
+    }
+    else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
+      attr_accesskey = value;
+    }
+    else if (STRCASEEQ('s','S',"size", name) && value && *value) {
+      attr_size = value;
+    }
+    else if (STRCASEEQ('s','S',"style", name) && value && *value) {
+      attr_style = value;
     }
   }
-  if (size && *size) {
+
+  if (IS_CSS_ON(chtml50->entryp)) {
+    css_prop_list_t *style = s_chtml50_nopush_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
+      css_property_t *cur;
+      for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
+        if (strcasestr(cur->value, "<ja:n>")) {
+          attr_istyle = "4";
+        }
+        else if (strcasestr(cur->value, "<ja:en>")) {
+          attr_istyle = "3";
+        }
+        else if (strcasestr(cur->value, "<ja:hk>")) {
+          attr_istyle = "2";
+        }
+        else if (strcasestr(cur->value, "<ja:h>")) {
+          attr_istyle = "1";
+        }
+      }
+    }
+  }
+
+  W_L("<input");
+  if (attr_type) {
+    W_L(" type=\"");
+    W_V(attr_type);
+    W_L("\"");
+  }
+  if (attr_size) {
     W_L(" size=\"");
-    W_V(size);
+    W_V(attr_size);
     W_L("\"");
   }
-  if (name && *name) {
+  if (attr_name) {
     W_L(" name=\"");
-    W_V(name);
+    W_V(attr_name);
     W_L("\"");
   }
-  if (value && *value) {
+  if (attr_value) {
     W_L(" value=\"");
-    W_V(chxj_add_slash_to_doublequote(doc->pool, value));
+    W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
     W_L("\"");
   }
-  if (accesskey && *accesskey) {
+  if (attr_accesskey) {
     W_L(" accesskey=\"");
-    W_V(accesskey);
+    W_V(attr_accesskey);
     W_L("\"");
   }
-  if (istyle) {
-    /*------------------------------------------------------------------------*/
-    /* CHTML 2.0                                                              */
-    /*------------------------------------------------------------------------*/
-    if (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4') {
+  if (attr_istyle) {
+    if (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4') {
       W_L(" istyle=\"");
-      W_V(istyle);
+      W_V(attr_istyle);
       W_L("\"");
     }
   }
-
   /*--------------------------------------------------------------------------*/
   /* The figure is default for the password.                                  */
   /*--------------------------------------------------------------------------*/
-  if (max_length && *max_length) {
-    if (chxj_chk_numeric(max_length) != 0) {
-      max_length = apr_psprintf(r->pool, "0");
+  if (attr_max_length) {
+    if (chxj_chk_numeric(attr_max_length) != 0) {
+      attr_max_length = apr_psprintf(doc->buf.pool, "0");
     }
-    if (istyle != NULL && *istyle == '1') {
-      char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length) * 2);
+    if (attr_istyle && *attr_istyle == '1') {
+      char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length) * 2);
       W_V(vv);
     }
-    else  {
-      char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length));
+    else {
+      char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length));
       W_V(vv);
     }
   }
-  if (checked) {
+  if (attr_checked) {
     W_L(" checked");
   }
   W_L(">");
index b0a7407..1547994 100644 (file)
@@ -642,6 +642,15 @@ void test_chtml50_form_tag_with_css_005();
 void test_chtml50_form_tag_with_css_006();
 void test_chtml50_form_tag_with_css_007();
 void test_chtml50_form_tag_with_css_008();
+
+void test_chtml50_input_tag_with_css_001();
+void test_chtml50_input_tag_with_css_002();
+void test_chtml50_input_tag_with_css_003();
+void test_chtml50_input_tag_with_css_004();
+void test_chtml50_input_tag_with_css_005();
+void test_chtml50_input_tag_with_css_006();
+void test_chtml50_input_tag_with_css_007();
+void test_chtml50_input_tag_with_css_008();
 /* pend */
 
 int
@@ -1245,6 +1254,15 @@ main()
   CU_add_test(chtml50_suite, "test form with css 006",                             test_chtml50_form_tag_with_css_006);
   CU_add_test(chtml50_suite, "test form with css 007",                             test_chtml50_form_tag_with_css_007);
   CU_add_test(chtml50_suite, "test form with css 008",                             test_chtml50_form_tag_with_css_008);
+
+  CU_add_test(chtml50_suite, "test input with css 001",                            test_chtml50_input_tag_with_css_001);
+  CU_add_test(chtml50_suite, "test input with css 002",                            test_chtml50_input_tag_with_css_002);
+  CU_add_test(chtml50_suite, "test input with css 003",                            test_chtml50_input_tag_with_css_003);
+  CU_add_test(chtml50_suite, "test input with css 004",                            test_chtml50_input_tag_with_css_004);
+  CU_add_test(chtml50_suite, "test input with css 005",                            test_chtml50_input_tag_with_css_005);
+  CU_add_test(chtml50_suite, "test input with css 006",                            test_chtml50_input_tag_with_css_006);
+  CU_add_test(chtml50_suite, "test input with css 007",                            test_chtml50_input_tag_with_css_007);
+  CU_add_test(chtml50_suite, "test input with css 008",                            test_chtml50_input_tag_with_css_008);
   /* aend */
 
   CU_basic_run_tests();
@@ -18339,6 +18357,334 @@ void test_chtml50_form_tag_with_css_008()
 }
 
 
+/*===========================================================================*/
+/* input tag with CSS                                                        */
+/*===========================================================================*/
+char *test_chxj_serf_get080(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"
+                     "input   { -wap-input-format: &quot;*&lt;ja:h&gt;&quot; }\n";
+  *len = strlen(css);
+  call_check = 1;
+  return css;
+}
+void test_chtml50_input_tag_with_css_001()
+{
+#define  TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\"  type=\"text/css\" />" \
+                     "</head><form><input type=\"text\"></form></html>"
+#define  RESULT_STRING "<html><head></head><form><input type=\"text\" istyle=\"1\"></form></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_get080;
+  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_chtml50(&r, &spec, tmp, destlen, &destlen, &entry, &cookie);
+  ret = chxj_rencoding(&r, ret, &destlen);
+  fprintf(stderr, "actual:[%s]\n", ret);
+  fprintf(stderr, "expect:[%s]\n", RESULT_STRING);
+  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_chtml50_input_tag_with_css_002()
+{
+#define  TEST_STRING "<html><head>" \
+                     "</head><form><input type=\"text\" style=\"-wap-input-format: &quot;*&lt;ja:h&gt;&quot;\"></form></html>"
+#define  RESULT_STRING "<html><head></head><form><input type=\"text\" istyle=\"1\"></form></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_get080;
+  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_chtml50(&r, &spec, tmp, destlen, &destlen, &entry, &cookie);
+  ret = chxj_rencoding(&r, ret, &destlen);
+  fprintf(stderr, "actual:[%s]\n", ret);
+  fprintf(stderr, "expect:[%s]\n", RESULT_STRING);
+  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_get081(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"
+                     "input   { -wap-input-format: &quot;*&lt;ja:hk&gt;&quot; }\n";
+  *len = strlen(css);
+  call_check = 1;
+  return css;
+}
+void test_chtml50_input_tag_with_css_003()
+{
+#define  TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\"  type=\"text/css\" />" \
+                     "</head><form><input type=\"text\"></form></html>"
+#define  RESULT_STRING "<html><head></head><form><input type=\"text\" istyle=\"2\"></form></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_get081;
+  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_chtml50(&r, &spec, tmp, destlen, &destlen, &entry, &cookie);
+  ret = chxj_rencoding(&r, ret, &destlen);
+  fprintf(stderr, "actual:[%s]\n", ret);
+  fprintf(stderr, "expect:[%s]\n", RESULT_STRING);
+  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_chtml50_input_tag_with_css_004()
+{
+#define  TEST_STRING "<html><head>" \
+                     "</head><form><input type=\"text\" style=\"-wap-input-format: &quot;*&lt;ja:hk&gt;&quot;\"></form></html>"
+#define  RESULT_STRING "<html><head></head><form><input type=\"text\" istyle=\"2\"></form></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_get081;
+  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_chtml50(&r, &spec, tmp, destlen, &destlen, &entry, &cookie);
+  ret = chxj_rencoding(&r, ret, &destlen);
+  fprintf(stderr, "actual:[%s]\n", ret);
+  fprintf(stderr, "expect:[%s]\n", RESULT_STRING);
+  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_get082(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"
+                     "input   { -wap-input-format: &quot;*&lt;ja:en&gt;&quot; }\n";
+  *len = strlen(css);
+  call_check = 1;
+  return css;
+}
+void test_chtml50_input_tag_with_css_005()
+{
+#define  TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\"  type=\"text/css\" />" \
+                     "</head><form><input type=\"text\"></form></html>"
+#define  RESULT_STRING "<html><head></head><form><input type=\"text\" istyle=\"3\"></form></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_get082;
+  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_chtml50(&r, &spec, tmp, destlen, &destlen, &entry, &cookie);
+  ret = chxj_rencoding(&r, ret, &destlen);
+  fprintf(stderr, "actual:[%s]\n", ret);
+  fprintf(stderr, "expect:[%s]\n", RESULT_STRING);
+  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_chtml50_input_tag_with_css_006()
+{
+#define  TEST_STRING "<html><head>" \
+                     "</head><form><input type=\"text\" style=\"-wap-input-format: &quot;*&lt;ja:en&gt;&quot;\"></form></html>"
+#define  RESULT_STRING "<html><head></head><form><input type=\"text\" istyle=\"3\"></form></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_get082;
+  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_chtml50(&r, &spec, tmp, destlen, &destlen, &entry, &cookie);
+  ret = chxj_rencoding(&r, ret, &destlen);
+  fprintf(stderr, "actual:[%s]\n", ret);
+  fprintf(stderr, "expect:[%s]\n", RESULT_STRING);
+  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_get083(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"
+                     "input   { -wap-input-format: &quot;*&lt;ja:n&gt;&quot;; }\n";
+  *len = strlen(css);
+  call_check = 1;
+  return css;
+}
+void test_chtml50_input_tag_with_css_007()
+{
+#define  TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\"  type=\"text/css\" />" \
+                     "</head><form><input type=\"text\"></form></html>"
+#define  RESULT_STRING "<html><head></head><form><input type=\"text\" istyle=\"4\"></form></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_get083;
+  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_chtml50(&r, &spec, tmp, destlen, &destlen, &entry, &cookie);
+  ret = chxj_rencoding(&r, ret, &destlen);
+  fprintf(stderr, "actual:[%s]\n", ret);
+  fprintf(stderr, "expect:[%s]\n", RESULT_STRING);
+  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_chtml50_input_tag_with_css_008()
+{
+#define  TEST_STRING "<html><head>" \
+                     "</head><form><input type=\"text\" style=\"-wap-input-format: &quot;*&lt;ja:n&gt;&quot;;\"></form></html>"
+#define  RESULT_STRING "<html><head></head><form><input type=\"text\" istyle=\"4\"></form></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_get083;
+  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_chtml50(&r, &spec, tmp, destlen, &destlen, &entry, &cookie);
+  ret = chxj_rencoding(&r, ret, &destlen);
+  fprintf(stderr, "actual:[%s]\n", ret);
+  fprintf(stderr, "expect:[%s]\n", RESULT_STRING);
+  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
  */