From 8dc10da934e06979faf64e0b9c205658d2b3b483 Mon Sep 17 00:00:00 2001
From: konn
Date: Tue, 8 Jul 2008 11:13:23 +0000
Subject: [PATCH] * Added p tag with CSS for SoftBank XHTML converter.
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/branches/sandbox@2835 1a406e8e-add9-4483-a2c8-d8cac5b7c224
---
include/chxj_jxhtml.h | 6 +
src/chxj_chtml20.c | 3 +
src/chxj_chtml30.c | 3 +
src/chxj_chtml40.c | 3 +
src/chxj_chtml50.c | 3 +
src/chxj_jhtml.c | 5 +
src/chxj_jxhtml.c | 67 ++++-
test/chxj_jxhtml/test_chxj_jxhtml.c | 529 +++++++++++++++++++++++++++++++++++-
8 files changed, 609 insertions(+), 10 deletions(-)
diff --git a/include/chxj_jxhtml.h b/include/chxj_jxhtml.h
index a5ee0a59..31b7d53a 100644
--- a/include/chxj_jxhtml.h
+++ b/include/chxj_jxhtml.h
@@ -51,6 +51,12 @@ struct jxhtml_t {
css_prop_list_stack_t *css_prop_stack;
};
+typedef struct _jxhtml_flags_t jxhtml_flags_t;
+struct _jxhtml_flags_t {
+ int with_font_flag;
+ int with_blink_flag;
+};
+
/*----------------------------------------------------------------------------*/
/* Prototype */
/*----------------------------------------------------------------------------*/
diff --git a/src/chxj_chtml20.c b/src/chxj_chtml20.c
index a0ea895b..0295b89a 100644
--- a/src/chxj_chtml20.c
+++ b/src/chxj_chtml20.c
@@ -2971,6 +2971,9 @@ s_chtml20_end_p_tag(void *pdoc, Node *node)
W_L("");
}
W_L("
");
+ if (IS_CSS_ON(chtml20->entryp)) {
+ chxj_css_pop_prop_list(chtml20->css_prop_stack);
+ }
return chtml20->out;
}
diff --git a/src/chxj_chtml30.c b/src/chxj_chtml30.c
index 54f36cd8..5a6d481f 100644
--- a/src/chxj_chtml30.c
+++ b/src/chxj_chtml30.c
@@ -2234,6 +2234,9 @@ s_chtml30_end_p_tag(void *pdoc, Node *node)
W_L("");
}
W_L("");
+ if (IS_CSS_ON(chtml30->entryp)) {
+ chxj_css_pop_prop_list(chtml30->css_prop_stack);
+ }
return chtml30->out;
}
diff --git a/src/chxj_chtml40.c b/src/chxj_chtml40.c
index b03db7b3..79f86203 100644
--- a/src/chxj_chtml40.c
+++ b/src/chxj_chtml40.c
@@ -2246,6 +2246,9 @@ s_chtml40_end_p_tag(void *pdoc, Node *node)
W_L("");
}
W_L("");
+ if (IS_CSS_ON(chtml40->entryp)) {
+ chxj_css_pop_prop_list(chtml40->css_prop_stack);
+ }
return chtml40->out;
}
diff --git a/src/chxj_chtml50.c b/src/chxj_chtml50.c
index f9fdca83..fe6294a4 100644
--- a/src/chxj_chtml50.c
+++ b/src/chxj_chtml50.c
@@ -2293,6 +2293,9 @@ s_chtml50_end_p_tag(void *pdoc, Node *node)
W_L("");
}
W_L("");
+ if (IS_CSS_ON(chtml50->entryp)) {
+ chxj_css_pop_prop_list(chtml50->css_prop_stack);
+ }
return chtml50->out;
}
diff --git a/src/chxj_jhtml.c b/src/chxj_jhtml.c
index 7bff0d7e..04874852 100644
--- a/src/chxj_jhtml.c
+++ b/src/chxj_jhtml.c
@@ -1883,6 +1883,11 @@ s_jhtml_end_p_tag(void *pdoc, Node *node)
W_L("");
}
W_L("");
+
+ if (IS_CSS_ON(jhtml->entryp)) {
+ chxj_css_pop_prop_list(jhtml->css_prop_stack);
+ }
+
return jhtml->out;
}
diff --git a/src/chxj_jxhtml.c b/src/chxj_jxhtml.c
index 00649f3a..daa4fa25 100644
--- a/src/chxj_jxhtml.c
+++ b/src/chxj_jxhtml.c
@@ -1804,17 +1804,19 @@ s_jxhtml_end_ol_tag(void *pdoc, Node *UNUSED(child))
static char *
s_jxhtml_start_p_tag(void *pdoc, Node *node)
{
- jxhtml_t *jxhtml;
+ jxhtml_t *jxhtml;
Doc *doc;
request_rec *r;
- char *align = NULL;
Attr *attr;
+ char *attr_align = NULL;
+ char *attr_style = NULL;
+ char *attr_color = NULL;
+ char *attr_blink = NULL;
jxhtml = GET_JXHTML(pdoc);
doc = jxhtml->doc;
r = doc->r;
- W_L("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) {
- W_L(" align=\"");
- W_V(align);
+ 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 *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("
");
@@ -1855,6 +1905,9 @@ s_jxhtml_end_p_tag(void *pdoc, Node *UNUSED(child))
Doc *doc = jxhtml->doc;
W_L("
");
+ if (IS_CSS_ON(jxhtml->entryp)) {
+ chxj_css_pop_prop_list(jxhtml->css_prop_stack);
+ }
return jxhtml->out;
}
diff --git a/test/chxj_jxhtml/test_chxj_jxhtml.c b/test/chxj_jxhtml/test_chxj_jxhtml.c
index 4688a8f0..a6da0c50 100644
--- a/test/chxj_jxhtml/test_chxj_jxhtml.c
+++ b/test/chxj_jxhtml/test_chxj_jxhtml.c
@@ -10284,7 +10284,7 @@ void test_jxhtml_p_tag_004()
void test_jxhtml_p_tag_005()
{
#define TEST_STRING "ããã
"
-#define RESULT_STRING "ããã
"
+#define RESULT_STRING "ããã
"
char *ret;
char *tmp;
device_table spec;
@@ -10314,7 +10314,7 @@ void test_jxhtml_p_tag_005()
void test_jxhtml_p_tag_006()
{
#define TEST_STRING "ããã
"
-#define RESULT_STRING "ããã
"
+#define RESULT_STRING "ããã
"
char *ret;
char *tmp;
device_table spec;
@@ -10344,7 +10344,7 @@ void test_jxhtml_p_tag_006()
void test_jxhtml_p_tag_007()
{
#define TEST_STRING "ããã
"
-#define RESULT_STRING "ããã
"
+#define RESULT_STRING "ããã
"
char *ret;
char *tmp;
device_table spec;
@@ -14725,6 +14725,529 @@ fprintf(stderr, "actual:[%s]\n", ret);
#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_jxhtml_p_tag_with_css_001()
+{
+#define TEST_STRING "" \
+ "ããã
"
+#define RESULT_STRING "" \
+ ""
+ 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_jxhtml(&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_jxhtml_p_tag_with_css_002()
+{
+#define TEST_STRING "" \
+ "ããã
"
+#define RESULT_STRING "" \
+ ""
+ 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_jxhtml(&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_jxhtml_p_tag_with_css_003()
+{
+#define TEST_STRING "" \
+ "ããã
"
+#define RESULT_STRING "" \
+ ""
+ 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_jxhtml(&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_jxhtml_p_tag_with_css_004()
+{
+#define TEST_STRING "" \
+ "ããã
"
+#define RESULT_STRING "" \
+ ""
+ 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_jxhtml(&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_jxhtml_p_tag_with_css_005()
+{
+#define TEST_STRING "" \
+ "ããã
"
+#define RESULT_STRING "" \
+ ""
+ 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_jxhtml(&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_jxhtml_p_tag_with_css_006()
+{
+#define TEST_STRING "" \
+ "ããã
"
+#define RESULT_STRING "" \
+ ""
+ 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_jxhtml(&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_jxhtml_p_tag_with_css_007()
+{
+#define TEST_STRING "" \
+ "ããã
"
+#define RESULT_STRING "" \
+ ""
+ 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_jxhtml(&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_jxhtml_p_tag_with_css_008()
+{
+#define TEST_STRING "" \
+ "ããã
"
+#define RESULT_STRING "" \
+ ""
+ 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_jxhtml(&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_jxhtml_p_tag_with_css_009()
+{
+#define TEST_STRING "" \
+ "ããã
"
+#define RESULT_STRING "" \
+ ""
+ 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_jxhtml(&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_jxhtml_p_tag_with_css_010()
+{
+#define TEST_STRING "" \
+ "ããã
"
+#define RESULT_STRING "" \
+ ""
+ 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_jxhtml(&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_jxhtml_p_tag_with_css_011()
+{
+#define TEST_STRING "" \
+ "ããã
"
+#define RESULT_STRING "" \
+ ""
+ 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_jxhtml(&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_jxhtml_p_tag_with_css_012()
+{
+#define TEST_STRING "" \
+ "ããã
"
+#define RESULT_STRING "" \
+ ""
+ 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_jxhtml(&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_jxhtml_p_tag_with_css_013()
+{
+#define TEST_STRING "" \
+ "ããã
"
+#define RESULT_STRING "" \
+ ""
+ 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_jxhtml(&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
*/
--
2.11.0