diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-06-24 12:31:56 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2019-06-28 23:26:10 +0100 |
| commit | 759a2e6150e2a611db90cd81c0b2f81699eb22bd (patch) | |
| tree | ae1a28f9873f598f699b9400040f8212eb8c846e /test/ssa_reader_test.cc | |
| parent | 79e9e5e1ee2b6757c85a9e79893c4be413bd6d62 (diff) | |
Add support for \c in SSA.v1.4.9
Backported from 2e4089247c02f1f1bf43ab880594ce0218dfbc11 in master.
Diffstat (limited to 'test/ssa_reader_test.cc')
| -rw-r--r-- | test/ssa_reader_test.cc | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/test/ssa_reader_test.cc b/test/ssa_reader_test.cc index 1b4d596..4aa8ff5 100644 --- a/test/ssa_reader_test.cc +++ b/test/ssa_reader_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Carl Hetherington <cth@carlh.net> + Copyright (C) 2016-2019 Carl Hetherington <cth@carlh.net> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,6 +21,7 @@ #include "ssa_reader.h" #include "collect.h" #include "subtitle.h" +#include "exceptions.h" #include <boost/test/unit_test.hpp> #include <boost/filesystem.hpp> #include <boost/foreach.hpp> @@ -494,3 +495,34 @@ BOOST_AUTO_TEST_CASE (ssa_reader_fs) ++i; BOOST_REQUIRE (i == r.end ()); } + +/** Test a valid \c */ +BOOST_AUTO_TEST_CASE (ssa_reader_c) +{ + sub::RawSubtitle base; + list<sub::RawSubtitle> r = sub::SSAReader::parse_line ( + base, + "{\\c&H00FFFF&}Dieser Untertitel ist gelb", + 1920, 1080 + ); + + list<sub::RawSubtitle>::const_iterator i = r.begin (); + BOOST_CHECK_EQUAL (i->text, "Dieser Untertitel ist gelb"); + BOOST_CHECK (i->colour == sub::Colour::from_rgb_hex("ffff00")); + ++i; + BOOST_REQUIRE (i == r.end ()); +} + +/** Test invalid \c */ +BOOST_AUTO_TEST_CASE (ssa_reader_c_bad) +{ + sub::RawSubtitle base; + BOOST_CHECK_THROW( + sub::SSAReader::parse_line( + base, + "{\\c&H0}Dieser Untertitel ist gelb", + 1920, 1080 + ), + sub::SSAError + ); +} |
