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\
source/dialogs/help-keys.c\
source/helper.c\
source/theme.c\
source/mode.c\
source/rofi-types.c\
include/rofi-types.h\
@ -558,6 +559,7 @@ helper_tokenize_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\

View File

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

View File

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

View File

@ -37,14 +37,31 @@
#include <mode-private.h>
#include <dialogs/help-keys.h>
#include <xkbcommon/xkbcommon.h>
#include "theme.h"
#include "rofi.h"
#include "display.h"
#include "xcb.h"
#include "widgets/textbox.h"
#include <keyb.h>
#include <helper.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 )
{
}
@ -57,11 +74,6 @@ int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup )
fputs ( msg, stderr );
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 )
{
@ -119,7 +131,7 @@ END_TEST
START_TEST(test_mode_num_items)
{
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++ ){
int state = 0;
GList *list = NULL;