[Test] Fix the test.

This commit is contained in:
Dave Davenport 2021-06-15 12:31:32 +02:00
parent 0f21541327
commit 74144db77d
14 changed files with 144 additions and 13 deletions

View File

@ -218,22 +218,22 @@ static char * combi_mgrv ( const Mode *sw, unsigned int selected_line, int *stat
char * str = retv = mode_get_display_value ( pd->switchers[i].mode, selected_line - pd->starts[i], state, attr_list, TRUE );
const char *dname = mode_get_display_name ( pd->switchers[i].mode );
if ( !config.combi_hide_mode_prefix ) {
retv = g_strdup_printf ( "%s %s", dname, str );
g_free ( str );
}
retv = g_strdup_printf ( "%s %s", dname, str );
g_free ( str );
if ( attr_list != NULL ) {
if ( attr_list != NULL ) {
ThemeWidget *wid = rofi_config_find_widget ( sw->name, NULL, TRUE );
Property *p = rofi_theme_find_property ( wid, P_COLOR, pd->switchers[i].mode->name, TRUE );
if ( p != NULL ) {
PangoAttribute *pa = pango_attr_foreground_new (
p->value.color.red * 65535,
p->value.color.green * 65535,
p->value.color.blue * 65535 );
pa->start_index = PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING;
pa->end_index = strlen ( dname );
*attr_list = g_list_append ( *attr_list, pa );
PangoAttribute *pa = pango_attr_foreground_new (
p->value.color.red * 65535,
p->value.color.green * 65535,
p->value.color.blue * 65535 );
pa->start_index = PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING;
pa->end_index = strlen ( dname );
*attr_list = g_list_append ( *attr_list, pa );
}
}
}
return retv;
}

View File

@ -153,8 +153,15 @@ void mode_set_private_data ( Mode *mode, void *pd )
const char *mode_get_display_name ( const Mode *mode )
{
if ( mode->display_name != NULL ) {
return mode->display_name;
ThemeWidget *wid = rofi_config_find_widget ( mode->name, NULL, TRUE );
if ( wid ) {
Property *p = rofi_theme_find_property ( wid, P_STRING, "display-name", FALSE );
if ( p != NULL ) {
return p->value.s;
}
}
if ( mode->display_name != NULL ) {
return mode->display_name;
}
return mode->name;
}

View File

@ -16,6 +16,8 @@ const char * const PropertyTypeName[P_NUM_TYPES] = {
"Boolean",
/** Color */
"Color",
/** Image */
"Iamge",
/** Padding */
"Padding",
/** Link to global setting */

View File

@ -62,6 +62,17 @@ unsigned int test =0;
abort ( ); \
} \
}
ThemeWidget *rofi_configuration = NULL;
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
int monitor_active ( G_GNUC_UNUSED workarea *mon )

View File

@ -55,6 +55,16 @@ static int test = 0;
}
#include "theme.h"
ThemeWidget *rofi_theme = NULL;
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
gboolean rofi_theme_parse_string ( const char *string )
{

View File

@ -56,6 +56,16 @@ static int test = 0;
}
ThemeWidget *rofi_theme = NULL;
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
double textbox_get_estimated_char_height ( void )
{
return 12.0;

View File

@ -48,6 +48,16 @@ static int test = 0;
#include "theme.h"
ThemeWidget *rofi_theme = NULL;
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
gboolean rofi_theme_parse_string ( const char *string )
{
return FALSE;

View File

@ -63,12 +63,24 @@ static int test = 0;
}
#include "widgets/textbox.h"
ThemeWidget *rofi_theme = NULL;
gboolean rofi_theme_parse_string ( const char *string )
{
return FALSE;
}
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
double textbox_get_estimated_char_height ( void )
{
return 12.0;

View File

@ -45,6 +45,16 @@
ThemeWidget *rofi_theme = NULL;
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
gboolean rofi_theme_parse_string ( G_GNUC_UNUSED const char *string )
{
return FALSE;

View File

@ -49,6 +49,16 @@
ThemeWidget *rofi_theme = NULL;
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
gboolean rofi_theme_parse_string ( const char *string )
{
return FALSE;

View File

@ -56,6 +56,18 @@ unsigned int test =0;
} \
}
ThemeWidget *rofi_configuration = NULL;
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
int monitor_active ( G_GNUC_UNUSED workarea *mon )
{
return 0;

View File

@ -52,6 +52,19 @@ unsigned int normal_window_mode = 0;
#include "view.h"
ThemeWidget *rofi_configuration = NULL;
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, G_GNUC_UNUSED char **error )
{
return FALSE;

View File

@ -48,6 +48,17 @@
#define REAL_COMPARE_DELTA 0.001
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup )
{
fputs ( msg, stderr );

View File

@ -43,6 +43,19 @@ unsigned int test =0;
assert ( a ); \
printf ( "Test %3u passed (%s)\n", ++test, # a ); \
}
ThemeWidget *rofi_configuration = NULL;
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, G_GNUC_UNUSED char **error )
{
return FALSE;