Blame tests/check/gst/gstchildproxy.c

Packit a6ee4b
/* GStreamer
Packit a6ee4b
 * Copyright (C) 2009 Stefan Kost <ensonic@users.sf.net>
Packit a6ee4b
 *
Packit a6ee4b
 * gstchildproxy.c: Unit test for GstChildProxy interface
Packit a6ee4b
 *
Packit a6ee4b
 * This library is free software; you can redistribute it and/or
Packit a6ee4b
 * modify it under the terms of the GNU Library General Public
Packit a6ee4b
 * License as published by the Free Software Foundation; either
Packit a6ee4b
 * version 2 of the License, or (at your option) any later version.
Packit a6ee4b
 *
Packit a6ee4b
 * This library is distributed in the hope that it will be useful,
Packit a6ee4b
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit a6ee4b
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit a6ee4b
 * Library General Public License for more details.
Packit a6ee4b
 *
Packit a6ee4b
 * You should have received a copy of the GNU Library General Public
Packit a6ee4b
 * License along with this library; if not, write to the
Packit a6ee4b
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit a6ee4b
 * Boston, MA 02110-1301, USA.
Packit a6ee4b
 */
Packit a6ee4b
#ifdef HAVE_CONFIG_H
Packit a6ee4b
#include "config.h"
Packit a6ee4b
#endif
Packit a6ee4b
Packit a6ee4b
#include <gst/check/gstcheck.h>
Packit a6ee4b
Packit a6ee4b
GST_START_TEST (test_get)
Packit a6ee4b
{
Packit a6ee4b
  GstElement *pipeline;
Packit a6ee4b
  gchar *name;
Packit a6ee4b
Packit a6ee4b
  pipeline = gst_pipeline_new ("foo");
Packit a6ee4b
  fail_unless (pipeline != NULL, "Could not create pipeline");
Packit a6ee4b
Packit a6ee4b
  gst_child_proxy_get (GST_CHILD_PROXY (pipeline), "name", &name, NULL);
Packit a6ee4b
  fail_if (g_strcmp0 ("foo", name));
Packit a6ee4b
  g_free (name);
Packit a6ee4b
Packit a6ee4b
  gst_object_unref (pipeline);
Packit a6ee4b
}
Packit a6ee4b
Packit a6ee4b
GST_END_TEST;
Packit a6ee4b
Packit a6ee4b
GST_START_TEST (test_child_get)
Packit a6ee4b
{
Packit a6ee4b
  GstElement *pipeline, *elem;
Packit a6ee4b
  gchar *name;
Packit a6ee4b
Packit a6ee4b
  pipeline = gst_pipeline_new (NULL);
Packit a6ee4b
  fail_unless (pipeline != NULL, "Could not create pipeline");
Packit a6ee4b
Packit a6ee4b
  elem = gst_element_factory_make ("fakesrc", "src");
Packit a6ee4b
  fail_if (elem == NULL, "Could not create fakesrc");
Packit a6ee4b
Packit a6ee4b
  gst_bin_add (GST_BIN (pipeline), elem);
Packit a6ee4b
Packit a6ee4b
  gst_child_proxy_get (GST_CHILD_PROXY (pipeline), "src::name", &name, NULL);
Packit a6ee4b
  fail_if (g_strcmp0 ("src", name));
Packit a6ee4b
  g_free (name);
Packit a6ee4b
Packit a6ee4b
  gst_object_unref (pipeline);
Packit a6ee4b
}
Packit a6ee4b
Packit a6ee4b
GST_END_TEST;
Packit a6ee4b
Packit a6ee4b
Packit a6ee4b
static Suite *
Packit a6ee4b
gst_child_proxy_suite (void)
Packit a6ee4b
{
Packit a6ee4b
  Suite *s = suite_create ("GstChildProxy");
Packit a6ee4b
  TCase *tc_chain = tcase_create ("child proxy tests");
Packit a6ee4b
Packit a6ee4b
  tcase_set_timeout (tc_chain, 0);
Packit a6ee4b
Packit a6ee4b
  suite_add_tcase (s, tc_chain);
Packit a6ee4b
  tcase_add_test (tc_chain, test_get);
Packit a6ee4b
  tcase_add_test (tc_chain, test_child_get);
Packit a6ee4b
Packit a6ee4b
  return s;
Packit a6ee4b
}
Packit a6ee4b
Packit a6ee4b
GST_CHECK_MAIN (gst_child_proxy);