ext/cairo/gsttextoverlay.c: Add info about static leak.

Original commit message from CVS:
* ext/cairo/gsttextoverlay.c:
Add info about static leak.
* tests/check/Makefile.am:
* tests/check/generic/states.c:
Improved state change unit test.
This commit is contained in:
Stefan Kost 2007-09-20 13:35:34 +00:00
parent 747b46f419
commit ce322e50aa
4 changed files with 143 additions and 29 deletions

View file

@ -1,3 +1,12 @@
2007-09-20 Stefan Kost <ensonic@users.sf.net>
* ext/cairo/gsttextoverlay.c:
Add info about static leak.
* tests/check/Makefile.am:
* tests/check/generic/states.c:
Improved state change unit test.
2007-09-19 Stefan Kost <ensonic@users.sf.net>
* docs/plugins/.cvsignore:

View file

@ -281,6 +281,9 @@ gst_text_overlay_font_init (GstCairoTextOverlay * overlay)
cairo_select_font_face (cr, overlay->font, overlay->slant, overlay->weight);
cairo_set_font_size (cr, overlay->scale);
/* this has a static leak:
* http://lists.freedesktop.org/archives/cairo/2007-May/010623.html
*/
cairo_font_extents (cr, &font_extents);
overlay->font_height = GST_ROUND_UP_2 ((guint) font_extents.height);
overlay->need_render = TRUE;

View file

@ -1,6 +1,6 @@
include $(top_srcdir)/common/check.mak
CHECK_REGISTRY = $(top_builddir)/tests/check/test-registry.xml
CHECK_REGISTRY = $(top_builddir)/tests/check/test-registry.reg
TEST_FILES_DIRECTORY = $(top_srcdir)/tests/files
REGISTRY_ENVIRONMENT = \
@ -11,10 +11,10 @@ TESTS_ENVIRONMENT = \
GST_PLUGIN_SYSTEM_PATH= \
GST_PLUGIN_PATH=$(top_builddir)/gst:$(top_builddir)/ext:$(top_builddir)/sys:$(GSTPB_PLUGINS_DIR):$(GST_PLUGINS_DIR) \
GST_TEST_FILES_PATH=$(TEST_FILES_DIRECTORY) \
STATE_IGNORE_ELEMENTS="aasink cacasink autovideosink gconfvideosink"
STATE_IGNORE_ELEMENTS="aasink autovideosink cacasink cairotextoverlay"
# ths core dumps of some machines have PIDs appended
CLEANFILES = core.* test-registry.xml
CLEANFILES = core.* test-registry.*
clean-local: clean-local-check
@ -69,8 +69,8 @@ check_PROGRAMS = \
$(check_sunaudio) \
$(check_taglib) \
$(check_wavpack)
VALGRIND_TO_FIX =
VALGRIND_TO_FIX =
TESTS = $(check_PROGRAMS)

View file

@ -28,15 +28,17 @@
#include <gst/check/gstcheck.h>
GST_START_TEST (test_state_changes)
static GList *elements = NULL;
static void
setup ()
{
GstElement *element;
GList *features, *f;
GList *plugins, *p;
gchar **ignorelist = NULL;
const gchar *STATE_IGNORE_ELEMENTS = NULL;
GST_DEBUG ("testing elements from source %s", PACKAGE);
GST_DEBUG ("getting elements for package %s", PACKAGE);
STATE_IGNORE_ELEMENTS = g_getenv ("STATE_IGNORE_ELEMENTS");
if (STATE_IGNORE_ELEMENTS) {
GST_DEBUG ("Will ignore element factories: '%s'", STATE_IGNORE_ELEMENTS);
@ -76,26 +78,8 @@ GST_START_TEST (test_state_changes)
continue;
}
GST_DEBUG ("testing element %s", name);
element = gst_element_factory_make (name, name);
fail_if (element == NULL, "Could not make element from factory %s", name);
if (GST_IS_PIPELINE (element)) {
GST_DEBUG ("element %s is a pipeline", name);
}
gst_element_set_state (element, GST_STATE_READY);
gst_element_set_state (element, GST_STATE_PAUSED);
gst_element_set_state (element, GST_STATE_PLAYING);
gst_element_set_state (element, GST_STATE_PAUSED);
gst_element_set_state (element, GST_STATE_READY);
gst_element_set_state (element, GST_STATE_NULL);
gst_element_set_state (element, GST_STATE_PAUSED);
gst_element_set_state (element, GST_STATE_READY);
gst_element_set_state (element, GST_STATE_PLAYING);
gst_element_set_state (element, GST_STATE_PAUSED);
gst_element_set_state (element, GST_STATE_NULL);
gst_object_unref (GST_OBJECT (element));
GST_DEBUG ("adding element %s", name);
elements = g_list_prepend (elements, (gpointer) g_strdup (name));
}
gst_plugin_feature_list_free (features);
}
@ -103,8 +87,123 @@ GST_START_TEST (test_state_changes)
g_strfreev (ignorelist);
}
static void
teardown ()
{
GList *e;
for (e = elements; e; e = e->next) {
g_free (e->data);
}
g_list_free (elements);
elements = NULL;
}
GST_START_TEST (test_state_changes_up_and_down_seq)
{
GstElement *element;
GList *e;
for (e = elements; e; e = e->next) {
const gchar *name = e->data;
GST_INFO ("testing element %s", name);
element = gst_element_factory_make (name, name);
fail_if (element == NULL, "Could not make element from factory %s", name);
if (GST_IS_PIPELINE (element)) {
GST_DEBUG ("element %s is a pipeline", name);
}
gst_element_set_state (element, GST_STATE_READY);
gst_element_set_state (element, GST_STATE_PAUSED);
gst_element_set_state (element, GST_STATE_PLAYING);
gst_element_set_state (element, GST_STATE_PAUSED);
gst_element_set_state (element, GST_STATE_READY);
gst_element_set_state (element, GST_STATE_NULL);
gst_element_set_state (element, GST_STATE_PAUSED);
gst_element_set_state (element, GST_STATE_READY);
gst_element_set_state (element, GST_STATE_PLAYING);
gst_element_set_state (element, GST_STATE_PAUSED);
gst_element_set_state (element, GST_STATE_NULL);
gst_object_unref (GST_OBJECT (element));
}
}
GST_END_TEST;
GST_START_TEST (test_state_changes_up_seq)
{
GstElement *element;
GList *e;
for (e = elements; e; e = e->next) {
const gchar *name = e->data;
GST_INFO ("testing element %s", name);
element = gst_element_factory_make (name, name);
fail_if (element == NULL, "Could not make element from factory %s", name);
if (GST_IS_PIPELINE (element)) {
GST_DEBUG ("element %s is a pipeline", name);
}
gst_element_set_state (element, GST_STATE_READY);
gst_element_set_state (element, GST_STATE_PAUSED);
gst_element_set_state (element, GST_STATE_READY);
gst_element_set_state (element, GST_STATE_PAUSED);
gst_element_set_state (element, GST_STATE_PLAYING);
gst_element_set_state (element, GST_STATE_PAUSED);
gst_element_set_state (element, GST_STATE_READY);
gst_element_set_state (element, GST_STATE_NULL);
gst_object_unref (GST_OBJECT (element));
}
}
GST_END_TEST;
GST_START_TEST (test_state_changes_down_seq)
{
GstElement *element;
GList *e;
for (e = elements; e; e = e->next) {
const gchar *name = e->data;
GST_INFO ("testing element %s", name);
element = gst_element_factory_make (name, name);
fail_if (element == NULL, "Could not make element from factory %s", name);
if (GST_IS_PIPELINE (element)) {
GST_DEBUG ("element %s is a pipeline", name);
}
gst_element_set_state (element, GST_STATE_READY);
gst_element_set_state (element, GST_STATE_PAUSED);
gst_element_set_state (element, GST_STATE_PLAYING);
gst_element_set_state (element, GST_STATE_PAUSED);
gst_element_set_state (element, GST_STATE_PLAYING);
gst_element_set_state (element, GST_STATE_PAUSED);
gst_element_set_state (element, GST_STATE_READY);
gst_element_set_state (element, GST_STATE_PAUSED);
gst_element_set_state (element, GST_STATE_PLAYING);
gst_element_set_state (element, GST_STATE_PAUSED);
gst_element_set_state (element, GST_STATE_READY);
gst_element_set_state (element, GST_STATE_NULL);
gst_object_unref (GST_OBJECT (element));
}
}
GST_END_TEST;
Suite *
states_suite (void)
{
@ -112,7 +211,10 @@ states_suite (void)
TCase *tc_chain = tcase_create ("general");
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_state_changes);
tcase_add_checked_fixture (tc_chain, setup, teardown);
tcase_add_test (tc_chain, test_state_changes_up_and_down_seq);
tcase_add_test (tc_chain, test_state_changes_up_seq);
tcase_add_test (tc_chain, test_state_changes_down_seq);
return s;
}