gstreamer_core/tsrc/check/gst/gstindex/src/gstindex.c
changeset 0 0e761a78d257
child 8 4a7fac7dd34a
equal deleted inserted replaced
-1:000000000000 0:0e761a78d257
       
     1 /* GStreamer GstIndex unit test
       
     2  * Copyright (C) 2008 Tim-Philipp Müller <tim centricular net>
       
     3  *
       
     4  * This library is free software; you can redistribute it and/or
       
     5  * modify it under the terms of the GNU Library General Public
       
     6  * License as published by the Free Software Foundation; either
       
     7  * version 2 of the License, or (at your option) any later version.
       
     8  *
       
     9  * This library is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    12  * Library General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU Library General Public
       
    15  * License along with this library; if not, write to the
       
    16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    17  * Boston, MA 02111-1307, USA.
       
    18  */
       
    19 
       
    20 
       
    21 #define LOG_FILE "c:\\logs\\gstindex_log1.txt" 
       
    22 
       
    23 #include <gst/gst_global.h>
       
    24 #include "std_log_result.h" 
       
    25 #define LOG_FILENAME_LINE __FILE__, __LINE__
       
    26 
       
    27 void create_xml(int result)
       
    28 {
       
    29     if(result)
       
    30         assert_failed = 1;
       
    31     
       
    32     testResultXml(xmlfile);
       
    33     close_log_file();
       
    34 }
       
    35 
       
    36 #include <gst/check/gstcheck.h>
       
    37 
       
    38 #include <gst/gst.h>
       
    39 #include <string.h>
       
    40 
       
    41 void test_index_entries()
       
    42 {
       
    43   GstIndexEntry *entry;
       
    44   GstElement *pipe;
       
    45   GstIndex *index;
       
    46   gint id = -1;
       
    47   
       
    48   std_log(LOG_FILENAME_LINE, "Test Started test_index_entries");
       
    49 
       
    50   pipe = gst_pipeline_new ("pipeline");
       
    51 
       
    52   index = gst_index_new ();
       
    53   fail_unless (gst_index_get_writer_id (index, GST_OBJECT (pipe), &id));
       
    54 
       
    55   entry = gst_index_add_format (index, id, GST_FORMAT_BYTES);
       
    56   gst_index_entry_free (entry);
       
    57 
       
    58   gst_object_unref (index);
       
    59   gst_object_unref (pipe);
       
    60   
       
    61   std_log(LOG_FILENAME_LINE, "Test Successful");
       
    62   create_xml(0);
       
    63 }
       
    64 
       
    65 
       
    66 void (*fn[]) (void) = {
       
    67 test_index_entries
       
    68 };
       
    69 
       
    70 char *args[] = {
       
    71 "test_index_entries"
       
    72 };
       
    73 
       
    74 GST_CHECK_MAIN (gst_index);