Support underlining of subtitles.
[libdcp.git] / test / read_interop_subtitle_test.cc
index 7cbb5803c904a59fff390b927c5fcb45e8435e14..7febaab485696b617548d4ec2483354c1cb93f6e 100644 (file)
@@ -1,20 +1,20 @@
 /*
     Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
 
-    This program is free software; you can redistribute it and/or modify
+    This file is part of libdcp.
+
+    libdcp is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    This program is distributed in the hope that it will be useful,
+    libdcp is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
+    along with libdcp.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "interop_subtitle_asset.h"
@@ -50,6 +50,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1)
                                   string ("theFontId"),
                                   false,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   39,
                                   1.0,
@@ -59,6 +60,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1)
                                   dcp::HALIGN_CENTER,
                                   0.15,
                                   dcp::VALIGN_BOTTOM,
+                                  dcp::DIRECTION_LTR,
                                   "My jacket was Idi Amin's",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -72,6 +74,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1)
                                   string ("theFontId"),
                                   true,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   39,
                                   1.0,
@@ -81,6 +84,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1)
                                   dcp::HALIGN_CENTER,
                                   0.21,
                                   dcp::VALIGN_BOTTOM,
+                                  dcp::DIRECTION_LTR,
                                   "My corset was H.M. The Queen's",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -91,6 +95,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1)
                                   string ("theFontId"),
                                   false,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   39,
                                   1.0,
@@ -100,6 +105,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1)
                                   dcp::HALIGN_CENTER,
                                   0.15,
                                   dcp::VALIGN_BOTTOM,
+                                  dcp::DIRECTION_LTR,
                                   "My large wonderbra",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -113,6 +119,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1)
                                   string ("theFontId"),
                                   false,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   39,
                                   1.0,
@@ -122,6 +129,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1)
                                   dcp::HALIGN_CENTER,
                                   0.15,
                                   dcp::VALIGN_BOTTOM,
+                                  dcp::DIRECTION_LTR,
                                   "Once belonged to the Shah",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -134,7 +142,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1)
        BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
                                   string ("theFontId"),
                                   false,
-                                  false,
+                                  true,
+                                  true,
                                   dcp::Colour (255, 255, 255),
                                   39,
                                   1.0,
@@ -144,6 +153,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1)
                                   dcp::HALIGN_CENTER,
                                   0.15,
                                   dcp::VALIGN_BOTTOM,
+                                  dcp::DIRECTION_LTR,
                                   "And these are Roy Hattersley's jeans",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -163,6 +173,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   string ("theFont"),
                                   true,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -172,6 +183,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   dcp::HALIGN_CENTER,
                                   0.89,
                                   dcp::VALIGN_TOP,
+                                  dcp::DIRECTION_LTR,
                                   "At afternoon tea with John Peel",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -182,6 +194,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   string ("theFont"),
                                   true,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -191,6 +204,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   dcp::HALIGN_CENTER,
                                   0.95,
                                   dcp::VALIGN_TOP,
+                                  dcp::DIRECTION_LTR,
                                   "I enquired if his accent was real",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -204,6 +218,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   string ("theFont"),
                                   true,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -213,6 +228,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   dcp::HALIGN_CENTER,
                                   0.89,
                                   dcp::VALIGN_TOP,
+                                  dcp::DIRECTION_LTR,
                                   "He said \"out of the house",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -223,6 +239,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   string ("theFont"),
                                   true,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -232,6 +249,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   dcp::HALIGN_CENTER,
                                   0.95,
                                   dcp::VALIGN_TOP,
+                                  dcp::DIRECTION_LTR,
                                   "I'm incredibly scouse",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -245,6 +263,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   string ("theFont"),
                                   true,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -254,6 +273,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   dcp::HALIGN_CENTER,
                                   0.89,
                                   dcp::VALIGN_TOP,
+                                  dcp::DIRECTION_LTR,
                                   "At home it depends how I feel.\"",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -264,6 +284,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   string ("theFont"),
                                   true,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -273,6 +294,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   dcp::HALIGN_CENTER,
                                   0.95,
                                   dcp::VALIGN_TOP,
+                                  dcp::DIRECTION_LTR,
                                   "I spent a long weekend in Brighton",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -286,6 +308,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   string ("theFont"),
                                   true,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -295,6 +318,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   dcp::HALIGN_CENTER,
                                   0.89,
                                   dcp::VALIGN_TOP,
+                                  dcp::DIRECTION_RTL,
                                   "With the legendary Miss Enid Blyton",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -305,6 +329,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   string ("theFont"),
                                   true,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -314,6 +339,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   dcp::HALIGN_CENTER,
                                   0.95,
                                   dcp::VALIGN_TOP,
+                                  dcp::DIRECTION_TTB,
                                   "She said \"you be Noddy",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -327,6 +353,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   string ("theFont"),
                                   true,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -336,6 +363,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   dcp::HALIGN_CENTER,
                                   0.89,
                                   dcp::VALIGN_TOP,
+                                  dcp::DIRECTION_BTT,
                                   "That curious creature the Sphinx",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -346,6 +374,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   string ("theFont"),
                                   true,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -355,6 +384,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   dcp::HALIGN_CENTER,
                                   0.95,
                                   dcp::VALIGN_TOP,
+                                  dcp::DIRECTION_LTR,
                                   "Is smarter than anyone thinks",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -368,6 +398,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   string ("theFont"),
                                   false,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -377,6 +408,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   dcp::HALIGN_CENTER,
                                   0.89,
                                   dcp::VALIGN_TOP,
+                                  dcp::DIRECTION_LTR,
                                   "It sits there and smirks",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -387,6 +419,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   string ("theFont"),
                                   false,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -396,6 +429,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   dcp::HALIGN_CENTER,
                                   0.95,
                                   dcp::VALIGN_TOP,
+                                  dcp::DIRECTION_LTR,
                                   "And you don't think it works",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -409,6 +443,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   string ("theFont"),
                                   false,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -418,6 +453,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   dcp::HALIGN_CENTER,
                                   0.89,
                                   dcp::VALIGN_TOP,
+                                  dcp::DIRECTION_LTR,
                                   "Then when you're not looking, it winks.",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -428,6 +464,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   string ("theFont"),
                                   false,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -437,6 +474,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   dcp::HALIGN_CENTER,
                                   0.95,
                                   dcp::VALIGN_TOP,
+                                  dcp::DIRECTION_LTR,
                                   "When it snows you will find Sister Sledge",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -450,6 +488,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   string ("theFont"),
                                   false,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -459,6 +498,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   dcp::HALIGN_CENTER,
                                   0.89,
                                   dcp::VALIGN_TOP,
+                                  dcp::DIRECTION_LTR,
                                   "Out mooning, at night, on the ledge",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -469,6 +509,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   string ("theFont"),
                                   false,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -478,6 +519,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   dcp::HALIGN_CENTER,
                                   0.95,
                                   dcp::VALIGN_TOP,
+                                  dcp::DIRECTION_LTR,
                                   "One storey down",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -491,6 +533,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   string ("theFont"),
                                   true,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -500,6 +543,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   dcp::HALIGN_CENTER,
                                   0.89,
                                   dcp::VALIGN_TOP,
+                                  dcp::DIRECTION_LTR,
                                   "HELLO",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),
@@ -510,6 +554,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   string ("theFont"),
                                   true,
                                   false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -519,6 +564,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
                                   dcp::HALIGN_CENTER,
                                   0.95,
                                   dcp::VALIGN_TOP,
+                                  dcp::DIRECTION_LTR,
                                   "WORLD",
                                   dcp::BORDER,
                                   dcp::Colour (0, 0, 0),