check/Makefile.am: set GST_TOOLS_DIR

Original commit message from CVS:

* check/Makefile.am:
set GST_TOOLS_DIR
* gst/check/gstcheck.c: (gst_check_message_error):
* gst/check/gstcheck.h:
add a fail_unless_equals_int
add fail_unless for error messages
This commit is contained in:
Thomas Vander Stichele 2005-08-20 20:15:53 +00:00
parent f42f103a5c
commit 088fed6d36
9 changed files with 77 additions and 1 deletions

View file

@ -1,3 +1,12 @@
2005-08-20 Thomas Vander Stichele <thomas at apestaart dot org>
* check/Makefile.am:
set GST_TOOLS_DIR
* gst/check/gstcheck.c: (gst_check_message_error):
* gst/check/gstcheck.h:
add a fail_unless_equals_int
add fail_unless for error messages
2005-08-20 Thomas Vander Stichele <thomas at apestaart dot org> 2005-08-20 Thomas Vander Stichele <thomas at apestaart dot org>
* check/Makefile.am: * check/Makefile.am:

View file

@ -2,6 +2,8 @@ include $(top_srcdir)/common/check.mak
CHECK_REGISTRY=$(top_builddir)/check/test-registry.xml CHECK_REGISTRY=$(top_builddir)/check/test-registry.xml
GST_TOOLS_DIR = $(top_builddir)/tools
TESTS_ENVIRONMENT=\ TESTS_ENVIRONMENT=\
GST_PLUGIN_PATH_ONLY=yes \ GST_PLUGIN_PATH_ONLY=yes \
GST_PLUGIN_PATH=$(top_builddir)/gst \ GST_PLUGIN_PATH=$(top_builddir)/gst \

2
common

@ -1 +1 @@
Subproject commit b7d5fb659c1720aecd039effd1d87813e4b8fd92 Subproject commit 4cc6f465857331531a09aff0a23dc0b133e7f669

View file

@ -86,3 +86,19 @@ gst_check_init (int *argc, char **argv[])
g_log_set_handler ("GLib-GObject", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING, g_log_set_handler ("GLib-GObject", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
gst_check_log_critical_func, NULL); gst_check_log_critical_func, NULL);
} }
/* message checking */
void
gst_check_message_error (GstMessage * message, GstMessageType type,
GQuark domain, gint code)
{
GError *error;
gchar *debug;
fail_unless_equals_int (GST_MESSAGE_TYPE (message), type);
gst_message_parse_error (message, &error, &debug);
fail_unless_equals_int (error->domain, domain);
fail_unless_equals_int (error->code, code);
g_error_free (error);
g_free (debug);
}

View file

@ -45,6 +45,12 @@ extern gboolean _gst_check_expecting_log;
void gst_check_init (int *argc, char **argv[]); void gst_check_init (int *argc, char **argv[]);
void gst_check_message_error (GstMessage *message, GstMessageType type, GQuark domain, gint code);
#define fail_unless_message_error(msg, domain, code) \
gst_check_message_error (msg, GST_MESSAGE_ERROR, \
GST_ ## domain ## _ERROR, GST_ ## domain ## _ERROR_ ## code)
/*** /***
* wrappers for START_TEST and END_TEST * wrappers for START_TEST and END_TEST
*/ */
@ -56,6 +62,15 @@ static void __testname (void)\
#define GST_END_TEST END_TEST #define GST_END_TEST END_TEST
/* additional fail macros */
#define fail_unless_equals_int(a, b) \
G_STMT_START { \
int first = a; \
int second = b; \
fail_unless(first == second, \
"'" #a "' (%d) is not equal to '" #b"' (%d)", first, second); \
} G_STMT_END;
/*** /***
* thread test macros and variables * thread test macros and variables
*/ */

View file

@ -2099,6 +2099,7 @@ not_accepted:
} }
} }
/* returns TRUE if the src pad could be configured to accept the given caps */
static gboolean static gboolean
gst_pad_configure_src (GstPad * pad, GstCaps * caps) gst_pad_configure_src (GstPad * pad, GstCaps * caps)
{ {

View file

@ -86,3 +86,19 @@ gst_check_init (int *argc, char **argv[])
g_log_set_handler ("GLib-GObject", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING, g_log_set_handler ("GLib-GObject", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
gst_check_log_critical_func, NULL); gst_check_log_critical_func, NULL);
} }
/* message checking */
void
gst_check_message_error (GstMessage * message, GstMessageType type,
GQuark domain, gint code)
{
GError *error;
gchar *debug;
fail_unless_equals_int (GST_MESSAGE_TYPE (message), type);
gst_message_parse_error (message, &error, &debug);
fail_unless_equals_int (error->domain, domain);
fail_unless_equals_int (error->code, code);
g_error_free (error);
g_free (debug);
}

View file

@ -45,6 +45,12 @@ extern gboolean _gst_check_expecting_log;
void gst_check_init (int *argc, char **argv[]); void gst_check_init (int *argc, char **argv[]);
void gst_check_message_error (GstMessage *message, GstMessageType type, GQuark domain, gint code);
#define fail_unless_message_error(msg, domain, code) \
gst_check_message_error (msg, GST_MESSAGE_ERROR, \
GST_ ## domain ## _ERROR, GST_ ## domain ## _ERROR_ ## code)
/*** /***
* wrappers for START_TEST and END_TEST * wrappers for START_TEST and END_TEST
*/ */
@ -56,6 +62,15 @@ static void __testname (void)\
#define GST_END_TEST END_TEST #define GST_END_TEST END_TEST
/* additional fail macros */
#define fail_unless_equals_int(a, b) \
G_STMT_START { \
int first = a; \
int second = b; \
fail_unless(first == second, \
"'" #a "' (%d) is not equal to '" #b"' (%d)", first, second); \
} G_STMT_END;
/*** /***
* thread test macros and variables * thread test macros and variables
*/ */

View file

@ -2,6 +2,8 @@ include $(top_srcdir)/common/check.mak
CHECK_REGISTRY=$(top_builddir)/check/test-registry.xml CHECK_REGISTRY=$(top_builddir)/check/test-registry.xml
GST_TOOLS_DIR = $(top_builddir)/tools
TESTS_ENVIRONMENT=\ TESTS_ENVIRONMENT=\
GST_PLUGIN_PATH_ONLY=yes \ GST_PLUGIN_PATH_ONLY=yes \
GST_PLUGIN_PATH=$(top_builddir)/gst \ GST_PLUGIN_PATH=$(top_builddir)/gst \