projects
/
libsub.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
08bfc1d
)
Cleanup: tidy up a test.
author
Carl Hetherington
<cth@carlh.net>
Wed, 10 Aug 2022 08:44:35 +0000
(10:44 +0200)
committer
Carl Hetherington
<cth@carlh.net>
Wed, 10 Aug 2022 18:58:36 +0000
(20:58 +0200)
test/ssa_reader_test.cc
patch
|
blob
|
history
diff --git
a/test/ssa_reader_test.cc
b/test/ssa_reader_test.cc
index f0eb504cc72175152cb297fcd48c7ccd730bec7b..ab9cae107bf33a2c902ee5e3155299e1e1f998f0 100644
(file)
--- a/
test/ssa_reader_test.cc
+++ b/
test/ssa_reader_test.cc
@@
-19,6
+19,7
@@
#include "collect.h"
#include "collect.h"
+#include "compose.hpp"
#include "exceptions.h"
#include "ssa_reader.h"
#include "subtitle.h"
#include "exceptions.h"
#include "ssa_reader.h"
#include "subtitle.h"
@@
-31,6
+32,7
@@
using std::fabs;
using std::fabs;
+using std::string;
using std::vector;
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,
{
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 ();
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");
}
}