2 Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 #include "lib/render_subtitles.h"
22 #include <dcp/subtitle_string.h>
23 #include <boost/test/unit_test.hpp>
26 add (std::list<dcp::SubtitleString>& s, std::string text, bool italic, bool bold, bool underline)
30 boost::optional<std::string> (),
34 dcp::Colour (255, 255, 255),
46 dcp::Colour (0, 0, 0),
53 /** Test marked_up() in render_subtitles.cc */
54 BOOST_AUTO_TEST_CASE (render_markup_test1)
56 std::list<dcp::SubtitleString> s;
57 add (s, "Hello", false, false, false);
58 BOOST_CHECK_EQUAL (marked_up (s), "Hello");
61 /** Test marked_up() in render_subtitles.cc */
62 BOOST_AUTO_TEST_CASE (render_markup_test2)
64 std::list<dcp::SubtitleString> s;
65 add (s, "Hello", false, true, false);
66 BOOST_CHECK_EQUAL (marked_up (s), "<b>Hello</b>");
70 /** Test marked_up() in render_subtitles.cc */
71 BOOST_AUTO_TEST_CASE (render_markup_test3)
73 std::list<dcp::SubtitleString> s;
74 add (s, "Hello", true, true, false);
75 BOOST_CHECK_EQUAL (marked_up (s), "<i><b>Hello</b></i>");
78 /** Test marked_up() in render_subtitles.cc */
79 BOOST_AUTO_TEST_CASE (render_markup_test4)
81 std::list<dcp::SubtitleString> s;
82 add (s, "Hello", true, true, true);
83 BOOST_CHECK_EQUAL (marked_up (s), "<i><b><u>Hello</u></b></i>");