mirror of
https://github.com/lbonn/rofi
synced 2024-11-15 00:27:36 +00:00
[Lexer] Fix wrong division factor for #RGB color parsing (15 not 16)
This commit is contained in:
parent
38f91e8953
commit
d79423f2cf
2 changed files with 54 additions and 3 deletions
|
@ -426,9 +426,9 @@ if ( queue == NULL ){
|
|||
union { uint16_t val; struct { unsigned char b:4,g:4,r:4,a :4;};} val;
|
||||
val.val = (uint16_t )g_ascii_strtoull ( &yytext[1], NULL, 16);
|
||||
yylval->colorval.alpha = 1.0;
|
||||
yylval->colorval.red = val.r/16.0;
|
||||
yylval->colorval.green = val.g/16.0;
|
||||
yylval->colorval.blue = val.b/16.0;
|
||||
yylval->colorval.red = val.r/15.0;
|
||||
yylval->colorval.green = val.g/15.0;
|
||||
yylval->colorval.blue = val.b/15.0;
|
||||
return T_COLOR;
|
||||
}
|
||||
<PROPERTIES>rgba\({NUMBER}{1,3},{NUMBER}{1,3},{NUMBER}{1,3},[01](\.{NUMBER}+)?\) {
|
||||
|
|
|
@ -297,6 +297,57 @@ int main ( int argc, char ** argv )
|
|||
rofi_theme_free ( rofi_theme );
|
||||
rofi_theme = NULL;
|
||||
}
|
||||
{
|
||||
rofi_theme = NULL;
|
||||
error = 0;
|
||||
rofi_theme_parse_string ( "* { none: none; bold: bold; underline: underline; italic: italic;}");
|
||||
TASSERT ( error == 0 );
|
||||
ThemeHighlight th = { HL_BOLD, {0.0,0.0,0.0,0.0}};
|
||||
th = rofi_theme_get_highlight ( &wid, "none", th);
|
||||
TASSERT ( th.style == HL_NONE );
|
||||
th = rofi_theme_get_highlight ( &wid, "underline", th);
|
||||
TASSERT ( th.style == HL_UNDERLINE);
|
||||
th = rofi_theme_get_highlight ( &wid, "italic", th);
|
||||
TASSERT ( th.style == HL_ITALIC);
|
||||
th = rofi_theme_get_highlight ( &wid, "bold", th);
|
||||
TASSERT ( th.style == HL_BOLD);
|
||||
|
||||
rofi_theme_parse_string ( "* { boldu: bold underline ; boldi: bold italic; underlinei: underline italic; italicu: italic underline;}");
|
||||
th = rofi_theme_get_highlight ( &wid, "boldu", th);
|
||||
TASSERT ( th.style == (HL_UNDERLINE|HL_BOLD));
|
||||
th = rofi_theme_get_highlight ( &wid, "boldi", th);
|
||||
TASSERT ( th.style == (HL_ITALIC|HL_BOLD));
|
||||
th = rofi_theme_get_highlight ( &wid, "underlinei", th);
|
||||
TASSERT ( th.style == (HL_ITALIC|HL_UNDERLINE));
|
||||
th = rofi_theme_get_highlight ( &wid, "italicu", th);
|
||||
TASSERT ( th.style == (HL_ITALIC|HL_UNDERLINE));
|
||||
rofi_theme_free ( rofi_theme );
|
||||
rofi_theme = NULL;
|
||||
}
|
||||
{
|
||||
rofi_theme = NULL;
|
||||
error = 0;
|
||||
rofi_theme_parse_string ( "* { red: #F00; green: #0F0; blue: #00F; }");
|
||||
TASSERT ( error == 0 );
|
||||
ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE );
|
||||
Property *p = rofi_theme_find_property ( twid, P_COLOR, "red", FALSE );
|
||||
TASSERT ( p != NULL );
|
||||
TASSERT ( p->value.color.red == 1 );
|
||||
TASSERT ( p->value.color.green == 0 );
|
||||
TASSERT ( p->value.color.blue == 0 );
|
||||
p = rofi_theme_find_property ( twid, P_COLOR, "green", FALSE );
|
||||
TASSERT ( p != NULL );
|
||||
TASSERT ( p->value.color.red == 0 );
|
||||
TASSERT ( p->value.color.green == 1 );
|
||||
TASSERT ( p->value.color.blue == 0 );
|
||||
p = rofi_theme_find_property ( twid, P_COLOR, "blue", FALSE );
|
||||
TASSERT ( p != NULL );
|
||||
TASSERT ( p->value.color.red == 0 );
|
||||
TASSERT ( p->value.color.green == 0 );
|
||||
TASSERT ( p->value.color.blue == 1 );
|
||||
rofi_theme_free ( rofi_theme );
|
||||
rofi_theme = NULL;
|
||||
}
|
||||
{
|
||||
rofi_theme = NULL;
|
||||
rofi_theme_parse_file ("/dev/null");
|
||||
|
|
Loading…
Reference in a new issue