From 504c7ba026dff76f4124effef01f36a528a04bec Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 26 Sep 2022 19:44:32 +0200 Subject: Better subtitle comparisons in tests. --- src/subtitle.cc | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'src/subtitle.cc') diff --git a/src/subtitle.cc b/src/subtitle.cc index 9d82a128..15481528 100644 --- a/src/subtitle.cc +++ b/src/subtitle.cc @@ -41,6 +41,7 @@ #include "dcp_time.h" +using std::shared_ptr; using namespace dcp; @@ -66,3 +67,52 @@ Subtitle::Subtitle ( { } + + +bool +Subtitle::equals(shared_ptr other, EqualityOptions, NoteHandler note) const +{ + bool same = true; + + if (in() != other->in()) { + note(NoteType::ERROR, "subtitle in times differ"); + same = false; + } + + if (out() != other->out()) { + note(NoteType::ERROR, "subtitle out times differ"); + same = false; + } + + if (h_position() != other->h_position()) { + note(NoteType::ERROR, "subtitle horizontal positions differ"); + same = false; + } + + if (h_align() != other->h_align()) { + note(NoteType::ERROR, "subtitle horizontal alignments differ"); + same = false; + } + + if (v_position() != other->v_position()) { + note(NoteType::ERROR, "subtitle vertical positions differ"); + same = false; + } + + if (v_align() != other->v_align()) { + note(NoteType::ERROR, "subtitle vertical alignments differ"); + same = false; + } + + if (fade_up_time() != other->fade_up_time()) { + note(NoteType::ERROR, "subtitle fade-up times differ"); + same = false; + } + + if (fade_down_time() != other->fade_down_time()) { + note(NoteType::ERROR, "subtitle fade-down times differ"); + same = false; + } + + return same; +} -- cgit v1.2.3