html text attribute patches
cover html text attribute patches
Changes since last version:
* made utf8 safe
* changed signature to use 16 bit arrays for attributes
* changed signature to use number of attributes rather than length of attribute
* assume attributes are always 4 bytes
* incorporated other feedback from last review
* added unit test for utf8 text
Kristen Carlson Accardi (9):
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
src/stkutil.c | 229 ++++++++++++++++ src/stkutil.h | 2 + unit/test-stkutil.c | 714 ++++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 853 insertions(+), 92 deletions(-)
PATCH 1/9 stkutil: display text attributes as html
--- src/stkutil.c | 229 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/stkutil.h | 2 + 2 files changed, 231 insertions(+), 0 deletions(-)
src/stkutil.c +229 -0
@@ -5847,3 +5847,232 @@ 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 0xFFFF + +/* 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 *utf8, +const unsigned short *attrs,int num_attrs) +{ +long text_len =g_utf8_strlen (utf8,-1 ); +GString *string =g_string_sized_new (strlen (utf8) +1 ); +short *formats; +int pos, i, j; +guint16 start, end, len, attr, prev_attr; +guint8 code, color, align; +const char *text = utf8; +int attrs_len = num_attrs *4 ; + + formats =g_try_malloc0 (sizeof (gint16) * (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 < attrs_len; i +=4 ) { + start = attrs[i]; + len = attrs[i +1 ]; + code = attrs[i +2 ] &0xFF ; + color = attrs[i +3 ] &0xFF ; + +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 (g_utf8_get_char (text)) { +case '\n' : +g_string_append (string,"<br/>" ); +break ; +case '\r' : + { +char *next =g_utf8_next_char (text); +gunichar c =g_utf8_get_char (next); + +g_string_append (string,"<br/>" ); + +if ((pos +1 < text_len) && (c =='\n' )) { + text =g_utf8_next_char (text); + pos++; + } +break ; + } +case '<' : +g_string_append (string,"<" ); +break ; +case '>' : +g_string_append (string,">" ); +break ; +case '&' : +g_string_append (string,"&" ); +break ; +default : +g_string_append_unichar (string,g_utf8_get_char (text)); + } + + text =g_utf8_next_char (text); + } + +g_free (formats); + +/* return characters from string. Caller must free char data */ +return g_string_free (string, FALSE); +}
src/stkutil.h +2 -0
@@ -1642,3 +1642,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, +const unsigned short *attrs,int num_attrs);
Signature · 1 line
1.6.6.1
Re: [PATCH 1/9] stkutil: display text attributes as html
Hi Kristen,
Quoted 6 lines
src/stkutil.c +6
-0+/* 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 ,
src/stkutil.c const unsigned char *stk_pdu_from_envelope(const struct stk_envelope *envelope, · line 5891
Quoted 10 lines
src/stkutil.c +10
-0+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, +}; + +
Why the extra line?
Quoted 8 lines
src/stkutil.c +8
-0+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>" ); +}
src/stkutil.c const unsigned char *stk_pdu_from_envelope(const struct stk_envelope *envelope, · line 5909
Quoted 10 lines
src/stkutil.c +10
-0+ +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 */
Did you mean 'block of text' here?
Quoted 8 lines
src/stkutil.c +8
-0+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 :
src/stkutil.c const unsigned char *stk_pdu_from_envelope(const struct stk_envelope *envelope, · line 5927
Quoted 10 lines
src/stkutil.c +10
-0+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 ; +
I really prefer font == 0 && style == 0 && color == 0 here.
Quoted 16 lines
src/stkutil.c +16
-0+/* 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 ;
src/stkutil.c const unsigned char *stk_pdu_from_envelope(const struct stk_envelope *envelope, · line 5953
Quoted 10 lines
src/stkutil.c +10
-0+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 ; + }
Please note that text format is actually a bitmask, not a single selector. So switch/case here is inappropriate. Maybe you got confused by some earlier feedback... :)
Quoted 13 lines
src/stkutil.c +13
-0+ +/* 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 *utf8, +const unsigned short *attrs,int num_attrs) +{
src/stkutil.c const unsigned char *stk_pdu_from_envelope(const struct stk_envelope *envelope, · line 5976
Quoted 10 lines
src/stkutil.c +10
-0+long text_len =g_utf8_strlen (utf8,-1 ); +GString *string =g_string_sized_new (strlen (utf8) +1 ); +short *formats; +int pos, i, j; +guint16 start, end, len, attr, prev_attr; +guint8 code, color, align; +const char *text = utf8; +int attrs_len = num_attrs *4 ; + + formats =g_try_malloc0 (sizeof (gint16) * (text_len +1 ));
Please use g_try_new0 here, it is a bit more readable.
src/stkutil.c const unsigned char *stk_pdu_from_envelope(const struct stk_envelope *envelope, · line 5978
Quoted 2 lines
src/stkutil.c +2
-0+if (formats ==NULL ) +return NULL ;
You're leaking the GString here.
Quoted 27 lines
src/stkutil.c +27
-0+ +/* 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 < attrs_len; i +=4 ) { + start = attrs[i]; + len = attrs[i +1 ]; + code = attrs[i +2 ] &0xFF ; + color = attrs[i +3 ] &0xFF ; + +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 ;
src/stkutil.c const unsigned char *stk_pdu_from_envelope(const struct stk_envelope *envelope, · line 6015
Quoted 10 lines
src/stkutil.c +10
-0+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 ; +
So I think the above code is actually incorrect. The spec talks about Language dependent (default) alignment being equal to STK_DEFAULT_TEXT_ALIGNMENT. So if the SIM sends us a Left aligned attribute, it really means Left aligned.
Maybe something like this is enough?
if (start == 0)
align = STK_TEXT_FORMAT_NO_ALIGN; else align = formats[start - 1] & STK_TEXT_FORMAT_ALIGN_MASK;
Also, it would seem STK_TEXT_FORMAT_INIT should be set to 0x9003. Black foreground, white background, unaligned, unformatted.
Quoted 4 lines
src/stkutil.c +4
-0+ attr = code | (color <<8 ); + +for (j = start; j < end; j++) + formats[j] = attr;
src/stkutil.c const unsigned char *stk_pdu_from_envelope(const struct stk_envelope *envelope, · line 6029
Quoted 10 lines
src/stkutil.c +10
-0+ } + + 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 );
Is the 3rd argument above really supposed to be attr >> 8?
Probably be more easier if end_format & start_format took the short value instead of bitshifting everywhere.
Quoted 39 lines
src/stkutil.c +39
-0+ +if (attr !=STK_TEXT_FORMAT_INIT ) +start_format (string, attr &0xFF , + (attr >>8 ) &0xFF ); + + prev_attr = attr; + } + +if (pos == text_len) +break ; + +switch (g_utf8_get_char (text)) { +case '\n' : +g_string_append (string,"<br/>" ); +break ; +case '\r' : + { +char *next =g_utf8_next_char (text); +gunichar c =g_utf8_get_char (next); + +g_string_append (string,"<br/>" ); + +if ((pos +1 < text_len) && (c =='\n' )) { + text =g_utf8_next_char (text); + pos++; + } +break ; + } +case '<' : +g_string_append (string,"<" ); +break ; +case '>' : +g_string_append (string,">" ); +break ; +case '&' : +g_string_append (string,"&" ); +break ; +default : +g_string_append_unichar (string,g_utf8_get_char (text));
src/stkutil.c const unsigned char *stk_pdu_from_envelope(const struct stk_envelope *envelope, · line 6078
Quoted 10 lines
src/stkutil.c +10
-0+ } + + text =g_utf8_next_char (text); + } + +g_free (formats); + +/* return characters from string. Caller must free char data */ +return g_string_free (string, FALSE); +}
Regards,
-Denis
Re: [PATCH 1/9] stkutil: display text attributes as html
Quoted 23 lines · On Thu, 08 Jul 2010 17:49:56 -0500 Denis Kenzior <[email protected]> wrote:
Quoted 7 lines
src/stkutil.c +7
-0+/* +* 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 ;src/stkutil.c const unsigned char *stk_pdu_from_envelope(const struct stk_envelope *envelope, · line 6015
Quoted 10 lines
src/stkutil.c +10
-0+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 ; +So I think the above code is actually incorrect. The spec talks about Language dependent (default) alignment being equal to
STK_DEFAULT_TEXT_ALIGNMENT. So if the SIM sends us a Left aligned attribute, it really means Left aligned.
Quoted 6 lines
Maybe something like this is enough?
if (start == 0)
align = STK_TEXT_FORMAT_NO_ALIGN; else align = formats[start - 1] & STK_TEXT_FORMAT_ALIGN_MASK;
I agree with you that this does not match the spec. I did this deliberately, because I had a problem deciding how to deal with the test case which you requested I include, which was defined in test_sms.c (header_test). I included the test case below for your reference.
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",
};So, you have your first formatting at start position 0x19, with format code 0x20, and color not set (0x00). Since previously you had no formatting from the beginning to byte 0x19, and this formatting specifies an alignment value of 0, if we interpret this the way you suggest we will now insert a <div > tag with left alignment specified at character 0x19, which would cause a break in the text. So, we can chose to interpret left alignment as really meaning left alignment, which would be correct according to the spec, but if this test case is truly representative of what SIMs might send us, then we are going to have some weird looking strings resulting.
How would you suggest handling this?
Re: [PATCH 1/9] stkutil: display text attributes as html
Hi Kristen,
Quoted 35 lines
I agree with you that this does not match the spec. I did this deliberately, because I had a problem deciding how to deal with the test case which you requested I include, which was defined in
test_sms.c(header_test). I included the test case below for your reference.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", };So, you have your first formatting at start position
0x19, with format code0x20, and color not set (0x00). Since previously you had no formatting from the beginning to byte0x19, and this formatting specifies an alignment value of 0, if we interpret this the way you suggest we will now insert a <div > tag with left alignment specified at character0x19, which would cause a break in the text. So, we can chose to interpret left alignment as really meaning left alignment, which would be correct according to the spec, but if this test case is truly representative of what SIMs might send us, then we are going to have some weird looking strings resulting.
Quoted 1 line
How would you suggest handling this?
The above test is pretty arbitrary, so I wouldn't worry too much about it. I think that the explicit left alignment is better and is in line with tests from 102.384.
However, maybe generating some additional SMS messages with EMS text attributes for testing might be a good idea. See if anyone has an old Sony Ericsson mobile around?
Regards,
-Denis
Re: [PATCH 1/9] stkutil: display text attributes as html
Quoted 43 lines · On Fri, 09 Jul 2010 17:13:57 -0500 Denis Kenzior <[email protected]> wrote:
Hi Kristen,
Quoted 35 lines
I agree with you that this does not match the spec. I did this deliberately, because I had a problem deciding how to deal with the test case which you requested I include, which was defined in
test_sms.c(header_test). I included the test case below for your reference.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", };So, you have your first formatting at start position
0x19, with format code0x20, and color not set (0x00). Since previously you had no formatting from the beginning to byte0x19, and this formatting specifies an alignment value of 0, if we interpret this the way you suggest we will now insert a <div > tag with left alignment specified at character0x19, which would cause a break in the text. So, we can chose to interpret left alignment as really meaning left alignment, which would be correct according to the spec, but if this test case is truly representative of what SIMs might send us, then we are going to have some weird looking strings resulting.Quoted 1 line
How would you suggest handling this?
The above test is pretty arbitrary, so I wouldn't worry too much about it. I think that the explicit left alignment is better and is in line with tests from 102.384.
Quoted 6 lines
However, maybe generating some additional SMS messages with EMS text attributes for testing might be a good idea. See if anyone has an old Sony Ericsson mobile around?
Regards,
-Denis
I'll delete this test then. Not sure if I'll be able to find a Sony Ericsson laying around, so adding other SMS messages might need to be delayed.
Re: [PATCH 1/9] stkutil: display text attributes as html
Hi Kristen,
Quoted 7 lines
Quoted 3 lines
However, maybe generating some additional SMS messages with EMS text attributes for testing might be a good idea. See if anyone has an old Sony Ericsson mobile around?
I'll delete this test then. Not sure if I'll be able to find a Sony Ericsson laying around, so adding other SMS messages might need to be delayed.
I played around with EMS yesterday and submitted a new unit test to test-sms you might find useful.
Regards,
-Denis
Re: [PATCH 1/9] stkutil: display text attributes as html
In reply to Kristen Carlson AccardiHi,
Quoted 56 lines · Kristen Carlson Accardi
Quoted 23 lines · On Thu, 08 Jul 2010 17:49:56 -0500 Denis Kenzior <[email protected]> wrote:
Quoted 13 lines
+ /*
+ * 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;
+ }src/stkutil.c const unsigned char *stk_pdu_from_envelope(const struct stk_envelope *envelope, · line 6015
Quoted 4 lines
src/stkutil.c +4
-0+ + if ((code & STK_TEXT_FORMAT_ALIGN_MASK) == align) + code |= STK_TEXT_FORMAT_NO_ALIGN; +So I think the above code is actually incorrect. The spec talks about Language dependent (default) alignment being equal to
STK_DEFAULT_TEXT_ALIGNMENT. So if the SIM sends us a Left aligned attribute, it really means Left aligned.Quoted 6 lines
Maybe something like this is enough?
if (start == 0)
align =STK_TEXT_FORMAT_NO_ALIGN;
else
align = formats[start - 1] &STK_TEXT_FORMAT_ALIGN_MASK;I agree with you that this does not match the spec. I did this deliberately, because I had a problem deciding how to deal with the test case which you requested I include, which was defined in
test_sms.c(header_test). I included the test case below for your reference.static struct
html_attr_testhtml_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",
};
Quoted 11 lines
So, you have your first formatting at start position
0x19, with format code0x20, and color not set (0x00). Since previously you had no formatting from the beginning to byte0x19, and this formatting specifies an alignment value of 0, if we interpret this the way you suggest we will now insert a <div > tag with left alignment specified at character0x19, which would cause a break in the text. So, we can chose to interpret left alignment as really meaning left alignment, which would be correct according to the spec, but if this test case is truly representative of what SIMs might send us, then we are going to have some weird looking strings resulting.
One idea to handle this was for the text_to_html function to take a language parameter (for now it could just hardcode English) and decide the default alignment based on it. Then default alignment (bits 0:3 == 3) would be treated same as left (or right).
This assumes the test is correct afterall, because it's not clear from 23 040.
Best regards
Re: [PATCH 1/9] stkutil: display text attributes as html
Hi Andrew,
Quoted 4 lines
One idea to handle this was for the
text_to_htmlfunction to take a language parameter (for now it could just hardcode English) and decide the default alignment based on it. Then default alignment (bits 0:3 == 3) would be treated same as left (or right).
Yes that is another approach, however I think that this might be moot anyway. At least on my Sony Ericsson T610 the EMS composer defaults to alignment 'Auto' (No Alignment in the protocol) and only adds Left/Right/Center alignment when the user tells it to.
Quoted 3 lines
This assumes the test is correct afterall, because it's not clear from 23 040.
I'm fairly sure the current test case is synthetic, so might not reflect how EMS messages are created in the real world.
I added another test case to test-sms with a test message composed by my T610. That is the better test case to focus on.
Regards,
-Denis
PATCH 2/9 test-stkutil: add unit test for html text attributes
In reply to Kristen Carlson Accardi--- unit/test-stkutil.c | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 115 insertions(+), 0 deletions(-)
unit/test-stkutil.c +115 -0
@@ -478,6 +478,29 @@ 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; +unsigned short attrs[256 ]; +int i; + +if (expected_html ==NULL ) +return ; + +for (i =0 ; i < test->len; i +=4 ) { + attrs[i] = test->attributes[i]; + attrs[i +1 ] = test->attributes[i +1 ]; + attrs[i +2 ] = test->attributes[i +2 ]; + attrs[i +3 ] = test->attributes[i +3 ]; + } + html =stk_text_to_html (text, attrs, test->len /4 ); + +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)
@@ -22129,6 +22152,87 @@ 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 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 ,0x00 }, + }, + .html ="1 < 2, 2 > 1, 1 & 0 == 0<br/>Special Chars are Fun" +"<br/>To Write" , +}; + +static struct html_attr_test html_attr_data_5 = { + .text ="€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€" +"€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€" +"€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€" +"€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€" +"€€€€€€€€€€€€€€€" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x00 ,0x00 ,0x94 }, + }, + .html ="<span style=\"color: #347235;background-color: #FFFFFF;\">" +"€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€" +"€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€" +"€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€" +"€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€" +"€€€€€€€€€€€€€€€</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 );
@@ -24136,5 +24240,16 @@ 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); +g_test_add_data_func ("/teststk/HTML Attribute Test 4" , + &html_attr_data_4, test_html_attr); +g_test_add_data_func ("/teststk/HTML Attribute Test 5" , + &html_attr_data_5, test_html_attr); +return g_test_run (); }
Signature · 1 line
1.6.6.1
PATCH 3/9 test-stkutil: add html attribute test for Display Text tests
In reply to Kristen Carlson Accardi--- unit/test-stkutil.c | 204 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 204 insertions(+), 0 deletions(-)
unit/test-stkutil.c +204 -0
@@ -537,6 +537,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 ,
@@ -632,6 +633,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 };
@@ -737,6 +801,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),
@@ -777,6 +960,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);
@@ -22259,6 +22445,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",
Signature · 1 line
1.6.6.1
PATCH 4/9 test-stkutil: add html attribute tests for get_inkey_test
In reply to Kristen Carlson Accardi--- unit/test-stkutil.c | 69 +++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 53 insertions(+), 16 deletions(-)
unit/test-stkutil.c +53 -16
@@ -977,6 +977,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 ,
@@ -1582,7 +1583,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 = {
@@ -1600,7 +1603,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 = {
@@ -1618,7 +1624,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 = {
@@ -1636,7 +1645,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 = {
@@ -1647,7 +1658,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 = {
@@ -1665,7 +1678,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 = {
@@ -1676,7 +1691,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 = {
@@ -1694,7 +1711,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 = {
@@ -1705,7 +1724,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 = {
@@ -1723,7 +1744,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 = {
@@ -1734,7 +1757,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 = {
@@ -1752,7 +1777,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 = {
@@ -1763,7 +1790,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 = {
@@ -1781,7 +1810,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 = {
@@ -1792,7 +1823,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 = {
@@ -1817,7 +1850,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 = {
@@ -1899,6 +1934,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);
Signature · 1 line
1.6.6.1
PATCH 5/9 test-stkutil: add html attribute tests for get_input_test
In reply to Kristen Carlson Accardi--- unit/test-stkutil.c | 69 +++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 53 insertions(+), 16 deletions(-)
unit/test-stkutil.c +53 -16
@@ -1951,6 +1951,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 ,
@@ -2786,7 +2787,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 = {
@@ -2812,7 +2815,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 = {
@@ -2838,7 +2844,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 = {
@@ -2864,7 +2873,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 = {
@@ -2879,7 +2890,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 = {
@@ -2905,7 +2918,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 = {
@@ -2920,7 +2935,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 = {
@@ -2946,7 +2963,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 = {
@@ -2961,7 +2980,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 = {
@@ -2987,7 +3008,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 = {
@@ -3002,7 +3025,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 = {
@@ -3028,7 +3053,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 = {
@@ -3043,7 +3070,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 = {
@@ -3069,7 +3098,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 = {
@@ -3084,7 +3115,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 = {
@@ -3110,7 +3143,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 = {
@@ -3244,6 +3279,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);
Signature · 1 line
1.6.6.1
PATCH 6/9 test-stkutil: add html attribute tests for play_tone_test
In reply to Kristen Carlson Accardi--- unit/test-stkutil.c | 69 +++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 53 insertions(+), 16 deletions(-)
unit/test-stkutil.c +53 -16
@@ -3332,6 +3332,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 ,
@@ -4102,7 +4103,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 = {
@@ -4130,7 +4133,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 = {
@@ -4158,7 +4164,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 = {
@@ -4186,7 +4195,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 = {
@@ -4202,7 +4213,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 = {
@@ -4230,7 +4243,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 = {
@@ -4246,7 +4261,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 = {
@@ -4274,7 +4291,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 = {
@@ -4290,7 +4309,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 = {
@@ -4318,7 +4339,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 = {
@@ -4334,7 +4357,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 = {
@@ -4362,7 +4387,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 = {
@@ -4378,7 +4405,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 = {
@@ -4406,7 +4435,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 = {
@@ -4422,7 +4453,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 = {
@@ -4450,7 +4483,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 = {
@@ -4560,6 +4595,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);
Signature · 1 line
1.6.6.1
PATCH 7/9 test-stkutil: add html attribute test for setup_menu_test
In reply to Kristen Carlson Accardi--- unit/test-stkutil.c | 50 ++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 38 insertions(+), 12 deletions(-)
unit/test-stkutil.c +38 -12
@@ -4657,6 +4657,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 ,
@@ -5470,7 +5471,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 = {
@@ -5503,7 +5506,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 = {
@@ -5540,7 +5546,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 = {
@@ -5573,7 +5582,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 = {
@@ -5594,7 +5605,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 = {
@@ -5627,7 +5640,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 = {
@@ -5648,7 +5663,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 = {
@@ -5669,7 +5686,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 = {
@@ -5690,7 +5709,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 = {
@@ -5711,7 +5732,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 = {
@@ -5732,7 +5755,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 = {
@@ -5875,7 +5900,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); }
Signature · 1 line
1.6.6.1
PATCH 8/9 test-stkutil: add html attribute test for select_item_test
In reply to Kristen Carlson Accardi--- unit/test-stkutil.c | 69 +++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 53 insertions(+), 16 deletions(-)
unit/test-stkutil.c +53 -16
@@ -5944,6 +5944,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 ,
@@ -6990,7 +6991,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 = {
@@ -7020,7 +7023,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 = {
@@ -7050,7 +7056,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 = {
@@ -7080,7 +7089,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 = {
@@ -7099,7 +7110,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 = {
@@ -7129,7 +7142,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 = {
@@ -7148,7 +7163,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 = {
@@ -7178,7 +7195,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 = {
@@ -7197,7 +7216,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 = {
@@ -7227,7 +7248,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 = {
@@ -7246,7 +7269,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 = {
@@ -7276,7 +7301,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 = {
@@ -7295,7 +7322,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 = {
@@ -7325,7 +7354,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 = {
@@ -7344,7 +7375,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 = {
@@ -7374,7 +7407,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 = {
@@ -7502,6 +7537,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);
Signature · 1 line
1.6.6.1
PATCH 9/9 test-stkutil: add html attribute tests for setup idle mode tests
In reply to Kristen Carlson Accardi--- unit/test-stkutil.c | 69 +++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 53 insertions(+), 16 deletions(-)
unit/test-stkutil.c +53 -16
@@ -13932,6 +13932,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 ,
@@ -14364,7 +14365,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 = {
@@ -14382,7 +14385,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 = {
@@ -14400,7 +14406,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 = {
@@ -14418,7 +14427,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 = {
@@ -14429,7 +14440,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 = {
@@ -14447,7 +14460,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 = {
@@ -14458,7 +14473,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 = {
@@ -14476,7 +14493,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 = {
@@ -14487,7 +14506,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 = {
@@ -14505,7 +14526,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 = {
@@ -14516,7 +14539,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 = {
@@ -14534,7 +14559,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 = {
@@ -14545,7 +14572,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 = {
@@ -14563,7 +14592,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 = {
@@ -14574,7 +14605,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 = {
@@ -14592,7 +14625,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 = {
@@ -14637,6 +14672,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);
Signature · 1 line
1.6.6.1