mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
tests: Add some utils for test writing
This commit is contained in:
parent
fbefd6dae3
commit
6462b86ac4
3 changed files with 142 additions and 8 deletions
|
@ -10,8 +10,21 @@ install-pluginLTLIBRARIES:
|
||||||
# the core dumps of some machines have PIDs appended
|
# the core dumps of some machines have PIDs appended
|
||||||
CLEANFILES = core.* test-registry.*
|
CLEANFILES = core.* test-registry.*
|
||||||
|
|
||||||
|
common_cflags=-I$(top_srcdir) $(GST_PLUGINS_BASE_CFLAGS) $(GST_OBJ_CFLAGS) \
|
||||||
|
$(GST_CHECK_CFLAGS) $(GST_OPTION_CFLAGS) $(GST_CFLAGS)
|
||||||
|
common_ldadd=$(top_builddir)/ges/libges-@GST_API_VERSION@.la \
|
||||||
|
$(GST_PLUGINS_BASE_LIBS) -lgstpbutils-$(GST_API_VERSION) \
|
||||||
|
$(GST_OBJ_LIBS) $(GST_CHECK_LIBS)
|
||||||
|
|
||||||
|
testutils_noisnt_libraries=libtestutils.la
|
||||||
|
testutils_noinst_headers=ges/test-utils.h
|
||||||
|
libtestutils_la_LIBADD=$(common_ldadd)
|
||||||
|
libtestutils_la_CFLAGS=$(common_cflags)
|
||||||
|
libtestutils_la_SOURCES=ges/test-utils.c
|
||||||
|
|
||||||
SUPPRESSIONS = $(top_srcdir)/common/gst.supp # $(srcdir)/gst-plugins-bad.supp
|
SUPPRESSIONS = $(top_srcdir)/common/gst.supp # $(srcdir)/gst-plugins-bad.supp
|
||||||
|
|
||||||
|
|
||||||
clean-local: clean-local-check
|
clean-local: clean-local-check
|
||||||
|
|
||||||
check_PROGRAMS = \
|
check_PROGRAMS = \
|
||||||
|
@ -29,16 +42,12 @@ check_PROGRAMS = \
|
||||||
ges/text_properties\
|
ges/text_properties\
|
||||||
ges/save_and_load
|
ges/save_and_load
|
||||||
|
|
||||||
noinst_HEADERS =
|
noinst_LTLIBRARIES=$(testutils_noisnt_libraries)
|
||||||
|
noinst_HEADERS=$(testutils_noinst_headers)
|
||||||
|
|
||||||
TESTS = $(check_PROGRAMS)
|
TESTS = $(check_PROGRAMS)
|
||||||
|
|
||||||
AM_CFLAGS = -I$(top_srcdir) $(GST_PLUGINS_BASE_CFLAGS) $(GST_OBJ_CFLAGS) \
|
AM_CFLAGS = $(common_cflags) -UG_DISABLE_ASSERT -UG_DISABLE_CAST_CHECKS
|
||||||
$(GST_CHECK_CFLAGS) $(GST_OPTION_CFLAGS) $(GST_CFLAGS) \
|
LDADD = $(common_ldadd) libtestutils.la
|
||||||
-UG_DISABLE_ASSERT -UG_DISABLE_CAST_CHECKS
|
|
||||||
|
|
||||||
LDADD = $(top_builddir)/ges/libges-@GST_API_VERSION@.la \
|
|
||||||
$(GST_PLUGINS_BASE_LIBS) -lgstpbutils-$(GST_API_VERSION) \
|
|
||||||
$(GST_OBJ_LIBS) $(GST_CHECK_LIBS)
|
|
||||||
|
|
||||||
EXTRA_DIST = #gst-plugins-bad.supp
|
EXTRA_DIST = #gst-plugins-bad.supp
|
||||||
|
|
80
tests/check/ges/test-utils.c
Normal file
80
tests/check/ges/test-utils.c
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
/**
|
||||||
|
* Gstreamer Editing Services
|
||||||
|
*
|
||||||
|
* Copyright (C) <2012> Thibault Saunier <thibault.saunier@collabora.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 "test-utils.h"
|
||||||
|
#include <gio/gio.h>
|
||||||
|
|
||||||
|
gchar *
|
||||||
|
ges_test_get_audio_only_uri (void)
|
||||||
|
{
|
||||||
|
gchar *uri;
|
||||||
|
GFile *cfile, *fdir, *f_audio_only;
|
||||||
|
|
||||||
|
cfile = g_file_new_for_path (__FILE__);
|
||||||
|
fdir = g_file_get_parent (cfile);
|
||||||
|
|
||||||
|
f_audio_only = g_file_get_child (fdir, "audio_only.ogg");
|
||||||
|
uri = g_file_get_uri (f_audio_only);
|
||||||
|
|
||||||
|
g_object_unref (cfile);
|
||||||
|
g_object_unref (fdir);
|
||||||
|
g_object_unref (f_audio_only);
|
||||||
|
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
gchar *
|
||||||
|
ges_test_get_audio_video_uri (void)
|
||||||
|
{
|
||||||
|
gchar *uri;
|
||||||
|
GFile *cfile, *fdir, *f_audio_video;
|
||||||
|
|
||||||
|
cfile = g_file_new_for_path (__FILE__);
|
||||||
|
fdir = g_file_get_parent (cfile);
|
||||||
|
|
||||||
|
f_audio_video = g_file_get_child (fdir, "audio_video.ogg");
|
||||||
|
uri = g_file_get_uri (f_audio_video);
|
||||||
|
|
||||||
|
g_object_unref (cfile);
|
||||||
|
g_object_unref (fdir);
|
||||||
|
g_object_unref (f_audio_video);
|
||||||
|
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
gchar *
|
||||||
|
ges_test_file_uri (const gchar * filename)
|
||||||
|
{
|
||||||
|
gchar *uri;
|
||||||
|
GFile *cfile, *fdir, *f_xptv;
|
||||||
|
|
||||||
|
cfile = g_file_new_for_path (__FILE__);
|
||||||
|
fdir = g_file_get_parent (cfile);
|
||||||
|
|
||||||
|
f_xptv = g_file_get_child (fdir, filename);
|
||||||
|
uri = g_file_get_uri (f_xptv);
|
||||||
|
|
||||||
|
g_object_unref (cfile);
|
||||||
|
g_object_unref (fdir);
|
||||||
|
g_object_unref (f_xptv);
|
||||||
|
|
||||||
|
return uri;
|
||||||
|
}
|
45
tests/check/ges/test-utils.h
Normal file
45
tests/check/ges/test-utils.h
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
/**
|
||||||
|
* Gstreamer Editing Services
|
||||||
|
*
|
||||||
|
* Copyright (C) <2012> Thibault Saunier <thibault.saunier@collabora.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_TEST_UTILS
|
||||||
|
#define _GES_TEST_UTILS
|
||||||
|
|
||||||
|
#include <ges/ges.h>
|
||||||
|
|
||||||
|
gchar * ges_test_get_audio_only_uri (void);
|
||||||
|
gchar * ges_test_get_audio_video_uri (void);
|
||||||
|
gchar * ges_test_file_uri (const gchar *filename);
|
||||||
|
|
||||||
|
#define gnl_object_check(gnlobj, start, duration, mstart, mduration, priority, active) { \
|
||||||
|
guint64 pstart, pdur, pmstart, pmdur, pprio, pact; \
|
||||||
|
g_object_get (gnlobj, "start", &pstart, "duration", &pdur, \
|
||||||
|
"media-start", &pmstart, "media-duration", &pmdur, \
|
||||||
|
"priority", &pprio, "active", &pact, \
|
||||||
|
NULL); \
|
||||||
|
assert_equals_uint64 (pstart, start); \
|
||||||
|
assert_equals_uint64 (pdur, duration); \
|
||||||
|
assert_equals_uint64 (pmstart, mstart); \
|
||||||
|
assert_equals_uint64 (pmdur, mduration); \
|
||||||
|
assert_equals_int (pprio, priority); \
|
||||||
|
assert_equals_int (pact, active); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _GES_TEST_UTILS */
|
Loading…
Reference in a new issue