Merge branch 'master' of ssh://main.carlh.net/home/carl/git/libdcp
[libdcp.git] / test / read_interop_subtitle_test.cc
index a66327f1c59e73e629888c0f13028eef7a53b147..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"
@@ -49,6 +49,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1)
        BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
                                   string ("theFontId"),
                                   false,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   39,
                                   1.0,
@@ -58,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),
@@ -70,6 +73,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1)
        BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
                                   string ("theFontId"),
                                   true,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   39,
                                   1.0,
@@ -79,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),
@@ -88,6 +94,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1)
        BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
                                   string ("theFontId"),
                                   false,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   39,
                                   1.0,
@@ -97,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),
@@ -109,6 +118,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1)
        BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
                                   string ("theFontId"),
                                   false,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   39,
                                   1.0,
@@ -118,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),
@@ -130,6 +142,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1)
        BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
                                   string ("theFontId"),
                                   false,
+                                  true,
+                                  true,
                                   dcp::Colour (255, 255, 255),
                                   39,
                                   1.0,
@@ -139,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),
@@ -157,6 +172,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
        BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
                                   string ("theFont"),
                                   true,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -166,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),
@@ -175,6 +193,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
        BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
                                   string ("theFont"),
                                   true,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -184,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),
@@ -196,6 +217,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
        BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
                                   string ("theFont"),
                                   true,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -205,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),
@@ -214,6 +238,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
        BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
                                   string ("theFont"),
                                   true,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -223,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),
@@ -235,6 +262,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
        BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
                                   string ("theFont"),
                                   true,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -244,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),
@@ -253,6 +283,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
        BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
                                   string ("theFont"),
                                   true,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -262,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),
@@ -274,6 +307,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
        BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
                                   string ("theFont"),
                                   true,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -283,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),
@@ -292,6 +328,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
        BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
                                   string ("theFont"),
                                   true,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -301,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),
@@ -313,6 +352,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
        BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
                                   string ("theFont"),
                                   true,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -322,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),
@@ -331,6 +373,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
        BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
                                   string ("theFont"),
                                   true,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -340,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),
@@ -352,6 +397,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
        BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
                                   string ("theFont"),
                                   false,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -361,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),
@@ -370,6 +418,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
        BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
                                   string ("theFont"),
                                   false,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -379,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),
@@ -391,6 +442,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
        BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
                                   string ("theFont"),
                                   false,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -400,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),
@@ -409,6 +463,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
        BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
                                   string ("theFont"),
                                   false,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -418,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),
@@ -430,6 +487,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
        BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
                                   string ("theFont"),
                                   false,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -439,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),
@@ -448,6 +508,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
        BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
                                   string ("theFont"),
                                   false,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -457,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),
@@ -469,6 +532,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
        BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
                                   string ("theFont"),
                                   true,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -478,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),
@@ -487,6 +553,8 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
        BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
                                   string ("theFont"),
                                   true,
+                                  false,
+                                  false,
                                   dcp::Colour (255, 255, 255),
                                   42,
                                   1.0,
@@ -496,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),