From 9de5f965ea92873df65d8a8ae70a9d134e013d01 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 4 May 2007 12:41:21 +0000 Subject: [PATCH] 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. --- ChangeLog | 7 ++++++ tests/check/Makefile.am | 2 ++ tests/check/elements/volume.c | 53 +++++++++++++++++++++++++++++-------------- 3 files changed, 45 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index f5b5d2b..55d328e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2007-05-04 Tim-Philipp Müller + * 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 + * gst-libs/gst/cdda/gstcddabasesrc.c: (gst_cdda_base_src_add_track): Fix it so that it (a) makes sense and (b) doesn't break diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index 8a63f82..ebf10ea 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -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) diff --git a/tests/check/elements/volume.c b/tests/check/elements/volume.c index 2ec78ac..d92b35d 100644 --- a/tests/check/elements/volume.c +++ b/tests/check/elements/volume.c @@ -24,6 +24,7 @@ #include #include +#include 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) -- 2.7.4