mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
Update box test with some click injections
This commit is contained in:
parent
2ee72b6c12
commit
8a186726f8
1 changed files with 40 additions and 7 deletions
|
@ -23,11 +23,16 @@ 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 )
|
||||
{
|
||||
{
|
||||
box *b = box_create ( BOX_HORIZONTAL, 0, 0, 100, 20 );
|
||||
box_set_padding ( b, 5 );
|
||||
box *b = box_create ( BOX_HORIZONTAL, 0, 0, 100, 20 );
|
||||
box_set_padding ( b, 5 );
|
||||
|
||||
widget *wid1 = g_malloc0(sizeof(widget));
|
||||
box_add ( b , WIDGET( wid1 ), TRUE, FALSE );
|
||||
|
@ -35,7 +40,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
|||
TASSERTE ( wid1->h, 0);
|
||||
TASSERTE ( wid1->w, 0 );
|
||||
widget_enable ( WIDGET ( wid1 ) );
|
||||
widget_update ( WIDGET ( b ) ) ;
|
||||
widget_update ( WIDGET ( b ) ) ;
|
||||
// Widget enabled. so width allocated.
|
||||
TASSERTE ( wid1->h, 20);
|
||||
TASSERTE ( wid1->w, 100 );
|
||||
|
@ -73,7 +78,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
|||
TASSERTE ( wid3->h, 20);
|
||||
TASSERTE ( wid3->w, 20);
|
||||
TASSERTE ( box_get_fixed_pixels ( b ) , 30 );
|
||||
|
||||
|
||||
widget *wid4 = g_malloc0(sizeof(widget));
|
||||
widget_enable ( WIDGET ( wid4 ) );
|
||||
widget_resize ( WIDGET ( wid4 ), 20, 20 );
|
||||
|
@ -87,8 +92,8 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
|||
widget_free ( WIDGET ( b ) );
|
||||
}
|
||||
{
|
||||
box *b = box_create ( BOX_VERTICAL, 0, 0, 20, 100 );
|
||||
box_set_padding ( b, 5 );
|
||||
box *b = box_create ( BOX_VERTICAL, 0, 0, 20, 100 );
|
||||
box_set_padding ( b, 5 );
|
||||
|
||||
widget *wid1 = g_malloc0(sizeof(widget));
|
||||
box_add ( b , WIDGET( wid1 ), TRUE, FALSE );
|
||||
|
@ -96,7 +101,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
|||
TASSERTE ( wid1->h, 0);
|
||||
TASSERTE ( wid1->w, 0 );
|
||||
widget_enable ( WIDGET ( wid1 ) );
|
||||
widget_update ( WIDGET ( b ) ) ;
|
||||
widget_update ( WIDGET ( b ) ) ;
|
||||
// Widget enabled. so width allocated.
|
||||
TASSERTE ( wid1->h, 100);
|
||||
TASSERTE ( wid1->w, 20 );
|
||||
|
@ -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 ) );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue