tests/check/: Minimal check for volume's GstController usability; also another test for #422295.

Original commit message from CVS:
* tests/check/Makefile.am:
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Minimal check for volume's GstController usability; also another
test for #422295.
This commit is contained in:
Tim-Philipp Müller 2007-05-04 12:41:21 +00:00
parent 4f0e7a9ef9
commit 9de5f965ea
3 changed files with 45 additions and 17 deletions

View file

@ -1,3 +1,10 @@
2007-05-04 Tim-Philipp Müller <tim at centricular dot net>
* tests/check/Makefile.am:
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Minimal check for volume's GstController usability; also another
test for #422295.
2007-05-04 Tim-Philipp Müller <tim at centricular dot net>
* gst-libs/gst/cdda/gstcddabasesrc.c:

View file

@ -188,11 +188,13 @@ elements_textoverlay_LDADD = $(GST_BASE_LIBS) $(LDADD)
elements_textoverlay_CFLAGS = $(GST_BASE_CFLAGS) $(AM_CFLAGS)
elements_volume_LDADD = \
$(GST_CONTROLLER_LIBS) \
$(GST_BASE_LIBS) \
$(LDADD)
elements_volume_CFLAGS = \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_CONTROLLER_CFLAGS) \
$(GST_BASE_CFLAGS) \
$(AM_CFLAGS)

View file

@ -24,6 +24,7 @@
#include <gst/base/gstbasetransform.h>
#include <gst/check/gstcheck.h>
#include <gst/controller/gstcontroller.h>
gboolean have_eos = FALSE;
@ -369,7 +370,39 @@ GST_START_TEST (test_passthrough)
GST_END_TEST;
Suite *
GST_START_TEST (test_controller_usability)
{
GstController *c;
GstElement *volume;
GValue value = { 0, };
/* note: the volume element should init the controller library for us */
volume = setup_volume ();
g_value_init (&value, G_TYPE_DOUBLE);
c = gst_controller_new (G_OBJECT (volume), "volume", NULL);
fail_unless (GST_IS_CONTROLLER (c));
/* this shouldn't crash, whether this mode is implemented or not */
gst_controller_set_interpolation_mode (c, "volume", GST_INTERPOLATE_CUBIC);
g_value_set_double (&value, 1.0);
gst_controller_set (c, "volume", 0 * GST_SECOND, &value);
g_value_set_double (&value, 1.0);
gst_controller_set (c, "volume", 5 * GST_SECOND, &value);
g_value_set_double (&value, 0.0);
gst_controller_set (c, "volume", 10 * GST_SECOND, &value);
g_object_unref (c);
cleanup_volume (volume);
}
GST_END_TEST;
static Suite *
volume_suite (void)
{
Suite *s = suite_create ("volume");
@ -382,23 +415,9 @@ volume_suite (void)
tcase_add_test (tc_chain, test_mute);
tcase_add_test (tc_chain, test_wrong_caps);
tcase_add_test (tc_chain, test_passthrough);
tcase_add_test (tc_chain, test_controller_usability);
return s;
}
int
main (int argc, char **argv)
{
int nf;
Suite *s = volume_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;
}
GST_CHECK_MAIN (volume)