diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-09-26 19:44:32 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-09-26 19:44:32 +0200 |
| commit | 504c7ba026dff76f4124effef01f36a528a04bec (patch) | |
| tree | 2dacf936bf75271bc4b5a09dc79b66aa0e725150 /src/subtitle.cc | |
| parent | 8e971733f7e001f944d6dd29193938ebadafd0be (diff) | |
Better subtitle comparisons in tests.v1.8.30
Diffstat (limited to 'src/subtitle.cc')
| -rw-r--r-- | src/subtitle.cc | 50 |
1 files changed, 50 insertions, 0 deletions
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<const Subtitle> 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; +} |
