diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-05-19 21:23:37 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-05-19 21:23:37 +0200 |
| commit | b38aa006143abd4f10b7ec32576f5ce2867fa975 (patch) | |
| tree | 80c9ff2e89cd4ef1a1ee764daa94e79fd3b09bcb /test/stl_binary_reader_test.cc | |
| parent | ba0d345e3a986ea07398c1a9abe8d5263a870318 (diff) | |
Basic support for colours in binary STL.v1.6.48
Diffstat (limited to 'test/stl_binary_reader_test.cc')
| -rw-r--r-- | test/stl_binary_reader_test.cc | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/test/stl_binary_reader_test.cc b/test/stl_binary_reader_test.cc index 6566c5f..a0469d0 100644 --- a/test/stl_binary_reader_test.cc +++ b/test/stl_binary_reader_test.cc @@ -17,6 +17,7 @@ */ + #include "stl_binary_reader.h" #include "subtitle.h" #include "test.h" @@ -24,10 +25,13 @@ #include <boost/test/unit_test.hpp> #include <fstream> + using std::ifstream; +using std::make_shared; using std::ofstream; using std::shared_ptr; -using std::make_shared; +using std::vector; + /* Test reading of a binary STL file */ BOOST_AUTO_TEST_CASE (stl_binary_reader_test1) @@ -94,3 +98,36 @@ BOOST_AUTO_TEST_CASE (stl_binary_reader_test3) } } + +BOOST_AUTO_TEST_CASE(stl_binary_reader_with_colour) +{ + auto path = private_test / "at.stl"; + ifstream in(path.string().c_str()); + auto reader = make_shared<sub::STLBinaryReader>(in); + + vector<sub::Colour> reference = { + { 1, 1, 1 }, + { 1, 0, 1 }, + { 1, 1, 1 }, + { 1, 0, 1 }, + { 1, 1, 1 }, + { 1, 1, 0 }, + { 1, 1, 1 }, + { 1, 1, 0 }, + { 1, 1, 1 }, + { 1, 1, 0 }, + { 1, 1, 1 }, + { 1, 1, 0 }, + { 1, 1, 1 }, + { 1, 1, 0 } + }; + + /* Check the first few lines */ + auto subs = reader->subtitles(); + BOOST_REQUIRE(subs.size() >= reference.size()); + + for (size_t i = 0; i < reference.size(); ++i) { + BOOST_CHECK(subs[i].colour == reference[i]); + } +} + |
