[farsight2/master] Move the transmitter creation test to the generic file

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:26:15 PST 2008


---
 tests/check/transmitter/generic.c   |   33 +++++++++++++++++++++
 tests/check/transmitter/generic.h   |    2 +
 tests/check/transmitter/multicast.c |   29 +------------------
 tests/check/transmitter/nice.c      |   30 +------------------
 tests/check/transmitter/rawudp.c    |   53 +---------------------------------
 5 files changed, 40 insertions(+), 107 deletions(-)

diff --git a/tests/check/transmitter/generic.c b/tests/check/transmitter/generic.c
index 822b264..bbb6407 100644
--- a/tests/check/transmitter/generic.c
+++ b/tests/check/transmitter/generic.c
@@ -160,3 +160,36 @@ bus_error_callback (GstBus *bus, GstMessage *message, gpointer user_data)
 
   return TRUE;
 }
+
+void
+test_transmitter_creation (gchar *transmitter_name)
+{
+  GError *error = NULL;
+  FsTransmitter *trans;
+  GstElement *pipeline;
+  GstElement *trans_sink, *trans_src;
+
+  trans = fs_transmitter_new (transmitter_name, 2, &error);
+
+  if (error) {
+    ts_fail ("Error creating transmitter: (%s:%d) %s",
+      g_quark_to_string (error->domain), error->code, error->message);
+  }
+
+  ts_fail_if (trans == NULL, "No transmitter create, yet error is still NULL");
+
+  pipeline = setup_pipeline (trans, NULL);
+
+  g_object_get (trans, "gst-sink", &trans_sink, "gst-src", &trans_src, NULL);
+
+  fail_if (trans_sink == NULL, "Sink is NULL");
+  fail_if (trans_src == NULL, "Src is NULL");
+
+  gst_object_unref (trans_sink);
+  gst_object_unref (trans_src);
+
+  g_object_unref (trans);
+
+  gst_object_unref (pipeline);
+
+}
diff --git a/tests/check/transmitter/generic.h b/tests/check/transmitter/generic.h
index 1256aaa..51bc142 100644
--- a/tests/check/transmitter/generic.h
+++ b/tests/check/transmitter/generic.h
@@ -36,5 +36,7 @@ void stream_transmitter_error (FsStreamTransmitter *streamtransmitter,
 gboolean bus_error_callback (GstBus *bus, GstMessage *message,
     gpointer user_data);
 
+void test_transmitter_creation (gchar *transmitter_name);
+
 
 #endif /* __GENERIC_H__ */
diff --git a/tests/check/transmitter/multicast.c b/tests/check/transmitter/multicast.c
index 820b108..9b81bbe 100644
--- a/tests/check/transmitter/multicast.c
+++ b/tests/check/transmitter/multicast.c
@@ -44,34 +44,7 @@ gboolean src_setup[2] = {FALSE, FALSE};
 
 GST_START_TEST (test_multicasttransmitter_new)
 {
-  GError *error = NULL;
-  FsTransmitter *trans;
-  GstElement *pipeline;
-  GstElement *trans_sink, *trans_src;
-
-  trans = fs_transmitter_new ("multicast", 2, &error);
-
-  if (error) {
-    ts_fail ("Error creating transmitter: (%s:%d) %s",
-      g_quark_to_string (error->domain), error->code, error->message);
-  }
-
-  ts_fail_if (trans == NULL, "No transmitter create, yet error is still NULL");
-
-  pipeline = setup_pipeline (trans, NULL);
-
-  g_object_get (trans, "gst-sink", &trans_sink, "gst-src", &trans_src, NULL);
-
-  fail_if (trans_sink == NULL, "Sink is NULL");
-  fail_if (trans_src == NULL, "Src is NULL");
-
-  gst_object_unref (trans_sink);
-  gst_object_unref (trans_src);
-
-  g_object_unref (trans);
-
-  gst_object_unref (pipeline);
-
+  test_transmitter_creation ("multicast");
 }
 GST_END_TEST;
 
diff --git a/tests/check/transmitter/nice.c b/tests/check/transmitter/nice.c
index 167980a..e609ef7 100644
--- a/tests/check/transmitter/nice.c
+++ b/tests/check/transmitter/nice.c
@@ -32,36 +32,10 @@
 
 GST_START_TEST (test_nicetransmitter_new)
 {
-  GError *error = NULL;
-  FsTransmitter *trans;
-  GstElement *pipeline;
-  GstElement *trans_sink, *trans_src;
-
-  trans = fs_transmitter_new ("nice", 2, &error);
-
-  if (error) {
-    ts_fail ("Error creating transmitter: (%s:%d) %s",
-      g_quark_to_string (error->domain), error->code, error->message);
-  }
-
-  ts_fail_if (trans == NULL, "No transmitter create, yet error is still NULL");
-
-  pipeline = setup_pipeline (trans, NULL);
-
-  g_object_get (trans, "gst-sink", &trans_sink, "gst-src", &trans_src, NULL);
-
-  fail_if (trans_sink == NULL, "Sink is NULL");
-  fail_if (trans_src == NULL, "Src is NULL");
-
-  gst_object_unref (trans_sink);
-  gst_object_unref (trans_src);
-
-  g_object_unref (trans);
-
-  gst_object_unref (pipeline);
-
+  test_transmitter_creation ("nice");
 }
 GST_END_TEST;
+
 static Suite *
 nicetransmitter_suite (void)
 {
diff --git a/tests/check/transmitter/rawudp.c b/tests/check/transmitter/rawudp.c
index cdf70ab..8bc1b99 100644
--- a/tests/check/transmitter/rawudp.c
+++ b/tests/check/transmitter/rawudp.c
@@ -58,10 +58,6 @@ enum {
 
 GST_START_TEST (test_rawudptransmitter_new)
 {
-  GError *error = NULL;
-  FsTransmitter *trans;
-  GstElement *pipeline;
-  GstElement *trans_sink, *trans_src;
   gchar **transmitters;
   gint i;
   gboolean found_it = FALSE;
@@ -79,53 +75,8 @@ GST_START_TEST (test_rawudptransmitter_new)
 
   ts_fail_unless (found_it, "Did not find rawudp transmitter");
 
-  trans = fs_transmitter_new ("rawudp", 2, &error);
-
-  if (error) {
-    ts_fail ("Error creating transmitter: (%s:%d) %s",
-      g_quark_to_string (error->domain), error->code, error->message);
-  }
-
-  ts_fail_if (trans == NULL, "No transmitter create, yet error is still NULL");
-
-  pipeline = setup_pipeline (trans, NULL);
-
-  g_object_get (trans, "gst-sink", &trans_sink, "gst-src", &trans_src, NULL);
-
-  ts_fail_if (trans_sink == NULL, "Sink is NULL");
-  ts_fail_if (trans_src == NULL, "Src is NULL");
-
-  gst_object_unref (trans_sink);
-  gst_object_unref (trans_src);
-
-  g_object_unref (trans);
-
-  /* lets do it again to see if it still works */
-
-  trans = fs_transmitter_new ("rawudp", 2, &error);
-
-  if (error) {
-    ts_fail ("Error creating transmitter: (%s:%d) %s",
-      g_quark_to_string (error->domain), error->code, error->message);
-  }
-
-  ts_fail_if (trans == NULL, "No transmitter create, yet error is still NULL");
-
-  pipeline = setup_pipeline (trans, NULL);
-
-  g_object_get (trans, "gst-sink", &trans_sink, "gst-src", &trans_src, NULL);
-
-  ts_fail_if (trans_sink == NULL, "Sink is NULL");
-  ts_fail_if (trans_src == NULL, "Src is NULL");
-
-  gst_object_unref (trans_sink);
-  gst_object_unref (trans_src);
-
-  g_object_unref (trans);
-
-
-  gst_object_unref (pipeline);
-
+  test_transmitter_creation ("rawudp");
+  test_transmitter_creation ("rawudp");
 }
 GST_END_TEST;
 
-- 
1.5.6.5




More information about the farsight-commits mailing list