put back source in registry. add checks for find_plugin.

Original commit message from CVS:

* check/gst/.cvsignore:
* check/gst/gstplugin.c: (GST_START_TEST), (gst_plugin_suite):
* gst/gstregistryxml.c: (load_plugin),
(gst_registry_xml_save_plugin):
put back source in registry.  add checks for find_plugin.
* testsuite/states/bin.c: (assert_state), (empty_bin),
(test_adding_one_element), (main):
* testsuite/states/locked.c: (main):
some compile/run fixes
parent 62d1f4c8
2005-09-23 Thomas Vander Stichele <thomas at apestaart dot org>
* check/gst/.cvsignore:
* check/gst/gstplugin.c: (GST_START_TEST), (gst_plugin_suite):
* gst/gstregistryxml.c: (load_plugin),
(gst_registry_xml_save_plugin):
put back source in registry. add checks for find_plugin.
* testsuite/states/bin.c: (assert_state), (empty_bin),
(test_adding_one_element), (main):
* testsuite/states/locked.c: (main):
some compile/run fixes
2005-09-22 Thomas Vander Stichele <thomas at apestaart dot org>
* check/gst/gstvalue.c: (GST_START_TEST):
......
......@@ -18,4 +18,5 @@ gstplugin
gststructure
gstsystemclock
gsttag
gstutils
gstvalue
......@@ -69,8 +69,7 @@ GST_START_TEST (test_registry)
for (g = registry->plugins; g; g = g->next) {
GstPlugin *plugin = GST_PLUGIN (g->data);
fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 1,
"Plugin in registry should have refcount of 1");
ASSERT_OBJECT_REFCOUNT (plugin, "plugin in registry", 1);
GST_DEBUG ("refcount %d %s", GST_OBJECT_REFCOUNT_VALUE (plugin),
plugin->desc.name);
}
......@@ -139,6 +138,27 @@ GST_START_TEST (test_registry_get_plugin_list)
GST_END_TEST;
GST_START_TEST (test_find_plugin)
{
GstPlugin *plugin;
plugin = gst_registry_find_plugin (gst_registry_get_default (),
"gstelements");
fail_if (plugin == NULL, "Failed to find gstelements plugin");
ASSERT_OBJECT_REFCOUNT (plugin, "plugin", 2);
fail_unless_equals_string (plugin->desc.version, VERSION);
fail_unless_equals_string (plugin->desc.license, "LGPL");
fail_unless_equals_string (plugin->desc.source, "gstreamer");
fail_unless_equals_string (plugin->desc.package, GST_PACKAGE);
fail_unless_equals_string (plugin->desc.origin, GST_ORIGIN);
gst_object_unref (plugin);
}
GST_END_TEST;
GST_START_TEST (test_find_feature)
{
GstPluginFeature *feature;
......@@ -241,6 +261,7 @@ gst_plugin_suite (void)
tcase_add_test (tc_chain, test_registry);
tcase_add_test (tc_chain, test_load_gstelements);
tcase_add_test (tc_chain, test_registry_get_plugin_list);
tcase_add_test (tc_chain, test_find_plugin);
tcase_add_test (tc_chain, test_find_feature);
tcase_add_test (tc_chain, test_find_element);
//tcase_add_test (tc_chain, test_typefind);
......
......@@ -662,6 +662,10 @@ load_plugin (xmlTextReaderPtr reader, GList ** feature_list)
if (!read_string (reader, &plugin->desc.license))
break;
GST_DEBUG ("license %s", plugin->desc.license);
} else if (g_str_equal (tag, "source")) {
if (!read_string (reader, &plugin->desc.source))
break;
GST_DEBUG ("source %s", plugin->desc.source);
} else if (g_str_equal (tag, "package")) {
if (!read_string (reader, &plugin->desc.package))
break;
......@@ -960,6 +964,7 @@ gst_registry_xml_save_plugin (GstRegistry * registry, GstPlugin * plugin)
PUT_ESCAPED (" ", "m32p", s);
PUT_ESCAPED (" ", "version", plugin->desc.version);
PUT_ESCAPED (" ", "license", plugin->desc.license);
PUT_ESCAPED (" ", "source", plugin->desc.source);
PUT_ESCAPED (" ", "package", plugin->desc.package);
PUT_ESCAPED (" ", "origin", plugin->desc.origin);
......
......@@ -18,4 +18,5 @@ gstplugin
gststructure
gstsystemclock
gsttag
gstutils
gstvalue
......@@ -69,8 +69,7 @@ GST_START_TEST (test_registry)
for (g = registry->plugins; g; g = g->next) {
GstPlugin *plugin = GST_PLUGIN (g->data);
fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 1,
"Plugin in registry should have refcount of 1");
ASSERT_OBJECT_REFCOUNT (plugin, "plugin in registry", 1);
GST_DEBUG ("refcount %d %s", GST_OBJECT_REFCOUNT_VALUE (plugin),
plugin->desc.name);
}
......@@ -139,6 +138,27 @@ GST_START_TEST (test_registry_get_plugin_list)
GST_END_TEST;
GST_START_TEST (test_find_plugin)
{
GstPlugin *plugin;
plugin = gst_registry_find_plugin (gst_registry_get_default (),
"gstelements");
fail_if (plugin == NULL, "Failed to find gstelements plugin");
ASSERT_OBJECT_REFCOUNT (plugin, "plugin", 2);
fail_unless_equals_string (plugin->desc.version, VERSION);
fail_unless_equals_string (plugin->desc.license, "LGPL");
fail_unless_equals_string (plugin->desc.source, "gstreamer");
fail_unless_equals_string (plugin->desc.package, GST_PACKAGE);
fail_unless_equals_string (plugin->desc.origin, GST_ORIGIN);
gst_object_unref (plugin);
}
GST_END_TEST;
GST_START_TEST (test_find_feature)
{
GstPluginFeature *feature;
......@@ -241,6 +261,7 @@ gst_plugin_suite (void)
tcase_add_test (tc_chain, test_registry);
tcase_add_test (tc_chain, test_load_gstelements);
tcase_add_test (tc_chain, test_registry_get_plugin_list);
tcase_add_test (tc_chain, test_find_plugin);
tcase_add_test (tc_chain, test_find_feature);
tcase_add_test (tc_chain, test_find_element);
//tcase_add_test (tc_chain, test_typefind);
......
......@@ -26,7 +26,10 @@
static void
assert_state (GstElement * element, GstState state)
{
if (gst_element_get_state (element) != state) {
GstState current, pending;
gst_element_get_state (element, &current, &pending, NULL);
if (current != state) {
g_printerr ("%s: state is %s instead of %s",
GST_OBJECT_NAME (element),
gst_element_state_get_name (GST_STATE (element)),
......@@ -59,15 +62,16 @@ empty_bin (gchar * bin_name)
* GST_STATE_CHANGE_ASYNC */
GstElement *bin = gst_element_factory_make (bin_name, NULL);
g_assert (bin);
/* obvious */
assert_state (bin, GST_STATE_NULL);
/* see above */
assert_state_change (bin, GST_STATE_READY, GST_STATE_CHANGE_ASYNC,
GST_STATE_NULL);
assert_state_change (bin, GST_STATE_PAUSED, GST_STATE_CHANGE_ASYNC,
GST_STATE_NULL);
assert_state_change (bin, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC,
GST_STATE_NULL);
assert_state_change (bin, GST_STATE_READY, GST_STATE_CHANGE_SUCCESS,
GST_STATE_READY);
assert_state_change (bin, GST_STATE_PAUSED, GST_STATE_CHANGE_SUCCESS,
GST_STATE_PAUSED);
assert_state_change (bin, GST_STATE_PLAYING, GST_STATE_CHANGE_SUCCESS,
GST_STATE_PLAYING);
}
static void
......@@ -79,9 +83,10 @@ test_adding_one_element (GstElement * bin)
GST_STATE_PLAYING, GST_STATE_PAUSED, GST_STATE_READY, GST_STATE_NULL
};
GstElement *test = gst_element_factory_make ("identity", NULL);
GstState bin_state = gst_element_get_state (bin);
GstState bin_state;
gint i;
gst_element_get_state (bin, &bin_state, NULL, NULL);
g_assert (test);
gst_object_ref (test);
assert_state (test, GST_STATE_NULL);
......@@ -142,12 +147,11 @@ main (gint argc, gchar * argv[])
/* test behaviour of empty bins */
empty_bin ("bin");
empty_bin ("thread");
empty_bin ("pipeline");
g_print ("how far\n");
/* test behaviour of adding/removing elements to/from all core bin types */
test_element_in_bin ("bin");
test_element_in_bin ("thread");
test_element_in_bin ("pipeline");
return 0;
......
......@@ -52,7 +52,8 @@ main (gint argc, gchar * argv[])
loop = g_main_loop_new (NULL, FALSE);
bus = gst_element_get_bus (pipeline);
gst_bus_add_watch (bus, (GstBusHandler) message_received, pipeline);
gst_bus_add_watch (bus, GST_MESSAGE_EOS, (GstBusFunc) message_received,
(gpointer) pipeline);
gst_object_unref (bus);
fakesrc1 = gst_element_factory_make ("fakesrc", "fakesrc1");
......
......@@ -26,7 +26,10 @@
static void
assert_state (GstElement * element, GstState state)
{
if (gst_element_get_state (element) != state) {
GstState current, pending;
gst_element_get_state (element, &current, &pending, NULL);
if (current != state) {
g_printerr ("%s: state is %s instead of %s",
GST_OBJECT_NAME (element),
gst_element_state_get_name (GST_STATE (element)),
......@@ -59,15 +62,16 @@ empty_bin (gchar * bin_name)
* GST_STATE_CHANGE_ASYNC */
GstElement *bin = gst_element_factory_make (bin_name, NULL);
g_assert (bin);
/* obvious */
assert_state (bin, GST_STATE_NULL);
/* see above */
assert_state_change (bin, GST_STATE_READY, GST_STATE_CHANGE_ASYNC,
GST_STATE_NULL);
assert_state_change (bin, GST_STATE_PAUSED, GST_STATE_CHANGE_ASYNC,
GST_STATE_NULL);
assert_state_change (bin, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC,
GST_STATE_NULL);
assert_state_change (bin, GST_STATE_READY, GST_STATE_CHANGE_SUCCESS,
GST_STATE_READY);
assert_state_change (bin, GST_STATE_PAUSED, GST_STATE_CHANGE_SUCCESS,
GST_STATE_PAUSED);
assert_state_change (bin, GST_STATE_PLAYING, GST_STATE_CHANGE_SUCCESS,
GST_STATE_PLAYING);
}
static void
......@@ -79,9 +83,10 @@ test_adding_one_element (GstElement * bin)
GST_STATE_PLAYING, GST_STATE_PAUSED, GST_STATE_READY, GST_STATE_NULL
};
GstElement *test = gst_element_factory_make ("identity", NULL);
GstState bin_state = gst_element_get_state (bin);
GstState bin_state;
gint i;
gst_element_get_state (bin, &bin_state, NULL, NULL);
g_assert (test);
gst_object_ref (test);
assert_state (test, GST_STATE_NULL);
......@@ -142,12 +147,11 @@ main (gint argc, gchar * argv[])
/* test behaviour of empty bins */
empty_bin ("bin");
empty_bin ("thread");
empty_bin ("pipeline");
g_print ("how far\n");
/* test behaviour of adding/removing elements to/from all core bin types */
test_element_in_bin ("bin");
test_element_in_bin ("thread");
test_element_in_bin ("pipeline");
return 0;
......
......@@ -52,7 +52,8 @@ main (gint argc, gchar * argv[])
loop = g_main_loop_new (NULL, FALSE);
bus = gst_element_get_bus (pipeline);
gst_bus_add_watch (bus, (GstBusHandler) message_received, pipeline);
gst_bus_add_watch (bus, GST_MESSAGE_EOS, (GstBusFunc) message_received,
(gpointer) pipeline);
gst_object_unref (bus);
fakesrc1 = gst_element_factory_make ("fakesrc", "fakesrc1");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment