From 6e5d16ac6d3c1b7dced6de0a3de997c09d733a6b Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Mon, 15 Nov 2010 23:32:23 +0100 Subject: [PATCH] GESTrackEffect: add private struct --- docs/libs/ges-sections.txt | 2 -- ges/ges-track-effect.c | 2 ++ ges/ges-track-effect.h | 15 +++++------ tests/check/ges/effects.c | 51 +++++++++++++++++++++++++++++++++++--- 4 files changed, 55 insertions(+), 15 deletions(-) diff --git a/docs/libs/ges-sections.txt b/docs/libs/ges-sections.txt index 6f9cc97fc2..116bcdc00f 100644 --- a/docs/libs/ges-sections.txt +++ b/docs/libs/ges-sections.txt @@ -705,8 +705,6 @@ GESTrackEffect GESTrackEffectClass ges_track_effect_new ges_track_effect_new_with_name -ges_track_effect_set_human_name -ges_track_effect_get_human_name GES_IS_TRACK_EFFECT GES_IS_TRACK_EFFECT_CLASS diff --git a/ges/ges-track-effect.c b/ges/ges-track-effect.c index e37663b014..1e45ad04c2 100644 --- a/ges/ges-track-effect.c +++ b/ges/ges-track-effect.c @@ -81,6 +81,8 @@ ges_track_effect_class_init (GESTrackEffectClass * klass) g_type_class_add_private (klass, sizeof (GESTrackEffectPrivate)); + g_type_class_add_private (klass, sizeof (GESTrackEffectPrivate)); + object_class->get_property = ges_track_effect_get_property; object_class->set_property = ges_track_effect_set_property; object_class->dispose = ges_track_effect_dispose; diff --git a/ges/ges-track-effect.h b/ges/ges-track-effect.h index 3174122835..564a4a17b9 100644 --- a/ges/ges-track-effect.h +++ b/ges/ges-track-effect.h @@ -36,17 +36,20 @@ G_BEGIN_DECLS (G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_TRACK_EFFECT)) #define GES_TRACK_EFFECT_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_TRACK_EFFECT, GESTrackEffectClass)) + + +typedef struct _GESTrackEffectPrivate GESTrackEffectPrivate; + /** * GESTrackEffect: * */ - struct _GESTrackEffect +struct _GESTrackEffect { GESTrackOperation parent; /*< private > */ - gchar *bin_description; - gchar *human_name; + GESTrackEffectPrivate *priv; }; /** @@ -63,13 +66,7 @@ struct _GESTrackEffectClass GType ges_track_effect_get_type (void); -void ges_track_effect_set_human_name (GESTrackEffect * self, - const gchar * human_name); -gchar *ges_track_effect_get_human_name (GESTrackEffect * self); - GESTrackEffect *ges_track_effect_new (const gchar * bin_description); -GESTrackEffect *ges_track_effect_new_with_name (const gchar * bin_description, - const gchar * human_name); G_END_DECLS #endif /* _GES_TRACK_EFFECT */ diff --git a/tests/check/ges/effects.c b/tests/check/ges/effects.c index 37c1200c09..9ac80da547 100644 --- a/tests/check/ges/effects.c +++ b/tests/check/ges/effects.c @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * - * You should have received a copy of the GNU Library General Public + * You should have received track_audio copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. @@ -30,10 +30,52 @@ GST_START_TEST (test_effect_basic) effect = ges_track_effect_new ("identity"); fail_unless (effect != NULL); g_object_unref (effect); +} - effect = ges_track_effect_new_with_name ("identity", "Identity effect"); - fail_unless (effect != NULL); - g_object_unref (effect); +GST_END_TEST; + +GST_START_TEST (test_add_effect_to_tl_object) +{ + GESTimeline *timeline; + GESTimelineLayer *layer; + GESTrack *track_audio, *track_video; + GESTrackEffect *effect_track; + GESTimelineTestSource *source; + gboolean effect_added = FALSE; + + ges_init (); + + timeline = ges_timeline_new (); + layer = (GESTimelineLayer *) ges_simple_timeline_layer_new (); + track_audio = ges_track_audio_raw_new (); + track_video = ges_track_video_raw_new (); + + ges_timeline_add_track (timeline, track_audio); + ges_timeline_add_track (timeline, track_video); + ges_timeline_add_layer (timeline, layer); + + source = ges_timeline_test_source_new (); + + g_object_set (source, "duration", 10 * GST_SECOND, NULL); + + ges_simple_timeline_layer_add_object ((GESSimpleTimelineLayer *) (layer), + (GESTimelineObject *) source, 0); + + GST_DEBUG ("Adding effect"); + ges_timeline_object_add_effect (GES_TIMELINE_OBJECT (source), + "identity", track_video); + + effect_track = + GES_TRACK_EFFECT (ges_timeline_object_find_track_object + (GES_TIMELINE_OBJECT (source), track_video, GES_TYPE_TRACK_EFFECT)); + + assert_equals_int (GES_TRACK_OBJECT (effect_track)->active, TRUE); + fail_unless (GES_IS_TRACK_EFFECT (effect_track)); + + ges_timeline_layer_remove_object (layer, (GESTimelineObject *) source); + + g_object_unref (effect_track); + g_object_unref (timeline); } GST_END_TEST; @@ -47,6 +89,7 @@ ges_suite (void) suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_effect_basic); + tcase_add_test (tc_chain, test_add_effect_to_tl_object); return s; }