Add unit test system. Adjust GST_DEBUG usage.

This commit is contained in:
Edward Hervey 2009-08-06 19:51:29 +02:00
parent 7860b814d6
commit 12777c8532
20 changed files with 137 additions and 7 deletions

View file

@ -1,6 +1,6 @@
DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
SUBDIRS = ges SUBDIRS = ges tests
DIST_SUBDIRS = ges DIST_SUBDIRS = ges

View file

@ -240,5 +240,7 @@ common/m4/Makefile
gst-editing-services.spec gst-editing-services.spec
m4/Makefile m4/Makefile
ges/Makefile ges/Makefile
tests/Makefile
tests/check/Makefile
) )
AC_OUTPUT AC_OUTPUT

View file

@ -24,6 +24,7 @@ libges_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/ges
libges_@GST_MAJORMINOR@include_HEADERS = \ libges_@GST_MAJORMINOR@include_HEADERS = \
ges-types.h \ ges-types.h \
ges.h \ ges.h \
ges-internal.h \
ges-simple-timeline-layer.h \ ges-simple-timeline-layer.h \
ges-timeline.h \ ges-timeline.h \
ges-timeline-layer.h \ ges-timeline-layer.h \

28
ges/ges-internal.h Normal file
View file

@ -0,0 +1,28 @@
/* GStreamer Editing Services
* Copyright (C) 2009 Edward Hervey <bilboed@bilboed.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GES_INTERNAL_H__
#define __GES_INTERNAL_H__
#include <gst/gst.h>
GST_DEBUG_CATEGORY_EXTERN (ges_debug);
#define GST_CAT_DEFAULT ges_debug
#endif /* __GES_INTERNAL_H__ */

View file

@ -17,6 +17,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#include "ges-internal.h"
#include "ges-simple-timeline-layer.h" #include "ges-simple-timeline-layer.h"
G_DEFINE_TYPE (GESSimpleTimelineLayer, ges_simple_timeline_layer, G_DEFINE_TYPE (GESSimpleTimelineLayer, ges_simple_timeline_layer,

View file

@ -17,6 +17,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#include "ges-internal.h"
#include "gesmarshal.h" #include "gesmarshal.h"
#include "ges-timeline-layer.h" #include "ges-timeline-layer.h"
#include "ges.h" #include "ges.h"

View file

@ -17,6 +17,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#include "ges-internal.h"
#include "ges-timeline-object.h" #include "ges-timeline-object.h"
#include "ges.h" #include "ges.h"

View file

@ -17,6 +17,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#include "ges-internal.h"
#include "ges-timeline-pipeline.h" #include "ges-timeline-pipeline.h"
/* TimelinePipeline /* TimelinePipeline

View file

@ -17,6 +17,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#include "ges-internal.h"
#include "ges-timeline-object.h" #include "ges-timeline-object.h"
#include "ges-timeline-source.h" #include "ges-timeline-source.h"

View file

@ -17,6 +17,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#include "ges-internal.h"
#include "ges-timeline-transition.h" #include "ges-timeline-transition.h"
G_DEFINE_TYPE (GESTimelineTransition, ges_timeline_transition, G_DEFINE_TYPE (GESTimelineTransition, ges_timeline_transition,

View file

@ -18,6 +18,7 @@
*/ */
#include "gesmarshal.h" #include "gesmarshal.h"
#include "ges-internal.h"
#include "ges-timeline.h" #include "ges-timeline.h"
#include "ges-track.h" #include "ges-track.h"
#include "ges-timeline-layer.h" #include "ges-timeline-layer.h"

View file

@ -17,6 +17,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#include "ges-internal.h"
#include "ges-track-object.h" #include "ges-track-object.h"
#include "ges-timeline-object.h" #include "ges-timeline-object.h"
@ -159,12 +160,12 @@ ges_track_object_new (GESTimelineObject * timelineobj, GESTrack * track)
obj = g_object_new (GES_TYPE_TRACK_OBJECT, NULL); obj = g_object_new (GES_TYPE_TRACK_OBJECT, NULL);
/* FIXME : THIS IS TOTALLY BOGUS ! */
/* Set the timeline object and track */ /* Set the timeline object and track */
obj->timelineobj = timelineobj; obj->timelineobj = timelineobj;
obj->track = track; obj->track = track;
/* Create the associated GnlObject */
ges_track_object_create_gnl_object (obj);
return obj; return obj;
} }

View file

@ -72,7 +72,7 @@ GType ges_track_object_get_type (void);
GESTrackObject* ges_track_object_new (GESTimelineObject *timelineobj, GESTrack *track); GESTrackObject* ges_track_object_new (GESTimelineObject *timelineobj, GESTrack *track);
gboolean ges_track_object_create_gnl_object (GESTrackObject * object); /* gboolean ges_track_object_create_gnl_object (GESTrackObject * object); */
void ges_track_object_set_track (GESTrackObject * object, GESTrack * track); void ges_track_object_set_track (GESTrackObject * object, GESTrack * track);
void ges_track_object_set_timeline_object (GESTrackObject * object, GESTimelineObject * tlobject); void ges_track_object_set_timeline_object (GESTrackObject * object, GESTimelineObject * tlobject);

View file

@ -17,6 +17,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#include "ges-internal.h"
#include "ges-track-object.h" #include "ges-track-object.h"
#include "ges-track-source.h" #include "ges-track-source.h"

View file

@ -17,6 +17,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#include "ges-internal.h"
#include "ges-track.h" #include "ges-track.h"
#include "ges-track-object.h" #include "ges-track-object.h"

View file

@ -18,6 +18,7 @@
*/ */
#include <ges/ges.h> #include <ges/ges.h>
#include "ges-internal.h"
GST_DEBUG_CATEGORY (ges_debug); GST_DEBUG_CATEGORY (ges_debug);

View file

@ -36,9 +36,6 @@
#include <ges/ges-track-object.h> #include <ges/ges-track-object.h>
#include <ges/ges-track-source.h> #include <ges/ges-track-source.h>
GST_DEBUG_CATEGORY_EXTERN (ges_debug);
#define GST_CAT_DEFAULT ges_debug
G_BEGIN_DECLS G_BEGIN_DECLS
void ges_init (void); void ges_init (void);

5
tests/Makefile.am Normal file
View file

@ -0,0 +1,5 @@
if HAVE_GST_CHECK
SUBDIRS = check
else
SUBDIRS =
endif

27
tests/check/Makefile.am Normal file
View file

@ -0,0 +1,27 @@
include $(top_srcdir)/common/check.mak
TESTS_ENVIRONMENT =
plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@
# override to _not_ install the test plugins
install-pluginLTLIBRARIES:
# the core dumps of some machines have PIDs appended
CLEANFILES = core.* test-registry.*
SUPPRESSIONS = $(top_srcdir)/common/gst.supp # $(srcdir)/gst-plugins-bad.supp
clean-local: clean-local-check
check_PROGRAMS = \
ges/basic
noinst_HEADERS =
TESTS = $(check_PROGRAMS)
AM_CFLAGS = $(GST_OBJ_CFLAGS) $(GST_CHECK_CFLAGS) $(CHECK_CFLAGS) $(GST_OPTION_CFLAGS) -I$(top_srcdir)
LDADD = $(GST_OBJ_LIBS) $(GST_CHECK_LIBS) $(CHECK_LIBS) $(top_builddir)/ges/libges-@GST_MAJORMINOR@.la -lges-@GST_MAJORMINOR@
EXTRA_DIST = #gst-plugins-bad.supp

59
tests/check/ges/basic.c Normal file
View file

@ -0,0 +1,59 @@
/* GStreamer Editing Services
* Copyright (C) 2009 Edward Hervey <bilboed@bilboed.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <ges/ges.h>
#include <gst/check/gstcheck.h>
GST_START_TEST (test_ges_init)
{
/* Yes, I know.. minimalistic... */
ges_init ();
}
GST_END_TEST;
static Suite *
ges_suite (void)
{
Suite *s = suite_create ("ges");
TCase *tc_chain = tcase_create ("basic");
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_ges_init);
return s;
}
int
main (int argc, char **argv)
{
int nf;
Suite *s = ges_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}