diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-08-10 10:44:35 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-08-10 20:58:36 +0200 |
| commit | 750244bb43d19b039d3a78eef2ed576d9b8eae40 (patch) | |
| tree | ae70334ef42151d3fd3c6dd45250a82951c4eb06 | |
| parent | 08bfc1d87a5dce3693b3d811509bf1a99d613dd7 (diff) | |
Cleanup: tidy up a test.
| -rw-r--r-- | test/ssa_reader_test.cc | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/test/ssa_reader_test.cc b/test/ssa_reader_test.cc index f0eb504..ab9cae1 100644 --- a/test/ssa_reader_test.cc +++ b/test/ssa_reader_test.cc @@ -19,6 +19,7 @@ #include "collect.h" +#include "compose.hpp" #include "exceptions.h" #include "ssa_reader.h" #include "subtitle.h" @@ -31,6 +32,7 @@ using std::fabs; +using std::string; using std::vector; @@ -626,21 +628,27 @@ BOOST_AUTO_TEST_CASE (ssa_reader_fs) } -/** Test a valid \c */ -BOOST_AUTO_TEST_CASE (ssa_reader_c) +static void +test_c(string command, string colour) { sub::RawSubtitle base; auto r = sub::SSAReader::parse_line ( base, - "{\\c&H00FFFF&}Dieser Untertitel ist gelb", + String::compose("{\\c%1}Hello world", command), 1920, 1080 ); auto 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 ()); + BOOST_CHECK_EQUAL (i->text, "Hello world"); + BOOST_CHECK (i->colour == sub::Colour::from_rgb_hex(colour)); + BOOST_REQUIRE(std::next(i) == r.end()); +} + + +/** Test a valid \c */ +BOOST_AUTO_TEST_CASE (ssa_reader_c) +{ + test_c("&H00FFFF&", "ffff00"); } |
