mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
segment: Convert function to macro in unit test to get proper line numbers on failures
https://bugzilla.gnome.org/show_bug.cgi?id=748316
This commit is contained in:
parent
55f6582159
commit
f7f8312812
1 changed files with 20 additions and 23 deletions
|
@ -22,29 +22,26 @@
|
|||
|
||||
#include <gst/check/gstcheck.h>
|
||||
|
||||
static void
|
||||
check_times (GstSegment * segment, guint64 position, guint64 stream_time,
|
||||
guint64 running_time)
|
||||
{
|
||||
guint64 st, rt, pos;
|
||||
|
||||
st = gst_segment_to_stream_time (segment, segment->format, position);
|
||||
rt = gst_segment_to_running_time (segment, segment->format, position);
|
||||
GST_DEBUG ("position %" G_GUINT64_FORMAT ", st %" G_GUINT64_FORMAT ", rt %"
|
||||
G_GUINT64_FORMAT, position, stream_time, running_time);
|
||||
|
||||
fail_unless_equals_int64 (st, stream_time);
|
||||
fail_unless_equals_int64 (rt, running_time);
|
||||
if (stream_time != -1) {
|
||||
pos = gst_segment_position_from_stream_time (segment, segment->format, st);
|
||||
fail_unless_equals_int64 (pos, position);
|
||||
}
|
||||
|
||||
if (running_time != -1) {
|
||||
pos = gst_segment_position_from_running_time (segment, segment->format, rt);
|
||||
fail_unless_equals_int64 (pos, position);
|
||||
}
|
||||
}
|
||||
#define check_times(segment, position, stream_time, running_time) G_STMT_START { \
|
||||
guint64 st, rt, pos; \
|
||||
\
|
||||
st = gst_segment_to_stream_time ((segment), (segment)->format, (position)); \
|
||||
rt = gst_segment_to_running_time ((segment), (segment)->format, (position)); \
|
||||
GST_DEBUG ("position %" G_GUINT64_FORMAT ", st %" G_GUINT64_FORMAT ", rt %" \
|
||||
G_GUINT64_FORMAT, (guint64) (position), (guint64) (stream_time), (guint64) (running_time)); \
|
||||
\
|
||||
fail_unless_equals_int64 (st, (stream_time)); \
|
||||
fail_unless_equals_int64 (rt, (running_time)); \
|
||||
if ((stream_time) != -1) { \
|
||||
pos = gst_segment_position_from_stream_time ((segment), (segment)->format, st); \
|
||||
fail_unless_equals_int64 (pos, (position)); \
|
||||
} \
|
||||
\
|
||||
if ((running_time) != -1) { \
|
||||
pos = gst_segment_position_from_running_time ((segment), (segment)->format, rt); \
|
||||
fail_unless_equals_int64 (pos, (position)); \
|
||||
} \
|
||||
} G_STMT_END;
|
||||
|
||||
/* mess with the segment structure in the bytes format */
|
||||
GST_START_TEST (segment_seek_nosize)
|
||||
|
|
Loading…
Reference in a new issue