* [PATCH 00/10] html text attributes patches
@ 2010-07-01 15:31 Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 01/10] stkutil: display text attributes as html Kristen Carlson Accardi
` (9 more replies)
0 siblings, 10 replies; 12+ messages in thread
From: Kristen Carlson Accardi @ 2010-07-01 15:31 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 912 bytes --]
Incorporated feedback from last review. Added requested
unit tests.
Kristen Carlson Accardi (10):
stkutil: display text attributes as html
test-stkutil: add unit test for html text attributes
test-stkutil: add html attribute test for Display Text tests
test-stkutil: add html attribute tests for get_inkey_test
test-stkutil: add html attribute tests for get_input_test
test-stkutil: add html attribute tests for play_tone_test
test-stkutil: add html attribute test for setup_menu_test
test-stkutil: add html attribute test for select_item_test
test-stkutil: add html attribute tests for setup idle mode tests
test-stkutil: add html_attr_test for special chars
src/stkutil.c | 219 ++++++++++++++++
src/stkutil.h | 2 +
unit/test-stkutil.c | 687 ++++++++++++++++++++++++++++++++++++++++++++-------
3 files changed, 816 insertions(+), 92 deletions(-)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 01/10] stkutil: display text attributes as html
2010-07-01 15:31 [PATCH 00/10] html text attributes patches Kristen Carlson Accardi
@ 2010-07-01 15:31 ` Kristen Carlson Accardi
2010-07-01 23:12 ` Denis Kenzior
2010-07-01 15:31 ` [PATCH 02/10] test-stkutil: add unit test for html text attributes Kristen Carlson Accardi
` (8 subsequent siblings)
9 siblings, 1 reply; 12+ messages in thread
From: Kristen Carlson Accardi @ 2010-07-01 15:31 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 6883 bytes --]
---
src/stkutil.c | 219 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/stkutil.h | 2 +
2 files changed, 221 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 6f072e7..5da356c 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -5819,3 +5819,222 @@ const unsigned char *stk_pdu_from_envelope(const struct stk_envelope *envelope,
return pdu;
}
+
+static const char *html_colors[] = {
+ "#000000", /* Black */
+ "#808080", /* Dark Grey */
+ "#C11B17", /* Dark Red */
+ "#FBB117", /* Dark Yellow */
+ "#347235", /* Dark Green */
+ "#307D7E", /* Dark Cyan */
+ "#0000A0", /* Dark Blue */
+ "#C031C7", /* Dark Magenta */
+ "#C0C0C0", /* Grey */
+ "#FFFFFF", /* White */
+ "#FF0000", /* Bright Red */
+ "#FFFF00", /* Bright Yellow */
+ "#00FF00", /* Bright Green */
+ "#00FFFF", /* Bright Cyan */
+ "#0000FF", /* Bright Blue */
+ "#FF00FF", /* Bright Magenta */
+};
+
+#define STK_TEXT_FORMAT_ALIGN_MASK 0x03
+#define STK_TEXT_FORMAT_FONT_MASK 0x0C
+#define STK_TEXT_FORMAT_STYLE_MASK 0xF0
+#define STK_DEFAULT_TEXT_ALIGNMENT 0x00
+#define STK_TEXT_FORMAT_INIT -1
+
+/* Defined in ETSI 123 40 9.2.3.24.10.1.1 */
+enum stk_text_format_code {
+ STK_TEXT_FORMAT_LEFT_ALIGN = 0x00,
+ STK_TEXT_FORMAT_CENTER_ALIGN = 0x01,
+ STK_TEXT_FORMAT_RIGHT_ALIGN = 0x02,
+ STK_TEXT_FORMAT_NO_ALIGN = 0x03,
+ STK_TEXT_FORMAT_FONT_SIZE_LARGE = 0x04,
+ STK_TEXT_FORMAT_FONT_SIZE_SMALL = 0x08,
+ STK_TEXT_FORMAT_FONT_SIZE_RESERVED = 0x0c,
+ STK_TEXT_FORMAT_STYLE_BOLD = 0x10,
+ STK_TEXT_FORMAT_STYLE_ITALIC = 0x20,
+ STK_TEXT_FORMAT_STYLE_UNDERLINED = 0x40,
+ STK_TEXT_FORMAT_STYLE_STRIKETHROUGH = 0x80,
+};
+
+
+static void end_format(GString *string, guint8 code, guint8 color)
+{
+ if ((code & ~STK_TEXT_FORMAT_ALIGN_MASK) || color)
+ g_string_append(string, "</span>");
+
+ if ((code & STK_TEXT_FORMAT_ALIGN_MASK) != STK_TEXT_FORMAT_NO_ALIGN)
+ g_string_append(string, "</div>");
+}
+
+static void start_format(GString *string, guint8 code, guint8 color)
+{
+ guint8 align = code & STK_TEXT_FORMAT_ALIGN_MASK;
+ guint8 font = code & STK_TEXT_FORMAT_FONT_MASK;
+ guint8 style = code & STK_TEXT_FORMAT_STYLE_MASK;
+ int fg = color & 0x0f;
+ int bg = (color >> 4) & 0x0f;
+
+ /* align formatting applies to a block of test */
+ if (align != STK_TEXT_FORMAT_NO_ALIGN)
+ g_string_append(string, "<div style=\"");
+
+ switch (align) {
+ case STK_TEXT_FORMAT_RIGHT_ALIGN:
+ g_string_append(string, "text-align: right;\">");
+ break;
+ case STK_TEXT_FORMAT_CENTER_ALIGN:
+ g_string_append(string, "text-align: center;\">");
+ break;
+ case STK_TEXT_FORMAT_LEFT_ALIGN:
+ g_string_append(string, "text-align: left;\">");
+ break;
+ }
+
+ if (((code & ~STK_TEXT_FORMAT_ALIGN_MASK) == 0) && (color == 0))
+ return;
+
+ /* font, style, and color are inline */
+ g_string_append(string, "<span style=\"");
+
+ switch (font) {
+ case STK_TEXT_FORMAT_FONT_SIZE_LARGE:
+ g_string_append(string, "font-size: big;");
+ break;
+ case STK_TEXT_FORMAT_FONT_SIZE_SMALL:
+ g_string_append(string, "font-size: small;");
+ break;
+ }
+
+ switch (style) {
+ case STK_TEXT_FORMAT_STYLE_BOLD:
+ g_string_append(string, "font-weight: bold;");
+ break;
+ case STK_TEXT_FORMAT_STYLE_ITALIC:
+ g_string_append(string, "font-style: italic;");
+ break;
+ case STK_TEXT_FORMAT_STYLE_UNDERLINED:
+ g_string_append(string, "text-decoration: underline;");
+ break;
+ case STK_TEXT_FORMAT_STYLE_STRIKETHROUGH:
+ g_string_append(string, "text-decoration: line-through;");
+ break;
+ }
+
+ /* add any color */
+ if (fg)
+ g_string_append_printf(string, "color: %s;", html_colors[fg]);
+ if (bg)
+ g_string_append_printf(string, "background-color: %s;",
+ html_colors[bg]);
+ g_string_append(string, "\">");
+}
+
+char *stk_text_to_html(const char *text, int text_len,
+ const unsigned char *attrs, int attrs_len)
+{
+ GString *string = g_string_sized_new(text_len + 1);
+ int *formats;
+ int pos, i, j, attr, prev_attr;
+ guint8 start, end, code, color, len, align;
+
+ formats = g_try_malloc0(sizeof(int) * (text_len + 1));
+ if (formats == NULL)
+ return NULL;
+
+ /* we will need formatting at the position beyond the last char */
+ for (i = 0; i <= text_len; i++)
+ formats[i] = STK_TEXT_FORMAT_INIT;
+
+ for (i = 0; i+3 < attrs_len; i += 4) {
+ start = attrs[i];
+ len = attrs[i + 1];
+ code = attrs[i + 2];
+
+ if (i + 3 < attrs_len)
+ color = attrs[i + 3];
+ else
+ color = 0;
+
+ if (len == 0)
+ end = text_len;
+ else
+ end = start + len;
+
+ /* sanity check values */
+ if (start > end || end > text_len)
+ continue;
+
+ /*
+ * if the alignment is the same as either the default
+ * or the last alignment used, don't set any alignment
+ * value.
+ */
+ if (start == 0)
+ align = STK_DEFAULT_TEXT_ALIGNMENT;
+ else {
+ align = (formats[start - 1] & 0xFF) &
+ STK_TEXT_FORMAT_ALIGN_MASK;
+ if (align == STK_TEXT_FORMAT_NO_ALIGN)
+ align = STK_DEFAULT_TEXT_ALIGNMENT;
+ }
+
+ if ((code & STK_TEXT_FORMAT_ALIGN_MASK) == align)
+ code |= STK_TEXT_FORMAT_NO_ALIGN;
+
+ attr = code | (color << 8);
+
+ for (j = start; j < end; j++)
+ formats[j] = attr;
+ }
+
+ prev_attr = STK_TEXT_FORMAT_INIT;
+
+ for (pos = 0; pos <= text_len; pos++) {
+ attr = formats[pos];
+ if (attr != prev_attr) {
+ if (prev_attr != STK_TEXT_FORMAT_INIT)
+ end_format(string, prev_attr & 0xFF,
+ (attr >> 8) & 0xFF);
+
+ if (attr != STK_TEXT_FORMAT_INIT)
+ start_format(string, attr & 0xFF,
+ (attr >> 8) & 0xFF);
+
+ prev_attr = attr;
+ }
+
+ if (pos == text_len)
+ break;
+
+ switch (text[pos]) {
+ case '\n':
+ g_string_append(string, "<br/>");
+ break;
+ case '\r':
+ g_string_append(string, "<br/>");
+ if ((pos + 1 < text_len) && (text[pos + 1] == '\n'))
+ pos++;
+ break;
+ case '<':
+ g_string_append(string, "<");
+ break;
+ case '>':
+ g_string_append(string, ">");
+ break;
+ case '&':
+ g_string_append(string, "&");
+ break;
+ default:
+ g_string_append_c(string, text[pos]);
+ }
+ }
+
+ g_free(formats);
+
+ /* return characters from string. Caller must free char data */
+ return g_string_free(string, FALSE);
+}
diff --git a/src/stkutil.h b/src/stkutil.h
index ca4817e..2fbcd7d 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -1643,3 +1643,5 @@ const unsigned char *stk_pdu_from_response(const struct stk_response *response,
unsigned int *out_length);
const unsigned char *stk_pdu_from_envelope(const struct stk_envelope *envelope,
unsigned int *out_length);
+char *stk_text_to_html(const char *text, int text_len,
+ const unsigned char *attrs, int attrs_len);
--
1.6.6.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 02/10] test-stkutil: add unit test for html text attributes
2010-07-01 15:31 [PATCH 00/10] html text attributes patches Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 01/10] stkutil: display text attributes as html Kristen Carlson Accardi
@ 2010-07-01 15:31 ` Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 03/10] test-stkutil: add html attribute test for Display Text tests Kristen Carlson Accardi
` (7 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Kristen Carlson Accardi @ 2010-07-01 15:31 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3342 bytes --]
---
unit/test-stkutil.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 76 insertions(+), 0 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index 8b7e254..57e894b 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -472,6 +472,22 @@ static inline void check_cdma_sms_tpdu(
check_common_byte_array(command, test);
}
+static void check_text_attr_html(const struct stk_text_attribute *test,
+ char *text, const char *expected_html)
+{
+ char *html;
+
+ if (expected_html == NULL)
+ return;
+
+ html = stk_text_to_html(text, strlen(text), test->attributes,
+ test->len);
+
+ g_assert(memcmp(html, expected_html, strlen(expected_html)) == 0);
+
+ g_free(html);
+}
+
/* Defined in TS 102.223 Section 8.72 */
static void check_text_attr(const struct stk_text_attribute *command,
const struct stk_text_attribute *test)
@@ -21923,6 +21939,59 @@ static const struct envelope_test timer_expiration_data_221a = {
},
};
+struct html_attr_test {
+ char *text;
+ struct stk_text_attribute text_attr;
+ char *html;
+};
+
+static struct html_attr_test html_attr_data_1 = {
+ .text = "EMS messages can contain italic, bold, large, small and "
+ "colored text",
+ .text_attr = {
+ .len = 20,
+ .attributes = { 0x19, 0x06, 0x20, 0x00, 0x21, 0x04, 0x10, 0x00,
+ 0x27, 0x05, 0x04, 0x00, 0x2E, 0x05, 0x08, 0x00,
+ 0x38, 0x07, 0x00, 0x2B },
+ },
+ .html = "EMS messages can contain <span style=\"font-style: "
+ "italic;\">italic</span>, <span style=\"font-weight: bold;\">"
+ "bold</span>, <span style=\"font-size: big;\">large</span>, "
+ "<span style=\"font-size: small;\">small</span> and "
+ "<span style=\"color: #FFFF00;background-color: #C11B17;\">"
+ "colored</span> text",
+};
+
+static struct html_attr_test html_attr_data_2 = {
+ .text = "Blue green green green",
+ .text_attr = {
+ .len = 8,
+ .attributes = { 0x00, 0x00, 0x00, 0x94, 0x00, 0x04, 0x00,
+ 0x96 },
+ },
+ .html = "<span style=\"color: #0000A0;background-color: #FFFFFF;\">"
+ "Blue</span><span style=\"color: #347235;background-color: "
+ "#FFFFFF;\"> green green green</span>",
+};
+
+static struct html_attr_test html_attr_data_3 = {
+ .text = "abc",
+ .text_attr = {
+ .len = 8,
+ .attributes = { 0x00, 0x02, 0x00, 0x94, 0x01, 0x02, 0x00,
+ 0x96 },
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFFFF;\">"
+ "a</span><span style=\"color: #0000A0;background-color: "
+ "#FFFFFF;\">bc</span>",
+};
+
+static void test_html_attr(gconstpointer data)
+{
+ const struct html_attr_test *test = data;
+ check_text_attr_html(&test->text_attr, test->text, test->html);
+}
+
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
@@ -23930,5 +23999,12 @@ int main(int argc, char **argv)
g_test_add_data_func("/teststk/Timer Expiration 2.2.1A",
&timer_expiration_data_221a, test_envelope_encoding);
+ g_test_add_data_func("/teststk/HTML Attribute Test 1",
+ &html_attr_data_1, test_html_attr);
+ g_test_add_data_func("/teststk/HTML Attribute Test 2",
+ &html_attr_data_2, test_html_attr);
+ g_test_add_data_func("/teststk/HTML Attribute Test 3",
+ &html_attr_data_3, test_html_attr);
+
return g_test_run();
}
--
1.6.6.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 03/10] test-stkutil: add html attribute test for Display Text tests
2010-07-01 15:31 [PATCH 00/10] html text attributes patches Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 01/10] stkutil: display text attributes as html Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 02/10] test-stkutil: add unit test for html text attributes Kristen Carlson Accardi
@ 2010-07-01 15:31 ` Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 04/10] test-stkutil: add html attribute tests for get_inkey_test Kristen Carlson Accardi
` (6 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Kristen Carlson Accardi @ 2010-07-01 15:31 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 9127 bytes --]
---
unit/test-stkutil.c | 204 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 204 insertions(+), 0 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index 57e894b..bc0e018 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -524,6 +524,7 @@ struct display_text_test {
struct stk_duration duration;
struct stk_text_attribute text_attr;
struct stk_frame_id frame_id;
+ const char *html;
};
unsigned char display_text_111[] = { 0xD0, 0x1A, 0x81, 0x03, 0x01, 0x21, 0x80,
@@ -619,6 +620,69 @@ unsigned char display_text_711[] = { 0xD0, 0x19, 0x81, 0x03, 0x01, 0x21, 0x80,
0x63, 0x6F, 0x6E, 0x64, 0x84, 0x02,
0x01, 0x0A };
+unsigned char display_text_811[] = { 0xD0, 0x22, 0x81, 0x03, 0x01, 0x21, 0x80,
+ 0x82, 0x02, 0x81, 0x02, 0x8D, 0x11,
+ 0x04, 0x54, 0x65, 0x78, 0x74, 0x20,
+ 0x41, 0x74, 0x74, 0x72, 0x69, 0x62,
+ 0x75, 0x74, 0x65, 0x20, 0x31, 0xD0,
+ 0x04, 0x00, 0x10, 0x00, 0xB4 };
+
+unsigned char display_text_821[] = { 0xD0, 0x22, 0x81, 0x03, 0x01, 0x21, 0x80,
+ 0x82, 0x02, 0x81, 0x02, 0x8D, 0x11,
+ 0x04, 0x54, 0x65, 0x78, 0x74, 0x20,
+ 0x41, 0x74, 0x74, 0x72, 0x69, 0x62,
+ 0x75, 0x74, 0x65, 0x20, 0x31, 0xD0,
+ 0x04, 0x00, 0x10, 0x01, 0xB4 };
+
+unsigned char display_text_831[] = { 0xD0, 0x22, 0x81, 0x03, 0x01, 0x21, 0x80,
+ 0x82, 0x02, 0x81, 0x02, 0x8D, 0x11,
+ 0x04, 0x54, 0x65, 0x78, 0x74, 0x20,
+ 0x41, 0x74, 0x74, 0x72, 0x69, 0x62,
+ 0x75, 0x74, 0x65, 0x20, 0x31, 0xD0,
+ 0x04, 0x00, 0x10, 0x02, 0xB4 };
+
+unsigned char display_text_841[] = { 0xD0, 0x22, 0x81, 0x03, 0x01, 0x21, 0x80,
+ 0x82, 0x02, 0x81, 0x02, 0x8D, 0x11,
+ 0x04, 0x54, 0x65, 0x78, 0x74, 0x20,
+ 0x41, 0x74, 0x74, 0x72, 0x69, 0x62,
+ 0x75, 0x74, 0x65, 0x20, 0x31, 0xD0,
+ 0x04, 0x00, 0x10, 0x04, 0xB4 };
+
+unsigned char display_text_851[] = { 0xD0, 0x22, 0x81, 0x03, 0x01, 0x21, 0x80,
+ 0x82, 0x02, 0x81, 0x02, 0x8D, 0x11,
+ 0x04, 0x54, 0x65, 0x78, 0x74, 0x20,
+ 0x41, 0x74, 0x74, 0x72, 0x69, 0x62,
+ 0x75, 0x74, 0x65, 0x20, 0x31, 0xD0,
+ 0x04, 0x00, 0x10, 0x08, 0xB4 };
+
+unsigned char display_text_861[] = { 0xD0, 0x22, 0x81, 0x03, 0x01, 0x21, 0x80,
+ 0x82, 0x02, 0x81, 0x02, 0x8D, 0x11,
+ 0x04, 0x54, 0x65, 0x78, 0x74, 0x20,
+ 0x41, 0x74, 0x74, 0x72, 0x69, 0x62,
+ 0x75, 0x74, 0x65, 0x20, 0x31, 0xD0,
+ 0x04, 0x00, 0x10, 0x10, 0xB4 };
+
+unsigned char display_text_871[] = { 0xD0, 0x22, 0x81, 0x03, 0x01, 0x21, 0x80,
+ 0x82, 0x02, 0x81, 0x02, 0x8D, 0x11,
+ 0x04, 0x54, 0x65, 0x78, 0x74, 0x20,
+ 0x41, 0x74, 0x74, 0x72, 0x69, 0x62,
+ 0x75, 0x74, 0x65, 0x20, 0x31, 0xD0,
+ 0x04, 0x00, 0x10, 0x20, 0xB4 };
+
+unsigned char display_text_881[] = { 0xD0, 0x22, 0x81, 0x03, 0x01, 0x21, 0x80,
+ 0x82, 0x02, 0x81, 0x02, 0x8D, 0x11,
+ 0x04, 0x54, 0x65, 0x78, 0x74, 0x20,
+ 0x41, 0x74, 0x74, 0x72, 0x69, 0x62,
+ 0x75, 0x74, 0x65, 0x20, 0x31, 0xD0,
+ 0x04, 0x00, 0x10, 0x40, 0xB4 };
+
+unsigned char display_text_891[] = { 0xD0, 0x22, 0x81, 0x03, 0x01, 0x21, 0x80,
+ 0x82, 0x02, 0x81, 0x02, 0x8D, 0x11,
+ 0x04, 0x54, 0x65, 0x78, 0x74, 0x20,
+ 0x41, 0x74, 0x74, 0x72, 0x69, 0x62,
+ 0x75, 0x74, 0x65, 0x20, 0x31, 0xD0,
+ 0x04, 0x00, 0x10, 0x80, 0xB4 };
+
unsigned char display_text_911[] = { 0xD0, 0x10, 0x81, 0x03, 0x01, 0x21, 0x80,
0x82, 0x02, 0x81, 0x02, 0x8D, 0x05,
0x08, 0x4F, 0x60, 0x59, 0x7D };
@@ -724,6 +788,125 @@ static struct display_text_test display_text_data_711 = {
}
};
+static struct display_text_test display_text_data_811 = {
+ .pdu = display_text_811,
+ .pdu_len = sizeof(display_text_811),
+ .qualifier = 0x80,
+ .text = "Text Attribute 1",
+ .text_attr = {
+ .len = 4,
+ .attributes = { 0x00, 0x10, 0x00, 0xB4 },
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Text Attribute 1</span>",
+};
+
+static struct display_text_test display_text_data_821 = {
+ .pdu = display_text_821,
+ .pdu_len = sizeof(display_text_821),
+ .qualifier = 0x80,
+ .text = "Text Attribute 1",
+ .text_attr = {
+ .len = 4,
+ .attributes = { 0x00, 0x10, 0x01, 0xB4 },
+ },
+ .html = "<div style=\"text-align: center;\"><span style=\"color: "
+ "#347235;background-color: #FFFF00;\">Text Attribute 1</span>"
+ "</div>",
+};
+
+static struct display_text_test display_text_data_831 = {
+ .pdu = display_text_831,
+ .pdu_len = sizeof(display_text_831),
+ .qualifier = 0x80,
+ .text = "Text Attribute 1",
+ .text_attr = {
+ .len = 4,
+ .attributes = { 0x00, 0x10, 0x02, 0xB4 },
+ },
+ .html = "<div style=\"text-align: right;\"><span style=\"color: "
+ "#347235;background-color: #FFFF00;\">Text Attribute 1</span>"
+ "</div>",
+};
+
+static struct display_text_test display_text_data_841 = {
+ .pdu = display_text_841,
+ .pdu_len = sizeof(display_text_841),
+ .qualifier = 0x80,
+ .text = "Text Attribute 1",
+ .text_attr = {
+ .len = 4,
+ .attributes = { 0x00, 0x10, 0x04, 0xB4 },
+ },
+ .html = "<span style=\"font-size: big;color: #347235;background-color:"
+ " #FFFF00;\">Text Attribute 1</span>",
+};
+
+static struct display_text_test display_text_data_851 = {
+ .pdu = display_text_851,
+ .pdu_len = sizeof(display_text_851),
+ .qualifier = 0x80,
+ .text = "Text Attribute 1",
+ .text_attr = {
+ .len = 4,
+ .attributes = { 0x00, 0x10, 0x08, 0xB4 },
+ },
+ .html = "<span style=\"font-size: small;color: #347235;"
+ "background-color: #FFFF00;\">Text Attribute 1</span>",
+};
+
+static struct display_text_test display_text_data_861 = {
+ .pdu = display_text_861,
+ .pdu_len = sizeof(display_text_861),
+ .qualifier = 0x80,
+ .text = "Text Attribute 1",
+ .text_attr = {
+ .len = 4,
+ .attributes = { 0x00, 0x10, 0x10, 0xB4 },
+ },
+ .html = "<span style=\"font-weight: bold;color: #347235;"
+ "background-color: #FFFF00;\">Text Attribute 1</span>",
+};
+
+static struct display_text_test display_text_data_871 = {
+ .pdu = display_text_871,
+ .pdu_len = sizeof(display_text_871),
+ .qualifier = 0x80,
+ .text = "Text Attribute 1",
+ .text_attr = {
+ .len = 4,
+ .attributes = { 0x00, 0x10, 0x20, 0xB4 },
+ },
+ .html = "<span style=\"font-style: italic;color: #347235;"
+ "background-color: #FFFF00;\">Text Attribute 1</span>",
+};
+
+static struct display_text_test display_text_data_881 = {
+ .pdu = display_text_881,
+ .pdu_len = sizeof(display_text_881),
+ .qualifier = 0x80,
+ .text = "Text Attribute 1",
+ .text_attr = {
+ .len = 4,
+ .attributes = { 0x00, 0x10, 0x40, 0xB4 },
+ },
+ .html = "<span style=\"text-decoration: underline;color: #347235;"
+ "background-color: #FFFF00;\">Text Attribute 1</span>",
+};
+
+static struct display_text_test display_text_data_891 = {
+ .pdu = display_text_891,
+ .pdu_len = sizeof(display_text_891),
+ .qualifier = 0x80,
+ .text = "Text Attribute 1",
+ .text_attr = {
+ .len = 4,
+ .attributes = { 0x00, 0x10, 0x80, 0xB4 },
+ },
+ .html = "<span style=\"text-decoration: line-through;color: #347235;"
+ "background-color: #FFFF00;\">Text Attribute 1</span>",
+};
+
static struct display_text_test display_text_data_911 = {
.pdu = display_text_911,
.pdu_len = sizeof(display_text_911),
@@ -764,6 +947,9 @@ static void test_display_text(gconstpointer data)
check_duration(&command->display_text.duration, &test->duration);
check_text_attr(&command->display_text.text_attr,
&test->text_attr);
+ check_text_attr_html(&command->display_text.text_attr,
+ command->display_text.text,
+ test->html);
check_frame_id(&command->display_text.frame_id, &test->frame_id);
stk_command_free(command);
@@ -22018,6 +22204,24 @@ int main(int argc, char **argv)
&display_text_data_611, test_display_text);
g_test_add_data_func("/teststk/Display Text 7.1.1",
&display_text_data_711, test_display_text);
+ g_test_add_data_func("/teststk/Display Text 8.1.1",
+ &display_text_data_811, test_display_text);
+ g_test_add_data_func("/teststk/Display Text 8.2.1",
+ &display_text_data_821, test_display_text);
+ g_test_add_data_func("/teststk/Display Text 8.3.1",
+ &display_text_data_831, test_display_text);
+ g_test_add_data_func("/teststk/Display Text 8.4.1",
+ &display_text_data_841, test_display_text);
+ g_test_add_data_func("/teststk/Display Text 8.5.1",
+ &display_text_data_851, test_display_text);
+ g_test_add_data_func("/teststk/Display Text 8.6.1",
+ &display_text_data_861, test_display_text);
+ g_test_add_data_func("/teststk/Display Text 8.7.1",
+ &display_text_data_871, test_display_text);
+ g_test_add_data_func("/teststk/Display Text 8.8.1",
+ &display_text_data_881, test_display_text);
+ g_test_add_data_func("/teststk/Display Text 8.9.1",
+ &display_text_data_891, test_display_text);
g_test_add_data_func("/teststk/Display Text 9.1.1",
&display_text_data_911, test_display_text);
g_test_add_data_func("/teststk/Display Text 10.1.1",
--
1.6.6.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 04/10] test-stkutil: add html attribute tests for get_inkey_test
2010-07-01 15:31 [PATCH 00/10] html text attributes patches Kristen Carlson Accardi
` (2 preceding siblings ...)
2010-07-01 15:31 ` [PATCH 03/10] test-stkutil: add html attribute test for Display Text tests Kristen Carlson Accardi
@ 2010-07-01 15:31 ` Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 05/10] test-stkutil: add html attribute tests for get_input_test Kristen Carlson Accardi
` (5 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Kristen Carlson Accardi @ 2010-07-01 15:31 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 6358 bytes --]
---
unit/test-stkutil.c | 69 +++++++++++++++++++++++++++++++++++++++------------
1 files changed, 53 insertions(+), 16 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index bc0e018..3b19227 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -964,6 +964,7 @@ struct get_inkey_test {
struct stk_duration duration;
struct stk_text_attribute text_attr;
struct stk_frame_id frame_id;
+ char *html;
};
static unsigned char get_inkey_111[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22,
@@ -1569,7 +1570,9 @@ static struct get_inkey_test get_inkey_data_911 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x09, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Enter \"+\"</span>",
};
static struct get_inkey_test get_inkey_data_912 = {
@@ -1587,7 +1590,10 @@ static struct get_inkey_test get_inkey_data_921 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x09, 0x01, 0xB4 }
- }
+ },
+ .html = "<div style=\"text-align: center;\"><span style=\"color: "
+ "#347235;background-color: #FFFF00;\">Enter \"+\"</span>"
+ "</div>",
};
static struct get_inkey_test get_inkey_data_922 = {
@@ -1605,7 +1611,10 @@ static struct get_inkey_test get_inkey_data_931 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x09, 0x02, 0xB4 }
- }
+ },
+ .html = "<div style=\"text-align: right;\"><span style=\"color: "
+ "#347235;background-color: #FFFF00;\">Enter \"+\"</span>"
+ "</div>",
};
static struct get_inkey_test get_inkey_data_932 = {
@@ -1623,7 +1632,9 @@ static struct get_inkey_test get_inkey_data_941 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x09, 0x04, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-size: big;color: #347235;"
+ "background-color: #FFFF00;\">Enter \"+\"</span>",
};
static struct get_inkey_test get_inkey_data_942 = {
@@ -1634,7 +1645,9 @@ static struct get_inkey_test get_inkey_data_942 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x09, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Enter \"#\"</span>",
};
static struct get_inkey_test get_inkey_data_943 = {
@@ -1652,7 +1665,9 @@ static struct get_inkey_test get_inkey_data_951 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x09, 0x08, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-size: small;color: #347235;"
+ "background-color: #FFFF00;\">Enter \"+\"</span>",
};
static struct get_inkey_test get_inkey_data_952 = {
@@ -1663,7 +1678,9 @@ static struct get_inkey_test get_inkey_data_952 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x09, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Enter \"#\"</span>",
};
static struct get_inkey_test get_inkey_data_953 = {
@@ -1681,7 +1698,9 @@ static struct get_inkey_test get_inkey_data_961 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x09, 0x10, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-weight: bold;color: #347235;"
+ "background-color: #FFFF00;\">Enter \"+\"</span>",
};
static struct get_inkey_test get_inkey_data_962 = {
@@ -1692,7 +1711,9 @@ static struct get_inkey_test get_inkey_data_962 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x09, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Enter \"#\"</span>",
};
static struct get_inkey_test get_inkey_data_963 = {
@@ -1710,7 +1731,9 @@ static struct get_inkey_test get_inkey_data_971 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x09, 0x20, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-style: italic;color: #347235;"
+ "background-color: #FFFF00;\">Enter \"+\"</span>",
};
static struct get_inkey_test get_inkey_data_972 = {
@@ -1721,7 +1744,9 @@ static struct get_inkey_test get_inkey_data_972 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x09, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Enter \"#\"</span>",
};
static struct get_inkey_test get_inkey_data_973 = {
@@ -1739,7 +1764,9 @@ static struct get_inkey_test get_inkey_data_981 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x09, 0x40, 0xB4 }
- }
+ },
+ .html = "<span style=\"text-decoration: underline;color: #347235;"
+ "background-color: #FFFF00;\">Enter \"+\"</span>",
};
static struct get_inkey_test get_inkey_data_982 = {
@@ -1750,7 +1777,9 @@ static struct get_inkey_test get_inkey_data_982 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x09, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Enter \"#\"</span>",
};
static struct get_inkey_test get_inkey_data_983 = {
@@ -1768,7 +1797,9 @@ static struct get_inkey_test get_inkey_data_991 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x09, 0x80, 0xB4 }
- }
+ },
+ .html = "<span style=\"text-decoration: line-through;color: #347235;"
+ "background-color: #FFFF00;\">Enter \"+\"</span>",
};
static struct get_inkey_test get_inkey_data_992a = {
@@ -1779,7 +1810,9 @@ static struct get_inkey_test get_inkey_data_992a = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x09, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Enter \"#\"</span>",
};
static struct get_inkey_test get_inkey_data_992b = {
@@ -1804,7 +1837,9 @@ static struct get_inkey_test get_inkey_data_9101 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x09, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Enter \"+\"</span>",
};
static struct get_inkey_test get_inkey_data_9102 = {
@@ -1886,6 +1921,8 @@ static void test_get_inkey(gconstpointer data)
check_duration(&command->get_inkey.duration, &test->duration);
check_text_attr(&command->get_inkey.text_attr,
&test->text_attr);
+ check_text_attr_html(&command->get_inkey.text_attr,
+ command->get_inkey.text, test->html);
check_frame_id(&command->get_inkey.frame_id, &test->frame_id);
stk_command_free(command);
--
1.6.6.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 05/10] test-stkutil: add html attribute tests for get_input_test
2010-07-01 15:31 [PATCH 00/10] html text attributes patches Kristen Carlson Accardi
` (3 preceding siblings ...)
2010-07-01 15:31 ` [PATCH 04/10] test-stkutil: add html attribute tests for get_inkey_test Kristen Carlson Accardi
@ 2010-07-01 15:31 ` Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 06/10] test-stkutil: add html attribute tests for play_tone_test Kristen Carlson Accardi
` (4 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Kristen Carlson Accardi @ 2010-07-01 15:31 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 6340 bytes --]
---
unit/test-stkutil.c | 69 +++++++++++++++++++++++++++++++++++++++------------
1 files changed, 53 insertions(+), 16 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index 3b19227..4d22d94 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -1938,6 +1938,7 @@ struct get_input_test {
struct stk_icon_id icon_id;
struct stk_text_attribute text_attr;
struct stk_frame_id frame_id;
+ char *html;
};
static unsigned char get_input_111[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x23,
@@ -2773,7 +2774,9 @@ static struct get_input_test get_input_data_811 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x0B, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Enter 12345</span>"
};
static struct get_input_test get_input_data_812 = {
@@ -2799,7 +2802,10 @@ static struct get_input_test get_input_data_821 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x0B, 0x01, 0xB4 }
- }
+ },
+ .html = "<div style=\"text-align: center;\"><span style=\"color: "
+ "#347235;background-color: #FFFF00;\">Enter 12345</span>"
+ "</div>",
};
static struct get_input_test get_input_data_822 = {
@@ -2825,7 +2831,10 @@ static struct get_input_test get_input_data_831 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x0B, 0x02, 0xB4 }
- }
+ },
+ .html = "<div style=\"text-align: right;\"><span style=\"color: "
+ "#347235;background-color: #FFFF00;\">Enter 12345</span>"
+ "</div>",
};
static struct get_input_test get_input_data_832 = {
@@ -2851,7 +2860,9 @@ static struct get_input_test get_input_data_841 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x0B, 0x04, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-size: big;color: #347235;"
+ "background-color: #FFFF00;\">Enter 12345</span>",
};
static struct get_input_test get_input_data_842 = {
@@ -2866,7 +2877,9 @@ static struct get_input_test get_input_data_842 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x0B, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Enter 22222</span>"
};
static struct get_input_test get_input_data_843 = {
@@ -2892,7 +2905,9 @@ static struct get_input_test get_input_data_851 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x0B, 0x08, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-size: small;color: #347235;"
+ "background-color: #FFFF00;\">Enter 12345</span>",
};
static struct get_input_test get_input_data_852 = {
@@ -2907,7 +2922,9 @@ static struct get_input_test get_input_data_852 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x0B, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Enter 22222</span>"
};
static struct get_input_test get_input_data_853 = {
@@ -2933,7 +2950,9 @@ static struct get_input_test get_input_data_861 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x0B, 0x10, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-weight: bold;color: #347235;"
+ "background-color: #FFFF00;\">Enter 12345</span>"
};
static struct get_input_test get_input_data_862 = {
@@ -2948,7 +2967,9 @@ static struct get_input_test get_input_data_862 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x0B, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Enter 22222</span>"
};
static struct get_input_test get_input_data_863 = {
@@ -2974,7 +2995,9 @@ static struct get_input_test get_input_data_871 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x0B, 0x20, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-style: italic;color: #347235;"
+ "background-color: #FFFF00;\">Enter 12345</span>"
};
static struct get_input_test get_input_data_872 = {
@@ -2989,7 +3012,9 @@ static struct get_input_test get_input_data_872 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x0B, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Enter 22222</span>"
};
static struct get_input_test get_input_data_873 = {
@@ -3015,7 +3040,9 @@ static struct get_input_test get_input_data_881 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x0B, 0x40, 0xB4 }
- }
+ },
+ .html = "<span style=\"text-decoration: underline;color: #347235;"
+ "background-color: #FFFF00;\">Enter 12345</span>"
};
static struct get_input_test get_input_data_882 = {
@@ -3030,7 +3057,9 @@ static struct get_input_test get_input_data_882 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x0B, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Enter 22222</span>"
};
static struct get_input_test get_input_data_883 = {
@@ -3056,7 +3085,9 @@ static struct get_input_test get_input_data_891 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x0B, 0x80, 0xB4 }
- }
+ },
+ .html = "<span style=\"text-decoration: line-through;color: #347235;"
+ "background-color: #FFFF00;\">Enter 12345</span>"
};
static struct get_input_test get_input_data_892 = {
@@ -3071,7 +3102,9 @@ static struct get_input_test get_input_data_892 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x0B, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Enter 22222</span>"
};
static struct get_input_test get_input_data_893 = {
@@ -3097,7 +3130,9 @@ static struct get_input_test get_input_data_8101 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x0B, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Enter 12345</span>"
};
static struct get_input_test get_input_data_8102 = {
@@ -3231,6 +3266,8 @@ static void test_get_input(gconstpointer data)
check_icon_id(&command->get_input.icon_id, &test->icon_id);
check_text_attr(&command->get_input.text_attr,
&test->text_attr);
+ check_text_attr_html(&command->get_input.text_attr,
+ command->get_input.text, test->html);
check_frame_id(&command->get_input.frame_id, &test->frame_id);
stk_command_free(command);
--
1.6.6.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 06/10] test-stkutil: add html attribute tests for play_tone_test
2010-07-01 15:31 [PATCH 00/10] html text attributes patches Kristen Carlson Accardi
` (4 preceding siblings ...)
2010-07-01 15:31 ` [PATCH 05/10] test-stkutil: add html attribute tests for get_input_test Kristen Carlson Accardi
@ 2010-07-01 15:31 ` Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 07/10] test-stkutil: add html attribute test for setup_menu_test Kristen Carlson Accardi
` (3 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Kristen Carlson Accardi @ 2010-07-01 15:31 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 6493 bytes --]
---
unit/test-stkutil.c | 69 +++++++++++++++++++++++++++++++++++++++------------
1 files changed, 53 insertions(+), 16 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index 4d22d94..3ab3528 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -3319,6 +3319,7 @@ struct play_tone_test {
struct stk_icon_id icon_id;
struct stk_text_attribute text_attr;
struct stk_frame_id frame_id;
+ char *html;
};
static unsigned char play_tone_111[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x20,
@@ -4089,7 +4090,9 @@ static struct play_tone_test play_tone_data_411 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Text Attribute 1</span>",
};
static struct play_tone_test play_tone_data_412 = {
@@ -4117,7 +4120,10 @@ static struct play_tone_test play_tone_data_421 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x01, 0xB4 }
- }
+ },
+ .html = "<div style=\"text-align: center;\"><span style=\"color: "
+ "#347235;background-color: #FFFF00;\">Text Attribute 1</span>"
+ "</div>",
};
static struct play_tone_test play_tone_data_422 = {
@@ -4145,7 +4151,10 @@ static struct play_tone_test play_tone_data_431 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x02, 0xB4 }
- }
+ },
+ .html = "<div style=\"text-align: right;\"><span style=\"color: "
+ "#347235;background-color: #FFFF00;\">Text Attribute 1</span>"
+ "</div>",
};
static struct play_tone_test play_tone_data_432 = {
@@ -4173,7 +4182,9 @@ static struct play_tone_test play_tone_data_441 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x04, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-size: big;color: #347235;"
+ "background-color: #FFFF00;\">Text Attribute 1</span>",
};
static struct play_tone_test play_tone_data_442 = {
@@ -4189,7 +4200,9 @@ static struct play_tone_test play_tone_data_442 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Text Attribute 2</span>",
};
static struct play_tone_test play_tone_data_443 = {
@@ -4217,7 +4230,9 @@ static struct play_tone_test play_tone_data_451 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x08, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-size: small;color: #347235;"
+ "background-color: #FFFF00;\">Text Attribute 1</span>",
};
static struct play_tone_test play_tone_data_452 = {
@@ -4233,7 +4248,9 @@ static struct play_tone_test play_tone_data_452 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Text Attribute 2</span>",
};
static struct play_tone_test play_tone_data_453 = {
@@ -4261,7 +4278,9 @@ static struct play_tone_test play_tone_data_461 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x0E, 0x10, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-weight: bold;color: #347235;"
+ "background-color: #FFFF00;\">Text Attribute</span> 1"
};
static struct play_tone_test play_tone_data_462 = {
@@ -4277,7 +4296,9 @@ static struct play_tone_test play_tone_data_462 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Text Attribute 2</span>",
};
static struct play_tone_test play_tone_data_463 = {
@@ -4305,7 +4326,9 @@ static struct play_tone_test play_tone_data_471 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x0E, 0x20, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-style: italic;color: #347235;"
+ "background-color: #FFFF00;\">Text Attribute</span> 1",
};
static struct play_tone_test play_tone_data_472 = {
@@ -4321,7 +4344,9 @@ static struct play_tone_test play_tone_data_472 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Text Attribute 2</span>",
};
static struct play_tone_test play_tone_data_473 = {
@@ -4349,7 +4374,9 @@ static struct play_tone_test play_tone_data_481 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x40, 0xB4 }
- }
+ },
+ .html = "<span style=\"text-decoration: underline;color: #347235;"
+ "background-color: #FFFF00;\">Text Attribute 1</span>",
};
static struct play_tone_test play_tone_data_482 = {
@@ -4365,7 +4392,9 @@ static struct play_tone_test play_tone_data_482 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Text Attribute 2</span>",
};
static struct play_tone_test play_tone_data_483 = {
@@ -4393,7 +4422,9 @@ static struct play_tone_test play_tone_data_491 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x80, 0xB4 }
- }
+ },
+ .html = "<span style=\"text-decoration: line-through;color: #347235;"
+ "background-color: #FFFF00;\">Text Attribute 1</span>",
};
static struct play_tone_test play_tone_data_492 = {
@@ -4409,7 +4440,9 @@ static struct play_tone_test play_tone_data_492 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Text Attribute 2</span>",
};
static struct play_tone_test play_tone_data_493 = {
@@ -4437,7 +4470,9 @@ static struct play_tone_test play_tone_data_4101 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Text Attribute 1</span>",
};
static struct play_tone_test play_tone_data_4102 = {
@@ -4547,6 +4582,8 @@ static void test_play_tone(gconstpointer data)
check_duration(&command->play_tone.duration, &test->duration);
check_icon_id(&command->play_tone.icon_id, &test->icon_id);
check_text_attr(&command->play_tone.text_attr, &test->text_attr);
+ check_text_attr_html(&command->play_tone.text_attr,
+ command->play_tone.alpha_id, test->html);
check_frame_id(&command->play_tone.frame_id, &test->frame_id);
stk_command_free(command);
--
1.6.6.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 07/10] test-stkutil: add html attribute test for setup_menu_test
2010-07-01 15:31 [PATCH 00/10] html text attributes patches Kristen Carlson Accardi
` (5 preceding siblings ...)
2010-07-01 15:31 ` [PATCH 06/10] test-stkutil: add html attribute tests for play_tone_test Kristen Carlson Accardi
@ 2010-07-01 15:31 ` Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 08/10] test-stkutil: add html attribute test for select_item_test Kristen Carlson Accardi
` (2 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Kristen Carlson Accardi @ 2010-07-01 15:31 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 5187 bytes --]
---
unit/test-stkutil.c | 50 ++++++++++++++++++++++++++++++++++++++------------
1 files changed, 38 insertions(+), 12 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index 3ab3528..fca4526 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -4644,6 +4644,7 @@ struct setup_menu_test {
struct stk_item_icon_id_list item_icon_id_list;
struct stk_text_attribute text_attr;
struct stk_item_text_attribute_list item_text_attr_list;
+ char *html;
};
static unsigned char setup_menu_111[] = { 0xD0, 0x3B, 0x81, 0x03, 0x01, 0x25,
@@ -5457,7 +5458,9 @@ static struct setup_menu_test setup_menu_data_611 = {
.len = 12,
.list = { 0x00, 0x06, 0x00, 0xB4, 0x00, 0x06, 0x00, 0xB4,
0x00, 0x06, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Toolkit Menu 1</span>",
};
static struct setup_menu_test setup_menu_data_612 = {
@@ -5490,7 +5493,10 @@ static struct setup_menu_test setup_menu_data_621 = {
.len = 12,
.list = { 0x00, 0x06, 0x01, 0xB4, 0x00, 0x06, 0x01, 0xB4,
0x00, 0x06, 0x01, 0xB4 }
- }
+ },
+ .html = "<div style=\"text-align: center;\"><span style=\"color: "
+ "#347235;background-color: #FFFF00;\">Toolkit Menu 1</span>"
+ "</div>"
};
static struct setup_menu_test setup_menu_data_622 = {
@@ -5527,7 +5533,10 @@ static struct setup_menu_test setup_menu_data_631 = {
.len = 12,
.list = { 0x00, 0x06, 0x02, 0xB4, 0x00, 0x06, 0x02, 0xB4,
0x00, 0x06, 0x02, 0xB4 }
- }
+ },
+ .html = "<div style=\"text-align: right;\"><span style=\"color: "
+ "#347235;background-color: #FFFF00;\">Toolkit Menu 1</span>"
+ "</div>"
};
static struct setup_menu_test setup_menu_data_632 = {
@@ -5560,7 +5569,9 @@ static struct setup_menu_test setup_menu_data_641 = {
.len = 12,
.list = { 0x00, 0x06, 0x04, 0xB4, 0x00, 0x06, 0x04, 0xB4,
0x00, 0x06, 0x04, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-size: big;color: #347235;"
+ "background-color: #FFFF00;\">Toolkit Menu 1</span>",
};
static struct setup_menu_test setup_menu_data_642 = {
@@ -5581,7 +5592,9 @@ static struct setup_menu_test setup_menu_data_642 = {
.len = 12,
.list = { 0x00, 0x06, 0x00, 0xB4, 0x00, 0x06, 0x00, 0xB4,
0x00, 0x06, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Toolkit Menu 2</span>",
};
static struct setup_menu_test setup_menu_data_643 = {
@@ -5614,7 +5627,9 @@ static struct setup_menu_test setup_menu_data_651 = {
.len = 12,
.list = { 0x00, 0x06, 0x08, 0xB4, 0x00, 0x06, 0x08, 0xB4,
0x00, 0x06, 0x08, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-size: small;color: #347235;"
+ "background-color: #FFFF00;\">Toolkit Menu 1</span>",
};
static struct setup_menu_test setup_menu_data_661 = {
@@ -5635,7 +5650,9 @@ static struct setup_menu_test setup_menu_data_661 = {
.len = 12,
.list = { 0x00, 0x06, 0x10, 0xB4, 0x00, 0x06, 0x10, 0xB4,
0x00, 0x06, 0x10, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-weight: bold;color: #347235;"
+ "background-color: #FFFF00;\">Toolkit Menu 1</span>",
};
static struct setup_menu_test setup_menu_data_671 = {
@@ -5656,7 +5673,9 @@ static struct setup_menu_test setup_menu_data_671 = {
.len = 12,
.list = { 0x00, 0x06, 0x20, 0xB4, 0x00, 0x06, 0x20, 0xB4,
0x00, 0x06, 0x20, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-style: italic;color: #347235;"
+ "background-color: #FFFF00;\">Toolkit Menu 1</span>"
};
static struct setup_menu_test setup_menu_data_681 = {
@@ -5677,7 +5696,9 @@ static struct setup_menu_test setup_menu_data_681 = {
.len = 12,
.list = { 0x00, 0x06, 0x40, 0xB4, 0x00, 0x06, 0x40, 0xB4,
0x00, 0x06, 0x40, 0xB4 }
- }
+ },
+ .html = "<span style=\"text-decoration: underline;color: #347235;"
+ "background-color: #FFFF00;\">Toolkit Menu 1</span>",
};
static struct setup_menu_test setup_menu_data_691 = {
@@ -5698,7 +5719,9 @@ static struct setup_menu_test setup_menu_data_691 = {
.len = 12,
.list = { 0x00, 0x06, 0x80, 0xB4, 0x00, 0x06, 0x80, 0xB4,
0x00, 0x06, 0x80, 0xB4 }
- }
+ },
+ .html = "<span style=\"text-decoration: line-through;color: #347235;"
+ "background-color: #FFFF00;\">Toolkit Menu 1</span>"
};
static struct setup_menu_test setup_menu_data_6101 = {
@@ -5719,7 +5742,9 @@ static struct setup_menu_test setup_menu_data_6101 = {
.len = 12,
.list = { 0x00, 0x06, 0x00, 0xB4, 0x00, 0x06, 0x00, 0xB4,
0x00, 0x06, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Toolkit Menu</span>",
};
static struct setup_menu_test setup_menu_data_711 = {
@@ -5862,7 +5887,8 @@ static void test_setup_menu(gconstpointer data)
check_text_attr(&command->setup_menu.text_attr, &test->text_attr);
check_item_text_attribute_list(&command->setup_menu.item_text_attr_list,
&test->item_text_attr_list);
-
+ check_text_attr_html(&command->setup_menu.text_attr,
+ command->setup_menu.alpha_id, test->html);
stk_command_free(command);
}
--
1.6.6.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 08/10] test-stkutil: add html attribute test for select_item_test
2010-07-01 15:31 [PATCH 00/10] html text attributes patches Kristen Carlson Accardi
` (6 preceding siblings ...)
2010-07-01 15:31 ` [PATCH 07/10] test-stkutil: add html attribute test for setup_menu_test Kristen Carlson Accardi
@ 2010-07-01 15:31 ` Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 09/10] test-stkutil: add html attribute tests for setup idle mode tests Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 10/10] test-stkutil: add html_attr_test for special chars Kristen Carlson Accardi
9 siblings, 0 replies; 12+ messages in thread
From: Kristen Carlson Accardi @ 2010-07-01 15:31 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 7029 bytes --]
---
unit/test-stkutil.c | 69 +++++++++++++++++++++++++++++++++++++++------------
1 files changed, 53 insertions(+), 16 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index fca4526..ada02c0 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -5927,6 +5927,7 @@ struct select_item_test {
struct stk_text_attribute text_attr;
struct stk_item_text_attribute_list item_text_attr_list;
struct stk_frame_id frame_id;
+ char *html;
};
static unsigned char select_item_111[] = { 0xD0, 0x3D, 0x81, 0x03, 0x01, 0x24,
@@ -6973,7 +6974,9 @@ static struct select_item_test select_item_data_911 = {
.item_text_attr_list = {
.len = 8,
.list = { 0x00, 0x06, 0x00, 0xB4, 0x00, 0x06, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Toolkit Select 1</span>",
};
static struct select_item_test select_item_data_912 = {
@@ -7003,7 +7006,10 @@ static struct select_item_test select_item_data_921 = {
.item_text_attr_list = {
.len = 8,
.list = { 0x00, 0x06, 0x01, 0xB4, 0x00, 0x06, 0x01, 0xB4 }
- }
+ },
+ .html = "<div style=\"text-align: center;\"><span style=\"color: "
+ "#347235;background-color: #FFFF00;\">Toolkit Select 1</span>"
+ "</div>",
};
static struct select_item_test select_item_data_922 = {
@@ -7033,7 +7039,10 @@ static struct select_item_test select_item_data_931 = {
.item_text_attr_list = {
.len = 8,
.list = { 0x00, 0x06, 0x02, 0xB4, 0x00, 0x06, 0x02, 0xB4 }
- }
+ },
+ .html = "<div style=\"text-align: right;\"><span style=\"color: "
+ "#347235;background-color: #FFFF00;\">Toolkit Select 1</span>"
+ "</div>"
};
static struct select_item_test select_item_data_932 = {
@@ -7063,7 +7072,9 @@ static struct select_item_test select_item_data_941 = {
.item_text_attr_list = {
.len = 8,
.list = { 0x00, 0x06, 0x04, 0xB4, 0x00, 0x06, 0x04, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-size: big;color: #347235;"
+ "background-color: #FFFF00;\">Toolkit Select 1</span>",
};
static struct select_item_test select_item_data_942 = {
@@ -7082,7 +7093,9 @@ static struct select_item_test select_item_data_942 = {
.item_text_attr_list = {
.len = 8,
.list = { 0x00, 0x06, 0x00, 0xB4, 0x00, 0x06, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Toolkit Select 2</span>",
};
static struct select_item_test select_item_data_943 = {
@@ -7112,7 +7125,9 @@ static struct select_item_test select_item_data_951 = {
.item_text_attr_list = {
.len = 8,
.list = { 0x00, 0x06, 0x08, 0xB4, 0x00, 0x06, 0x08, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-size: small;color: #347235;"
+ "background-color: #FFFF00;\">Toolkit Select 1</span>",
};
static struct select_item_test select_item_data_952 = {
@@ -7131,7 +7146,9 @@ static struct select_item_test select_item_data_952 = {
.item_text_attr_list = {
.len = 8,
.list = { 0x00, 0x06, 0x00, 0xB4, 0x00, 0x06, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Toolkit Select 2</span>",
};
static struct select_item_test select_item_data_953 = {
@@ -7161,7 +7178,9 @@ static struct select_item_test select_item_data_961 = {
.item_text_attr_list = {
.len = 8,
.list = { 0x00, 0x06, 0x10, 0xB4, 0x00, 0x06, 0x10, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-weight: bold;color: #347235;"
+ "background-color: #FFFF00;\">Toolkit Select 1</span>",
};
static struct select_item_test select_item_data_962 = {
@@ -7180,7 +7199,9 @@ static struct select_item_test select_item_data_962 = {
.item_text_attr_list = {
.len = 8,
.list = { 0x00, 0x06, 0x00, 0xB4, 0x00, 0x06, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Toolkit Select 2</span>",
};
static struct select_item_test select_item_data_963 = {
@@ -7210,7 +7231,9 @@ static struct select_item_test select_item_data_971 = {
.item_text_attr_list = {
.len = 8,
.list = { 0x00, 0x06, 0x20, 0xB4, 0x00, 0x06, 0x20, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-style: italic;color: #347235;"
+ "background-color: #FFFF00;\">Toolkit Select 1</span>"
};
static struct select_item_test select_item_data_972 = {
@@ -7229,7 +7252,9 @@ static struct select_item_test select_item_data_972 = {
.item_text_attr_list = {
.len = 8,
.list = { 0x00, 0x06, 0x00, 0xB4, 0x00, 0x06, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Toolkit Select 2</span>",
};
static struct select_item_test select_item_data_973 = {
@@ -7259,7 +7284,9 @@ static struct select_item_test select_item_data_981 = {
.item_text_attr_list = {
.len = 8,
.list = { 0x00, 0x06, 0x40, 0xB4, 0x00, 0x06, 0x40, 0xB4 }
- }
+ },
+ .html = "<span style=\"text-decoration: underline;color: #347235;"
+ "background-color: #FFFF00;\">Toolkit Select 1</span>"
};
static struct select_item_test select_item_data_982 = {
@@ -7278,7 +7305,9 @@ static struct select_item_test select_item_data_982 = {
.item_text_attr_list = {
.len = 8,
.list = { 0x00, 0x06, 0x00, 0xB4, 0x00, 0x06, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Toolkit Select 2</span>",
};
static struct select_item_test select_item_data_983 = {
@@ -7308,7 +7337,9 @@ static struct select_item_test select_item_data_991 = {
.item_text_attr_list = {
.len = 8,
.list = { 0x00, 0x06, 0x80, 0xB4, 0x00, 0x06, 0x80, 0xB4 }
- }
+ },
+ .html = "<span style=\"text-decoration: line-through;color: #347235;"
+ "background-color: #FFFF00;\">Toolkit Select 1</span>",
};
static struct select_item_test select_item_data_992 = {
@@ -7327,7 +7358,9 @@ static struct select_item_test select_item_data_992 = {
.item_text_attr_list = {
.len = 8,
.list = { 0x00, 0x06, 0x00, 0xB4, 0x00, 0x06, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Toolkit Select 2</span>",
};
static struct select_item_test select_item_data_993 = {
@@ -7357,7 +7390,9 @@ static struct select_item_test select_item_data_9101 = {
.item_text_attr_list = {
.len = 8,
.list = { 0x00, 0x06, 0x00, 0xB4, 0x00, 0x06, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Toolkit Select 1</span>",
};
static struct select_item_test select_item_data_9102 = {
@@ -7485,6 +7520,8 @@ static void test_select_item(gconstpointer data)
check_item_text_attribute_list(
&command->select_item.item_text_attr_list,
&test->item_text_attr_list);
+ check_text_attr_html(&command->select_item.text_attr,
+ command->select_item.alpha_id, test->html);
check_frame_id(&command->select_item.frame_id, &test->frame_id);
stk_command_free(command);
--
1.6.6.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 09/10] test-stkutil: add html attribute tests for setup idle mode tests
2010-07-01 15:31 [PATCH 00/10] html text attributes patches Kristen Carlson Accardi
` (7 preceding siblings ...)
2010-07-01 15:31 ` [PATCH 08/10] test-stkutil: add html attribute test for select_item_test Kristen Carlson Accardi
@ 2010-07-01 15:31 ` Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 10/10] test-stkutil: add html_attr_test for special chars Kristen Carlson Accardi
9 siblings, 0 replies; 12+ messages in thread
From: Kristen Carlson Accardi @ 2010-07-01 15:31 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 7228 bytes --]
---
unit/test-stkutil.c | 69 +++++++++++++++++++++++++++++++++++++++------------
1 files changed, 53 insertions(+), 16 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index ada02c0..74e2ec2 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -13719,6 +13719,7 @@ struct setup_idle_mode_text_test {
struct stk_icon_id icon_id;
struct stk_text_attribute text_attr;
struct stk_frame_id frame_id;
+ char *html;
};
static unsigned char setup_idle_mode_text_111[] = { 0xD0, 0x1A, 0x81, 0x03,
@@ -14151,7 +14152,9 @@ static struct setup_idle_mode_text_test setup_idle_mode_text_data_411 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Idle Mode Text 1</span>",
};
static struct setup_idle_mode_text_test setup_idle_mode_text_data_412 = {
@@ -14169,7 +14172,10 @@ static struct setup_idle_mode_text_test setup_idle_mode_text_data_421 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x01, 0xB4 }
- }
+ },
+ .html = "<div style=\"text-align: center;\"><span style=\"color: "
+ "#347235;background-color: #FFFF00;\">Idle Mode Text 1</span>"
+ "</div>",
};
static struct setup_idle_mode_text_test setup_idle_mode_text_data_422 = {
@@ -14187,7 +14193,10 @@ static struct setup_idle_mode_text_test setup_idle_mode_text_data_431 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x02, 0xB4 }
- }
+ },
+ .html = "<div style=\"text-align: right;\"><span style=\"color: "
+ "#347235;background-color: #FFFF00;\">Idle Mode Text 1</span>"
+ "</div>",
};
static struct setup_idle_mode_text_test setup_idle_mode_text_data_432 = {
@@ -14205,7 +14214,9 @@ static struct setup_idle_mode_text_test setup_idle_mode_text_data_441 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x04, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-size: big;color: #347235;"
+ "background-color: #FFFF00;\">Idle Mode Text 1</span>",
};
static struct setup_idle_mode_text_test setup_idle_mode_text_data_442 = {
@@ -14216,7 +14227,9 @@ static struct setup_idle_mode_text_test setup_idle_mode_text_data_442 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Idle Mode Text 2</span>",
};
static struct setup_idle_mode_text_test setup_idle_mode_text_data_443 = {
@@ -14234,7 +14247,9 @@ static struct setup_idle_mode_text_test setup_idle_mode_text_data_451 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x08, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-size: small;color: #347235;"
+ "background-color: #FFFF00;\">Idle Mode Text 1</span>",
};
static struct setup_idle_mode_text_test setup_idle_mode_text_data_452 = {
@@ -14245,7 +14260,9 @@ static struct setup_idle_mode_text_test setup_idle_mode_text_data_452 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Idle Mode Text 2</span>",
};
static struct setup_idle_mode_text_test setup_idle_mode_text_data_453 = {
@@ -14263,7 +14280,9 @@ static struct setup_idle_mode_text_test setup_idle_mode_text_data_461 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x10, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-weight: bold;color: #347235;"
+ "background-color: #FFFF00;\">Idle Mode Text 1</span>",
};
static struct setup_idle_mode_text_test setup_idle_mode_text_data_462 = {
@@ -14274,7 +14293,9 @@ static struct setup_idle_mode_text_test setup_idle_mode_text_data_462 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Idle Mode Text 2</span>",
};
static struct setup_idle_mode_text_test setup_idle_mode_text_data_463 = {
@@ -14292,7 +14313,9 @@ static struct setup_idle_mode_text_test setup_idle_mode_text_data_471 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x20, 0xB4 }
- }
+ },
+ .html = "<span style=\"font-style: italic;color: #347235;"
+ "background-color: #FFFF00;\">Idle Mode Text 1</span>",
};
static struct setup_idle_mode_text_test setup_idle_mode_text_data_472 = {
@@ -14303,7 +14326,9 @@ static struct setup_idle_mode_text_test setup_idle_mode_text_data_472 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Idle Mode Text 2</span>",
};
static struct setup_idle_mode_text_test setup_idle_mode_text_data_473 = {
@@ -14321,7 +14346,9 @@ static struct setup_idle_mode_text_test setup_idle_mode_text_data_481 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x40, 0xB4 }
- }
+ },
+ .html = "<span style=\"text-decoration: underline;color: #347235;"
+ "background-color: #FFFF00;\">Idle Mode Text 1</span>",
};
static struct setup_idle_mode_text_test setup_idle_mode_text_data_482 = {
@@ -14332,7 +14359,9 @@ static struct setup_idle_mode_text_test setup_idle_mode_text_data_482 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Idle Mode Text 2</span>",
};
static struct setup_idle_mode_text_test setup_idle_mode_text_data_483 = {
@@ -14350,7 +14379,9 @@ static struct setup_idle_mode_text_test setup_idle_mode_text_data_491 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x80, 0xB4 }
- }
+ },
+ .html = "<span style=\"text-decoration: line-through;color: "
+ "#347235;background-color: #FFFF00;\">Idle Mode Text 1</span>",
};
static struct setup_idle_mode_text_test setup_idle_mode_text_data_492 = {
@@ -14361,7 +14392,9 @@ static struct setup_idle_mode_text_test setup_idle_mode_text_data_492 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Idle Mode Text 2</span>",
};
static struct setup_idle_mode_text_test setup_idle_mode_text_data_493 = {
@@ -14379,7 +14412,9 @@ static struct setup_idle_mode_text_test setup_idle_mode_text_data_4101 = {
.text_attr = {
.len = 4,
.attributes = { 0x00, 0x10, 0x00, 0xB4 }
- }
+ },
+ .html = "<span style=\"color: #347235;background-color: #FFFF00;\">"
+ "Idle Mode Text 1</span>",
};
static struct setup_idle_mode_text_test setup_idle_mode_text_data_4102 = {
@@ -14424,6 +14459,8 @@ static void test_setup_idle_mode_text(gconstpointer data)
check_icon_id(&command->setup_idle_mode_text.icon_id, &test->icon_id);
check_text_attr(&command->setup_idle_mode_text.text_attr,
&test->text_attr);
+ check_text_attr_html(&command->setup_idle_mode_text.text_attr,
+ command->setup_idle_mode_text.text, test->html);
check_frame_id(&command->setup_idle_mode_text.frame_id,
&test->frame_id);
--
1.6.6.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 10/10] test-stkutil: add html_attr_test for special chars
2010-07-01 15:31 [PATCH 00/10] html text attributes patches Kristen Carlson Accardi
` (8 preceding siblings ...)
2010-07-01 15:31 ` [PATCH 09/10] test-stkutil: add html attribute tests for setup idle mode tests Kristen Carlson Accardi
@ 2010-07-01 15:31 ` Kristen Carlson Accardi
9 siblings, 0 replies; 12+ messages in thread
From: Kristen Carlson Accardi @ 2010-07-01 15:31 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1105 bytes --]
---
unit/test-stkutil.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index 74e2ec2..c2e1327 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -22383,6 +22383,16 @@ static struct html_attr_test html_attr_data_3 = {
"#FFFFFF;\">bc</span>",
};
+static struct html_attr_test html_attr_data_4 = {
+ .text = "1 < 2, 2 > 1, 1 & 0 == 0\nSpecial Chars are Fun\r\nTo Write",
+ .text_attr = {
+ .len = 4,
+ .attributes = { 0x00, 0x00, 0x00 },
+ },
+ .html = "1 < 2, 2 > 1, 1 & 0 == 0<br/>Special Chars are Fun"
+ "<br/>To Write",
+};
+
static void test_html_attr(gconstpointer data)
{
const struct html_attr_test *test = data;
@@ -24420,6 +24430,8 @@ int main(int argc, char **argv)
&html_attr_data_2, test_html_attr);
g_test_add_data_func("/teststk/HTML Attribute Test 3",
&html_attr_data_3, test_html_attr);
+ g_test_add_data_func("/teststk/HTML Attribute Test 4",
+ &html_attr_data_4, test_html_attr);
return g_test_run();
}
--
1.6.6.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 01/10] stkutil: display text attributes as html
2010-07-01 15:31 ` [PATCH 01/10] stkutil: display text attributes as html Kristen Carlson Accardi
@ 2010-07-01 23:12 ` Denis Kenzior
0 siblings, 0 replies; 12+ messages in thread
From: Denis Kenzior @ 2010-07-01 23:12 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1988 bytes --]
Hi Kristen,
> +#define STK_TEXT_FORMAT_INIT -1
I'd really prefer 0xffff here
> +char *stk_text_to_html(const char *text, int text_len,
> + const unsigned char *attrs, int attrs_len)
> +{
I think that text_len is not required, this function can figure it out
itself by using strlen or friends.
> + GString *string = g_string_sized_new(text_len + 1);
> + int *formats;
> + int pos, i, j, attr, prev_attr;
> + guint8 start, end, code, color, len, align;
> +
> + formats = g_try_malloc0(sizeof(int) * (text_len + 1));
Why are you allocating ints instead of shorts?
Also, you have to be really careful here. Text inside oFono is
understood to be UTF8 always. The formats array should be allocated
according to how many UTF8 characters there are, not how many bytes
there are. GSM characters can be represented by up to 3 byte UTF8
chars. UCS2 characters can be represented by up to 4 byte UTF8 chars.
Also please realize that is is not required unless you modify the
signature of attrs to be something other than unsigned char (limited to
max=255)
> + if (formats == NULL)
> + return NULL;
> +
> + /* we will need formatting at the position beyond the last char */
> + for (i = 0; i <= text_len; i++)
> + formats[i] = STK_TEXT_FORMAT_INIT;
> +
> + for (i = 0; i+3 < attrs_len; i += 4) {
> + start = attrs[i];
> + len = attrs[i + 1];
> + code = attrs[i + 2];
> +
> + if (i + 3 < attrs_len)
> + color = attrs[i + 3];
> + else
> + color = 0;
My suggestion is to generalize this function to support both EMS
messages and STK strings. We can treat attrs as:
unsigned short *attrs, unsigned short len where len = number of
quadruples. See the earlier thread for details.
The reason for using shorts is to support larger EMS message sizes.
> +
> + for (pos = 0; pos <= text_len; pos++) {
And again here you have to be careful and use UTF8 character lengths,
not simple ASCII lengths.
Regards,
-Denis
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2010-07-01 23:12 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-01 15:31 [PATCH 00/10] html text attributes patches Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 01/10] stkutil: display text attributes as html Kristen Carlson Accardi
2010-07-01 23:12 ` Denis Kenzior
2010-07-01 15:31 ` [PATCH 02/10] test-stkutil: add unit test for html text attributes Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 03/10] test-stkutil: add html attribute test for Display Text tests Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 04/10] test-stkutil: add html attribute tests for get_inkey_test Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 05/10] test-stkutil: add html attribute tests for get_input_test Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 06/10] test-stkutil: add html attribute tests for play_tone_test Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 07/10] test-stkutil: add html attribute test for setup_menu_test Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 08/10] test-stkutil: add html attribute test for select_item_test Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 09/10] test-stkutil: add html attribute tests for setup idle mode tests Kristen Carlson Accardi
2010-07-01 15:31 ` [PATCH 10/10] test-stkutil: add html_attr_test for special chars Kristen Carlson Accardi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.