mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
tests: add small unit test for AC3 vs. JPEG typefinding issue
This commit is contained in:
parent
14d14a9143
commit
2c989ef3a7
6 changed files with 41 additions and 1 deletions
|
@ -953,6 +953,7 @@ tests/examples/volume/Makefile
|
|||
tests/examples/snapshot/Makefile
|
||||
tests/examples/gio/Makefile
|
||||
tests/examples/v4l/Makefile
|
||||
tests/files/Makefile
|
||||
tests/icles/Makefile
|
||||
docs/Makefile
|
||||
docs/design/Makefile
|
||||
|
|
|
@ -24,4 +24,5 @@ SUBDIRS = \
|
|||
DIST_SUBDIRS = \
|
||||
check \
|
||||
examples \
|
||||
files \
|
||||
icles
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
include $(top_srcdir)/common/check.mak
|
||||
|
||||
CHECK_REGISTRY = $(top_builddir)/tests/check/test-registry.reg
|
||||
TEST_FILES_DIRECTORY = $(top_srcdir)/tests/files
|
||||
|
||||
REGISTRY_ENVIRONMENT = \
|
||||
GST_REGISTRY=$(CHECK_REGISTRY)
|
||||
|
@ -136,7 +137,8 @@ VALGRIND_TO_FIX = \
|
|||
# these tests don't even pass
|
||||
noinst_PROGRAMS = $(check_libvisual)
|
||||
|
||||
AM_CFLAGS = $(GST_CFLAGS) $(GST_CHECK_CFLAGS)
|
||||
AM_CFLAGS = $(GST_CFLAGS) $(GST_CHECK_CFLAGS) \
|
||||
-DGST_TEST_FILES_PATH="\"$(TEST_FILES_DIRECTORY)\""
|
||||
LDADD = $(GST_LIBS) $(GST_CHECK_LIBS)
|
||||
|
||||
# valgrind testing
|
||||
|
|
|
@ -103,7 +103,40 @@ GST_START_TEST (test_broken_flac_in_ogg)
|
|||
|
||||
gst_buffer_unref (buf);
|
||||
gst_caps_unref (caps);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_jpeg_not_ac3)
|
||||
{
|
||||
const gchar *type;
|
||||
GstBuffer *buf;
|
||||
GError *err = NULL;
|
||||
GstCaps *caps = NULL;
|
||||
gchar *path, *data = NULL;
|
||||
gsize data_len;
|
||||
|
||||
path = g_build_filename (GST_TEST_FILES_PATH, "partialframe.mjpeg", NULL);
|
||||
GST_LOG ("reading file '%s'", path);
|
||||
if (!g_file_get_contents (path, &data, &data_len, &err)) {
|
||||
g_error ("error loading test file: %s", err->message);
|
||||
}
|
||||
|
||||
buf = gst_buffer_new ();
|
||||
GST_BUFFER_DATA (buf) = (guint8 *) data;
|
||||
GST_BUFFER_SIZE (buf) = data_len;
|
||||
GST_BUFFER_OFFSET (buf) = 0;
|
||||
|
||||
caps = gst_type_find_helper_for_buffer (NULL, buf, NULL);
|
||||
fail_unless (caps != NULL);
|
||||
GST_LOG ("Found type: %" GST_PTR_FORMAT, caps);
|
||||
|
||||
type = gst_structure_get_name (gst_caps_get_structure (caps, 0));
|
||||
fail_unless_equals_string (type, "image/jpeg");
|
||||
|
||||
gst_buffer_unref (buf);
|
||||
gst_caps_unref (caps);
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
@ -118,6 +151,7 @@ typefindfunctions_suite (void)
|
|||
|
||||
tcase_add_test (tc_chain, test_quicktime_mpeg4video);
|
||||
tcase_add_test (tc_chain, test_broken_flac_in_ogg);
|
||||
tcase_add_test (tc_chain, test_jpeg_not_ac3);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
2
tests/files/Makefile.am
Normal file
2
tests/files/Makefile.am
Normal file
|
@ -0,0 +1,2 @@
|
|||
EXTRA_DIST = \
|
||||
partialframe.mjpeg
|
BIN
tests/files/partialframe.mjpeg
Normal file
BIN
tests/files/partialframe.mjpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Loading…
Reference in a new issue