X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=test%2Frender_subtitles_test.cc;h=282c9311f7e24ef6a10bc8ee4419814f7422bc38;hb=486038a7eb23498e1e5097e73a32929d889ca505;hp=f4ff3b7bb2f05a76bcc76272eb3adeda3bb01590;hpb=74641dc13a4244ed656722a671f0c827dab39b03;p=dcpomatic.git diff --git a/test/render_subtitles_test.cc b/test/render_subtitles_test.cc index f4ff3b7bb..282c9311f 100644 --- a/test/render_subtitles_test.cc +++ b/test/render_subtitles_test.cc @@ -25,12 +25,17 @@ */ +#include "lib/image.h" +#include "lib/image_png.h" #include "lib/render_text.h" #include "lib/string_text.h" #include #include +using std::shared_ptr; + + static void add (std::list& s, std::string text, bool italic, bool bold, bool underline) { @@ -59,7 +64,8 @@ add (std::list& s, std::string text, bool italic, bool bold, bool un 0 ), 2, - std::shared_ptr() + std::shared_ptr(), + dcp::Standard::SMPTE ) ); } @@ -111,3 +117,30 @@ BOOST_AUTO_TEST_CASE (marked_up_test6) add (s, "we are bold.", false, true, false); BOOST_CHECK_EQUAL (marked_up(s, 1024, 1, ""), "Hello world we are bold."); } + + +#if 0 + +BOOST_AUTO_TEST_CASE (render_text_test) +{ + auto dcp_string = dcp::SubtitleString( + {}, false, false, false, dcp::Colour(255, 255, 255), 42, 1.0, + dcp::Time(0, 0, 0, 0, 24), dcp::Time(0, 0, 1, 0, 24), + 0.5, dcp::HAlign::CENTER, + 0.5, dcp::VAlign::CENTER, + dcp::Direction::LTR, + "HÄllo jokers", + dcp::Effect::NONE, dcp::Colour(0, 0, 0), + {}, {}, + 0 + ); + + auto string_text = StringText(dcp_string, 0, shared_ptr()); + + auto images = render_text({ string_text }, dcp::Size(1998, 1080), {}, 24); + + BOOST_CHECK_EQUAL(images.size(), 1U); + image_as_png(Image::ensure_alignment(images.front().image, Image::Alignment::PADDED)).write("build/test/render_text_test.png"); +} + +#endif