Doc *doc;
request_rec *r;
Attr *attr;
- char *color = NULL;
- char *size = NULL;
+ char *attr_color = NULL;
+ char *attr_size = NULL;
+ char *attr_style = NULL;
jxhtml = GET_JXHTML(pdoc);
doc = jxhtml->doc;
char *name = qs_get_attr_name(doc,attr);
char *value = qs_get_attr_value(doc,attr);
if (STRCASEEQ('c','C',"color",name) && value && *value) {
- color = apr_pstrdup(doc->buf.pool, value);
+ attr_color = apr_pstrdup(doc->buf.pool, value);
}
else if (STRCASEEQ('s','S',"size",name) && value && *value) {
/*----------------------------------------------------------------------*/
/* CHTML 5.0 */
/*----------------------------------------------------------------------*/
- size = apr_pstrdup(doc->buf.pool, value);
+ attr_size = apr_pstrdup(doc->buf.pool, value);
+ }
+ else if (STRCASEEQ('s','S',"style",name) && value && *value) {
+ attr_style = apr_pstrdup(doc->buf.pool, value);
}
}
- if (color) {
+ if (IS_CSS_ON(jxhtml->entryp)) {
+ css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+ if (style) {
+ css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
+ css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
+ css_property_t *cur;
+ 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 = size_prop->next; cur != size_prop; cur = cur->next) {
+ if (cur->value && *cur->value) {
+ attr_size = apr_pstrdup(doc->pool, cur->value);
+ if (STRCASEEQ('x','X',"xx-small",attr_size)) {
+ attr_size = apr_pstrdup(doc->pool, "1");
+ }
+ else if (STRCASEEQ('x','X',"x-small",attr_size)) {
+ attr_size = apr_pstrdup(doc->pool, "2");
+ }
+ else if (STRCASEEQ('s','S',"small",attr_size)) {
+ attr_size = apr_pstrdup(doc->pool, "3");
+ }
+ else if (STRCASEEQ('m','M',"medium",attr_size)) {
+ attr_size = apr_pstrdup(doc->pool, "4");
+ }
+ else if (STRCASEEQ('l','L',"large",attr_size)) {
+ attr_size = apr_pstrdup(doc->pool, "5");
+ }
+ else if (STRCASEEQ('x','X',"x-large",attr_size)) {
+ attr_size = apr_pstrdup(doc->pool, "6");
+ }
+ else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
+ attr_size = apr_pstrdup(doc->pool, "7");
+ }
+ }
+ }
+ }
+ }
+ jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
+ 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(color);
+ W_V(attr_color);
W_L("\">");
- jxhtml->font_flag++;
+ flg->font_color_flag = 1;
}
- if (size) {
- jxhtml->font_size_flag++;
- switch(*size) {
+ if (attr_size) {
+ flg->font_size_flag = 1;
+ switch(*attr_size) {
case '1': W_L("<span style=\"font-size: xx-small\">"); break;
case '2': W_L("<span style=\"font-size: x-small\">"); break;
case '3': W_L("<span style=\"font-size: small\">"); break;
case '6': W_L("<span style=\"font-size: x-large\">"); break;
case '7': W_L("<span style=\"font-size: xx-large\">"); break;
case '-':
- if (*(size + 1) == '1') {
+ if (*(attr_size + 1) == '1') {
W_L("<span style=\"font-size: small\">");
break;
}
- if (*(size + 1) == '2') {
+ if (*(attr_size + 1) == '2') {
W_L("<span style=\"font-size: x-small\">");
break;
}
- if (*(size + 1) == '3') {
+ if (*(attr_size + 1) == '3') {
W_L("<span style=\"font-size: xx-small\">");
break;
}
- jxhtml->font_size_flag--;
+ flg->font_size_flag = 0;
break;
case '+':
- if (*(size + 1) == '1') {
+ if (*(attr_size + 1) == '1') {
W_L("<span style=\"font-size: large\">");
break;
}
- if (*(size + 1) == '2') {
+ if (*(attr_size + 1) == '2') {
W_L("<span style=\"font-size: x-large\">");
break;
}
- if (*(size + 1) == '3') {
+ if (*(attr_size + 1) == '3') {
W_L("<span style=\"font-size: xx-large\">");
break;
}
- jxhtml->font_size_flag--;
+ flg->font_size_flag = 0;
break;
default:
- WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", size);
- jxhtml->font_size_flag--;
+ WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
+ flg->font_size_flag = 0;
}
}
+ node->userData = flg;
return jxhtml->out;
}
* @return The conversion result is returned.
*/
static char *
-s_jxhtml_end_font_tag(void *pdoc, Node *UNUSED(child))
+s_jxhtml_end_font_tag(void *pdoc, Node *node)
{
jxhtml_t *jxhtml;
request_rec *r;
doc = jxhtml->doc;
r = jxhtml->doc->r;
- if (jxhtml->font_size_flag) {
- W_L("</span>");
- jxhtml->font_size_flag--;
+ jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
+ if (flg && flg->font_size_flag) {
+ W_L("</span>");
}
- if (jxhtml->font_flag) {
+ if (flg && flg->font_color_flag) {
W_L("</font>");
- jxhtml->font_flag--;
}
+ if (IS_CSS_ON(jxhtml->entryp)) {
+ chxj_css_pop_prop_list(jxhtml->css_prop_stack);
+ }
+
return jxhtml->out;
}
void test_jxhtml_body_tag_with_css_002();
void test_jxhtml_body_tag_with_css_003();
void test_jxhtml_body_tag_with_css_004();
+
+void test_jxhtml_font_tag_with_css_001();
+void test_jxhtml_font_tag_with_css_002();
+void test_jxhtml_font_tag_with_css_003();
+void test_jxhtml_font_tag_with_css_004();
+void test_jxhtml_font_tag_with_css_005();
+void test_jxhtml_font_tag_with_css_006();
+void test_jxhtml_font_tag_with_css_007();
+void test_jxhtml_font_tag_with_css_008();
+void test_jxhtml_font_tag_with_css_009();
+void test_jxhtml_font_tag_with_css_010();
+void test_jxhtml_font_tag_with_css_011();
+void test_jxhtml_font_tag_with_css_012();
+void test_jxhtml_font_tag_with_css_013();
+void test_jxhtml_font_tag_with_css_014();
+void test_jxhtml_font_tag_with_css_015();
+void test_jxhtml_font_tag_with_css_016();
/* pend */
int
CU_add_test(jxhtml_suite, "test body with css 002", test_jxhtml_body_tag_with_css_002);
CU_add_test(jxhtml_suite, "test body with css 003", test_jxhtml_body_tag_with_css_003);
CU_add_test(jxhtml_suite, "test body with css 004", test_jxhtml_body_tag_with_css_004);
+
+ CU_add_test(jxhtml_suite, "test font with css 001", test_jxhtml_font_tag_with_css_001);
+ CU_add_test(jxhtml_suite, "test font with css 002", test_jxhtml_font_tag_with_css_002);
+ CU_add_test(jxhtml_suite, "test font with css 003", test_jxhtml_font_tag_with_css_003);
+ CU_add_test(jxhtml_suite, "test font with css 004", test_jxhtml_font_tag_with_css_004);
+ CU_add_test(jxhtml_suite, "test font with css 005", test_jxhtml_font_tag_with_css_005);
+ CU_add_test(jxhtml_suite, "test font with css 006", test_jxhtml_font_tag_with_css_006);
+ CU_add_test(jxhtml_suite, "test font with css 007", test_jxhtml_font_tag_with_css_007);
+ CU_add_test(jxhtml_suite, "test font with css 008", test_jxhtml_font_tag_with_css_008);
+ CU_add_test(jxhtml_suite, "test font with css 009", test_jxhtml_font_tag_with_css_009);
+ CU_add_test(jxhtml_suite, "test font with css 010", test_jxhtml_font_tag_with_css_010);
+ CU_add_test(jxhtml_suite, "test font with css 011", test_jxhtml_font_tag_with_css_011);
+ CU_add_test(jxhtml_suite, "test font with css 012", test_jxhtml_font_tag_with_css_012);
+ CU_add_test(jxhtml_suite, "test font with css 013", test_jxhtml_font_tag_with_css_013);
+ CU_add_test(jxhtml_suite, "test font with css 014", test_jxhtml_font_tag_with_css_014);
+ CU_add_test(jxhtml_suite, "test font with css 015", test_jxhtml_font_tag_with_css_015);
+ CU_add_test(jxhtml_suite, "test font with css 016", test_jxhtml_font_tag_with_css_016);
/* aend */
CU_basic_run_tests();
#undef TEST_STRING
#undef RESULT_STRING
}
+
+
+/*===========================================================================*/
+/* font tag with CSS */
+/*===========================================================================*/
+char *test_chxj_serf_get065(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"
+ "font { color:#ff0000 }\n";
+ *len = strlen(css);
+ call_check = 1;
+ return css;
+}
+void test_jxhtml_font_tag_with_css_001()
+{
+#define TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\" type=\"text/css\" />" \
+ "</head><font>あいう</font></html>"
+#define RESULT_STRING "<?xml version='1.0' encoding='Shift_JIS' ?>" \
+ "<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"html-basic10-plus.dtd\">" \
+ "<html><head></head><font color=\"#ff0000\">あいう</font></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_get065;
+ 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_jxhtml(&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_jxhtml_font_tag_with_css_002()
+{
+#define TEST_STRING "<html><head>" \
+ "</head><font style=\"color:#ff0000;\">あいう</font></html>"
+#define RESULT_STRING "<?xml version='1.0' encoding='Shift_JIS' ?>" \
+ "<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"html-basic10-plus.dtd\">" \
+ "<html><head></head><font color=\"#ff0000\">あいう</font></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_get065;
+ 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_jxhtml(&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_get066(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"
+ "font { font-size:xx-small }\n";
+ *len = strlen(css);
+ call_check = 1;
+ return css;
+}
+void test_jxhtml_font_tag_with_css_003()
+{
+#define TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\" type=\"text/css\" />" \
+ "</head><font>あいう</font></html>"
+#define RESULT_STRING "<?xml version='1.0' encoding='Shift_JIS' ?>" \
+ "<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"html-basic10-plus.dtd\">" \
+ "<html><head></head><span style=\"font-size: xx-small\">あいう</span></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_get066;
+ 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_jxhtml(&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
+}
+char *test_chxj_serf_get067(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"
+ "font { font-size:x-small }\n";
+ *len = strlen(css);
+ call_check = 1;
+ return css;
+}
+void test_jxhtml_font_tag_with_css_004()
+{
+#define TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\" type=\"text/css\" />" \
+ "</head><font>あいう</font></html>"
+#define RESULT_STRING "<?xml version='1.0' encoding='Shift_JIS' ?>" \
+ "<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"html-basic10-plus.dtd\">" \
+ "<html><head></head><span style=\"font-size: x-small\">あいう</span></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_get067;
+ 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_jxhtml(&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
+}
+char *test_chxj_serf_get068(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"
+ "font { font-size:small }\n";
+ *len = strlen(css);
+ call_check = 1;
+ return css;
+}
+void test_jxhtml_font_tag_with_css_005()
+{
+#define TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\" type=\"text/css\" />" \
+ "</head><font>あいう</font></html>"
+#define RESULT_STRING "<?xml version='1.0' encoding='Shift_JIS' ?>" \
+ "<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"html-basic10-plus.dtd\">" \
+ "<html><head></head><span style=\"font-size: small\">あいう</span></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_get068;
+ 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_jxhtml(&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
+}
+char *test_chxj_serf_get069(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"
+ "font { font-size:medium }\n";
+ *len = strlen(css);
+ call_check = 1;
+ return css;
+}
+void test_jxhtml_font_tag_with_css_006()
+{
+#define TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\" type=\"text/css\" />" \
+ "</head><font>あいう</font></html>"
+#define RESULT_STRING "<?xml version='1.0' encoding='Shift_JIS' ?>" \
+ "<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"html-basic10-plus.dtd\">" \
+ "<html><head></head><span style=\"font-size: medium\">あいう</span></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_get069;
+ 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_jxhtml(&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
+}
+
+char *test_chxj_serf_get070(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"
+ "font { font-size:large }\n";
+ *len = strlen(css);
+ call_check = 1;
+ return css;
+}
+void test_jxhtml_font_tag_with_css_007()
+{
+#define TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\" type=\"text/css\" />" \
+ "</head><font>あいう</font></html>"
+#define RESULT_STRING "<?xml version='1.0' encoding='Shift_JIS' ?>" \
+ "<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"html-basic10-plus.dtd\">" \
+ "<html><head></head><span style=\"font-size: large\">あいう</span></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_get070;
+ 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_jxhtml(&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
+}
+
+char *test_chxj_serf_get071(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"
+ "font { font-size:x-large }\n";
+ *len = strlen(css);
+ call_check = 1;
+ return css;
+}
+void test_jxhtml_font_tag_with_css_008()
+{
+#define TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\" type=\"text/css\" />" \
+ "</head><font>あいう</font></html>"
+#define RESULT_STRING "<?xml version='1.0' encoding='Shift_JIS' ?>" \
+ "<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"html-basic10-plus.dtd\">" \
+ "<html><head></head><span style=\"font-size: x-large\">あいう</span></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_get071;
+ 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_jxhtml(&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
+}
+
+char *test_chxj_serf_get072(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"
+ "font { font-size:xx-large }\n";
+ *len = strlen(css);
+ call_check = 1;
+ return css;
+}
+void test_jxhtml_font_tag_with_css_009()
+{
+#define TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\" type=\"text/css\" />" \
+ "</head><font>あいう</font></html>"
+#define RESULT_STRING "<?xml version='1.0' encoding='Shift_JIS' ?>" \
+ "<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"html-basic10-plus.dtd\">" \
+ "<html><head></head><span style=\"font-size: xx-large\">あいう</span></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_get072;
+ 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_jxhtml(&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_jxhtml_font_tag_with_css_010()
+{
+#define TEST_STRING "<html><head>" \
+ "</head><font style=\"font-size:xx-small;\">あいう</font></html>"
+#define RESULT_STRING "<?xml version='1.0' encoding='Shift_JIS' ?>" \
+ "<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"html-basic10-plus.dtd\">" \
+ "<html><head></head><span style=\"font-size: xx-small\">あいう</span></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_get072;
+ 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_jxhtml(&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
+}
+void test_jxhtml_font_tag_with_css_011()
+{
+#define TEST_STRING "<html><head>" \
+ "</head><font style=\"font-size:x-small;\">あいう</font></html>"
+#define RESULT_STRING "<?xml version='1.0' encoding='Shift_JIS' ?>" \
+ "<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"html-basic10-plus.dtd\">" \
+ "<html><head></head><span style=\"font-size: x-small\">あいう</span></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_get072;
+ 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_jxhtml(&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
+}
+void test_jxhtml_font_tag_with_css_012()
+{
+#define TEST_STRING "<html><head>" \
+ "</head><font style=\"font-size:small;\">あいう</font></html>"
+#define RESULT_STRING "<?xml version='1.0' encoding='Shift_JIS' ?>" \
+ "<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"html-basic10-plus.dtd\">" \
+ "<html><head></head><span style=\"font-size: small\">あいう</span></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_get072;
+ 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_jxhtml(&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
+}
+void test_jxhtml_font_tag_with_css_013()
+{
+#define TEST_STRING "<html><head>" \
+ "</head><font style=\"font-size:medium;\">あいう</font></html>"
+#define RESULT_STRING "<?xml version='1.0' encoding='Shift_JIS' ?>" \
+ "<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"html-basic10-plus.dtd\">" \
+ "<html><head></head><span style=\"font-size: medium\">あいう</span></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_get072;
+ 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_jxhtml(&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
+}
+void test_jxhtml_font_tag_with_css_014()
+{
+#define TEST_STRING "<html><head>" \
+ "</head><font style=\"font-size:large;\">あいう</font></html>"
+#define RESULT_STRING "<?xml version='1.0' encoding='Shift_JIS' ?>" \
+ "<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"html-basic10-plus.dtd\">" \
+ "<html><head></head><span style=\"font-size: large\">あいう</span></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_get072;
+ 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_jxhtml(&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
+}
+void test_jxhtml_font_tag_with_css_015()
+{
+#define TEST_STRING "<html><head>" \
+ "</head><font style=\"font-size:x-large;\">あいう</font></html>"
+#define RESULT_STRING "<?xml version='1.0' encoding='Shift_JIS' ?>" \
+ "<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"html-basic10-plus.dtd\">" \
+ "<html><head></head><span style=\"font-size: x-large\">あいう</span></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_get072;
+ 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_jxhtml(&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
+}
+void test_jxhtml_font_tag_with_css_016()
+{
+#define TEST_STRING "<html><head>" \
+ "</head><font style=\"font-size:xx-large;\">あいう</font></html>"
+#define RESULT_STRING "<?xml version='1.0' encoding='Shift_JIS' ?>" \
+ "<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"html-basic10-plus.dtd\">" \
+ "<html><head></head><span style=\"font-size: xx-large\">あいう</span></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_get072;
+ 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_jxhtml(&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
*/