ges: tests: Use correct variable types when setting properties
authorDoug Nazar <nazard@nazar.ca>
Sat, 1 May 2021 20:50:11 +0000 (16:50 -0400)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 18 Jul 2023 11:43:52 +0000 (11:43 +0000)
From https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/247

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5055>

subprojects/gst-editing-services/tests/check/ges/layer.c
subprojects/gst-editing-services/tests/check/ges/project.c
subprojects/gst-editing-services/tests/check/ges/test-utils.h
subprojects/gst-editing-services/tests/check/nle/nlecomposition.c
subprojects/gst-editing-services/tests/check/nle/tempochange.c

index 763e78a..bf96079 100644 (file)
@@ -53,7 +53,7 @@ GST_START_TEST (test_layer_properties)
   fail_unless (clip != NULL);
 
   /* Set some properties */
-  g_object_set (clip, "start", (guint64) 42, "duration", (guint64) 51,
+  g_object_set (clip, "start", (guint64) 42, "duration", (gint64) 51,
       "in-point", (guint64) 12, NULL);
   assert_equals_uint64 (_START (clip), 42);
   assert_equals_uint64 (_DURATION (clip), 51);
@@ -144,9 +144,9 @@ GST_START_TEST (test_layer_priorities)
   fail_unless (clip2 != NULL);
   fail_unless (clip3 != NULL);
 
-  g_object_set (clip1, "start", 0, "duration", 10, NULL);
-  g_object_set (clip2, "start", 10, "duration", 10, NULL);
-  g_object_set (clip3, "start", 20, "duration", 10, NULL);
+  g_object_set (clip1, "start", (guint64) 0, "duration", (gint64) 10, NULL);
+  g_object_set (clip2, "start", (guint64) 10, "duration", (gint64) 10, NULL);
+  g_object_set (clip3, "start", (guint64) 20, "duration", (gint64) 10, NULL);
 
   /* Add objects to the timeline */
   fail_unless (ges_layer_add_clip (layer1, clip1));
@@ -1606,7 +1606,7 @@ GST_START_TEST (test_layer_get_clips_in_interval)
 
   clip = (GESClip *) ges_test_clip_new ();
   fail_unless (clip != NULL);
-  g_object_set (clip, "start", 10, "duration", 30, NULL);
+  g_object_set (clip, "start", (guint64) 10, "duration", (gint64) 30, NULL);
   assert_equals_uint64 (_START (clip), 10);
   assert_equals_uint64 (_DURATION (clip), 30);
 
@@ -1662,7 +1662,7 @@ GST_START_TEST (test_layer_get_clips_in_interval)
   /* Multiple intersecting clips */
   clip2 = (GESClip *) ges_test_clip_new ();
   fail_unless (clip2 != NULL);
-  g_object_set (clip2, "start", 50, "duration", 10, NULL);
+  g_object_set (clip2, "start", (guint64) 50, "duration", (gint64) 10, NULL);
   assert_equals_uint64 (_START (clip2), 50);
   assert_equals_uint64 (_DURATION (clip2), 10);
 
@@ -1670,7 +1670,7 @@ GST_START_TEST (test_layer_get_clips_in_interval)
 
   clip3 = (GESClip *) ges_test_clip_new ();
   fail_unless (clip3 != NULL);
-  g_object_set (clip3, "start", 0, "duration", 5, NULL);
+  g_object_set (clip3, "start", (guint64) 0, "duration", (gint64) 5, NULL);
   assert_equals_uint64 (_START (clip3), 0);
   assert_equals_uint64 (_DURATION (clip3), 5);
 
index d5d7c73..0e62734 100644 (file)
@@ -346,12 +346,12 @@ _add_properties (GESTimeline * timeline)
             gst_object_unref (source);
           } else if (GES_IS_VIDEO_SOURCE (element)) {
             /* Adding children properties */
-            gint64 posx = 42;
+            gint posx = 42;
             ges_timeline_element_set_child_properties (GES_TIMELINE_ELEMENT
                 (element), "posx", posx, NULL);
             ges_timeline_element_get_child_properties (GES_TIMELINE_ELEMENT
                 (element), "posx", &posx, NULL);
-            fail_unless_equals_int64 (posx, 42);
+            fail_unless_equals_int (posx, 42);
           }
 
         }
@@ -419,10 +419,10 @@ _check_properties (GESTimeline * timeline)
           /* Checking children properties */
           else if (GES_IS_VIDEO_SOURCE (element)) {
             /* Init 'posx' with a wrong value */
-            gint64 posx = 27;
+            gint posx = 27;
             ges_timeline_element_get_child_properties (GES_TIMELINE_ELEMENT
                 (element), "posx", &posx, NULL);
-            fail_unless_equals_int64 (posx, 42);
+            fail_unless_equals_int (posx, 42);
           }
         }
         g_list_free_full (track_elements, g_object_unref);
index 85ee03a..e6adf4c 100644 (file)
@@ -55,13 +55,16 @@ void
 free_children_properties (GParamSpec ** list, guint num_props);
 
 #define nle_object_check(nleobj, start, duration, mstart, mduration, priority, active) { \
-  guint64 pstart, pdur, inpoint, pprio, pact;                  \
+  guint64 pstart, inpoint;                                             \
+  gint64 pdur;                                                         \
+  guint pprio;                                                         \
+  gboolean pact;                                                       \
   g_object_get (nleobj, "start", &pstart, "duration", &pdur,           \
-               "inpoint", &inpoint, "priority", &pprio, "active", &pact,                       \
+               "inpoint", &inpoint, "priority", &pprio, "active", &pact,       \
                NULL);                                                  \
   assert_equals_uint64 (pstart, start);                                        \
-  assert_equals_uint64 (pdur, duration);                                       \
-  assert_equals_uint64 (inpoint, mstart);                                      \
+  assert_equals_int64 (pdur, duration);                                        \
+  assert_equals_uint64 (inpoint, mstart);                              \
   assert_equals_int (pprio, priority);                                 \
   assert_equals_int (pact, active);                                    \
   }
index 3607ddb..667ae8d 100644 (file)
@@ -226,7 +226,8 @@ GST_START_TEST (test_remove_last_object)
   audiotestsrc = gst_element_factory_make ("audiotestsrc", "audiotestsrc1");
   gst_bin_add (GST_BIN (source1), audiotestsrc);
   g_object_set (source1, "start", (guint64) 0 * GST_SECOND,
-      "duration", 10 * GST_SECOND, "inpoint", (guint64) 0, "priority", 1, NULL);
+      "duration", (gint64) 10 * GST_SECOND, "inpoint", (guint64) 0, "priority",
+      1, NULL);
 
   nle_composition_add (composition, source1);
 
@@ -234,7 +235,8 @@ GST_START_TEST (test_remove_last_object)
   audiotestsrc2 = gst_element_factory_make ("audiotestsrc", "audiotestsrc1");
   gst_bin_add (GST_BIN (source2), audiotestsrc2);
   g_object_set (source2, "start", (guint64) 10 * GST_SECOND,
-      "duration", 10 * GST_SECOND, "inpoint", (guint64) 0, "priority", 1, NULL);
+      "duration", (gint64) 10 * GST_SECOND, "inpoint", (guint64) 0, "priority",
+      1, NULL);
 
   nle_composition_add (composition, source2);
 
@@ -314,7 +316,8 @@ GST_START_TEST (test_dispose_on_commit)
   audiotestsrc = gst_element_factory_make ("audiotestsrc", "audiotestsrc1");
   gst_bin_add (GST_BIN (nlesource), audiotestsrc);
   g_object_set (nlesource, "start", (guint64) 0 * GST_SECOND,
-      "duration", 10 * GST_SECOND, "inpoint", (guint64) 0, "priority", 1, NULL);
+      "duration", (gint64) 10 * GST_SECOND, "inpoint", (guint64) 0, "priority",
+      1, NULL);
   fail_unless (nle_composition_add (GST_BIN (composition), nlesource));
 
   gst_bin_add_many (GST_BIN (pipeline), composition, fakesink, NULL);
@@ -369,7 +372,8 @@ GST_START_TEST (test_simple_audiomixer)
   audiotestsrc1 = gst_element_factory_make ("audiotestsrc", "audiotestsrc1");
   gst_bin_add (GST_BIN (nlesource1), audiotestsrc1);
   g_object_set (nlesource1, "start", (guint64) 0 * GST_SECOND,
-      "duration", total_time / 2, "inpoint", (guint64) 0, "priority", 1, NULL);
+      "duration", (gint64) total_time / 2, "inpoint", (guint64) 0, "priority",
+      1, NULL);
   fail_unless (nle_composition_add (GST_BIN (composition), nlesource1));
 
   /* nlesource2 */
@@ -459,7 +463,8 @@ create_nested_source (gint nesting_depth)
     name = g_strdup_printf ("nested_src%d", i);
     source = gst_element_factory_make_or_warn ("nlesource", name);
     g_free (name);
-    g_object_set (source, "start", 0, "duration", 2 * GST_SECOND, NULL);
+    g_object_set (source, "start", (guint64) 0, "duration",
+        (gint64) 2 * GST_SECOND, NULL);
     gst_bin_add (GST_BIN (source), bin);
   }
 
index e3d8208..212b3c4 100644 (file)
@@ -292,20 +292,20 @@ _setup_test (GstElement * pipeline, gdouble rate)
   nle_source =
       audiotest_bin_src ("nle_source", 3 * GST_SECOND, 4 * GST_SECOND, 3,
       FALSE);
-  g_object_set (nle_source, "inpoint", 7 * GST_SECOND, NULL);
+  g_object_set (nle_source, "inpoint", (guint64) 7 * GST_SECOND, NULL);
   src = _get_source (nle_source);
   g_object_set (src, "name", "middle-source", NULL);
 
   nle_prev =
       audiotest_bin_src ("nle_previous", 0 * GST_SECOND, 3 * GST_SECOND, 2,
       FALSE);
-  g_object_set (nle_prev, "inpoint", 99 * GST_SECOND, NULL);
+  g_object_set (nle_prev, "inpoint", (guint64) 99 * GST_SECOND, NULL);
   prev = _get_source (nle_prev);
   g_object_set (src, "name", "previous-source", NULL);
 
   nle_post =
       audiotest_bin_src ("post", 7 * GST_SECOND, 5 * GST_SECOND, 2, FALSE);
-  g_object_set (nle_post, "inpoint", 20 * GST_SECOND, NULL);
+  g_object_set (nle_post, "inpoint", (guint64) 20 * GST_SECOND, NULL);
   post = _get_source (nle_post);
   g_object_set (src, "name", "post-source", NULL);
 
@@ -322,7 +322,7 @@ _setup_test (GstElement * pipeline, gdouble rate)
    * duration */
   nle_identity =
       new_operation ("nle_identity", "identity", 0, 12 * GST_SECOND, 1);
-  g_object_set (nle_identity, "inpoint", 5 * GST_SECOND, NULL);
+  g_object_set (nle_identity, "inpoint", (guint64) 5 * GST_SECOND, NULL);
   fail_unless (g_list_length (GST_BIN_CHILDREN (nle_oper)) == 1);
   identity = GST_ELEMENT (GST_BIN_CHILDREN (nle_identity)->data);