Example #1
0
int main (int argc, char *argv[])
{
  int i;
  int ret;
  int failed = 0;
  OilParameter param;
  
  //xmlfile = "proto3";
  std_log(LOG_FILENAME_LINE, "Test Started testsuite_proto3");

  for(i=0;good_params[i];i++){
    ret = oil_param_from_string (&param, good_params[i]);
    if (!ret) {
      printf("***ERROR***\n");
      std_log(LOG_FILENAME_LINE, "***ERROR***");
      failed = 1;
    }
    print_param (&param);
  }

  for(i=0;bad_params[i];i++){
    ret = oil_param_from_string (&param, bad_params[i]);
    if (ret) {
      printf("***ERROR***\n");
      std_log(LOG_FILENAME_LINE, "***ERROR***");
      failed = 1;
    }
  }
  std_log(LOG_FILENAME_LINE, "Test Successful");
  create_xml(0);
  return failed;
}
Example #2
0
void test_lock_start()
{
  GstTask *t;
  gboolean ret;
    //xmlfile = "test_lock_start";
 std_log(LOG_FILENAME_LINE, "Test Started test_lock_start");

  t = gst_task_create (task_func, NULL);
   fail_if (t == NULL);
  TEST_ASSERT_FAIL
   gst_task_set_lock (t, &task_mutex);
  task_cond = g_cond_new ();
  task_lock = g_mutex_new ();
  g_mutex_lock (task_lock);
   GST_DEBUG ("starting");
  ret = gst_task_start (t);
  fail_unless (ret == TRUE);
  TEST_ASSERT_FAIL
  /* wait for it to spin up */
  GST_DEBUG ("waiting");
  g_cond_wait (task_cond, task_lock);
  GST_DEBUG ("done waiting");
  g_mutex_unlock (task_lock);
  /* cannot set mutex now */
  ASSERT_WARNING (gst_task_set_lock (t, &task_mutex));//b failing
  GST_DEBUG ("joining");
  ret = gst_task_join (t);
    fail_unless (ret == TRUE);
  TEST_ASSERT_FAIL
  gst_object_unref (t);
  std_log(LOG_FILENAME_LINE, "Test Successful");
    create_xml(0);
}
Example #3
0
void test_no_lock()
{
  GstTask *t;
  gboolean ret;
    //xmlfile = "test_no_lock";
 std_log(LOG_FILENAME_LINE, "Test Started test_no_lock");

  t = gst_task_create (task_func, NULL);
  fail_if (t == NULL);
  TEST_ASSERT_FAIL

  /* stop should be possible without lock */
  gst_task_stop (t);
  /* pause should give a warning */
  ASSERT_WARNING (ret = gst_task_pause (t));   //b failing
   fail_unless (ret == FALSE);
    TEST_ASSERT_FAIL
    /* start should give a warning */
  ASSERT_WARNING (ret = gst_task_start (t));
  fail_unless (ret == FALSE);
   TEST_ASSERT_FAIL
     /* stop should be possible without lock */
  gst_task_stop (t);
  gst_object_unref (t);
  std_log(LOG_FILENAME_LINE, "Test Successful");
    create_xml(0);
}
int main()
{
       DBusMessage* msg;
	
	msg = dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_CALL);
	
	if(!msg)
	{
		std_log(LOG_FILENAME_LINE,"Fail to create Message");
		create_xml(1);
		return 1;
	}
	
	if(DBUS_MESSAGE_TYPE_METHOD_CALL != dbus_message_get_type(msg))
	{
		std_log(LOG_FILENAME_LINE,"Mismatch in Message type.");
		create_xml(1);
		return 1;
	}
	
	std_log(LOG_FILENAME_LINE,"Test Successful");
	create_xml(0);
	return 0;

}
Example #5
0
void test_gdouble_to_guint64()
{ 
  
  gdouble from[] = { 0., 1., 100., 10000., 9223372036854775808.,
    9223372036854775809., 13835058055282163712.
  };
  guint64 to[] = { 0, 1, 100, 10000, (guint64) (1) << 63,
    ((guint64) (1) << 63) + 1,
    ((guint64) (1) << 63) + (G_GINT64_CONSTANT (1) << 62)
  };
  guint64 tolerance[] = { 0, 0, 0, 0, 0, 1, 1 };
  gint i;
  gdouble result;
  guint64 delta;
  
  xmlfile = "gstutils_test_gdouble_to_guint64";
    std_log(LOG_FILENAME_LINE, "Test Started gstutils_test_gdouble_to_guint64");

  for (i = 0; i < G_N_ELEMENTS (from); ++i) {
    result = gst_util_gdouble_to_guint64 (from[i]);
    delta = ABS (to[i] - result);
    fail_unless (delta <= tolerance[i],
        "Could not convert %f: %" G_GUINT64_FORMAT
        " -> %d, got %d instead, delta of %e with tolerance of %e",
        i, from[i], to[i], result, delta, tolerance[i]);
  }
  std_log(LOG_FILENAME_LINE, "Test Successful");
  create_xml(0);
}
Example #6
0
void test_yuv2rgbx_sub2_u8()
    {
    uint8_t src1[MAX_SIZE], src2[MAX_SIZE], src3[MAX_SIZE];
    uint8_t res[RES_SIZE],check[RES_SIZE]={0,134,0,0,0,135,0,0,0,135,0,0,0,136,0,0,0,136,0,0,0,137,0,0,0,137,0,0,0,138,0,0,0,138,0,0,0,139,0,0};
    int i;
    
    for(i=0;i<MAX_SIZE;i++)
    {
          src1[i]=i;
          src2[i]=i+1;
          src3[i]=i+1;
    }
    
    for(i=0;i<RES_SIZE;i++)
        res[i]=0;
        
    oil_yuv2rgbx_sub2_u8(res,src1,src2,src3,MAX_SIZE);
    
    for(i=0;i<RES_SIZE;i++)
    if(res[i] == check[i])
        {
         std_log(LOG_FILENAME_LINE,"oil_yuv2rgbx_sub2_u8 successful, res[%d] = %d", i,res[i]); 
        }
    else
        {
         assert_failed=1;
         std_log(LOG_FILENAME_LINE,"oil_yuv2rgbx_sub2_u8 unsuccessful, Expected =%d,Obtained =%d",check[i],res[i]);
        }
    }
int main()
{
	DBusError src;
	DBusError dest;
	char err[] = "Sample Error0";	
			
	dbus_error_init(&src);
	dbus_error_init(&dest);
	
	dbus_set_error(&src, err, NULL);
	
	dbus_move_error(&src, &dest);
	
	if(!CheckMovedError(&src, &dest, err))
	{
		std_log(LOG_FILENAME_LINE, "Test Fail");
		dbus_error_free(&src);
		dbus_error_free(&dest);
		create_xml(1);
		return 1;
	}
	else
	{
		std_log(LOG_FILENAME_LINE, "Test Successful");
		dbus_error_free(&dest);
		create_xml(0);
		return 0;
	}
}
Example #8
0
void test_flags()
{
  GstElement *element;
  GError *err = NULL;

  xmlfile = "test_flags";
    std_log(LOG_FILENAME_LINE, "Test Started test_flags");
    
  /* avoid misleading 'no such element' error debug messages when using cvs */
  if (!g_getenv ("GST_DEBUG"))
    gst_debug_set_default_threshold (GST_LEVEL_NONE);

  /* default behaviour is to return any already constructed bins/elements */
  element = gst_parse_launch_full ("fakesrc ! coffeesink", NULL, 0, &err);
  fail_unless (err != NULL, "expected error");
  fail_unless_equals_int (err->code, GST_PARSE_ERROR_NO_SUCH_ELEMENT);
  fail_unless (element != NULL, "expected partial pipeline/element");
  g_error_free (err);
  err = NULL;
  gst_object_unref (element);

  /* test GST_PARSE_FLAG_FATAL_ERRORS */
  element = gst_parse_launch_full ("fakesrc ! coffeesink", NULL,
      GST_PARSE_FLAG_FATAL_ERRORS, &err);
  fail_unless (err != NULL, "expected error");
  fail_unless_equals_int (err->code, GST_PARSE_ERROR_NO_SUCH_ELEMENT);
  fail_unless (element == NULL, "expected NULL return with FATAL_ERRORS");
  g_error_free (err);
  err = NULL;
  
  std_log(LOG_FILENAME_LINE, "Test Successful");
   create_xml(0);
}
Example #9
0
static inline void
_rw_check_init (bool init, int line, const char *func)
{
    if (init && !driver_initialized) {
        fprintf (stderr, "%s:%d: %s: test driver already initialized\n",
                 __FILE__, line, func);
     std_log(LOG_FILENAME_LINE,"%s:%d: %s: test driver already initialized\n",
                 __FILE__, line, func);                 
        abort ();
    }

    if (!init && driver_initialized) {
        fprintf (stderr, "%s:%d: %s: test driver not initialized yet\n",
                 __FILE__, line, func);
      std_log(LOG_FILENAME_LINE,"%s:%d: %s: test driver not initialized yet\n",
                 __FILE__, line, func);                  
        abort ();
    }

    if (driver_finished) {
        fprintf (stderr, "%s:%d: %s: test finished, cannot call\n",
                 __FILE__, line, func);
     std_log(LOG_FILENAME_LINE,"%s:%d: %s: test finished, cannot call\n",
                 __FILE__, line, func);                 
    }
}
Example #10
0
static void
test_fill (const std::size_t N)
{
    rw_info (0, 0, 0,
            "template <class %s, class %s> "
            "void std::fill (%1$s, %1$s, const %2$s&)",
            "ForwardIterator", "T");

    if (rw_opt_no_fwd_iter) {
        rw_note (0, __FILE__, __LINE__, "ForwardIterator test disabled");
        std_log(LOG_FILENAME_LINE,"ForwardIterator test disabled");  
    }
    else {
        test_fill (N, FwdIter<X>(), (X*)0);
    }

    if (rw_opt_no_bidir_iter) {
        rw_note (0, __FILE__, __LINE__, "BidirectionalIterator test disabled");
        std_log(LOG_FILENAME_LINE,"BidirectionalIterator test disabled");  
    }
    else {
        test_fill (N, BidirIter<X>(), (X*)0);
    }

    if (rw_opt_no_rnd_iter) {
        rw_note (0, __FILE__, __LINE__,  "RandomAccessIterator test disabled");
        std_log(LOG_FILENAME_LINE,"RandomAccessIterator test disabled");  
    }
    else {
        test_fill (N, RandomAccessIter<X>(), (X*)0);
    }
}
Example #11
0
int
main (int   argc,
      char *argv[])
{
  GstElement *pipeline;
  GstElement *source, *filter, *sink;
  xmlfile = "test_elementlink";
  std_log(LOG_FILENAME_LINE, "Test Started element link");
  /* init */
  gst_init (&argc, &argv);

  /* create pipeline */
  pipeline = gst_pipeline_new ("my-pipeline");

  /* create elements */
  source = gst_element_factory_make ("fakesrc", "source");
  filter = gst_element_factory_make ("identity", "filter");
  sink = gst_element_factory_make ("fakesink", "sink");

  /* must add elements to pipeline before linking them */
  gst_bin_add_many (GST_BIN (pipeline), source, filter, sink, NULL);

  /* link */
  if (!gst_element_link_many (source, filter, sink, NULL)) {
    g_warning ("Failed to link elements!");
  }
  std_log(LOG_FILENAME_LINE, "Test Successful");
  create_xml(0);

/*** block b  from ../../../docs/manual/basics-elements.xml ***/
  return 0;

/*** block c  from ../../../docs/manual/basics-elements.xml ***/
}
int main()
{
    DBusError error;
    char* err = "Sample Error0";

    dbus_error_init(&error);

    dbus_set_error(&error, err, NULL);

    if(strcmp(err, error.name))
    {
        std_log(LOG_FILENAME_LINE, "Mismatch in Error Name");
        create_xml(1);
        return 1;
    }
    if(strcmp(err, error.message))
    {
        std_log(LOG_FILENAME_LINE, "Message set to :: %s", error.message);
        std_log(LOG_FILENAME_LINE, "Message is not set to NULL");
        create_xml(1);
        return 1;
    }

    dbus_error_free(&error);
    std_log(LOG_FILENAME_LINE, "Test Successful");
    create_xml(0);
    return 0;
}
int main()
{
    DBusMessage* msg;
    char* path = "/";

    msg = dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_CALL);

    if(!msg)
    {
        std_log(LOG_FILENAME_LINE,"Fail to create Message");
        create_xml(1);
        return 1;
    }

    if(!dbus_message_set_path(msg, path))
    {
        std_log(LOG_FILENAME_LINE,"Not enough Memory.");
        create_xml(1);
        return 1;
    }

    if(strcmp(path, dbus_message_get_path(msg)))
    {
        std_log(LOG_FILENAME_LINE,"Path is not correct");
        create_xml(1);
        return 1;
    }

    std_log(LOG_FILENAME_LINE,"Test Successful");
    create_xml(0);
    return 0;

}
Example #14
0
void test_pipelines()
{
  gint quality;
  xmlfile = "test_pipelines";
std_log(LOG_FILENAME_LINE, "Test Started test_pipelines");
  /* Test qualities 0, 5 and 10 */
  for (quality = 0; quality < 11; quality += 5) {
    test_pipeline (8, FALSE, 44100, 48000, quality);
    test_pipeline (8, FALSE, 48000, 44100, quality);

    test_pipeline (16, FALSE, 44100, 48000, quality);
    test_pipeline (16, FALSE, 48000, 44100, quality);

    test_pipeline (24, FALSE, 44100, 48000, quality);
    test_pipeline (24, FALSE, 48000, 44100, quality);

    test_pipeline (32, FALSE, 44100, 48000, quality);
    test_pipeline (32, FALSE, 48000, 44100, quality);

    test_pipeline (32, TRUE, 44100, 48000, quality);
    test_pipeline (32, TRUE, 48000, 44100, quality);

    test_pipeline (64, TRUE, 44100, 48000, quality);
    test_pipeline (64, TRUE, 48000, 44100, quality); 
  }
  
  std_log(LOG_FILENAME_LINE, "Test Successful");
  create_xml(0);
}
int main()
{
	std_log(LOG_FILENAME_LINE,"[Test Case for intrusive_ptr_test]");
    n_element_type::test();
    n_constructors::test();
    n_destructor::test();
    n_assignment::test();
    n_access::test();
    n_swap::test();
    n_comparison::test();
    n_static_cast::test();
    n_dynamic_cast::test();

    n_transitive::test();
    n_report_1::test();

#ifdef __SYMBIAN32__
    int failures = boost::report_errors();
	if(failures)
	{
		std_log(LOG_FILENAME_LINE,"Result : Failed");
		assert_failed = true;
	}
	else
	{
		std_log(LOG_FILENAME_LINE,"Result : Passed");
	}
	std_log(LOG_FILENAME_LINE,"[End Test Case ]");
#endif
	testResultXml("intrusive_ptr_test");
	close_log_file();
	return failures;
}
Example #16
0
void test()
    {
    OilTest *test;
    OilParameter *p;
    int16_t *data;
    int n;
    int footer;
    int footer_increment = 10;
    OilFunctionClass *klass;
    OilFunctionImpl *impl;
    
    klass = oil_class_get("abs_f32_f32");
    
    if(klass != NULL)
        {
        test = (OilTest *)oil_test_new(klass); 
        
        if(test != NULL)
            {
            impl = (OilFunctionImpl*)calloc(sizeof(OilFunctionImpl), 0);
            impl->func = (void*)abs_f32_f32_test;
            impl->name = "abs_f32_f32_test";
            impl->klass = klass;
            
            oil_test_set_impl(test, impl);
            
            if(test->impl != impl)
                {
                std_log(LOG_FILENAME_LINE,"oil_test_set_impl failed. errno = %d", errno);
                assert_failed = 1;
                }
            
            p = &test->params[1];
            footer = p->test_footer;
            oil_test_set_test_footer(test, p, OIL_TEST_FOOTER+footer_increment);
            
            if(p->test_footer != footer+footer_increment)
                {
                std_log(LOG_FILENAME_LINE,"oil_test_set_test_footer failed. errno = %d", errno);
                assert_failed = 1;
                }
            
            data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC1);
            n = oil_test_get_arg_pre_n (test, OIL_ARG_SRC1);
            
            oil_test_cleanup(test);
            oil_test_free(test);
            }
        else
            {
            std_log(LOG_FILENAME_LINE,"oil_test_new returned NULL. errno = %d", errno);
            assert_failed = 1;
            }
        }
    else
        {
        std_log(LOG_FILENAME_LINE,"oil_class_get returned NULL. errno = %d", errno);
        assert_failed = 1;
        }
    }
Example #17
0
void test_parse_launch_errors()
{
  GstElement *pipe;
  GError *err;
  const gchar *arr[] = { "fakesrc", "fakesink", NULL };

  std_log(LOG_FILENAME_LINE, "Test started test_parse_launch_errors");
  
  err = NULL;
  pipe = gst_parse_launch ("fakesrc ! fakesink", &err);
  fail_unless (err != NULL, "expected an error, but did not get one");
  fail_unless (pipe == NULL, "got pipeline, but expected NULL");
  fail_unless (err->domain == GST_CORE_ERROR);
  fail_unless (err->code == GST_CORE_ERROR_DISABLED);
  g_error_free (err);

  err = NULL;
  pipe = gst_parse_bin_from_description ("fakesrc ! fakesink", TRUE, &err);
  fail_unless (err != NULL, "expected an error, but did not get one");
  fail_unless (pipe == NULL, "got pipeline, but expected NULL");
  fail_unless (err->domain == GST_CORE_ERROR);
  fail_unless (err->code == GST_CORE_ERROR_DISABLED);
  g_error_free (err);

  err = NULL;
  pipe = gst_parse_launchv (arr, &err);
  fail_unless (err != NULL, "expected an error, but did not get one");
  fail_unless (pipe == NULL, "got pipeline, but expected NULL");
  fail_unless (err->domain == GST_CORE_ERROR);
  fail_unless (err->code == GST_CORE_ERROR_DISABLED);
  g_error_free (err);
  
  std_log(LOG_FILENAME_LINE, "Test Successful");
  create_xml(0);
}
Example #18
0
void test_is_writable()
{
  GstBuffer *buffer;
  GstMiniObject *mobj;
  
  xmlfile = "gstminiobject_test_is_writable";
    std_log(LOG_FILENAME_LINE, "Test Started test_is_writable");

  buffer = gst_buffer_new_and_alloc (4);
  mobj = GST_MINI_OBJECT (buffer);

  fail_unless (gst_mini_object_is_writable (mobj),
      "A buffer with one ref should be writable");

  GST_MINI_OBJECT_FLAG_SET (mobj, GST_MINI_OBJECT_FLAG_READONLY);
  fail_if (gst_mini_object_is_writable (mobj),
      "A buffer with READONLY set should not be writable");
  GST_MINI_OBJECT_FLAG_UNSET (mobj, GST_MINI_OBJECT_FLAG_READONLY);
  fail_unless (gst_mini_object_is_writable (mobj),
      "A buffer with one ref and READONLY not set should be writable");

  fail_if (gst_mini_object_ref (mobj) == NULL, "Could not ref the mobj");

  fail_if (gst_mini_object_is_writable (mobj),
      "A buffer with two refs should not be writable");
  
  std_log(LOG_FILENAME_LINE, "Test Successful");
    create_xml(0);
}
Example #19
0
void test_refcounts()
{
  GstNetTimeProvider *ntp;
  GstClock *clock;

	 xmlfile = "test_refcounts";
  std_log(LOG_FILENAME_LINE, "Test Started test_refcounts");
  
  clock = gst_system_clock_obtain ();
  fail_unless (clock != NULL, "failed to get system clock");

  /* one for gstreamer, one for us */
  ASSERT_OBJECT_REFCOUNT (clock, "system clock", 2);

  ntp = gst_net_time_provider_new (clock, NULL, 0);
  fail_unless (ntp != NULL, "failed to create net time provider");

  /* one for ntp, one for gstreamer, one for us */
  ASSERT_OBJECT_REFCOUNT (clock, "system clock", 3);
  /* one for us */
  ASSERT_OBJECT_REFCOUNT (ntp, "net time provider", 1);

  gst_object_unref (ntp);
  ASSERT_OBJECT_REFCOUNT (clock, "net time provider", 2);

  gst_object_unref (clock);
    
  std_log(LOG_FILENAME_LINE, "Test Successful");
  create_xml(0); 
}
Example #20
0
void test_make_writable()
{
  GstBuffer *buffer;
  GstMiniObject *mobj, *mobj2, *mobj3;
  
  xmlfile = "gstminiobject_test_make_writable";
      std_log(LOG_FILENAME_LINE, "Test Started test_make_writable");

  buffer = gst_buffer_new_and_alloc (4);
  mobj = GST_MINI_OBJECT (buffer);

  mobj2 = gst_mini_object_make_writable (mobj);
  fail_unless (GST_IS_BUFFER (mobj2), "make_writable did not return a buffer");
  fail_unless (mobj == mobj2,
      "make_writable returned a copy for a buffer with refcount 1");

  mobj2 = gst_mini_object_ref (mobj);
  mobj3 = gst_mini_object_make_writable (mobj);
  fail_unless (GST_IS_BUFFER (mobj3), "make_writable did not return a buffer");
  fail_if (mobj == mobj3,
      "make_writable returned same object for a buffer with refcount > 1");

  fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (mobj) == 1,
      "refcount of original mobj object should be back to 1");

  mobj2 = gst_mini_object_make_writable (mobj);
  fail_unless (GST_IS_BUFFER (mobj2), "make_writable did not return a buffer");
  fail_unless (mobj == mobj2,
      "make_writable returned a copy for a buffer with refcount 1");
  
  std_log(LOG_FILENAME_LINE, "Test Successful");
    create_xml(0);
}
Example #21
0
void test_no_clients()
{
  GstElement *sink;
  GstBuffer *buffer;
  GstCaps *caps;
  
  std_log(LOG_FILENAME_LINE, "Test Started test_no_clients");

  sink = setup_multifdsink ();

  ASSERT_SET_STATE (sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);

  caps = gst_caps_from_string ("application/x-gst-check");
  buffer = gst_buffer_new_and_alloc (4);
  gst_buffer_set_caps (buffer, caps);
  gst_caps_unref (caps);
  fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);

  GST_DEBUG ("cleaning up multifdsink");

  ASSERT_SET_STATE (sink, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS);  //commented bz..select() blocks indefinitly
  cleanup_multifdsink (sink);
  
  std_log(LOG_FILENAME_LINE, "Test Successful");
      create_xml(0);
}
Example #22
0
void test_unref_threaded()
{
  GstBuffer *buffer;
  GstMiniObject *mobj;
  int i;
  
  xmlfile = "gstminiobject_test_unref_threaded";
    std_log(LOG_FILENAME_LINE, "Test Started test_unref_threaded");

  buffer = gst_buffer_new_and_alloc (4);

  mobj = GST_MINI_OBJECT (buffer);

  for (i = 0; i < num_threads * refs_per_thread; ++i)
    gst_mini_object_ref (mobj);

  MAIN_START_THREADS (num_threads, thread_unref, mobj);

  MAIN_STOP_THREADS ();

  ASSERT_MINI_OBJECT_REFCOUNT (mobj, "miniobject", 1);

  /* final unref */
  gst_mini_object_unref (mobj);
  
  std_log(LOG_FILENAME_LINE, "Test Successful");
    create_xml(0);
}
Example #23
0
void test_without_implements_interface()
{
  GstElement *element;
  
  std_log(LOG_FILENAME_LINE, "Test Started test_without_implements_interface");

  /* we shouldn't crash if someone tries to use
   * gst_element_implements_interface() on an element which doesn't implement
   * the GstImplementsInterface (neither if the element does implement the
   * requested interface, nor if it doesn't) */
  element = gst_element_factory_make ("filesrc", "filesrc");
  fail_unless (element != NULL, "Could not create filesrc element");

  /* does not implement GstImplementsInterface, but does implement the
   * GstUriHandler interface, so should just return TRUE */
  fail_if (!gst_element_implements_interface (element, GST_TYPE_URI_HANDLER));
  fail_if (gst_element_implements_interface (element,
          GST_TYPE_IMPLEMENTS_INTERFACE));
  gst_object_unref (element);

  element = gst_element_factory_make ("identity", "identity");
  fail_unless (element != NULL, "Could not create identity element");
  fail_if (gst_element_implements_interface (element, GST_TYPE_URI_HANDLER));
  fail_if (gst_element_implements_interface (element,
          GST_TYPE_IMPLEMENTS_INTERFACE));
  gst_object_unref (element);
  
  std_log(LOG_FILENAME_LINE, "Test Successful");
    create_xml(0);
}
Example #24
0
void test_value_collection()
{
  GstBuffer *buf = NULL;
  MyFoo *foo;
  
  xmlfile = "gstminiobject_test_value_collection";
  std_log(LOG_FILENAME_LINE, "Test Started test_value_collection");

  foo = (MyFoo *) g_object_new (my_foo_get_type (), NULL);

  /* test g_object_get() refcounting */
  g_object_get (foo, "buffer", &buf, NULL);
  g_assert (GST_IS_BUFFER (buf));
  g_assert (GST_MINI_OBJECT_REFCOUNT_VALUE (GST_MINI_OBJECT_CAST (buf)) == 1);
  gst_buffer_unref (buf);

  /* test g_object_set() refcounting */
  buf = gst_buffer_new_and_alloc (1024);
  g_object_set (foo, "buffer", buf, NULL);
  g_assert (GST_MINI_OBJECT_REFCOUNT_VALUE (GST_MINI_OBJECT_CAST (buf)) == 1);
  gst_buffer_unref (buf);

  g_object_unref (foo);
  
  std_log(LOG_FILENAME_LINE, "Test Successful");
  create_xml(0);
}
Example #25
0
void test_one_buffer()
{
  GstElement *identity;
  GstBuffer *buffer;
  
  xmlfile = "identity_test_one_buffer";
  std_log(LOG_FILENAME_LINE, "Test Started test_one_buffer");

  identity = setup_identity ();
  fail_unless (gst_element_set_state (identity,
          GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
      "could not set to playing");

  
  buffer = gst_buffer_new_and_alloc (4);
  ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1);
  memcpy (GST_BUFFER_DATA (buffer), "data", 4);

  /* pushing gives away my reference ... */
  fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK,
      "Failed pushing buffer to identity");
  

  /* ... but it should end up being collected on the global buffer list */
  fail_unless (g_list_length (buffers) == 1);
  
  fail_unless ((GstBuffer *) (g_list_first (buffers)->data) == buffer);
  
  ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1);

  /* cleanup */
  cleanup_identity (identity);
  std_log(LOG_FILENAME_LINE, "Test Successful");
  create_xml(0); 
}
int main (int argc, char *argv[])
{
  std_log(LOG_FILENAME_LINE,"[Test Case for string assign]");
   #ifndef __SYMBIAN32__ 
    return rw_test (argc, argv, __FILE__,
                    "lib.string.assign",
                    0 /* no comment */, run_test,
                    0 /* co command line options */);
   #else
    rw_test (argc, argv, __FILE__,
                    "lib.string.assign",
                    0 /* no comment */, run_test,
                    0 /* co command line options */);                 
    if(failures)
      {
            assert_failed = true;
       std_log(LOG_FILENAME_LINE,"Result: Failed");
      }
     else
      {

       std_log(LOG_FILENAME_LINE,"Result: Passed");
      }
  
   std_log(LOG_FILENAME_LINE,"[End Test Case]");  
   
    testResultXml("21_string_assign");
    close_log_file();
  #endif
  
  return failures;
}
Example #27
0
void test_lock()
{
  GstTask *t;
  gboolean ret;
    //xmlfile = "test_lock";
 std_log(LOG_FILENAME_LINE, "Test Started test_lock");

  t = gst_task_create (task_func, NULL);
  fail_if (t == NULL);
  TEST_ASSERT_FAIL

  gst_task_set_lock (t, &task_mutex);

  GST_DEBUG ("pause");
  ret = gst_task_pause (t);
  fail_unless (ret == TRUE);
  TEST_ASSERT_FAIL

  g_usleep (1 * G_USEC_PER_SEC / 2);

  GST_DEBUG ("joining");
  ret = gst_task_join (t);
  fail_unless (ret == TRUE);
  TEST_ASSERT_FAIL

  g_usleep (1 * G_USEC_PER_SEC / 2);

  gst_object_unref (t);
  std_log(LOG_FILENAME_LINE, "Test Successful");
    create_xml(0);
}
int main()
{
   	DBusError error;
	DBusConnection* connection;
	dbus_int32_t data_slot = -1;
	
	dbus_error_init(&error);
	
	connection = dbus_bus_get_private(DBUS_BUS_SESSION, &error);
	if(!CheckConnection(connection, &error))
	{
		create_xml(1);
		return 1;
	}
	
	if(!dbus_connection_allocate_data_slot(&data_slot))
	{
		std_log(LOG_FILENAME_LINE, "Out of Memory");
		create_xml(1);
		return 1;
	}
	
	dbus_connection_free_data_slot(&data_slot);

	dbus_connection_close(connection);
	dbus_connection_unref(connection);
	dbus_shutdown();
	
	std_log(LOG_FILENAME_LINE, "Test Successful");
	create_xml(0);
	return 0;
}
Example #29
0
int main()
{
	DBusGConnection* connection;
	DBusGProxy* proxy;
	GError* error = NULL;
	
	char* path = "/Test/Proxy/Path";
	
	g_type_init();
	
	connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
	if (connection == NULL)
		{
			std_log(LOG_FILENAME_LINE, "Failed to open connection to bus: %s\n",
		              error->message);
		  g_error_free (error);
		  create_xml(1);
		  return 1;
		}
	
	proxy = dbus_g_proxy_new_for_name(connection, "Test.Glib.Proxy.Path", path, "Test.Proxy.Interface");
	
	if(strcmp(path, dbus_g_proxy_get_path(proxy)))
		{
		std_log(LOG_FILENAME_LINE, "Fail to check interface %s", path);
		create_xml(1);
		return 1;
		}
	
	std_log(LOG_FILENAME_LINE, "Test Successful");
	create_xml(0);
	return 0;
}
Example #30
0
void test_load_coreelements()
{
    GstPlugin *unloaded_plugin;
    GstPlugin *loaded_plugin;
    //xmlfile = "test_load_coreelements";
    std_log(LOG_FILENAME_LINE, "Test Started test_load_coreelements");
    unloaded_plugin = gst_default_registry_find_plugin ("coreelements");
    fail_if (unloaded_plugin == NULL, "Failed to find coreelements plugin");
    fail_if (GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin) != 2,
             "Refcount of unloaded plugin in registry initially should be 2");
    GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin));
    loaded_plugin = gst_plugin_load (unloaded_plugin);
    fail_if (loaded_plugin == NULL, "Failed to load plugin");
    if (loaded_plugin != unloaded_plugin) {
        fail_if (GST_OBJECT_REFCOUNT_VALUE (loaded_plugin) != 2,
                 "Refcount of loaded plugin in registry should be 2");
        GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (loaded_plugin));
        fail_if (GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin) != 1,
                 "Refcount of replaced plugin should be 1");
        GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin));
    }

    gst_object_unref (unloaded_plugin);
    gst_object_unref (loaded_plugin);
    std_log(LOG_FILENAME_LINE, "Test Successful");
    create_xml(0);
}