mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 06:26:23 +00:00
ges-asset: Do not forget to give a ref to the registry
+ Add test in the testsuite + Fix broken tests https://bugzilla.gnome.org/show_bug.cgi?id=721111
This commit is contained in:
parent
32d526756d
commit
94dbf20400
3 changed files with 23 additions and 13 deletions
|
@ -219,7 +219,7 @@ async_initable_init_async (GAsyncInitable * initable, gint io_priority,
|
|||
simple = g_simple_async_result_new (G_OBJECT (asset),
|
||||
callback, user_data, ges_asset_request_async);
|
||||
|
||||
ges_asset_cache_put (asset, simple);
|
||||
ges_asset_cache_put (g_object_ref (asset), simple);
|
||||
switch (GES_ASSET_GET_CLASS (asset)->start_loading (asset, &error)) {
|
||||
case GES_ASSET_LOADING_ERROR:
|
||||
{
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <gst/controller/gstdirectcontrolbinding.h>
|
||||
#include <gst/controller/gstinterpolationcontrolsource.h>
|
||||
|
||||
GMainLoop *mainloop;
|
||||
|
||||
static void
|
||||
project_loaded_cb (GESProject * project, GESTimeline * timeline,
|
||||
GMainLoop * mainloop)
|
||||
|
@ -50,7 +52,6 @@ GST_START_TEST (test_project_simple)
|
|||
gchar *id;
|
||||
GESProject *project;
|
||||
GESTimeline *timeline;
|
||||
GMainLoop *mainloop;
|
||||
|
||||
ges_init ();
|
||||
|
||||
|
@ -84,6 +85,16 @@ asset_removed_add_cb (GESProject * project, GESAsset * asset, gboolean * called)
|
|||
*called = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
asset_created_cb (GObject * source, GAsyncResult * res, GESAsset ** asset)
|
||||
{
|
||||
GError *error = NULL;
|
||||
*asset = ges_asset_request_finish (res, &error);
|
||||
|
||||
fail_unless (error == NULL);
|
||||
g_main_loop_quit (mainloop);
|
||||
}
|
||||
|
||||
GST_START_TEST (test_project_add_assets)
|
||||
{
|
||||
GESProject *project;
|
||||
|
@ -93,16 +104,20 @@ GST_START_TEST (test_project_add_assets)
|
|||
|
||||
ges_init ();
|
||||
|
||||
mainloop = g_main_loop_new (NULL, FALSE);
|
||||
project = GES_PROJECT (ges_asset_request (GES_TYPE_TIMELINE, NULL, NULL));
|
||||
fail_unless (GES_IS_PROJECT (project));
|
||||
fail_unless (GES_IS_PROJECT (project));
|
||||
|
||||
g_signal_connect (project, "asset-added",
|
||||
(GCallback) asset_removed_add_cb, &added_cb_called);
|
||||
g_signal_connect (project, "asset-removed",
|
||||
(GCallback) asset_removed_add_cb, &removed_cb_called);
|
||||
|
||||
asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL);
|
||||
ges_asset_request_async (GES_TYPE_TEST_CLIP, NULL, NULL,
|
||||
(GAsyncReadyCallback) asset_created_cb, &asset);
|
||||
g_main_loop_run (mainloop);
|
||||
g_main_loop_unref (mainloop);
|
||||
|
||||
fail_unless (GES_IS_ASSET (asset));
|
||||
|
||||
fail_unless (ges_project_add_asset (project, asset));
|
||||
|
@ -113,17 +128,16 @@ GST_START_TEST (test_project_add_assets)
|
|||
|
||||
fail_unless (ges_project_remove_asset (project, asset));
|
||||
fail_unless (removed_cb_called);
|
||||
gst_object_unref (asset);
|
||||
gst_object_unref (project);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (project,
|
||||
(GCallback) asset_removed_add_cb, &added_cb_called);
|
||||
g_signal_handlers_disconnect_by_func (project,
|
||||
(GCallback) asset_removed_add_cb, &removed_cb_called);
|
||||
|
||||
gst_object_unref (asset);
|
||||
gst_object_unref (project);
|
||||
ASSERT_OBJECT_REFCOUNT (asset, "The asset (1 ref in cache)", 1);
|
||||
ASSERT_OBJECT_REFCOUNT (project, "The project (1 ref in cache)", 1);
|
||||
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
@ -140,7 +154,6 @@ error_loading_asset_cb (GESProject * project, GError * error, gchar * id,
|
|||
GST_START_TEST (test_project_unexistant_effect)
|
||||
{
|
||||
GESProject *project;
|
||||
GMainLoop *mainloop;
|
||||
gboolean added_cb_called = FALSE;
|
||||
gboolean removed_cb_called = FALSE;
|
||||
|
||||
|
@ -148,7 +161,6 @@ GST_START_TEST (test_project_unexistant_effect)
|
|||
|
||||
project = GES_PROJECT (ges_asset_request (GES_TYPE_TIMELINE, NULL, NULL));
|
||||
fail_unless (GES_IS_PROJECT (project));
|
||||
fail_unless (GES_IS_PROJECT (project));
|
||||
|
||||
mainloop = g_main_loop_new (NULL, FALSE);
|
||||
g_signal_connect (project, "asset-added",
|
||||
|
@ -404,7 +416,6 @@ _check_keyframes (GESTimeline * timeline)
|
|||
|
||||
GST_START_TEST (test_project_add_keyframes)
|
||||
{
|
||||
GMainLoop *mainloop;
|
||||
GESProject *project;
|
||||
GESTimeline *timeline;
|
||||
GESAsset *formatter_asset;
|
||||
|
@ -469,7 +480,6 @@ GST_END_TEST;
|
|||
GST_START_TEST (test_project_load_xges)
|
||||
{
|
||||
gboolean saved;
|
||||
GMainLoop *mainloop;
|
||||
GESProject *project;
|
||||
GESTimeline *timeline;
|
||||
GESAsset *formatter_asset;
|
||||
|
@ -534,7 +544,6 @@ GST_END_TEST;
|
|||
GST_START_TEST (test_project_auto_transition)
|
||||
{
|
||||
GList *layers;
|
||||
GMainLoop *mainloop;
|
||||
GESProject *project;
|
||||
GESTimeline *timeline;
|
||||
GESLayer *layer = NULL;
|
||||
|
|
|
@ -46,7 +46,8 @@ asset_created_cb (GObject * source, GAsyncResult * res, gpointer udata)
|
|||
GError *error = NULL;
|
||||
|
||||
asset = ges_asset_request_finish (res, &error);
|
||||
ASSERT_OBJECT_REFCOUNT (asset, "1 for us one for the cache", 2);
|
||||
ASSERT_OBJECT_REFCOUNT (asset, "1 for us + for the cache + 1 taken "
|
||||
"by g_simple_async_result_complete_in_idle", 3);
|
||||
fail_unless (error == NULL);
|
||||
fail_if (asset == NULL);
|
||||
fail_if (g_strcmp0 (ges_asset_get_id (asset), av_uri));
|
||||
|
|
Loading…
Reference in a new issue