From f7060ca1af5cfea64ee81508e1ce0dddab49822b Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Tue, 1 Jun 2021 14:21:21 +0200 Subject: [PATCH] Fix tests. --- Makefile.am | 4 ++++ meson.build | 4 ++++ test/helper-config-cmdline-parser.c | 22 ++++++++++++++++++++++ test/helper-expand.c | 22 ++++++++++++++++++++++ test/helper-pidfile.c | 21 +++++++++++++++++++++ test/helper-test.c | 22 ++++++++++++++++++++++ 6 files changed, 95 insertions(+) diff --git a/Makefile.am b/Makefile.am index 144c4ff5..55713287 100644 --- a/Makefile.am +++ b/Makefile.am @@ -350,6 +350,7 @@ helper_pidfile_SOURCES=\ include/mode.h\ include/mode-private.h\ source/helper.c\ + source/theme.c\ source/rofi-types.c\ include/rofi-types.h\ include/helper.h\ @@ -464,6 +465,7 @@ helper_test_SOURCES=\ include/helper-theme.h\ include/xrmoptions.h\ source/xrmoptions.c\ + source/theme.c\ source/rofi-types.c\ include/rofi-types.h\ test/helper-test.c @@ -501,6 +503,7 @@ helper_expand_SOURCES=\ include/mode.h\ include/mode-private.h\ source/helper.c\ + source/theme.c\ include/helper.h\ include/helper-theme.h\ include/xrmoptions.h\ @@ -522,6 +525,7 @@ helper_config_cmdline_parser_SOURCES=\ include/mode.h\ include/mode-private.h\ source/helper.c\ + source/theme.c\ source/rofi-types.c\ include/rofi-types.h\ include/helper.h\ diff --git a/meson.build b/meson.build index 4ab0bc71..62e7f780 100644 --- a/meson.build +++ b/meson.build @@ -301,6 +301,7 @@ test('helper_pidfile test', executable('helper_pidfile.test', [ ], objects: rofi.extract_objects([ 'config/config.c', + 'source/theme.c', 'source/helper.c', 'source/xrmoptions.c', 'source/rofi-types.c', @@ -380,6 +381,7 @@ test('helper test', executable('helper.test', [ ], objects: rofi.extract_objects([ 'config/config.c', + 'source/theme.c', 'source/helper.c', 'source/xrmoptions.c', 'source/rofi-types.c', @@ -392,6 +394,7 @@ test('helper_expand test', executable('helper_expand.test', [ ], objects: rofi.extract_objects([ 'config/config.c', + 'source/theme.c', 'source/helper.c', 'source/xrmoptions.c', 'source/rofi-types.c', @@ -404,6 +407,7 @@ test('helper_config_cmdline_parser test', executable('helper_config_cmdline_pars ], objects: rofi.extract_objects([ 'config/config.c', + 'source/theme.c', 'source/helper.c', 'source/xrmoptions.c', 'source/rofi-types.c', diff --git a/test/helper-config-cmdline-parser.c b/test/helper-config-cmdline-parser.c index 3e1ddcb5..14e8e926 100644 --- a/test/helper-config-cmdline-parser.c +++ b/test/helper-config-cmdline-parser.c @@ -37,6 +37,7 @@ #include "xcb-internal.h" #include "rofi.h" #include "settings.h" +#include "widgets/textbox.h" static int test = 0; @@ -52,6 +53,27 @@ static int test = 0; abort ( ); \ } \ } +#include "theme.h" +ThemeWidget *rofi_theme = NULL; + +gboolean rofi_theme_parse_string ( const char *string ) +{ + return FALSE; +} + +double textbox_get_estimated_char_height ( void ) +{ + return 12.0; +} +void rofi_view_get_current_monitor ( int *width, int *height ) +{ +*width = 1920; +*height = 1080; +} +double textbox_get_estimated_ch ( void ) +{ + return 9.0; +} void rofi_add_error_message ( G_GNUC_UNUSED GString *msg ) { } diff --git a/test/helper-expand.c b/test/helper-expand.c index 628ffc7e..f589309b 100644 --- a/test/helper-expand.c +++ b/test/helper-expand.c @@ -32,11 +32,13 @@ #include #include #include +#include "theme.h" #include "display.h" #include "xcb.h" #include "xcb-internal.h" #include "rofi.h" #include "settings.h" +#include "widgets/textbox.h" static int test = 0; @@ -52,6 +54,26 @@ static int test = 0; abort ( ); \ } \ } +ThemeWidget *rofi_theme = NULL; + +double textbox_get_estimated_char_height ( void ) +{ + return 12.0; +} +void rofi_view_get_current_monitor ( int *width, int *height ) +{ +*width = 1920; +*height = 1080; +} +double textbox_get_estimated_ch ( void ) +{ + return 9.0; +} +gboolean rofi_theme_parse_string ( const char *string ) +{ +return 0; +} + void rofi_add_error_message ( G_GNUC_UNUSED GString *msg ) { } diff --git a/test/helper-pidfile.c b/test/helper-pidfile.c index e6550a4c..31e42770 100644 --- a/test/helper-pidfile.c +++ b/test/helper-pidfile.c @@ -37,6 +37,7 @@ #include "xcb-internal.h" #include "rofi.h" #include "settings.h" +#include "widgets/textbox.h" static int test = 0; @@ -44,6 +45,26 @@ static int test = 0; assert ( a ); \ printf ( "Test %i passed (%s)\n", ++test, # a ); \ } +#include "theme.h" +ThemeWidget *rofi_theme = NULL; + +gboolean rofi_theme_parse_string ( const char *string ) +{ + return FALSE; +} +double textbox_get_estimated_char_height ( void ) +{ + return 12.0; +} +void rofi_view_get_current_monitor ( int *width, int *height ) +{ +*width = 1920; +*height = 1080; +} +double textbox_get_estimated_ch ( void ) +{ + return 9.0; +} void rofi_add_error_message ( G_GNUC_UNUSED GString *msg ) { } diff --git a/test/helper-test.c b/test/helper-test.c index e30add0f..2d145dbc 100644 --- a/test/helper-test.c +++ b/test/helper-test.c @@ -32,6 +32,7 @@ #include #include #include +#include "theme.h" #include "display.h" #include "xcb.h" #include "xcb-internal.h" @@ -60,6 +61,27 @@ static int test = 0; abort ( ); \ } \ } + +#include "widgets/textbox.h" +ThemeWidget *rofi_theme = NULL; +gboolean rofi_theme_parse_string ( const char *string ) +{ + return FALSE; +} + +double textbox_get_estimated_char_height ( void ) +{ + return 12.0; +} +void rofi_view_get_current_monitor ( int *width, int *height ) +{ +*width = 1920; +*height = 1080; +} +double textbox_get_estimated_ch ( void ) +{ + return 9.0; +} void rofi_add_error_message ( G_GNUC_UNUSED GString *msg ) {