mirror of
https://github.com/lbonn/rofi
synced 2024-11-10 14:24:27 +00:00
Fix tests.
This commit is contained in:
parent
acfc07a63e
commit
28ca3cb510
3 changed files with 17 additions and 4 deletions
|
@ -377,7 +377,7 @@ void rofi_theme_widget_add_properties ( ThemeWidget *widget, GHashTable *table )
|
|||
|
||||
static inline ThemeWidget *rofi_theme_find_single ( ThemeWidget *widget, const char *name )
|
||||
{
|
||||
for ( unsigned int j = 0; j < widget->num_widgets; j++ ) {
|
||||
for ( unsigned int j = 0; widget && j < widget->num_widgets; j++ ) {
|
||||
if ( g_strcmp0 ( widget->widgets[j]->name, name ) == 0 ) {
|
||||
return widget->widgets[j];
|
||||
}
|
||||
|
|
|
@ -103,6 +103,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
|||
widget_resize ( WIDGET (b), 100, 20);
|
||||
|
||||
widget *wid1 = g_malloc0(sizeof(widget));
|
||||
wid1->parent = WIDGET(b);
|
||||
box_add ( b , WIDGET( wid1 ), TRUE );
|
||||
// Widget not enabled. no width allocated.
|
||||
TASSERTE ( wid1->h, 0);
|
||||
|
@ -113,6 +114,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
|||
TASSERTE ( wid1->h, 20);
|
||||
TASSERTE ( wid1->w, 100 );
|
||||
widget *wid2 = g_malloc0(sizeof(widget));
|
||||
wid2->parent = WIDGET (b) ;
|
||||
widget_enable ( WIDGET ( wid2 ) );
|
||||
box_add ( b , WIDGET( wid2 ), TRUE );
|
||||
TASSERTE ( wid1->h, 20);
|
||||
|
@ -121,6 +123,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
|||
TASSERTE ( wid2->w, 49);
|
||||
|
||||
widget *wid3 = g_malloc0(sizeof(widget));
|
||||
wid3->parent = WIDGET (b);
|
||||
widget_enable ( WIDGET ( wid3 ) );
|
||||
box_add ( b , WIDGET( wid3 ), FALSE );
|
||||
TASSERTE ( wid1->h, 20);
|
||||
|
@ -148,11 +151,13 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
|||
// TASSERTE ( box_get_fixed_pixels ( b ) , 24 );
|
||||
|
||||
widget *wid4 = g_malloc0(sizeof(widget));
|
||||
wid4->parent = WIDGET ( b );
|
||||
widget_enable ( WIDGET ( wid4 ) );
|
||||
widget_resize ( WIDGET ( wid4 ), 20, 20 );
|
||||
box_add ( b , WIDGET( wid4 ), FALSE );
|
||||
TASSERTE ( wid4->x, 200-20);
|
||||
widget *wid5 = g_malloc0(sizeof(widget));
|
||||
wid5->parent = WIDGET ( b );
|
||||
widget_enable ( WIDGET ( wid5 ) );
|
||||
widget_resize ( WIDGET ( wid5 ), 20, 20 );
|
||||
box_add ( b , WIDGET( wid5 ), TRUE );
|
||||
|
@ -165,6 +170,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
|||
//box_set_padding ( b, 5 );
|
||||
|
||||
widget *wid1 = g_malloc0(sizeof(widget));
|
||||
wid1->parent = WIDGET ( b );
|
||||
box_add ( b , WIDGET( wid1 ), TRUE );
|
||||
// Widget not enabled. no width allocated.
|
||||
TASSERTE ( wid1->h, 0);
|
||||
|
@ -175,6 +181,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
|||
TASSERTE ( wid1->h, 100);
|
||||
TASSERTE ( wid1->w, 20 );
|
||||
widget *wid2 = g_malloc0(sizeof(widget));
|
||||
wid2->parent = WIDGET ( b );
|
||||
widget_enable ( WIDGET ( wid2 ) );
|
||||
box_add ( b , WIDGET( wid2 ), TRUE );
|
||||
TASSERTE ( wid1->w, 20);
|
||||
|
@ -183,6 +190,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
|||
TASSERTE ( wid2->h, 49);
|
||||
|
||||
widget *wid3 = g_malloc0(sizeof(widget));
|
||||
wid3->parent = WIDGET ( b );
|
||||
widget_enable ( WIDGET ( wid3 ) );
|
||||
box_add ( b , WIDGET( wid3 ), FALSE );
|
||||
TASSERTE ( wid1->w, 20);
|
||||
|
@ -209,11 +217,13 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
|||
TASSERTE ( wid3->h, 20);
|
||||
// TASSERTE ( box_get_fixed_pixels ( b ) , 4 );
|
||||
widget *wid4 = g_malloc0(sizeof(widget));
|
||||
wid4->parent = WIDGET ( b );
|
||||
widget_enable ( WIDGET ( wid4 ) );
|
||||
widget_resize ( WIDGET ( wid4 ), 20, 20 );
|
||||
box_add ( b , WIDGET( wid4 ), FALSE );
|
||||
TASSERTE ( wid4->y, 180);
|
||||
widget *wid5 = g_malloc0(sizeof(widget));
|
||||
wid5->parent = WIDGET ( b );
|
||||
widget_enable ( WIDGET ( wid5 ) );
|
||||
widget_resize ( WIDGET ( wid5 ), 20, 20 );
|
||||
box_add ( b , WIDGET( wid5 ), TRUE );
|
||||
|
@ -225,14 +235,17 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
|||
widget_resize ( WIDGET (b), 20, 90);
|
||||
//box_set_padding ( b, 5 );
|
||||
widget *wid1 = g_malloc0(sizeof(widget));
|
||||
wid1->parent = WIDGET ( b );
|
||||
wid1->type = 1;
|
||||
widget_enable(wid1);
|
||||
box_add ( b , WIDGET( wid1 ), TRUE );
|
||||
widget *wid2 = g_malloc0(sizeof(widget));
|
||||
wid2->parent = WIDGET ( b );
|
||||
wid2->type = 1;
|
||||
widget_enable(wid2);
|
||||
box_add ( b , WIDGET( wid2 ), TRUE );
|
||||
widget *wid3 = g_malloc0(sizeof(widget));
|
||||
wid3->parent = WIDGET ( b );
|
||||
wid3->type = 2;
|
||||
widget_enable(wid3);
|
||||
box_add ( b , WIDGET( wid3 ), TRUE );
|
||||
|
|
|
@ -927,7 +927,7 @@ START_TEST ( test_properties_color_names )
|
|||
char * str = g_strdup_printf("* { color: %s;}", CSSColors[iter].name);
|
||||
rofi_theme_parse_string(str);
|
||||
ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE );
|
||||
Property *p = rofi_theme_find_property ( twid, P_COLOR, "color", FALSE );
|
||||
Property *p = rofi_theme_find_property ( twid, P_COLOR, "text-color", FALSE );
|
||||
ck_assert_ptr_nonnull ( p );
|
||||
ck_assert_double_eq ( p->value.color.alpha , 1.0 );
|
||||
ck_assert_double_eq_tol ( p->value.color.red , CSSColors[iter].r/255.0, 0.004);
|
||||
|
@ -939,7 +939,7 @@ START_TEST ( test_properties_color_names )
|
|||
{
|
||||
rofi_theme_parse_string("* {color: transparent;}");
|
||||
ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE );
|
||||
Property *p = rofi_theme_find_property ( twid, P_COLOR, "color", FALSE );
|
||||
Property *p = rofi_theme_find_property ( twid, P_COLOR, "text-color", FALSE );
|
||||
ck_assert_ptr_nonnull ( p );
|
||||
ck_assert_double_eq ( p->value.color.alpha , 0.0 );
|
||||
ck_assert_double_eq_tol ( p->value.color.red , 0.0, 0.004);
|
||||
|
@ -957,7 +957,7 @@ START_TEST ( test_properties_color_names_alpha )
|
|||
char * str = g_strdup_printf("* { color: %s / %d %%;}", CSSColors[iter].name, iter%101);
|
||||
rofi_theme_parse_string(str);
|
||||
ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE );
|
||||
Property *p = rofi_theme_find_property ( twid, P_COLOR, "color", FALSE );
|
||||
Property *p = rofi_theme_find_property ( twid, P_COLOR, "text-color", FALSE );
|
||||
ck_assert_ptr_nonnull ( p );
|
||||
ck_assert_double_eq ( p->value.color.alpha , (iter%101)/100.0);
|
||||
ck_assert_double_eq_tol ( p->value.color.red , CSSColors[iter].r/255.0, 0.004);
|
||||
|
|
Loading…
Reference in a new issue