1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

Update box test with some click injections

This commit is contained in:
Dave Davenport 2016-10-25 18:26:18 +02:00
parent 2ee72b6c12
commit 8a186726f8

View file

@ -23,6 +23,11 @@ unsigned int test =0;
} \
}
static gboolean test_widget_clicked ( G_GNUC_UNUSED widget *wid, G_GNUC_UNUSED xcb_button_press_event_t* xce, G_GNUC_UNUSED void *data )
{
return TRUE;
}
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
{
{
@ -146,4 +151,32 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
TASSERTE ( wid5->y, 200-20-20-6);
widget_free ( WIDGET ( b ) );
}
{
box *b = box_create ( BOX_VERTICAL, 0, 0, 20, 100 );
box_set_padding ( b, 5 );
widget *wid1 = g_malloc0(sizeof(widget));
widget_enable(wid1);
wid1->clicked = test_widget_clicked;
box_add ( b , WIDGET( wid1 ), TRUE, FALSE );
widget *wid2 = g_malloc0(sizeof(widget));
widget_enable(wid2);
box_add ( b , WIDGET( wid2 ), TRUE, FALSE );
xcb_button_press_event_t xce;
xce.event_x = 10;
xce.event_y = 60;
TASSERTE ( widget_clicked ( WIDGET(b), &xce ), 0);
xce.event_y = 50;
TASSERTE ( widget_clicked ( WIDGET(b), &xce ), 0);
xce.event_y = 45;
TASSERTE ( widget_clicked ( WIDGET(b), &xce ), 1);
widget_disable ( wid2 );
xce.event_y = 60;
TASSERTE ( widget_clicked ( WIDGET(b), &xce ), 1);
widget_disable ( wid1 );
widget_enable ( wid2 );
TASSERTE ( widget_clicked ( WIDGET(b), &xce ), 0);
widget_free ( WIDGET ( b ) );
}
}