markerlist: implement GESMarkerList
[platform/upstream/gst-editing-services.git] / tests / check / ges / layer.c
1 /* GStreamer Editing Services
2  * Copyright (C) 2010 Edward Hervey <bilboed@bilboed.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 #include "test-utils.h"
21 #include <ges/ges.h>
22 #include <gst/check/gstcheck.h>
23
24 #define LAYER_HEIGHT 1000
25
26 GST_START_TEST (test_layer_properties)
27 {
28   GESTimeline *timeline;
29   GESLayer *layer, *layer1;
30   GESTrack *track;
31   GESTrackElement *trackelement;
32   GESClip *clip;
33
34   ges_init ();
35
36   /* Timeline and 1 Layer */
37   timeline = ges_timeline_new ();
38
39   /* The default priority is 0 */
40   fail_unless ((layer = ges_timeline_append_layer (timeline)));
41   fail_unless_equals_int (ges_layer_get_priority (layer), 0);
42
43   fail_if (g_object_is_floating (layer));
44
45   fail_unless ((layer1 = ges_timeline_append_layer (timeline)));
46   fail_unless_equals_int (ges_layer_get_priority (layer1), 1);
47
48   track = GES_TRACK (ges_video_track_new ());
49   fail_unless (track != NULL);
50   fail_unless (ges_timeline_add_track (timeline, track));
51
52   clip = (GESClip *) ges_test_clip_new ();
53   fail_unless (clip != NULL);
54
55   /* Set some properties */
56   g_object_set (clip, "start", (guint64) 42, "duration", (guint64) 51,
57       "in-point", (guint64) 12, NULL);
58   assert_equals_uint64 (_START (clip), 42);
59   assert_equals_uint64 (_DURATION (clip), 51);
60   assert_equals_uint64 (_INPOINT (clip), 12);
61   assert_equals_uint64 (_PRIORITY (clip), 0);
62
63   /* Add the clip to the timeline */
64   fail_unless (g_object_is_floating (clip));
65   fail_unless (ges_layer_add_clip (layer, GES_CLIP (clip)));
66   fail_if (g_object_is_floating (clip));
67   trackelement = ges_clip_find_track_element (clip, track, G_TYPE_NONE);
68   fail_unless (trackelement != NULL);
69
70   /* This is not a SimpleLayer, therefore the properties shouldn't have changed */
71   assert_equals_uint64 (_START (clip), 42);
72   assert_equals_uint64 (_DURATION (clip), 51);
73   assert_equals_uint64 (_INPOINT (clip), 12);
74   assert_equals_uint64 (_PRIORITY (clip), 1);
75   ges_timeline_commit (timeline);
76   nle_object_check (ges_track_element_get_nleobject (trackelement), 42, 51, 12,
77       51, MIN_NLE_PRIO + TRANSITIONS_HEIGHT, TRUE);
78
79   /* Change the priority of the layer */
80   g_object_set (layer, "priority", 1, NULL);
81   assert_equals_int (ges_layer_get_priority (layer), 1);
82   assert_equals_uint64 (_PRIORITY (clip), 1);
83   ges_timeline_commit (timeline);
84   nle_object_check (ges_track_element_get_nleobject (trackelement), 42, 51, 12,
85       51, LAYER_HEIGHT + MIN_NLE_PRIO + TRANSITIONS_HEIGHT, TRUE);
86
87   /* Change it to an insanely high value */
88   g_object_set (layer, "priority", 31, NULL);
89   assert_equals_int (ges_layer_get_priority (layer), 31);
90   assert_equals_uint64 (_PRIORITY (clip), 1);
91   ges_timeline_commit (timeline);
92   nle_object_check (ges_track_element_get_nleobject (trackelement), 42, 51, 12,
93       51, MIN_NLE_PRIO + TRANSITIONS_HEIGHT + LAYER_HEIGHT * 31, TRUE);
94
95   /* and back to 0 */
96   fail_unless (ges_timeline_move_layer (timeline, layer, 0));
97   assert_equals_int (ges_layer_get_priority (layer), 0);
98   assert_equals_uint64 (_PRIORITY (clip), 1);
99   ges_timeline_commit (timeline);
100   nle_object_check (ges_track_element_get_nleobject (trackelement), 42, 51, 12,
101       51, MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 0, TRUE);
102
103   gst_object_unref (trackelement);
104   fail_unless (ges_layer_remove_clip (layer, clip));
105   fail_unless (ges_timeline_remove_track (timeline, track));
106   fail_unless (ges_timeline_remove_layer (timeline, layer));
107   gst_object_unref (timeline);
108
109   ges_deinit ();
110 }
111
112 GST_END_TEST;
113
114 GST_START_TEST (test_layer_priorities)
115 {
116   GESTrack *track;
117   GESTimeline *timeline;
118   GESLayer *layer1, *layer2, *layer3;
119   GESTrackElement *trackelement1, *trackelement2, *trackelement3;
120   GESClip *clip1, *clip2, *clip3;
121   GstElement *nleobj1, *nleobj2, *nleobj3;
122   guint prio1, prio2, prio3;
123   GList *objs;
124
125   ges_init ();
126
127   /* Timeline and 3 Layer */
128   timeline = ges_timeline_new ();
129   fail_unless ((layer1 = ges_timeline_append_layer (timeline)));
130   fail_unless ((layer2 = ges_timeline_append_layer (timeline)));
131   fail_unless ((layer3 = ges_timeline_append_layer (timeline)));
132   fail_unless_equals_int (ges_layer_get_priority (layer1), 0);
133   fail_unless_equals_int (ges_layer_get_priority (layer2), 1);
134   fail_unless_equals_int (ges_layer_get_priority (layer3), 2);
135
136   track = GES_TRACK (ges_video_track_new ());
137   fail_unless (track != NULL);
138   fail_unless (ges_timeline_add_track (timeline, track));
139
140   clip1 = GES_CLIP (ges_test_clip_new ());
141   clip2 = GES_CLIP (ges_test_clip_new ());
142   clip3 = GES_CLIP (ges_test_clip_new ());
143   fail_unless (clip1 != NULL);
144   fail_unless (clip2 != NULL);
145   fail_unless (clip3 != NULL);
146
147   g_object_set (clip1, "start", 0, "duration", 10, NULL);
148   g_object_set (clip2, "start", 10, "duration", 10, NULL);
149   g_object_set (clip3, "start", 20, "duration", 10, NULL);
150
151   /* Add objects to the timeline */
152   fail_unless (ges_layer_add_clip (layer1, clip1));
153   trackelement1 = ges_clip_find_track_element (clip1, track, G_TYPE_NONE);
154   fail_unless (trackelement1 != NULL);
155
156   fail_unless (ges_layer_add_clip (layer2, clip2));
157   trackelement2 = ges_clip_find_track_element (clip2, track, G_TYPE_NONE);
158   fail_unless (trackelement2 != NULL);
159
160   fail_unless (ges_layer_add_clip (layer3, clip3));
161   trackelement3 = ges_clip_find_track_element (clip3, track, G_TYPE_NONE);
162   fail_unless (trackelement3 != NULL);
163
164   ges_timeline_commit (timeline);
165   assert_equals_int (_PRIORITY (clip1), 1);
166   nleobj1 = ges_track_element_get_nleobject (trackelement1);
167   fail_unless (nleobj1 != NULL);
168   g_object_get (nleobj1, "priority", &prio1, NULL);
169   assert_equals_int (prio1, MIN_NLE_PRIO + TRANSITIONS_HEIGHT);
170
171   assert_equals_int (_PRIORITY (clip2), 1);
172   nleobj2 = ges_track_element_get_nleobject (trackelement2);
173   fail_unless (nleobj2 != NULL);
174   g_object_get (nleobj2, "priority", &prio2, NULL);
175   /* clip2 is on the second layer and has a priority of 1 */
176   assert_equals_int (prio2, MIN_NLE_PRIO + LAYER_HEIGHT + 1);
177
178   /* We do not take into account users set priorities */
179   assert_equals_int (_PRIORITY (clip3), 1);
180
181   nleobj3 = ges_track_element_get_nleobject (trackelement3);
182   fail_unless (nleobj3 != NULL);
183
184   /* clip3 is on the third layer and has a priority of LAYER_HEIGHT + 1
185    * it priority must have the maximum priority of this layer*/
186   g_object_get (nleobj3, "priority", &prio3, NULL);
187   assert_equals_int (prio3, 1 + MIN_NLE_PRIO + LAYER_HEIGHT * 2);
188
189   /* Move layers around */
190   fail_unless (ges_timeline_move_layer (timeline, layer1, 2));
191   ges_timeline_commit (timeline);
192
193   /* And check the new priorities */
194   assert_equals_int (ges_layer_get_priority (layer1), 2);
195   assert_equals_int (ges_layer_get_priority (layer2), 0);
196   assert_equals_int (ges_layer_get_priority (layer3), 1);
197   assert_equals_int (_PRIORITY (clip1), 1);
198   assert_equals_int (_PRIORITY (clip2), 1);
199   assert_equals_int (_PRIORITY (clip3), 1);
200   g_object_get (nleobj1, "priority", &prio1, NULL);
201   g_object_get (nleobj2, "priority", &prio2, NULL);
202   g_object_get (nleobj3, "priority", &prio3, NULL);
203   assert_equals_int (prio1,
204       2 * LAYER_HEIGHT + MIN_NLE_PRIO + TRANSITIONS_HEIGHT);
205   assert_equals_int (prio2, MIN_NLE_PRIO + 1);
206   assert_equals_int (prio3, LAYER_HEIGHT + MIN_NLE_PRIO + TRANSITIONS_HEIGHT);
207
208   /* And move objects around */
209   fail_unless (ges_clip_move_to_layer (clip2, layer1));
210   fail_unless (ges_clip_move_to_layer (clip3, layer1));
211   ges_timeline_commit (timeline);
212
213   objs = ges_layer_get_clips (layer1);
214   assert_equals_int (g_list_length (objs), 3);
215   fail_unless (ges_layer_get_clips (layer2) == NULL);
216   fail_unless (ges_layer_get_clips (layer3) == NULL);
217   g_list_free_full (objs, gst_object_unref);
218
219   /*  Check their priorities (layer1 priority is now 2) */
220   assert_equals_int (_PRIORITY (clip1), 1);
221   assert_equals_int (_PRIORITY (clip2), 2);
222   assert_equals_int (_PRIORITY (clip3), 3);
223   g_object_get (nleobj1, "priority", &prio1, NULL);
224   g_object_get (nleobj2, "priority", &prio2, NULL);
225   g_object_get (nleobj3, "priority", &prio3, NULL);
226   assert_equals_int (prio1,
227       2 * LAYER_HEIGHT + MIN_NLE_PRIO + TRANSITIONS_HEIGHT);
228   assert_equals_int (prio2,
229       2 * LAYER_HEIGHT + 1 + MIN_NLE_PRIO + TRANSITIONS_HEIGHT);
230   assert_equals_int (prio3,
231       2 * LAYER_HEIGHT + 2 + MIN_NLE_PRIO + TRANSITIONS_HEIGHT);
232
233   gst_object_unref (trackelement1);
234   gst_object_unref (trackelement2);
235   gst_object_unref (trackelement3);
236   gst_object_unref (timeline);
237
238   ges_deinit ();
239 }
240
241 GST_END_TEST;
242
243 GST_START_TEST (test_timeline_auto_transition)
244 {
245   GESAsset *asset;
246   GESTimeline *timeline;
247   GESLayer *layer, *layer1, *layer2;
248
249   ges_init ();
250
251   asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL);
252   fail_unless (GES_IS_ASSET (asset));
253   gst_object_unref (asset);
254
255   GST_DEBUG ("Create timeline");
256   timeline = ges_timeline_new_audio_video ();
257   assert_is_type (timeline, GES_TYPE_TIMELINE);
258
259   GST_DEBUG ("Create layers");
260   layer = ges_layer_new ();
261   assert_is_type (layer, GES_TYPE_LAYER);
262   layer1 = ges_layer_new ();
263   assert_is_type (layer, GES_TYPE_LAYER);
264   layer2 = ges_layer_new ();
265   assert_is_type (layer, GES_TYPE_LAYER);
266
267   GST_DEBUG ("Set auto-transition to the layers");
268   ges_layer_set_auto_transition (layer, TRUE);
269   ges_layer_set_auto_transition (layer1, TRUE);
270   ges_layer_set_auto_transition (layer2, TRUE);
271
272   GST_DEBUG ("Add layers to the timeline");
273   ges_timeline_add_layer (timeline, layer);
274   ges_timeline_add_layer (timeline, layer1);
275   ges_timeline_add_layer (timeline, layer2);
276
277   GST_DEBUG ("Check that auto-transition was properly set to the layers");
278   fail_unless (ges_layer_get_auto_transition (layer));
279   fail_unless (ges_layer_get_auto_transition (layer1));
280   fail_unless (ges_layer_get_auto_transition (layer2));
281
282   GST_DEBUG ("Set timeline auto-transition property to FALSE");
283   ges_timeline_set_auto_transition (timeline, FALSE);
284
285   GST_DEBUG
286       ("Check that layers auto-transition has the same value as timeline");
287   fail_if (ges_layer_get_auto_transition (layer));
288   fail_if (ges_layer_get_auto_transition (layer1));
289   fail_if (ges_layer_get_auto_transition (layer2));
290
291   GST_DEBUG ("Set timeline auto-transition property to TRUE");
292   ges_timeline_set_auto_transition (timeline, TRUE);
293
294   GST_DEBUG
295       ("Check that layers auto-transition has the same value as timeline");
296   fail_unless (ges_layer_get_auto_transition (layer));
297   fail_unless (ges_layer_get_auto_transition (layer1));
298   fail_unless (ges_layer_get_auto_transition (layer2));
299
300   gst_object_unref (timeline);
301
302   ges_deinit ();
303 }
304
305 GST_END_TEST;
306
307 GST_START_TEST (test_single_layer_automatic_transition)
308 {
309   GESAsset *asset;
310   GESTimeline *timeline;
311   GList *objects;
312   GESClip *transition;
313   GESLayer *layer;
314   GESTimelineElement *src, *src1, *src2;
315
316   ges_init ();
317
318   asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL);
319   fail_unless (GES_IS_ASSET (asset));
320
321   GST_DEBUG ("Create timeline");
322   timeline = ges_timeline_new_audio_video ();
323   assert_is_type (timeline, GES_TYPE_TIMELINE);
324
325   GST_DEBUG ("Create first layer");
326   layer = ges_layer_new ();
327   assert_is_type (layer, GES_TYPE_LAYER);
328
329   GST_DEBUG ("Add first layer to timeline");
330   fail_unless (ges_timeline_add_layer (timeline, layer));
331
332   GST_DEBUG ("Set auto transition to first layer");
333   ges_layer_set_auto_transition (layer, TRUE);
334
335   GST_DEBUG ("Check that auto-transition was properly set");
336   fail_unless (ges_layer_get_auto_transition (layer));
337
338   GST_DEBUG ("Adding assets to first layer");
339   GST_DEBUG ("Adding clip from 0 -- 1000 to first layer");
340   src = GES_TIMELINE_ELEMENT (ges_layer_add_asset (layer, asset, 0, 0,
341           1000, GES_TRACK_TYPE_UNKNOWN));
342   fail_unless (GES_IS_CLIP (src));
343
344   GST_DEBUG ("Adding clip from 500 -- 1000 to first layer");
345   src1 = GES_TIMELINE_ELEMENT (ges_layer_add_asset (layer, asset, 500,
346           0, 1000, GES_TRACK_TYPE_UNKNOWN));
347   fail_unless (GES_IS_CLIP (src1));
348
349   /*
350    *        500__transition__1000
351    * 0___________src_________1000
352    *        500___________src1_________1500
353    */
354   GST_DEBUG ("Checking src timing values");
355   assert_equals_uint64 (_START (src), 0);
356   assert_equals_uint64 (_DURATION (src), 1000);
357   assert_equals_uint64 (_START (src1), 500);
358   assert_equals_uint64 (_DURATION (src1), 1500 - 500);
359   ges_timeline_commit (timeline);
360
361   GST_DEBUG ("Checking that a transition has been added");
362   objects = ges_layer_get_clips (layer);
363   assert_equals_int (g_list_length (objects), 4);
364   assert_is_type (objects->data, GES_TYPE_TEST_CLIP);
365
366   transition = objects->next->data;
367   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
368   assert_equals_uint64 (_START (transition), 500);
369   assert_equals_uint64 (_DURATION (transition), 500);
370
371   transition = objects->next->next->data;
372   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
373   assert_equals_uint64 (_START (transition), 500);
374   assert_equals_uint64 (_DURATION (transition), 500);
375   g_list_free_full (objects, gst_object_unref);
376   ASSERT_OBJECT_REFCOUNT (transition, "layer + timeline", 2);
377
378   GST_DEBUG ("Moving first source to 250");
379   ges_timeline_element_set_start (src, 250);
380
381   /*
382    *           600_____transition______1500
383    *           600___________src_________1600
384    *        500___________src1_________1500
385    */
386   GST_DEBUG ("Checking src timing values");
387   CHECK_OBJECT_PROPS (src, 250, 0, 1000);
388   CHECK_OBJECT_PROPS (src1, 500, 0, 1000);
389
390   objects = ges_layer_get_clips (layer);
391   assert_equals_int (g_list_length (objects), 4);
392   transition = objects->next->data;
393   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
394   CHECK_OBJECT_PROPS (transition, 500, 0, 750);
395
396   transition = objects->next->next->data;
397   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
398   assert_equals_int (_START (transition), 500);
399   assert_equals_uint64 (_DURATION (transition), 750);
400   g_list_free_full (objects, gst_object_unref);
401
402   fail_if (ges_timeline_element_set_start (src1, 250));
403
404   fail_if (ges_container_edit (GES_CONTAINER (src), NULL, -1,
405           GES_EDIT_MODE_TRIM, GES_EDGE_START, 500));
406   CHECK_OBJECT_PROPS (src, 250, 0, 1000);
407   CHECK_OBJECT_PROPS (src1, 500, 0, 1000);
408   fail_if (ges_timeline_element_trim (src, 500));
409   CHECK_OBJECT_PROPS (src, 250, 0, 1000);
410   CHECK_OBJECT_PROPS (src1, 500, 0, 1000);
411   fail_if (ges_timeline_element_trim (src, 750));
412   CHECK_OBJECT_PROPS (src, 250, 0, 1000);
413   CHECK_OBJECT_PROPS (src1, 500, 0, 1000);
414   fail_if (ges_timeline_element_set_start (src, 500));
415   CHECK_OBJECT_PROPS (src, 250, 0, 1000);
416   CHECK_OBJECT_PROPS (src1, 500, 0, 1000);
417
418   /*
419    *           600_____transition______1500
420    *           600___________src_________1600
421    *        500___________src1_________1500
422    */
423   ges_timeline_element_set_start (src, 600);
424   CHECK_OBJECT_PROPS (src, 600, 0, 1000);
425   CHECK_OBJECT_PROPS (src1, 500, 0, 1000);
426   objects = ges_layer_get_clips (layer);
427   assert_equals_int (g_list_length (objects), 4);
428   transition = objects->next->data;
429   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
430   CHECK_OBJECT_PROPS (transition, 600, 0, 900);
431   g_list_free_full (objects, gst_object_unref);
432
433   GST_DEBUG ("Adding asset to first layer");
434   GST_DEBUG ("Adding clip from 1250 -- 1000 to first layer");
435   fail_if (ges_layer_add_asset (layer, asset, 1250, 0,
436           1000, GES_TRACK_TYPE_UNKNOWN));
437
438   /*
439    *                                    1500___________src2________2000
440    *                                    1500_trans_1600
441    *           600______________src________________1600
442    *           600_____transition______1500
443    *        500___________src1_________1500
444    */
445   src2 = GES_TIMELINE_ELEMENT (ges_layer_add_asset (layer, asset, 1500, 0,
446           500, GES_TRACK_TYPE_UNKNOWN));
447   assert_is_type (src2, GES_TYPE_TEST_CLIP);
448
449   CHECK_OBJECT_PROPS (src, 600, 0, 1000);
450   CHECK_OBJECT_PROPS (src1, 500, 0, 1000);
451   CHECK_OBJECT_PROPS (src2, 1500, 0, 500);
452   objects = ges_layer_get_clips (layer);
453   transition = objects->next->next->data;
454   assert_equals_int (g_list_length (objects), 7);
455   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
456   CHECK_OBJECT_PROPS (transition, 600, 0, 900);
457   transition = objects->next->next->next->next->data;
458   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
459   CHECK_OBJECT_PROPS (transition, 1500, 0, 100);
460
461   g_list_free_full (objects, gst_object_unref);
462
463   gst_object_unref (timeline);
464
465   ges_deinit ();
466 }
467
468 GST_END_TEST;
469
470 GST_START_TEST (test_multi_layer_automatic_transition)
471 {
472   GESAsset *asset;
473   GESTimeline *timeline;
474   GList *objects, *current;
475   GESClip *transition;
476   GESLayer *layer, *layer1;
477   GESTimelineElement *src, *src1, *src2, *src3;
478
479   ges_init ();
480
481   asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL);
482   fail_unless (GES_IS_ASSET (asset));
483
484   GST_DEBUG ("Create timeline");
485   timeline = ges_timeline_new_audio_video ();
486   assert_is_type (timeline, GES_TYPE_TIMELINE);
487
488   GST_DEBUG ("Create first layer");
489   layer = ges_layer_new ();
490   assert_is_type (layer, GES_TYPE_LAYER);
491
492   GST_DEBUG ("Add first layer to timeline");
493   fail_unless (ges_timeline_add_layer (timeline, layer));
494
495   GST_DEBUG ("Append a new layer to the timeline");
496   layer1 = ges_timeline_append_layer (timeline);
497   assert_is_type (layer1, GES_TYPE_LAYER);
498
499   GST_DEBUG ("Set auto transition to first layer");
500   ges_layer_set_auto_transition (layer, TRUE);
501
502   GST_DEBUG ("Check that auto-transition was properly set");
503   fail_unless (ges_layer_get_auto_transition (layer));
504   fail_if (ges_layer_get_auto_transition (layer1));
505
506   GST_DEBUG ("Adding assets to first layer");
507   GST_DEBUG ("Adding clip from 0 -- 1000 to first layer");
508   src = GES_TIMELINE_ELEMENT (ges_layer_add_asset (layer, asset, 0, 0,
509           1000, GES_TRACK_TYPE_UNKNOWN));
510   fail_unless (GES_IS_CLIP (src));
511
512   GST_DEBUG ("Adding clip from 500 -- 1000 to first layer");
513   src1 = GES_TIMELINE_ELEMENT (ges_layer_add_asset (layer, asset, 500,
514           0, 1000, GES_TRACK_TYPE_UNKNOWN));
515   ges_timeline_commit (timeline);
516   fail_unless (GES_IS_CLIP (src1));
517
518   /*
519    *        500__transition__1000
520    * 0___________src_________1000
521    *        500___________src1_________1500
522    */
523   GST_DEBUG ("Checking src timing values");
524   assert_equals_uint64 (_START (src), 0);
525   assert_equals_uint64 (_DURATION (src), 1000);
526   assert_equals_uint64 (_START (src1), 500);
527   assert_equals_uint64 (_DURATION (src1), 1500 - 500);
528
529   GST_DEBUG ("Checking that a transition has been added");
530   current = objects = ges_layer_get_clips (layer);
531   assert_equals_int (g_list_length (objects), 4);
532   assert_is_type (current->data, GES_TYPE_TEST_CLIP);
533
534   current = current->next;
535   transition = current->data;
536   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
537   assert_equals_uint64 (_START (transition), 500);
538   assert_equals_uint64 (_DURATION (transition), 500);
539
540   current = current->next;
541   transition = current->data;
542   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
543   assert_equals_uint64 (_START (transition), 500);
544   assert_equals_uint64 (_DURATION (transition), 500);
545   g_list_free_full (objects, gst_object_unref);
546   ASSERT_OBJECT_REFCOUNT (transition, "layer + timeline", 2);
547
548   GST_DEBUG ("Adding clip 2 from 500 -- 1000 to second layer");
549   src2 = GES_TIMELINE_ELEMENT (ges_layer_add_asset (layer1, asset, 0,
550           0, 1000, GES_TRACK_TYPE_UNKNOWN));
551   GST_DEBUG ("Adding clip 3 from 500 -- 1000 to second layer");
552   src3 = GES_TIMELINE_ELEMENT (ges_layer_add_asset (layer1, asset, 500,
553           0, 1000, GES_TRACK_TYPE_UNKNOWN));
554   assert_is_type (src3, GES_TYPE_TEST_CLIP);
555
556   /*        500__transition__1000
557    * 0___________src_________1000
558    *        500___________src1_________1500
559    *----------------------------------------------------
560    * 0___________src2_________1000
561    *        500___________src3_________1500         Layer1
562    */
563   GST_DEBUG ("Checking src timing values");
564   assert_equals_uint64 (_START (src), 0);
565   assert_equals_uint64 (_DURATION (src), 1000);
566   assert_equals_uint64 (_START (src1), 500);
567   assert_equals_uint64 (_DURATION (src1), 1500 - 500);
568   assert_equals_uint64 (_START (src2), 0);
569   assert_equals_uint64 (_DURATION (src2), 1000);
570   assert_equals_uint64 (_START (src3), 500);
571   assert_equals_uint64 (_DURATION (src3), 1500 - 500);
572
573   GST_DEBUG ("Checking transitions on first layer");
574   current = objects = ges_layer_get_clips (layer);
575   assert_equals_int (g_list_length (objects), 4);
576   assert_is_type (current->data, GES_TYPE_TEST_CLIP);
577
578   current = current->next;
579   transition = current->data;
580   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
581   assert_equals_uint64 (_START (transition), 500);
582   assert_equals_uint64 (_DURATION (transition), 500);
583
584   current = current->next;
585   transition = current->data;
586   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
587   assert_equals_uint64 (_START (transition), 500);
588   assert_equals_uint64 (_DURATION (transition), 500);
589   g_list_free_full (objects, gst_object_unref);
590   ASSERT_OBJECT_REFCOUNT (transition, "layer + timeline", 2);
591
592   GST_DEBUG ("Checking transitions on second layer");
593   current = objects = ges_layer_get_clips (layer1);
594   assert_equals_int (g_list_length (objects), 2);
595   fail_unless (current->data == src2);
596   fail_unless (current->next->data == src3);
597   g_list_free_full (objects, gst_object_unref);
598
599   GST_DEBUG
600       ("Set auto transition to second layer, a new transition should be added");
601   ges_layer_set_auto_transition (layer1, TRUE);
602
603   /*        500__transition__1000
604    * 0___________src_________1000
605    *        500___________src1_________1500
606    *----------------------------------------------------
607    *        500__transition__1000
608    * 0__________src2_________1000
609    *        500___________src3_________1500         Layer1
610    */
611   GST_DEBUG ("Checking src timing values");
612   assert_equals_uint64 (_START (src), 0);
613   assert_equals_uint64 (_DURATION (src), 1000);
614   assert_equals_uint64 (_START (src1), 500);
615   assert_equals_uint64 (_DURATION (src1), 1500 - 500);
616   assert_equals_uint64 (_START (src2), 0);
617   assert_equals_uint64 (_DURATION (src2), 1000);
618   assert_equals_uint64 (_START (src3), 500);
619   assert_equals_uint64 (_DURATION (src3), 1500 - 500);
620
621   GST_DEBUG ("Checking transitions on first layer");
622   current = objects = ges_layer_get_clips (layer);
623   assert_equals_int (g_list_length (objects), 4);
624   assert_is_type (current->data, GES_TYPE_TEST_CLIP);
625
626   current = current->next;
627   transition = current->data;
628   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
629   assert_equals_uint64 (_START (transition), 500);
630   assert_equals_uint64 (_DURATION (transition), 500);
631
632   current = current->next;
633   transition = current->data;
634   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
635   assert_equals_uint64 (_START (transition), 500);
636   assert_equals_uint64 (_DURATION (transition), 500);
637   g_list_free_full (objects, gst_object_unref);
638   ASSERT_OBJECT_REFCOUNT (transition, "layer + timeline", 2);
639
640   GST_DEBUG ("Checking transitions has been added on second layer");
641   current = objects = ges_layer_get_clips (layer1);
642   assert_equals_int (g_list_length (objects), 4);
643   assert_is_type (current->data, GES_TYPE_TEST_CLIP);
644
645   current = current->next;
646   transition = current->data;
647   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
648   assert_equals_uint64 (_START (transition), 500);
649   assert_equals_uint64 (_DURATION (transition), 500);
650
651   current = current->next;
652   transition = current->data;
653   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
654   assert_equals_uint64 (_START (transition), 500);
655   assert_equals_uint64 (_DURATION (transition), 500);
656   g_list_free_full (objects, gst_object_unref);
657   ASSERT_OBJECT_REFCOUNT (transition, "layer + timeline", 2);
658
659   GST_DEBUG ("Moving src3 to 1000. should remove transition");
660   ges_timeline_element_set_start (src3, 1000);
661
662   /*        500__transition__1000
663    * 0___________src_________1000
664    *        500___________src1_________1500                           Layer
665    *----------------------------------------------------
666    * 0__________src2_________1000
667    *                         1000___________src3_________2000         Layer1
668    */
669   GST_DEBUG ("Checking src timing values");
670   assert_equals_uint64 (_START (src), 0);
671   assert_equals_uint64 (_DURATION (src), 1000);
672   assert_equals_uint64 (_START (src1), 500);
673   assert_equals_uint64 (_DURATION (src1), 1500 - 500);
674   assert_equals_uint64 (_START (src2), 0);
675   assert_equals_uint64 (_DURATION (src2), 1000);
676   assert_equals_uint64 (_START (src3), 1000);
677   assert_equals_uint64 (_DURATION (src3), 2000 - 1000);
678
679   GST_DEBUG ("Checking transitions on first layer");
680   current = objects = ges_layer_get_clips (layer);
681   assert_equals_int (g_list_length (objects), 4);
682   assert_is_type (current->data, GES_TYPE_TEST_CLIP);
683
684   current = current->next;
685   transition = current->data;
686   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
687   assert_equals_uint64 (_START (transition), 500);
688   assert_equals_uint64 (_DURATION (transition), 500);
689
690   current = current->next;
691   transition = current->data;
692   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
693   assert_equals_uint64 (_START (transition), 500);
694   assert_equals_uint64 (_DURATION (transition), 500);
695   g_list_free_full (objects, gst_object_unref);
696   ASSERT_OBJECT_REFCOUNT (transition, "layer + timeline", 2);
697
698   GST_DEBUG ("Checking transitions has been removed on second layer");
699   current = objects = ges_layer_get_clips (layer1);
700   assert_equals_int (g_list_length (objects), 2);
701   fail_unless (current->data == src2);
702   fail_unless (current->next->data == src3);
703   g_list_free_full (objects, gst_object_unref);
704   ASSERT_OBJECT_REFCOUNT (transition, "layer + timeline", 2);
705
706   GST_DEBUG ("Moving src3 to first layer, should add a transition");
707   ges_clip_move_to_layer (GES_CLIP (src3), layer);
708
709   /*        500__transition__1000
710    * 0___________src_________1000
711    *        500___________src1_________1500
712    *                         1000___________src3_________2000   Layer
713    *                         1000__tr__1500
714    *----------------------------------------------------
715    * 0__________src2_________1000                               Layer1
716    */
717   GST_DEBUG ("Checking src timing values");
718   assert_equals_uint64 (_START (src), 0);
719   assert_equals_uint64 (_DURATION (src), 1000);
720   assert_equals_uint64 (_START (src1), 500);
721   assert_equals_uint64 (_DURATION (src1), 1500 - 500);
722   assert_equals_uint64 (_START (src2), 0);
723   assert_equals_uint64 (_DURATION (src2), 1000);
724   assert_equals_uint64 (_START (src3), 1000);
725   assert_equals_uint64 (_DURATION (src3), 2000 - 1000);
726
727   GST_DEBUG ("Checking transitions on first layer");
728   current = objects = ges_layer_get_clips (layer);
729   assert_equals_int (g_list_length (objects), 7);
730   fail_unless (current->data == src);
731
732   current = current->next;
733   transition = current->data;
734   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
735   assert_equals_uint64 (_START (transition), 500);
736   assert_equals_uint64 (_DURATION (transition), 500);
737
738   current = current->next;
739   transition = current->data;
740   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
741   assert_equals_uint64 (_START (transition), 500);
742   assert_equals_uint64 (_DURATION (transition), 500);
743
744   current = current->next;
745   fail_unless (current->data == src1);
746
747   current = current->next;
748   transition = current->data;
749   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
750   assert_equals_uint64 (_START (transition), 1000);
751   assert_equals_uint64 (_DURATION (transition), 1500 - 1000);
752
753   current = current->next;
754   transition = current->data;
755   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
756   assert_equals_uint64 (_START (transition), 1000);
757   assert_equals_uint64 (_DURATION (transition), 1500 - 1000);
758
759   current = current->next;
760   fail_unless (current->data == src3);
761
762   g_list_free_full (objects, gst_object_unref);
763   ASSERT_OBJECT_REFCOUNT (transition, "layer + timeline", 2);
764
765   GST_DEBUG ("Checking second layer");
766   current = objects = ges_layer_get_clips (layer1);
767   assert_equals_int (g_list_length (objects), 1);
768   fail_unless (current->data == src2);
769   g_list_free_full (objects, gst_object_unref);
770   ASSERT_OBJECT_REFCOUNT (transition, "layer + timeline", 2);
771
772   GST_DEBUG
773       ("Moving src to second layer, should remove first transition on first layer");
774   fail_if (ges_clip_move_to_layer (GES_CLIP (src), layer1));
775
776   /*        500___________src1_________1500
777    *                         1000___________src3_________2000   Layer
778    *                         1000__tr__1500
779    *----------------------------------------------------
780    * 0___________src_________1000
781    * 0__________src2_________1000                               Layer1
782    */
783   GST_DEBUG ("Checking src timing values");
784   assert_equals_uint64 (_START (src), 0);
785   assert_equals_uint64 (_DURATION (src), 1000);
786   assert_equals_uint64 (_START (src1), 500);
787   assert_equals_uint64 (_DURATION (src1), 1500 - 500);
788   assert_equals_uint64 (_START (src2), 0);
789   assert_equals_uint64 (_DURATION (src2), 1000);
790   assert_equals_uint64 (_START (src3), 1000);
791   assert_equals_uint64 (_DURATION (src3), 2000 - 1000);
792
793   GST_DEBUG ("Checking transitions on first layer");
794   current = objects = ges_layer_get_clips (layer);
795   assert_equals_int (g_list_length (objects), 7);
796
797   g_list_free_full (objects, gst_object_unref);
798   ASSERT_OBJECT_REFCOUNT (transition, "layer + timeline", 2);
799
800   GST_DEBUG ("Edit src to first layer start=1500");
801   ges_container_edit (GES_CONTAINER (src), NULL, 0,
802       GES_EDIT_MODE_NORMAL, GES_EDGE_NONE, 1500);
803   /*                                   1500___________src_________2500
804    *                                   1500______tr______2000
805    *        500___________src1_________1500                 ^
806    *                         1000_________^_src3_________2000   Layer
807    *                         1000__tr__1500
808    *---------------------------------------------------------------------------
809    * 0__________src2_________1000                               Layer1
810    */
811   GST_DEBUG ("Checking src timing values");
812   assert_equals_uint64 (_START (src), 1500);
813   assert_equals_uint64 (_DURATION (src), 1000);
814   assert_equals_uint64 (_START (src1), 500);
815   assert_equals_uint64 (_DURATION (src1), 1500 - 500);
816   assert_equals_uint64 (_START (src2), 0);
817   assert_equals_uint64 (_DURATION (src2), 1000);
818   assert_equals_uint64 (_START (src3), 1000);
819   assert_equals_uint64 (_DURATION (src3), 2000 - 1000);
820
821   GST_DEBUG ("Checking transitions on first layer");
822   current = objects = ges_layer_get_clips (layer);
823   assert_equals_int (g_list_length (objects), 7);
824   fail_unless (current->data == src1);
825
826   current = current->next;
827   transition = current->data;
828   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
829   assert_equals_uint64 (_START (transition), 1000);
830   assert_equals_uint64 (_DURATION (transition), 500);
831
832   current = current->next;
833   transition = current->data;
834   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
835   assert_equals_uint64 (_START (transition), 1000);
836   assert_equals_uint64 (_DURATION (transition), 500);
837
838   current = current->next;
839   fail_unless (current->data == src3);
840
841   current = current->next;
842   transition = current->data;
843   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
844   assert_equals_uint64 (_START (transition), 1500);
845   assert_equals_uint64 (_DURATION (transition), 500);
846
847   current = current->next;
848   transition = current->data;
849   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
850   assert_equals_uint64 (_START (transition), 1500);
851   assert_equals_uint64 (_DURATION (transition), 500);
852
853   current = current->next;
854   fail_unless (current->data == src);
855   g_list_free_full (objects, gst_object_unref);
856   ASSERT_OBJECT_REFCOUNT (transition, "layer + timeline", 2);
857
858   GST_DEBUG ("Checking second layer");
859   current = objects = ges_layer_get_clips (layer1);
860   assert_equals_int (g_list_length (objects), 1);
861   assert_is_type (current->data, GES_TYPE_TEST_CLIP);
862   g_list_free_full (objects, gst_object_unref);
863   ASSERT_OBJECT_REFCOUNT (transition, "layer + timeline", 2);
864
865   GST_DEBUG ("Ripple src1 to 700");
866   ges_container_edit (GES_CONTAINER (src1), NULL, 0,
867       GES_EDIT_MODE_RIPPLE, GES_EDGE_NONE, 700);
868
869   /*                                           1700___________src_________2700
870    *                                           1700__tr__2000
871    *                700___________src1_________1700
872    *                                1200___________src3_________2200   Layer
873    *                                1200___tr__1700
874    *---------------------------------------------------------------------------
875    * 0__________src2_________1000                               Layer1
876    */
877   GST_DEBUG ("Checking src timing values");
878   assert_equals_uint64 (_START (src), 1700);
879   assert_equals_uint64 (_DURATION (src), 1000);
880   assert_equals_uint64 (_START (src1), 700);
881   assert_equals_uint64 (_DURATION (src1), 1700 - 700);
882   assert_equals_uint64 (_START (src2), 0);
883   assert_equals_uint64 (_DURATION (src2), 1000);
884   assert_equals_uint64 (_START (src3), 1200);
885   assert_equals_uint64 (_DURATION (src3), 2200 - 1200);
886
887   GST_DEBUG ("Checking transitions on first layer");
888   current = objects = ges_layer_get_clips (layer);
889   assert_equals_int (g_list_length (objects), 7);
890   fail_unless (current->data == src1);
891
892   current = current->next;
893   transition = current->data;
894   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
895   assert_equals_uint64 (_START (transition), 1200);
896   assert_equals_uint64 (_DURATION (transition), 1700 - 1200);
897
898   current = current->next;
899   transition = current->data;
900   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
901   assert_equals_uint64 (_START (transition), 1200);
902   assert_equals_uint64 (_DURATION (transition), 1700 - 1200);
903
904   current = current->next;
905   fail_unless (current->data == src3);
906
907   current = current->next;
908   transition = current->data;
909   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
910   assert_equals_uint64 (_START (transition), 1700);
911   assert_equals_uint64 (_DURATION (transition), 2200 - 1700);
912
913   current = current->next;
914   transition = current->data;
915   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
916   assert_equals_uint64 (_START (transition), 1700);
917   assert_equals_uint64 (_DURATION (transition), 2200 - 1700);
918
919   current = current->next;
920   fail_unless (current->data == src);
921   g_list_free_full (objects, gst_object_unref);
922   ASSERT_OBJECT_REFCOUNT (transition, "layer + timeline", 2);
923
924   GST_DEBUG ("Checking second layer");
925   current = objects = ges_layer_get_clips (layer1);
926   assert_equals_int (g_list_length (objects), 1);
927   assert_is_type (current->data, GES_TYPE_TEST_CLIP);
928   g_list_free_full (objects, gst_object_unref);
929   ASSERT_OBJECT_REFCOUNT (transition, "layer + timeline", 2);
930
931   gst_object_unref (timeline);
932
933   ges_deinit ();
934 }
935
936 GST_END_TEST;
937
938 GST_START_TEST (test_layer_activate_automatic_transition)
939 {
940   GESAsset *asset, *transition_asset;
941   GESTimeline *timeline;
942   GESLayer *layer;
943   GList *objects, *current;
944   GESClip *transition;
945   GESTimelineElement *src, *src1, *src2, *src3;
946
947   ges_init ();
948
949   asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL);
950   transition_asset =
951       ges_asset_request (GES_TYPE_TRANSITION_CLIP, "crossfade", NULL);
952   fail_unless (GES_IS_ASSET (asset));
953
954   GST_DEBUG ("Create timeline");
955   timeline = ges_timeline_new_audio_video ();
956   assert_is_type (timeline, GES_TYPE_TIMELINE);
957
958   GST_DEBUG ("Append a layer to the timeline");
959   layer = ges_timeline_append_layer (timeline);
960   assert_is_type (layer, GES_TYPE_LAYER);
961
962   GST_DEBUG ("Adding clip from 0 -- 1000 to layer");
963   src = GES_TIMELINE_ELEMENT (ges_layer_add_asset (layer, asset, 0, 0,
964           1000, GES_TRACK_TYPE_UNKNOWN));
965   fail_unless (GES_IS_CLIP (src));
966
967   GST_DEBUG ("Adding clip from 500 -- 1000 to first layer");
968   src1 = GES_TIMELINE_ELEMENT (ges_layer_add_asset (layer, asset, 500,
969           0, 1000, GES_TRACK_TYPE_UNKNOWN));
970   fail_unless (GES_IS_CLIP (src1));
971
972   GST_DEBUG ("Adding clip from 1000 -- 2000 to layer");
973   src2 = GES_TIMELINE_ELEMENT (ges_layer_add_asset (layer, asset, 1000,
974           0, 1000, GES_TRACK_TYPE_UNKNOWN));
975   fail_unless (GES_IS_CLIP (src2));
976
977   GST_DEBUG ("Adding clip from 2000 -- 2500 to layer");
978   src3 = GES_TIMELINE_ELEMENT (ges_layer_add_asset (layer, asset, 2000,
979           0, 500, GES_TRACK_TYPE_UNKNOWN));
980   fail_unless (GES_IS_CLIP (src3));
981
982   /*
983    * 0___________src_________1000
984    *        500___________src1_________1500
985    *                         1000____src2_______2000
986    *                                            2000_______src2_____2500
987    */
988   GST_DEBUG ("Checking src timing values");
989   assert_equals_uint64 (_START (src), 0);
990   assert_equals_uint64 (_DURATION (src), 1000);
991   assert_equals_uint64 (_START (src1), 500);
992   assert_equals_uint64 (_DURATION (src1), 1500 - 500);
993   assert_equals_uint64 (_START (src2), 1000);
994   assert_equals_uint64 (_DURATION (src2), 1000);
995   assert_equals_uint64 (_START (src3), 2000);
996   assert_equals_uint64 (_DURATION (src3), 500);
997
998   GST_DEBUG ("Checking that no transition has been added");
999   current = objects = ges_layer_get_clips (layer);
1000   assert_equals_int (g_list_length (objects), 4);
1001   assert_is_type (current->data, GES_TYPE_TEST_CLIP);
1002   g_list_free_full (objects, gst_object_unref);
1003
1004   GST_DEBUG ("Adding transition from 1000 -- 1500 to layer");
1005   transition =
1006       GES_CLIP (ges_layer_add_asset (layer,
1007           transition_asset, 1000, 0, 500, GES_TRACK_TYPE_VIDEO));
1008   g_object_unref (transition_asset);
1009   fail_unless (GES_IS_TRANSITION_CLIP (transition));
1010   objects = GES_CONTAINER_CHILDREN (transition);
1011   assert_equals_int (g_list_length (objects), 1);
1012
1013   GST_DEBUG ("Checking the transitions");
1014   /*
1015    * 0___________src_________1000
1016    *        500___________src1_________1500
1017    *                         1000__tr__1500 (1 of the 2 tracks only)
1018    *                         1000____src2_______2000
1019    *                                            2000_______src3_____2500
1020    */
1021   current = objects = ges_layer_get_clips (layer);
1022   assert_equals_int (g_list_length (objects), 5);
1023   current = current->next;
1024   assert_is_type (current->data, GES_TYPE_TEST_CLIP);
1025   current = current->next;
1026   assert_is_type (current->data, GES_TYPE_TRANSITION_CLIP);
1027   current = current->next;
1028   assert_is_type (current->data, GES_TYPE_TEST_CLIP);
1029   current = current->next;
1030   assert_is_type (current->data, GES_TYPE_TEST_CLIP);
1031   g_list_free_full (objects, gst_object_unref);
1032
1033   ges_layer_set_auto_transition (layer, TRUE);
1034   /*
1035    * 0___________src_________1000
1036    *        500______tr______1000
1037    *        500___________src1_________1500
1038    *                         1000__tr__1500
1039    *                         1000____src2_______2000
1040    *                                            2000_______src3_____2500
1041    */
1042   current = objects = ges_layer_get_clips (layer);
1043   assert_equals_int (g_list_length (objects), 8);
1044   assert_equals_uint64 (_START (src), 0);
1045   assert_equals_uint64 (_DURATION (src), 1000);
1046   assert_equals_uint64 (_START (src1), 500);
1047   assert_equals_uint64 (_DURATION (src1), 1500 - 500);
1048   assert_equals_uint64 (_START (src2), 1000);
1049   assert_equals_uint64 (_DURATION (src2), 1000);
1050   assert_equals_uint64 (_START (src3), 2000);
1051   assert_equals_uint64 (_DURATION (src3), 500);
1052
1053   GST_DEBUG ("Checking transitions");
1054   fail_unless (current->data == src);
1055
1056   current = current->next;
1057   transition = current->data;
1058   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
1059   assert_equals_uint64 (_START (transition), 500);
1060   assert_equals_uint64 (_DURATION (transition), 500);
1061
1062   current = current->next;
1063   transition = current->data;
1064   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
1065   assert_equals_uint64 (_START (transition), 500);
1066   assert_equals_uint64 (_DURATION (transition), 500);
1067
1068   current = current->next;
1069   fail_unless (current->data == src1);
1070
1071   current = current->next;
1072   transition = current->data;
1073   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
1074   assert_equals_uint64 (_START (transition), 1000);
1075   assert_equals_uint64 (_DURATION (transition), 500);
1076
1077   current = current->next;
1078   transition = current->data;
1079   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
1080   assert_equals_uint64 (_START (transition), 1000);
1081   assert_equals_uint64 (_DURATION (transition), 500);
1082
1083   current = current->next;
1084   fail_unless (current->data == src2);
1085
1086   current = current->next;
1087   fail_unless (current->data == src3);
1088   g_list_free_full (objects, gst_object_unref);
1089   ASSERT_OBJECT_REFCOUNT (transition, "layer + timeline", 2);
1090
1091   GST_DEBUG ("Moving src2 to 1200, check everything updates properly");
1092   ges_timeline_element_set_start (src2, 1200);
1093   ges_timeline_commit (timeline);
1094   /*
1095    * 0___________src_________1000
1096    *        500______tr______1000
1097    *        500___________src1_________1500
1098    *                           1200_tr_1500
1099    *                           1200____src2_______2200
1100    *                                          !__tr__^
1101    *                                          2000_______src3_____2500
1102    */
1103   current = objects = ges_layer_get_clips (layer);
1104   assert_equals_int (g_list_length (objects), 10);
1105   assert_equals_uint64 (_START (src), 0);
1106   assert_equals_uint64 (_DURATION (src), 1000);
1107   assert_equals_uint64 (_START (src1), 500);
1108   assert_equals_uint64 (_DURATION (src1), 1500 - 500);
1109   assert_equals_uint64 (_START (src2), 1200);
1110   assert_equals_uint64 (_DURATION (src2), 1000);
1111   assert_equals_uint64 (_START (src3), 2000);
1112   assert_equals_uint64 (_DURATION (src3), 500);
1113
1114   GST_DEBUG ("Checking transitions");
1115   fail_unless (current->data == src);
1116
1117   current = current->next;
1118   transition = current->data;
1119   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
1120   assert_equals_uint64 (_START (transition), 500);
1121   assert_equals_uint64 (_DURATION (transition), 500);
1122
1123   current = current->next;
1124   transition = current->data;
1125   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
1126   assert_equals_uint64 (_START (transition), 500);
1127   assert_equals_uint64 (_DURATION (transition), 500);
1128
1129   current = current->next;
1130   fail_unless (current->data == src1);
1131
1132   current = current->next;
1133   transition = current->data;
1134   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
1135   assert_equals_uint64 (_START (transition), 1200);
1136   assert_equals_uint64 (_DURATION (transition), 300);
1137
1138   current = current->next;
1139   transition = current->data;
1140   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
1141   assert_equals_uint64 (_START (transition), 1200);
1142   assert_equals_uint64 (_DURATION (transition), 300);
1143
1144   current = current->next;
1145   fail_unless (current->data == src2);
1146
1147   current = current->next;
1148   transition = current->data;
1149   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
1150   assert_equals_uint64 (_START (transition), 2000);
1151   assert_equals_uint64 (_DURATION (transition), 200);
1152
1153   current = current->next;
1154   transition = current->data;
1155   assert_is_type (transition, GES_TYPE_TRANSITION_CLIP);
1156   assert_equals_uint64 (_START (transition), 2000);
1157   assert_equals_uint64 (_DURATION (transition), 200);
1158
1159   current = current->next;
1160   fail_unless (current->data == src3);
1161   g_list_free_full (objects, gst_object_unref);
1162   ASSERT_OBJECT_REFCOUNT (transition, "layer + timeline", 2);
1163
1164
1165   gst_object_unref (timeline);
1166
1167   ges_deinit ();
1168 }
1169
1170 GST_END_TEST;
1171
1172 GST_START_TEST (test_layer_meta_string)
1173 {
1174   GESTimeline *timeline;
1175   GESLayer *layer;
1176   const gchar *result;
1177
1178   ges_init ();
1179
1180   timeline = ges_timeline_new_audio_video ();
1181   layer = ges_layer_new ();
1182   ges_timeline_add_layer (timeline, layer);
1183
1184   ges_meta_container_set_string (GES_META_CONTAINER (layer),
1185       "ges-test", "blub");
1186
1187   fail_unless ((result = ges_meta_container_get_string (GES_META_CONTAINER
1188               (layer), "ges-test")) != NULL);
1189
1190   assert_equals_string (result, "blub");
1191
1192   ges_deinit ();
1193 }
1194
1195 GST_END_TEST;
1196
1197 GST_START_TEST (test_layer_meta_boolean)
1198 {
1199   GESTimeline *timeline;
1200   GESLayer *layer;
1201   gboolean result;
1202
1203   ges_init ();
1204
1205   timeline = ges_timeline_new_audio_video ();
1206   layer = ges_layer_new ();
1207   ges_timeline_add_layer (timeline, layer);
1208
1209   ges_meta_container_set_boolean (GES_META_CONTAINER (layer), "ges-test", TRUE);
1210
1211   fail_unless (ges_meta_container_get_boolean (GES_META_CONTAINER
1212           (layer), "ges-test", &result));
1213
1214   fail_unless (result);
1215
1216   ges_deinit ();
1217 }
1218
1219 GST_END_TEST;
1220
1221 GST_START_TEST (test_layer_meta_int)
1222 {
1223   GESTimeline *timeline;
1224   GESLayer *layer;
1225   gint result;
1226
1227   ges_init ();
1228
1229   timeline = ges_timeline_new_audio_video ();
1230   layer = ges_layer_new ();
1231   ges_timeline_add_layer (timeline, layer);
1232
1233   ges_meta_container_set_int (GES_META_CONTAINER (layer), "ges-test", 1234);
1234
1235   fail_unless (ges_meta_container_get_int (GES_META_CONTAINER (layer),
1236           "ges-test", &result));
1237
1238   assert_equals_int (result, 1234);
1239
1240   ges_deinit ();
1241 }
1242
1243 GST_END_TEST;
1244
1245 GST_START_TEST (test_layer_meta_uint)
1246 {
1247   GESTimeline *timeline;
1248   GESLayer *layer;
1249   guint result;
1250
1251   ges_init ();
1252
1253   timeline = ges_timeline_new_audio_video ();
1254   layer = ges_layer_new ();
1255   ges_timeline_add_layer (timeline, layer);
1256
1257   ges_meta_container_set_uint (GES_META_CONTAINER (layer), "ges-test", 42);
1258
1259   fail_unless (ges_meta_container_get_uint (GES_META_CONTAINER
1260           (layer), "ges-test", &result));
1261
1262   assert_equals_int (result, 42);
1263
1264   ges_deinit ();
1265 }
1266
1267 GST_END_TEST;
1268
1269 GST_START_TEST (test_layer_meta_int64)
1270 {
1271   GESTimeline *timeline;
1272   GESLayer *layer;
1273   gint64 result;
1274
1275   ges_init ();
1276
1277   timeline = ges_timeline_new_audio_video ();
1278   layer = ges_layer_new ();
1279   ges_timeline_add_layer (timeline, layer);
1280
1281   ges_meta_container_set_int64 (GES_META_CONTAINER (layer), "ges-test", 1234);
1282
1283   fail_unless (ges_meta_container_get_int64 (GES_META_CONTAINER (layer),
1284           "ges-test", &result));
1285
1286   assert_equals_int64 (result, 1234);
1287
1288   ges_deinit ();
1289 }
1290
1291 GST_END_TEST;
1292
1293 GST_START_TEST (test_layer_meta_uint64)
1294 {
1295   GESTimeline *timeline;
1296   GESLayer *layer;
1297   guint64 result;
1298
1299   ges_init ();
1300
1301   timeline = ges_timeline_new_audio_video ();
1302   layer = ges_layer_new ();
1303   ges_timeline_add_layer (timeline, layer);
1304
1305   ges_meta_container_set_uint64 (GES_META_CONTAINER (layer), "ges-test", 42);
1306
1307   fail_unless (ges_meta_container_get_uint64 (GES_META_CONTAINER
1308           (layer), "ges-test", &result));
1309
1310   assert_equals_uint64 (result, 42);
1311
1312   ges_deinit ();
1313 }
1314
1315 GST_END_TEST;
1316
1317 GST_START_TEST (test_layer_meta_float)
1318 {
1319   GESTimeline *timeline;
1320   GESLayer *layer;
1321   gfloat result;
1322
1323   ges_init ();
1324
1325   timeline = ges_timeline_new_audio_video ();
1326   layer = ges_layer_new ();
1327   ges_timeline_add_layer (timeline, layer);
1328
1329   fail_unless (ges_meta_container_set_float (GES_META_CONTAINER (layer),
1330           "ges-test", 23.456));
1331
1332   fail_unless (ges_meta_container_get_float (GES_META_CONTAINER (layer),
1333           "ges-test", &result));
1334
1335   assert_equals_float (result, 23.456f);
1336
1337   ges_deinit ();
1338 }
1339
1340 GST_END_TEST;
1341
1342 GST_START_TEST (test_layer_meta_double)
1343 {
1344   GESTimeline *timeline;
1345   GESLayer *layer;
1346   gdouble result;
1347
1348   ges_init ();
1349
1350   timeline = ges_timeline_new_audio_video ();
1351   layer = ges_layer_new ();
1352   ges_timeline_add_layer (timeline, layer);
1353
1354   ges_meta_container_set_double (GES_META_CONTAINER (layer),
1355       "ges-test", 23.456);
1356
1357   fail_unless (ges_meta_container_get_double (GES_META_CONTAINER
1358           (layer), "ges-test", &result));
1359   fail_unless (result == 23.456);
1360
1361   //TODO CHECK
1362   assert_equals_float (result, 23.456);
1363
1364   ges_deinit ();
1365 }
1366
1367 GST_END_TEST;
1368
1369 GST_START_TEST (test_layer_meta_date)
1370 {
1371   GESTimeline *timeline;
1372   GESLayer *layer;
1373   GDate *input;
1374   GDate *result;
1375
1376   ges_init ();
1377
1378   timeline = ges_timeline_new_audio_video ();
1379   layer = ges_layer_new ();
1380   ges_timeline_add_layer (timeline, layer);
1381
1382   input = g_date_new_dmy (1, 1, 2012);
1383
1384   ges_meta_container_set_date (GES_META_CONTAINER (layer), "ges-test", input);
1385
1386   fail_unless (ges_meta_container_get_date (GES_META_CONTAINER
1387           (layer), "ges-test", &result));
1388
1389   fail_unless (g_date_compare (result, input) == 0);
1390
1391   g_date_free (input);
1392   g_date_free (result);
1393
1394   ges_deinit ();
1395 }
1396
1397 GST_END_TEST;
1398
1399 GST_START_TEST (test_layer_meta_date_time)
1400 {
1401   GESTimeline *timeline;
1402   GESLayer *layer;
1403   GstDateTime *input;
1404   GstDateTime *result = NULL;
1405
1406   ges_init ();
1407
1408   timeline = ges_timeline_new_audio_video ();
1409   layer = ges_layer_new ();
1410   ges_timeline_add_layer (timeline, layer);
1411
1412   input = gst_date_time_new_from_unix_epoch_local_time (123456789);
1413
1414   fail_unless (ges_meta_container_set_date_time (GES_META_CONTAINER
1415           (layer), "ges-test", input));
1416
1417   fail_unless (ges_meta_container_get_date_time (GES_META_CONTAINER
1418           (layer), "ges-test", &result));
1419
1420   fail_unless (result != NULL);
1421   fail_unless (gst_date_time_get_day (input) == gst_date_time_get_day (result));
1422   fail_unless (gst_date_time_get_hour (input) ==
1423       gst_date_time_get_hour (result));
1424
1425   gst_date_time_unref (input);
1426   gst_date_time_unref (result);
1427
1428   ges_deinit ();
1429 }
1430
1431 GST_END_TEST;
1432
1433
1434 GST_START_TEST (test_layer_meta_value)
1435 {
1436   GESTimeline *timeline;
1437   GESLayer *layer;
1438   GValue data = G_VALUE_INIT;
1439   const GValue *result;
1440
1441   ges_init ();
1442
1443   timeline = ges_timeline_new_audio_video ();
1444   layer = ges_layer_new ();
1445   ges_timeline_add_layer (timeline, layer);
1446
1447   g_value_init (&data, G_TYPE_STRING);
1448   g_value_set_string (&data, "Hello world!");
1449
1450   ges_meta_container_set_meta (GES_META_CONTAINER (layer),
1451       "ges-test-value", &data);
1452
1453   result =
1454       ges_meta_container_get_meta (GES_META_CONTAINER (layer),
1455       "ges-test-value");
1456   assert_equals_string (g_value_get_string (result), "Hello world!");
1457
1458   g_value_unset (&data);
1459
1460   ges_deinit ();
1461 }
1462
1463 GST_END_TEST;
1464
1465
1466 GST_START_TEST (test_layer_meta_marker_list)
1467 {
1468   GESTimeline *timeline;
1469   GESLayer *layer, *layer2;
1470   GESMarkerList *mlist, *mlist2;
1471   GESMarker *marker;
1472   gchar *metas1, *metas2;
1473
1474   ges_init ();
1475
1476   timeline = ges_timeline_new_audio_video ();
1477   layer = ges_layer_new ();
1478   ges_timeline_add_layer (timeline, layer);
1479   layer2 = ges_layer_new ();
1480   ges_timeline_add_layer (timeline, layer2);
1481
1482   mlist = ges_marker_list_new ();
1483   marker = ges_marker_list_add (mlist, 42);
1484   ges_meta_container_set_string (GES_META_CONTAINER (marker), "bar", "baz");
1485   marker = ges_marker_list_add (mlist, 84);
1486   ges_meta_container_set_string (GES_META_CONTAINER (marker), "lorem",
1487       "ip\tsu\"m;");
1488
1489   ASSERT_OBJECT_REFCOUNT (mlist, "local ref", 1);
1490
1491   fail_unless (ges_meta_container_set_marker_list (GES_META_CONTAINER (layer),
1492           "foo", mlist));
1493
1494   ASSERT_OBJECT_REFCOUNT (mlist, "GstStructure + local ref", 2);
1495
1496   mlist2 =
1497       ges_meta_container_get_marker_list (GES_META_CONTAINER (layer), "foo");
1498
1499   fail_unless (mlist == mlist2);
1500
1501   ASSERT_OBJECT_REFCOUNT (mlist, "GstStructure + getter + local ref", 3);
1502
1503   g_object_unref (mlist2);
1504
1505   ASSERT_OBJECT_REFCOUNT (mlist, "GstStructure + local ref", 2);
1506
1507   metas1 = ges_meta_container_metas_to_string (GES_META_CONTAINER (layer));
1508   ges_meta_container_add_metas_from_string (GES_META_CONTAINER (layer2),
1509       metas1);
1510   metas2 = ges_meta_container_metas_to_string (GES_META_CONTAINER (layer2));
1511
1512   fail_unless_equals_string (metas1, metas2);
1513   g_free (metas1);
1514   g_free (metas2);
1515
1516   fail_unless (ges_meta_container_set_marker_list (GES_META_CONTAINER (layer),
1517           "foo", NULL));
1518
1519   ASSERT_OBJECT_REFCOUNT (mlist, "local ref", 1);
1520
1521   g_object_unref (mlist);
1522   g_object_unref (timeline);
1523
1524   ges_deinit ();
1525 }
1526
1527 GST_END_TEST;
1528
1529 GST_START_TEST (test_layer_meta_register)
1530 {
1531   GESTimeline *timeline;
1532   GESLayer *layer;
1533   const gchar *result;
1534
1535   ges_init ();
1536
1537   timeline = ges_timeline_new_audio_video ();
1538   layer = ges_layer_new ();
1539   ges_timeline_add_layer (timeline, layer);
1540
1541   fail_unless (ges_meta_container_register_meta_string (GES_META_CONTAINER
1542           (layer), GES_META_READABLE, "ges-test-value", "Hello world!"));
1543
1544   result = ges_meta_container_get_string (GES_META_CONTAINER (layer),
1545       "ges-test-value");
1546   assert_equals_string (result, "Hello world!");
1547
1548   fail_if (ges_meta_container_set_int (GES_META_CONTAINER (layer),
1549           "ges-test-value", 123456));
1550
1551   result = ges_meta_container_get_string (GES_META_CONTAINER (layer),
1552       "ges-test-value");
1553   assert_equals_string (result, "Hello world!");
1554
1555   ges_deinit ();
1556 }
1557
1558 GST_END_TEST;
1559
1560 static void
1561 test_foreach (const GESMetaContainer * container, const gchar * key,
1562     GValue * value, gpointer user_data)
1563 {
1564   fail_unless ((0 == g_strcmp0 (key, "some-string")) ||
1565       (0 == g_strcmp0 (key, "some-int")) || (0 == g_strcmp0 (key, "volume")));
1566 }
1567
1568 GST_START_TEST (test_layer_meta_foreach)
1569 {
1570   GESTimeline *timeline;
1571   GESLayer *layer;
1572
1573   ges_init ();
1574
1575   timeline = ges_timeline_new_audio_video ();
1576   layer = ges_layer_new ();
1577   ges_timeline_add_layer (timeline, layer);
1578
1579   ges_meta_container_set_string (GES_META_CONTAINER (layer),
1580       "some-string", "some-content");
1581
1582   ges_meta_container_set_int (GES_META_CONTAINER (layer), "some-int", 123456);
1583
1584   ges_meta_container_foreach (GES_META_CONTAINER (layer),
1585       (GESMetaForeachFunc) test_foreach, NULL);
1586
1587   ges_deinit ();
1588 }
1589
1590 GST_END_TEST;
1591
1592 GST_START_TEST (test_layer_get_clips_in_interval)
1593 {
1594   GESTimeline *timeline;
1595   GESLayer *layer;
1596   GESClip *clip, *clip2, *clip3;
1597   GList *objects, *current;
1598
1599   ges_init ();
1600
1601   timeline = ges_timeline_new_audio_video ();
1602   layer = ges_layer_new ();
1603   ges_timeline_add_layer (timeline, layer);
1604
1605   clip = (GESClip *) ges_test_clip_new ();
1606   fail_unless (clip != NULL);
1607   g_object_set (clip, "start", 10, "duration", 30, NULL);
1608   assert_equals_uint64 (_START (clip), 10);
1609   assert_equals_uint64 (_DURATION (clip), 30);
1610
1611   ges_layer_add_clip (layer, GES_CLIP (clip));
1612
1613   /* Clip's start lies between the interval */
1614   current = objects = ges_layer_get_clips_in_interval (layer, 0, 30);
1615   assert_equals_int (g_list_length (objects), 1);
1616   fail_unless (current->data == GES_TIMELINE_ELEMENT (clip));
1617   g_list_free_full (objects, gst_object_unref);
1618
1619   current = objects = ges_layer_get_clips_in_interval (layer, 0, 11);
1620   assert_equals_int (g_list_length (objects), 1);
1621   fail_unless (current->data == GES_TIMELINE_ELEMENT (clip));
1622   g_list_free_full (objects, gst_object_unref);
1623
1624   /* Clip's end lies between the interval */
1625   current = objects = ges_layer_get_clips_in_interval (layer, 30, 50);
1626   assert_equals_int (g_list_length (objects), 1);
1627   fail_unless (current->data == GES_TIMELINE_ELEMENT (clip));
1628   g_list_free_full (objects, gst_object_unref);
1629
1630   current = objects = ges_layer_get_clips_in_interval (layer, 39, 50);
1631   assert_equals_int (g_list_length (objects), 1);
1632   fail_unless (current->data == GES_TIMELINE_ELEMENT (clip));
1633   g_list_free_full (objects, gst_object_unref);
1634
1635   /* Clip exactly overlaps the interval */
1636   current = objects = ges_layer_get_clips_in_interval (layer, 10, 40);
1637   assert_equals_int (g_list_length (objects), 1);
1638   fail_unless (current->data == GES_TIMELINE_ELEMENT (clip));
1639   g_list_free_full (objects, gst_object_unref);
1640
1641   /* Clip completely inside the interval */
1642   current = objects = ges_layer_get_clips_in_interval (layer, 0, 50);
1643   assert_equals_int (g_list_length (objects), 1);
1644   fail_unless (current->data == GES_TIMELINE_ELEMENT (clip));
1645   g_list_free_full (objects, gst_object_unref);
1646
1647   /* Interval completely inside the clip duration */
1648   current = objects = ges_layer_get_clips_in_interval (layer, 20, 30);
1649   assert_equals_int (g_list_length (objects), 1);
1650   fail_unless (current->data == GES_TIMELINE_ELEMENT (clip));
1651   g_list_free_full (objects, gst_object_unref);
1652
1653   /* No intersecting clip */
1654   objects = ges_layer_get_clips_in_interval (layer, 0, 10);
1655   assert_equals_int (g_list_length (objects), 0);
1656
1657   objects = ges_layer_get_clips_in_interval (layer, 40, 50);
1658   assert_equals_int (g_list_length (objects), 0);
1659
1660   /* Multiple intersecting clips */
1661   clip2 = (GESClip *) ges_test_clip_new ();
1662   fail_unless (clip2 != NULL);
1663   g_object_set (clip2, "start", 50, "duration", 10, NULL);
1664   assert_equals_uint64 (_START (clip2), 50);
1665   assert_equals_uint64 (_DURATION (clip2), 10);
1666
1667   ges_layer_add_clip (layer, GES_CLIP (clip2));
1668
1669   clip3 = (GESClip *) ges_test_clip_new ();
1670   fail_unless (clip3 != NULL);
1671   g_object_set (clip3, "start", 0, "duration", 5, NULL);
1672   assert_equals_uint64 (_START (clip3), 0);
1673   assert_equals_uint64 (_DURATION (clip3), 5);
1674
1675   ges_layer_add_clip (layer, GES_CLIP (clip3));
1676
1677   /**
1678   * Our timeline:
1679   * -------------
1680   *
1681   *          |--------    0---------------     0---------       |
1682   * layer:   |  clip3 |   |     clip     |     |  clip2  |      |
1683   *          |-------05  10-------------40    50--------60      |
1684   *          |--------------------------------------------------|
1685   *
1686   */
1687
1688   current = objects = ges_layer_get_clips_in_interval (layer, 4, 52);
1689   assert_equals_int (g_list_length (objects), 3);
1690   fail_unless (current->data == GES_TIMELINE_ELEMENT (clip3));
1691   current = current->next;
1692   fail_unless (current->data == GES_TIMELINE_ELEMENT (clip));
1693   current = current->next;
1694   fail_unless (current->data == GES_TIMELINE_ELEMENT (clip2));
1695   g_list_free_full (objects, gst_object_unref);
1696
1697   current = objects = ges_layer_get_clips_in_interval (layer, 39, 65);
1698   assert_equals_int (g_list_length (objects), 2);
1699   fail_unless (current->data == GES_TIMELINE_ELEMENT (clip));
1700   current = current->next;
1701   fail_unless (current->data == GES_TIMELINE_ELEMENT (clip2));
1702   g_list_free_full (objects, gst_object_unref);
1703
1704   ges_deinit ();
1705 }
1706
1707 GST_END_TEST;
1708
1709 static Suite *
1710 ges_suite (void)
1711 {
1712   Suite *s = suite_create ("ges-layer");
1713   TCase *tc_chain = tcase_create ("timeline-layer");
1714
1715   suite_add_tcase (s, tc_chain);
1716
1717   tcase_add_test (tc_chain, test_layer_properties);
1718   tcase_add_test (tc_chain, test_layer_priorities);
1719   tcase_add_test (tc_chain, test_timeline_auto_transition);
1720   tcase_add_test (tc_chain, test_single_layer_automatic_transition);
1721   tcase_add_test (tc_chain, test_multi_layer_automatic_transition);
1722   tcase_add_test (tc_chain, test_layer_activate_automatic_transition);
1723   tcase_add_test (tc_chain, test_layer_meta_string);
1724   tcase_add_test (tc_chain, test_layer_meta_boolean);
1725   tcase_add_test (tc_chain, test_layer_meta_int);
1726   tcase_add_test (tc_chain, test_layer_meta_uint);
1727   tcase_add_test (tc_chain, test_layer_meta_int64);
1728   tcase_add_test (tc_chain, test_layer_meta_uint64);
1729   tcase_add_test (tc_chain, test_layer_meta_float);
1730   tcase_add_test (tc_chain, test_layer_meta_double);
1731   tcase_add_test (tc_chain, test_layer_meta_date);
1732   tcase_add_test (tc_chain, test_layer_meta_date_time);
1733   tcase_add_test (tc_chain, test_layer_meta_value);
1734   tcase_add_test (tc_chain, test_layer_meta_marker_list);
1735   tcase_add_test (tc_chain, test_layer_meta_register);
1736   tcase_add_test (tc_chain, test_layer_meta_foreach);
1737   tcase_add_test (tc_chain, test_layer_get_clips_in_interval);
1738
1739   return s;
1740 }
1741
1742 GST_CHECK_MAIN (ges);