1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

Fix tests. (#1323)

This commit is contained in:
TonCherAmi 2021-06-05 13:58:07 +03:00 committed by GitHub
parent 95c4e0424e
commit 12b2b38578
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 7 deletions

View file

@ -543,6 +543,7 @@ mode_test_SOURCES=\
test/mode-test.c\ test/mode-test.c\
source/dialogs/help-keys.c\ source/dialogs/help-keys.c\
source/helper.c\ source/helper.c\
source/theme.c\
source/mode.c\ source/mode.c\
source/rofi-types.c\ source/rofi-types.c\
include/rofi-types.h\ include/rofi-types.h\
@ -558,6 +559,7 @@ helper_tokenize_SOURCES=\
include/mode.h\ include/mode.h\
include/mode-private.h\ include/mode-private.h\
source/helper.c\ source/helper.c\
source/theme.c\
source/rofi-types.c\ source/rofi-types.c\
include/rofi-types.h\ include/rofi-types.h\
include/helper.h\ include/helper.h\

View file

@ -441,6 +441,7 @@ if check.found()
'config/config.c', 'config/config.c',
'source/dialogs/help-keys.c', 'source/dialogs/help-keys.c',
'source/helper.c', 'source/helper.c',
'source/theme.c',
'source/mode.c', 'source/mode.c',
'source/xrmoptions.c', 'source/xrmoptions.c',
'source/rofi-types.c', 'source/rofi-types.c',
@ -455,6 +456,7 @@ if check.found()
objects: rofi.extract_objects([ objects: rofi.extract_objects([
'config/config.c', 'config/config.c',
'source/helper.c', 'source/helper.c',
'source/theme.c',
'source/xrmoptions.c', 'source/xrmoptions.c',
'source/rofi-types.c', 'source/rofi-types.c',
]), ]),

View file

@ -33,14 +33,36 @@
#include <string.h> #include <string.h>
#include <xcb/xcb_ewmh.h> #include <xcb/xcb_ewmh.h>
#include "display.h" #include "display.h"
#include "theme.h"
#include "xcb.h" #include "xcb.h"
#include "xcb-internal.h" #include "xcb-internal.h"
#include "rofi.h" #include "rofi.h"
#include "settings.h" #include "settings.h"
#include "rofi-types.h" #include "rofi-types.h"
#include "widgets/textbox.h"
#include <check.h> #include <check.h>
ThemeWidget *rofi_theme = NULL;
gboolean rofi_theme_parse_string ( G_GNUC_UNUSED 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 ) void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
{ {
} }
@ -465,5 +487,5 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv )
number_failed = srunner_ntests_failed(sr); number_failed = srunner_ntests_failed(sr);
srunner_free(sr); srunner_free(sr);
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
} }

View file

@ -37,14 +37,31 @@
#include <mode-private.h> #include <mode-private.h>
#include <dialogs/help-keys.h> #include <dialogs/help-keys.h>
#include <xkbcommon/xkbcommon.h> #include <xkbcommon/xkbcommon.h>
#include "theme.h"
#include "rofi.h" #include "rofi.h"
#include "display.h" #include "display.h"
#include "xcb.h" #include "xcb.h"
#include "widgets/textbox.h"
#include <keyb.h> #include <keyb.h>
#include <helper.h> #include <helper.h>
#include <check.h> #include <check.h>
ThemeWidget *rofi_theme = NULL;
gboolean rofi_theme_parse_string ( const char *string )
{
return FALSE;
}
double textbox_get_estimated_char_height ( void )
{
return 16.0;
}
double textbox_get_estimated_ch ( void )
{
return 9.0;
}
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg ) void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
{ {
} }
@ -57,11 +74,6 @@ int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup )
fputs ( msg, stderr ); fputs ( msg, stderr );
return TRUE; return TRUE;
} }
int textbox_get_estimated_char_height ( void );
int textbox_get_estimated_char_height ( void )
{
return 16;
}
void rofi_view_get_current_monitor ( G_GNUC_UNUSED int *width, G_GNUC_UNUSED int *height ) void rofi_view_get_current_monitor ( G_GNUC_UNUSED int *width, G_GNUC_UNUSED int *height )
{ {
@ -119,7 +131,7 @@ END_TEST
START_TEST(test_mode_num_items) START_TEST(test_mode_num_items)
{ {
unsigned int rows = mode_get_num_entries ( &help_keys_mode); unsigned int rows = mode_get_num_entries ( &help_keys_mode);
ck_assert_int_eq ( rows, 72); ck_assert_int_eq ( rows, 73);
for ( unsigned int i =0; i < rows; i++ ){ for ( unsigned int i =0; i < rows; i++ ){
int state = 0; int state = 0;
GList *list = NULL; GList *list = NULL;