[farsight2/master] Test setting relay-info
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:26:40 PST 2008
---
tests/check/transmitter/nice.c | 53 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 53 insertions(+), 0 deletions(-)
diff --git a/tests/check/transmitter/nice.c b/tests/check/transmitter/nice.c
index 8e31385..620eb93 100644
--- a/tests/check/transmitter/nice.c
+++ b/tests/check/transmitter/nice.c
@@ -581,6 +581,9 @@ GST_START_TEST (test_nicetransmitter_invalid_arguments)
GError *error = NULL;
guint comps = 0;
GParameter params[1];
+ GValueArray *va;
+ GstStructure *s;
+ GValue val = {0};
memset (params, 0, sizeof(GParameter) * 1);
@@ -665,6 +668,56 @@ GST_START_TEST (test_nicetransmitter_invalid_arguments)
g_clear_error (&error);
g_value_unset (¶ms[0].value);
+ params[0].name = "relay-info";
+ g_value_init (¶ms[0].value, G_TYPE_VALUE_ARRAY);
+
+ /* no IP */
+ va = g_value_array_new (1);
+ s = gst_structure_new ("aa", NULL);
+ g_value_init (&val, GST_TYPE_STRUCTURE);
+ g_value_take_boxed (&val, s);
+ g_value_array_append (va, &val);
+ g_value_take_boxed (¶ms[0].value, va);
+ st = fs_transmitter_new_stream_transmitter (trans, p, 1, params, &error);
+ ts_fail_unless (st == NULL);
+ ts_fail_unless (error &&
+ error->domain == FS_ERROR &&
+ error->code == FS_ERROR_INVALID_ARGUMENTS);
+ g_clear_error (&error);
+
+ /* no port */
+ va = g_value_array_new (1);
+ s = gst_structure_new ("aa",
+ "ip", G_TYPE_STRING, "127.0.0.1",
+ NULL);
+ g_value_take_boxed (&val, s);
+ g_value_array_append (va, &val);
+ g_value_take_boxed (¶ms[0].value, va);
+ st = fs_transmitter_new_stream_transmitter (trans, p, 1, params, &error);
+ ts_fail_unless (st == NULL);
+ ts_fail_unless (error &&
+ error->domain == FS_ERROR &&
+ error->code == FS_ERROR_INVALID_ARGUMENTS);
+ g_clear_error (&error);
+
+ /* valid */
+ va = g_value_array_new (1);
+ s = gst_structure_new ("aa",
+ "ip", G_TYPE_STRING, "127.0.0.1",
+ "port", G_TYPE_UINT, 7654,
+ NULL);
+ g_value_take_boxed (&val, s);
+ g_value_array_append (va, &val);
+ g_value_take_boxed (¶ms[0].value, va);
+ st = fs_transmitter_new_stream_transmitter (trans, p, 1, params, &error);
+ ts_fail_if (st == NULL);
+ ts_fail_unless (error == NULL);
+
+ g_object_unref (st);
+
+ g_value_unset (&val);
+ g_value_unset (¶ms[0].value);
+
g_object_unref (p);
g_object_unref (trans);
}
--
1.5.6.5
More information about the farsight-commits
mailing list