Fix tests by splitting types name into separate file.

This commit is contained in:
Dave Davenport 2017-06-20 21:02:13 +02:00
parent 4d813a5391
commit 9af191de26
10 changed files with 82 additions and 31 deletions

View File

@ -56,6 +56,7 @@ SOURCES=\
source/timings.c\
source/history.c\
source/theme.c\
source/rofi-types.c\
source/widgets/box.c\
source/widgets/container.c\
source/widgets/widget.c\
@ -77,6 +78,7 @@ SOURCES=\
include/xcb.h\
include/xcb-internal.h\
include/rofi.h\
include/rofi-types.h\
include/mode.h\
include/mode-private.h\
include/settings.h\
@ -306,6 +308,8 @@ helper_pidfile_SOURCES=\
include/mode.h\
include/mode-private.h\
source/helper.c\
source/rofi-types.c\
include/rofi-types.h\
include/helper.h\
include/helper-theme.h\
include/xrmoptions.h\
@ -320,6 +324,8 @@ helper_tokenize_SOURCES=\
include/mode.h\
include/mode-private.h\
source/helper.c\
source/rofi-types.c\
include/rofi-types.h\
include/helper.h\
include/helper-theme.h\
include/xrmoptions.h\
@ -332,6 +338,8 @@ widget_test_SOURCES=\
source/widgets/widget.c\
source/widgets/textbox.c\
source/theme.c\
source/rofi-types.c\
include/rofi-types.h\
source/css-colors.c\
source/helper.c\
config/config.c\
@ -347,6 +355,8 @@ box_test_SOURCES=\
lexer/theme-parser.y\
lexer/theme-lexer.l\
source/theme.c\
source/rofi-types.c\
include/rofi-types.h\
source/css-colors.c\
include/theme.h\
include/css-colors.h\
@ -360,6 +370,8 @@ scrollbar_test_SOURCES=\
lexer/theme-parser.y\
lexer/theme-lexer.l\
source/theme.c\
source/rofi-types.c\
include/rofi-types.h\
source/css-colors.c\
include/theme.h\
include/css-colors.h\
@ -371,6 +383,8 @@ textbox_test_SOURCES=\
lexer/theme-parser.y\
lexer/theme-lexer.l\
source/theme.c\
source/rofi-types.c\
include/rofi-types.h\
source/css-colors.c\
source/helper.c\
config/config.c\
@ -406,6 +420,8 @@ theme_parser_test_SOURCES=\
lexer/theme-parser.c\
lexer/theme-parser.h\
source/theme.c\
source/rofi-types.c\
include/rofi-types.h\
source/css-colors.c\
test/theme-parser-test.c
endif
@ -420,6 +436,8 @@ helper_test_SOURCES=\
include/helper-theme.h\
include/xrmoptions.h\
source/xrmoptions.c\
source/rofi-types.c\
include/rofi-types.h\
test/helper-test.c
@ -460,6 +478,8 @@ helper_expand_SOURCES=\
include/helper-theme.h\
include/xrmoptions.h\
source/xrmoptions.c\
source/rofi-types.c\
include/rofi-types.h\
test/helper-expand.c
helper_expand_CFLAGS=${helper_test_CFLAGS}
@ -475,6 +495,8 @@ helper_config_cmdline_parser_SOURCES=\
include/mode.h\
include/mode-private.h\
source/helper.c\
source/rofi-types.c\
include/rofi-types.h\
include/helper.h\
include/helper-theme.h\
include/xrmoptions.h\
@ -491,6 +513,8 @@ mode_test_SOURCES=\
source/dialogs/help-keys.c\
source/helper.c\
source/mode.c\
source/rofi-types.c\
include/rofi-types.h\
source/xrmoptions.c\
source/keyb.c\
include/mode.h\

6
include/rofi-types.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef INCLUDE_ROFI_TYPES_H
#define INCLUDE_ROFI_TYPES_H
extern const char *PropertyTypeName[];
#endif // INCLUDE_ROFI_TYPES_H

View File

@ -155,6 +155,7 @@ rofi_sources = files(
'source/widgets/listview.c',
'source/widgets/scrollbar.c',
'source/xrmoptions.c',
'source/rofi-types.c',
'source/xcb.c',
'source/dialogs/run.c',
'source/dialogs/ssh.c',
@ -179,6 +180,7 @@ rofi_sources = files(
'include/timings.h',
'include/history.h',
'include/theme.h',
'include/rofi-types.h',
'include/css-colors.h',
'include/default-theme.h',
'include/widgets/box.h',
@ -278,6 +280,7 @@ test('helper_pidfile test', executable('helper_pidfile.test', [
'config/config.c',
'source/helper.c',
'source/xrmoptions.c',
'source/rofi-types.c',
]),
dependencies: deps,
))
@ -289,6 +292,7 @@ test('helper_tokenize test', executable('helper_tokenize.test', [
'config/config.c',
'source/helper.c',
'source/xrmoptions.c',
'source/rofi-types.c',
]),
dependencies: deps,
))
@ -302,6 +306,7 @@ test('widget test', executable('widget.test', [
'source/widgets/widget.c',
'source/widgets/textbox.c',
'source/theme.c',
'source/rofi-types.c',
'source/css-colors.c',
'source/helper.c',
'config/config.c',
@ -318,6 +323,7 @@ test('box test', executable('box.test', [
'source/widgets/widget.c',
'source/widgets/box.c',
'source/theme.c',
'source/rofi-types.c',
'source/css-colors.c',
'config/config.c',
]),
@ -333,6 +339,7 @@ test('scrollbar test', executable('scrollbar.test', [
'source/widgets/widget.c',
'source/widgets/scrollbar.c',
'source/theme.c',
'source/rofi-types.c',
'source/css-colors.c',
'config/config.c',
]),
@ -348,6 +355,7 @@ test('textbox test', executable('textbox.test', [
'source/widgets/widget.c',
'source/widgets/textbox.c',
'source/theme.c',
'source/rofi-types.c',
'source/css-colors.c',
'source/helper.c',
'config/config.c',
@ -362,6 +370,7 @@ test('helper test', executable('helper.test', [
'config/config.c',
'source/helper.c',
'source/xrmoptions.c',
'source/rofi-types.c',
]),
dependencies: deps,
))
@ -373,6 +382,7 @@ test('helper_expand test', executable('helper_expand.test', [
'config/config.c',
'source/helper.c',
'source/xrmoptions.c',
'source/rofi-types.c',
]),
dependencies: deps,
))
@ -384,6 +394,7 @@ test('helper_config_cmdline_parser test', executable('helper_config_cmdline_pars
'config/config.c',
'source/helper.c',
'source/xrmoptions.c',
'source/rofi-types.c',
]),
dependencies: deps,
))
@ -401,6 +412,7 @@ if check.found()
'source/helper.c',
'source/xrmoptions.c',
'source/theme.c',
'source/rofi-types.c',
'source/css-colors.c',
]),
dependencies: deps,
@ -415,6 +427,7 @@ if check.found()
'source/helper.c',
'source/mode.c',
'source/xrmoptions.c',
'source/rofi-types.c',
'source/keyb.c',
]),
dependencies: deps,

29
source/rofi-types.c Normal file
View File

@ -0,0 +1,29 @@
#include "rofi-types.h"
/**
* Name of the property type
*/
const char *PropertyTypeName[] = {
/** Integer */
"Integer",
/** Double */
"Double",
/** String */
"String",
/** Boolean */
"Boolean",
/** Color */
"Color",
/** RofiPadding */
"RofiPadding",
/** Link to global setting */
"Reference",
/** Position */
"Position",
/** Highlight */
"Highlight",
/** List */
"List",
/** Orientation */
"Orientation",
};

View File

@ -41,34 +41,8 @@
#include "widgets/textbox.h"
#include "view.h"
#include "rofi.h"
#include "rofi-types.h"
/**
* Name of the property type
*/
const char *PropertyTypeName[] = {
/** Integer */
"Integer",
/** Double */
"Double",
/** String */
"String",
/** Boolean */
"Boolean",
/** Color */
"Color",
/** RofiPadding */
"RofiPadding",
/** Link to global setting */
"Reference",
/** Position */
"Position",
/** Highlight */
"Highlight",
/** List */
"List",
/** Orientation */
"Orientation",
};
void yyerror ( YYLTYPE *yylloc, const char *, const char * );
static gboolean distance_compare ( RofiDistance d, RofiDistance e )
{

View File

@ -40,6 +40,7 @@
#include "xrmoptions.h"
#include "settings.h"
#include "helper.h"
#include "rofi-types.h"
/** Different sources of configuration. */
const char * const ConfigSourceStr[] = {

View File

@ -63,8 +63,9 @@ unsigned int test =0;
} \
}
void config_parse_set_property ( G_GNUC_UNUSED const Property *p )
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, char **error )
{
return FALSE;
}
char * rofi_expand_path ( G_GNUC_UNUSED const char *path )
{

View File

@ -59,8 +59,9 @@ char * helper_get_theme_path ( const char *file )
{
return g_strdup ( file );
}
void config_parse_set_property ( G_GNUC_UNUSED const Property *p )
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, char **error )
{
return FALSE;
}
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
{}

View File

@ -52,8 +52,9 @@ unsigned int normal_window_mode = 0;
#include "view.h"
void config_parse_set_property ( G_GNUC_UNUSED const Property *p )
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, char **error )
{
return FALSE;
}
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg)

View File

@ -43,8 +43,9 @@ unsigned int test =0;
assert ( a ); \
printf ( "Test %3i passed (%s)\n", ++test, # a ); \
}
void config_parse_set_property ( G_GNUC_UNUSED const Property *p )
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, char **error )
{
return FALSE;
}
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
{