More subs tests.
authorCarl Hetherington <cth@carlh.net>
Wed, 22 Aug 2012 17:03:18 +0000 (18:03 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 22 Aug 2012 17:03:18 +0000 (18:03 +0100)
src/subtitle_asset.cc
src/subtitle_asset.h
test/data/subs1.xml [new file with mode: 0644]
test/data/subs2.xml [new file with mode: 0755]
test/ref/subs.xml [deleted file]
test/tests.cc

index 2446c137b24078aa4623d4d2f3acdf22e25064e1..ac222638eae6156ce811f0a1b39c3c1927fe64e6 100644 (file)
@@ -96,8 +96,8 @@ SubtitleAsset::examine_text_nodes (
                                        (*i)->text,
                                        effective.effect.get(),
                                        effective.effect_color.get(),
-                                       (*i)->fade_up_time,
-                                       (*i)->fade_down_time
+                                       subtitle_node->fade_up_time,
+                                       subtitle_node->fade_down_time
                                        )
                                )
                        );
@@ -170,30 +170,12 @@ SubtitleNode::SubtitleNode (xmlpp::Node const * node)
        out = time_attribute ("TimeOut");
        font_nodes = sub_nodes<FontNode> ("Font");
        text_nodes = sub_nodes<TextNode> ("Text");
-}
-
-TextNode::TextNode (xmlpp::Node const * node)
-       : XMLNode (node)
-       , v_align (CENTER)
-{
-       text = content ();
-       v_position = float_attribute ("VPosition");
-       string const v = optional_string_attribute ("VAlign");
-       if (v == "top") {
-               v_align = TOP;
-       } else if (v == "center") {
-               v_align = CENTER;
-       } else if (v == "bottom") {
-               v_align = BOTTOM;
-       }
-
        fade_up_time = fade_time ("FadeUpTime");
-       fade_down_time = fade_time ("FadeUpTime");
+       fade_down_time = fade_time ("FadeDownTime");
 }
 
-
 Time
-TextNode::fade_time (string name)
+SubtitleNode::fade_time (string name)
 {
        string const u = optional_string_attribute (name);
        Time t;
@@ -213,6 +195,23 @@ TextNode::fade_time (string name)
        return t;
 }
 
+TextNode::TextNode (xmlpp::Node const * node)
+       : XMLNode (node)
+       , v_align (CENTER)
+{
+       text = content ();
+       v_position = float_attribute ("VPosition");
+       string const v = optional_string_attribute ("VAlign");
+       if (v == "top") {
+               v_align = TOP;
+       } else if (v == "center") {
+               v_align = CENTER;
+       } else if (v == "bottom") {
+               v_align = BOTTOM;
+       }
+}
+
+
 list<shared_ptr<Subtitle> >
 SubtitleAsset::subtitles_at (Time t) const
 {
index 72563470c982c1609a6fba31b35c6e68c4e11a7e..efcab3a35fff68ed52a42b131ef064f756949b29 100644 (file)
@@ -35,12 +35,6 @@ public:
        float v_position;
        VAlign v_align;
        std::string text;
-       Time fade_up_time;
-       Time fade_down_time;
-
-private:
-       Time fade_time (std::string name);
-       
 };
 
 class SubtitleNode : public XMLNode
@@ -51,8 +45,13 @@ public:
 
        Time in;
        Time out;
+       Time fade_up_time;
+       Time fade_down_time;
        std::list<boost::shared_ptr<FontNode> > font_nodes;
        std::list<boost::shared_ptr<TextNode> > text_nodes;
+
+private:
+       Time fade_time (std::string name);
 };
 
 class FontNode : public XMLNode
diff --git a/test/data/subs1.xml b/test/data/subs1.xml
new file mode 100644 (file)
index 0000000..515dd9f
--- /dev/null
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<DCSubtitle Version="1.0">
+  <SubtitleID>cab5c268-222b-41d2-88ae-6d6999441b17</SubtitleID>
+  <MovieTitle>Movie Title</MovieTitle>
+  <ReelNumber>1</ReelNumber>
+  <Language>French</Language>
+  <LoadFont Id="theFontId" URI="arial.ttf"/>
+  <Font Id="theFontId" Color="FFFFFFFF" Effect="border" EffectColor="FF000000" Italic="no" Size="39" Script="normal" Underlined="no" Weight="normal">
+    <Subtitle SpotNumber="1" TimeIn="00:00:05:198" TimeOut="00:00:07:115" FadeUpTime="1" FadeDownTime="1">
+      <Text VAlign="bottom" VPosition="15.0">My jacket was Idi Amin's</Text>
+    </Subtitle>
+    <Font Italic="yes">
+      <Subtitle SpotNumber="2" TimeIn="00:00:07:177" TimeOut="00:00:11:031" FadeUpTime="1" FadeDownTime="1">
+        <Text VAlign="bottom" VPosition="21.0">My corset was H.M. The Queen's</Text>
+       <Font Italic="no">
+          <Text VAlign="bottom" VPosition="15.0">My large wonderbra</Text>
+       </Font>
+      </Subtitle>
+    </Font>
+    <Subtitle SpotNumber="3" TimeIn="00:00:11:094" TimeOut="00:00:13:063" FadeUpTime="1" FadeDownTime="1">
+      <Text VAlign="bottom" VPosition="15.0">Once belonged to the Shah</Text>
+    </Subtitle>
+    <Subtitle SpotNumber="4" TimeIn="00:00:13:104" TimeOut="00:00:15:177" FadeUpTime="1" FadeDownTime="1">
+      <Text VAlign="bottom" VPosition="15.0">And these are Roy Hattersley's jeans</Text>
+    </Subtitle>
+  </Font>
+</DCSubtitle>
diff --git a/test/data/subs2.xml b/test/data/subs2.xml
new file mode 100755 (executable)
index 0000000..c0001b0
--- /dev/null
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<DCSubtitle Version="1.0">
+               <SubtitleID>notusedforthstest</SubtitleID>
+               <Language>notusedforthistest</Language>
+               <MovieTitle>subs2 test</MovieTitle>
+               <ReelNumber>1</ReelNumber>
+               <LoadFont Id="theFont" URI="arial.ttf"/>
+               <Font Id="theFont" Italic="no" Color="FFFFFFFF" Effect="border" EffectColor="FF000000" Size="42">
+                       <Subtitle SpotNumber="1" TimeIn="00:00:41:062" TimeOut="00:00:43:052" FadeUpTime="0" FadeDownTime="0">
+                               <Font Italic="yes">
+                                       <Text HAlign="center" HPosition="0" VAlign="top" VPosition="89" ZPosition="0.5">At afternoon tea with John Peel</Text>
+                               </Font>
+                               <Font Italic="yes">
+                                       <Text HAlign="center" HPosition="0" VAlign="top" VPosition="95" ZPosition="0.5">I enquired if his accent was real</Text>
+                               </Font>
+                       </Subtitle>
+                       <Subtitle SpotNumber="2" TimeIn="00:00:50:042" TimeOut="00:00:52:021" FadeUpTime="0" FadeDownTime="0">
+                               <Font Italic="yes">
+                                       <Text HAlign="center" HPosition="0" VAlign="top" VPosition="89" ZPosition="0.5">He said "out of the house</Text>
+                               </Font>
+                               <Font Italic="yes">
+                                       <Text HAlign="center" HPosition="0" VAlign="top" VPosition="95" ZPosition="0.5">I'm incredibly scouse</Text>
+                               </Font>
+                       </Subtitle>
+                       <Subtitle SpotNumber="3" TimeIn="00:01:02:208" TimeOut="00:01:04:010" FadeUpTime="0" FadeDownTime="0">
+                               <Font Italic="yes">
+                                       <Text HAlign="center" HPosition="0" VAlign="top" VPosition="89" ZPosition="0.5">At home it depends how I feel."</Text>
+                               </Font>
+                               <Font Italic="yes">
+                                       <Text HAlign="center" HPosition="0" VAlign="top" VPosition="95" ZPosition="0.5">I spent a long weekend in Brighton</Text>
+                               </Font>
+                       </Subtitle>
+                       <Subtitle SpotNumber="4" TimeIn="00:01:15:042" TimeOut="00:01:16:042" FadeUpTime="0" FadeDownTime="0">
+                               <Font Italic="yes">
+                                       <Text HAlign="center" HPosition="0" VAlign="top" VPosition="89" ZPosition="0.5">With the legendary Miss Enid Blyton</Text>
+                               </Font>
+                               <Font Italic="yes">
+                                       <Text HAlign="center" HPosition="0" VAlign="top" VPosition="95" ZPosition="0.5">She said "you be Noddy</Text>
+                               </Font>
+                       </Subtitle>
+                       <Subtitle SpotNumber="5" TimeIn="00:01:20:219" TimeOut="00:01:22:073" FadeUpTime="0" FadeDownTime="0">
+                               <Font Italic="yes">
+                                       <Text HAlign="center" HPosition="0" VAlign="top" VPosition="89" ZPosition="0.5">and I'll show you my body"</Text>
+                               </Font>
+                               <Font Italic="yes">
+                                       <Text HAlign="center" HPosition="0" VAlign="top" VPosition="95" ZPosition="0.5">But Big Ears kept turning the light on.</Text>
+                               </Font>
+                       </Subtitle>
+                       <Subtitle SpotNumber="6" TimeIn="00:01:27:115" TimeOut="00:01:28:208" FadeUpTime="0" FadeDownTime="0">
+                               <Font Italic="yes">
+                                       <Text HAlign="center" HPosition="0" VAlign="top" VPosition="89" ZPosition="0.5">That curious creature the Sphinx</Text>
+                               </Font>
+                               <Font Italic="yes">
+                                       <Text HAlign="center" HPosition="0" VAlign="top" VPosition="95" ZPosition="0.5">Is smarter than anyone thinks</Text>
+                               </Font>
+                       </Subtitle>
+                       <Subtitle SpotNumber="7" TimeIn="00:01:42:229" TimeOut="00:01:45:062" FadeUpTime="0" FadeDownTime="0">
+                               <Text HAlign="center" HPosition="0" VAlign="top" VPosition="89" ZPosition="0.5">It sits there and smirks</Text>
+                               <Text HAlign="center" HPosition="0" VAlign="top" VPosition="95" ZPosition="0.5">And you don't think it works</Text>
+                       </Subtitle>
+                       <Subtitle SpotNumber="8" TimeIn="00:01:45:146" TimeOut="00:01:47:094" FadeUpTime="0" FadeDownTime="0">
+                               <Text HAlign="center" HPosition="0" VAlign="top" VPosition="89" ZPosition="0.5">Then when you're not looking, it winks.</Text>
+                               <Text HAlign="center" HPosition="0" VAlign="top" VPosition="95" ZPosition="0.5">When it snows you will find Sister Sledge</Text>
+                       </Subtitle>
+                       <Subtitle SpotNumber="9" TimeIn="00:01:47:146" TimeOut="00:01:48:167" FadeUpTime="0" FadeDownTime="0">
+                               <Text HAlign="center" HPosition="0" VAlign="top" VPosition="89" ZPosition="0.5">Out mooning, at night, on the ledge</Text>
+                               <Text HAlign="center" HPosition="0" VAlign="top" VPosition="95" ZPosition="0.5">One storey down</Text>
+                       </Subtitle>
+                       <Subtitle SpotNumber="10" TimeIn="00:01:53:021" TimeOut="00:01:56:010" FadeUpTime="0" FadeDownTime="0">
+                               <Text HAlign="center" HPosition="0" VAlign="top" VPosition="89" ZPosition="-0.5">Is the maestro, James Brown</Text>
+                               <Text HAlign="center" HPosition="0" VAlign="top" VPosition="95" ZPosition="-0.5">Displaying his meat and two veg.</Text>
+                       </Subtitle>
+                       <Subtitle SpotNumber="15" TimeIn="00:02:05:208" TimeOut="00:02:07:031" FadeUpTime="0" FadeDownTime="0">
+                               <Font Italic="yes">
+                                       <Text HAlign="center" HPosition="0" VAlign="top" VPosition="89" ZPosition="0.5">HELLO</Text>
+                               </Font>
+                               <Font Italic="yes">
+                                       <Text HAlign="center" HPosition="0" VAlign="top" VPosition="95" ZPosition="0.5">WORLD</Text>
+                               </Font>
+                       </Subtitle>
+               </Font>
+       </DCSubtitle>
diff --git a/test/ref/subs.xml b/test/ref/subs.xml
deleted file mode 100644 (file)
index 515dd9f..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<DCSubtitle Version="1.0">
-  <SubtitleID>cab5c268-222b-41d2-88ae-6d6999441b17</SubtitleID>
-  <MovieTitle>Movie Title</MovieTitle>
-  <ReelNumber>1</ReelNumber>
-  <Language>French</Language>
-  <LoadFont Id="theFontId" URI="arial.ttf"/>
-  <Font Id="theFontId" Color="FFFFFFFF" Effect="border" EffectColor="FF000000" Italic="no" Size="39" Script="normal" Underlined="no" Weight="normal">
-    <Subtitle SpotNumber="1" TimeIn="00:00:05:198" TimeOut="00:00:07:115" FadeUpTime="1" FadeDownTime="1">
-      <Text VAlign="bottom" VPosition="15.0">My jacket was Idi Amin's</Text>
-    </Subtitle>
-    <Font Italic="yes">
-      <Subtitle SpotNumber="2" TimeIn="00:00:07:177" TimeOut="00:00:11:031" FadeUpTime="1" FadeDownTime="1">
-        <Text VAlign="bottom" VPosition="21.0">My corset was H.M. The Queen's</Text>
-       <Font Italic="no">
-          <Text VAlign="bottom" VPosition="15.0">My large wonderbra</Text>
-       </Font>
-      </Subtitle>
-    </Font>
-    <Subtitle SpotNumber="3" TimeIn="00:00:11:094" TimeOut="00:00:13:063" FadeUpTime="1" FadeDownTime="1">
-      <Text VAlign="bottom" VPosition="15.0">Once belonged to the Shah</Text>
-    </Subtitle>
-    <Subtitle SpotNumber="4" TimeIn="00:00:13:104" TimeOut="00:00:15:177" FadeUpTime="1" FadeDownTime="1">
-      <Text VAlign="bottom" VPosition="15.0">And these are Roy Hattersley's jeans</Text>
-    </Subtitle>
-  </Font>
-</DCSubtitle>
index fa6ba8e09f55a03d6dc0346b87189af370938763..43c959057ea02eb7cff2c4762aa9bd91b32e0327 100644 (file)
@@ -111,9 +111,9 @@ BOOST_AUTO_TEST_CASE (read_dcp)
        BOOST_CHECK_EQUAL (d.length(), 24);
 }
        
-BOOST_AUTO_TEST_CASE (subtitles)
+BOOST_AUTO_TEST_CASE (subtitles1)
 {
-       libdcp::SubtitleAsset subs ("test/ref", "subs.xml");
+       libdcp::SubtitleAsset subs ("test/data", "subs1.xml");
 
        BOOST_CHECK_EQUAL (subs.language(), "French");
 
@@ -131,8 +131,8 @@ BOOST_AUTO_TEST_CASE (subtitles)
                                   "My jacket was Idi Amin's",
                                   libdcp::BORDER,
                                   libdcp::Color (0, 0, 0),
-                                  libdcp::Time (0, 0, 0, 20),
-                                  libdcp::Time (0, 0, 0, 20)
+                                  libdcp::Time (0, 0, 0, 1),
+                                  libdcp::Time (0, 0, 0, 1)
                                   ));
                                                         
        s = subs.subtitles_at (libdcp::Time (0, 0, 7, 190));
@@ -149,8 +149,8 @@ BOOST_AUTO_TEST_CASE (subtitles)
                                   "My corset was H.M. The Queen's",
                                   libdcp::BORDER,
                                   libdcp::Color (0, 0, 0),
-                                  libdcp::Time (0, 0, 0, 20),
-                                  libdcp::Time (0, 0, 0, 20)
+                                  libdcp::Time (0, 0, 0, 1),
+                                  libdcp::Time (0, 0, 0, 1)
                                   ));
        BOOST_CHECK_EQUAL (*(s.back().get()), libdcp::Subtitle (
                                   "Arial",
@@ -164,8 +164,8 @@ BOOST_AUTO_TEST_CASE (subtitles)
                                   "My large wonderbra",
                                   libdcp::BORDER,
                                   libdcp::Color (0, 0, 0),
-                                  libdcp::Time (0, 0, 0, 20),
-                                  libdcp::Time (0, 0, 0, 20)
+                                  libdcp::Time (0, 0, 0, 1),
+                                  libdcp::Time (0, 0, 0, 1)
                                   ));
 
        s = subs.subtitles_at (libdcp::Time (0, 0, 11, 95));
@@ -182,8 +182,8 @@ BOOST_AUTO_TEST_CASE (subtitles)
                                   "Once belonged to the Shah",
                                   libdcp::BORDER,
                                   libdcp::Color (0, 0, 0),
-                                  libdcp::Time (0, 0, 0, 20),
-                                  libdcp::Time (0, 0, 0, 20)
+                                  libdcp::Time (0, 0, 0, 1),
+                                  libdcp::Time (0, 0, 0, 1)
                                   ));
 
        s = subs.subtitles_at (libdcp::Time (0, 0, 14, 42));
@@ -200,11 +200,316 @@ BOOST_AUTO_TEST_CASE (subtitles)
                                   "And these are Roy Hattersley's jeans",
                                   libdcp::BORDER,
                                   libdcp::Color (0, 0, 0),
-                                  libdcp::Time (0, 0, 0, 20),
-                                  libdcp::Time (0, 0, 0, 20)
+                                  libdcp::Time (0, 0, 0, 1),
+                                  libdcp::Time (0, 0, 0, 1)
                                   ));
 }
 
+BOOST_AUTO_TEST_CASE (subtitles2)
+{
+       libdcp::SubtitleAsset subs ("test/data", "subs2.xml");
+
+       list<shared_ptr<libdcp::Subtitle> > s = subs.subtitles_at (libdcp::Time (0, 0, 42, 100));
+       BOOST_CHECK_EQUAL (s.size(), 2);
+       BOOST_CHECK_EQUAL (*(s.front().get()), libdcp::Subtitle (
+                                  "Arial",
+                                  true,
+                                  libdcp::Color (255, 255, 255),
+                                  42,
+                                  libdcp::Time (0, 0, 41, 62),
+                                  libdcp::Time (0, 0, 43, 52),
+                                  89,
+                                  libdcp::TOP,
+                                  "At afternoon tea with John Peel",
+                                  libdcp::BORDER,
+                                  libdcp::Color (0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0)
+                                  ));
+       BOOST_CHECK_EQUAL (*(s.back().get()), libdcp::Subtitle (
+                                  "Arial",
+                                  true,
+                                  libdcp::Color (255, 255, 255),
+                                  42,
+                                  libdcp::Time (0, 0, 41, 62),
+                                  libdcp::Time (0, 0, 43, 52),
+                                  95,
+                                  libdcp::TOP,
+                                  "I enquired if his accent was real",
+                                  libdcp::BORDER,
+                                  libdcp::Color (0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0)
+                                  ));
+
+       s = subs.subtitles_at (libdcp::Time (0, 0, 50, 50));
+       BOOST_CHECK_EQUAL (s.size(), 2);
+       BOOST_CHECK_EQUAL (*(s.front().get()), libdcp::Subtitle (
+                                  "Arial",
+                                  true,
+                                  libdcp::Color (255, 255, 255),
+                                  42,
+                                  libdcp::Time (0, 0, 50, 42),
+                                  libdcp::Time (0, 0, 52, 21),
+                                  89,
+                                  libdcp::TOP,
+                                  "He said \"out of the house",
+                                  libdcp::BORDER,
+                                  libdcp::Color (0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0)
+                                  ));
+       BOOST_CHECK_EQUAL (*(s.back().get()), libdcp::Subtitle (
+                                  "Arial",
+                                  true,
+                                  libdcp::Color (255, 255, 255),
+                                  42,
+                                  libdcp::Time (0, 0, 50, 42),
+                                  libdcp::Time (0, 0, 52, 21),
+                                  95,
+                                  libdcp::TOP,
+                                  "I'm incredibly scouse",
+                                  libdcp::BORDER,
+                                  libdcp::Color (0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0)
+                                  ));
+
+       s = subs.subtitles_at (libdcp::Time (0, 1, 2, 300));
+       BOOST_CHECK_EQUAL (s.size(), 2);
+       BOOST_CHECK_EQUAL (*(s.front().get()), libdcp::Subtitle (
+                                  "Arial",
+                                  true,
+                                  libdcp::Color (255, 255, 255),
+                                  42,
+                                  libdcp::Time (0, 1, 2, 208),
+                                  libdcp::Time (0, 1, 4, 10),
+                                  89,
+                                  libdcp::TOP,
+                                  "At home it depends how I feel.\"",
+                                  libdcp::BORDER,
+                                  libdcp::Color (0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0)
+                                  ));
+       BOOST_CHECK_EQUAL (*(s.back().get()), libdcp::Subtitle (
+                                  "Arial",
+                                  true,
+                                  libdcp::Color (255, 255, 255),
+                                  42,
+                                  libdcp::Time (0, 1, 2, 208),
+                                  libdcp::Time (0, 1, 4, 10),
+                                  95,
+                                  libdcp::TOP,
+                                  "I spent a long weekend in Brighton",
+                                  libdcp::BORDER,
+                                  libdcp::Color (0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0)
+                                  ));
+
+       s = subs.subtitles_at (libdcp::Time (0, 1, 15, 50));
+       BOOST_CHECK_EQUAL (s.size(), 2);
+       BOOST_CHECK_EQUAL (*(s.front().get()), libdcp::Subtitle (
+                                  "Arial",
+                                  true,
+                                  libdcp::Color (255, 255, 255),
+                                  42,
+                                  libdcp::Time (0, 1, 15, 42),
+                                  libdcp::Time (0, 1, 16, 42),
+                                  89,
+                                  libdcp::TOP,
+                                  "With the legendary Miss Enid Blyton",
+                                  libdcp::BORDER,
+                                  libdcp::Color (0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0)
+                                  ));
+       BOOST_CHECK_EQUAL (*(s.back().get()), libdcp::Subtitle (
+                                  "Arial",
+                                  true,
+                                  libdcp::Color (255, 255, 255),
+                                  42,
+                                  libdcp::Time (0, 1, 15, 42),
+                                  libdcp::Time (0, 1, 16, 42),
+                                  95,
+                                  libdcp::TOP,
+                                  "She said \"you be Noddy",
+                                  libdcp::BORDER,
+                                  libdcp::Color (0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0)
+                                  ));
+
+       s = subs.subtitles_at (libdcp::Time (0, 1, 27, 200));
+       BOOST_CHECK_EQUAL (s.size(), 2);
+       BOOST_CHECK_EQUAL (*(s.front().get()), libdcp::Subtitle (
+                                  "Arial",
+                                  true,
+                                  libdcp::Color (255, 255, 255),
+                                  42,
+                                  libdcp::Time (0, 1, 27, 115),
+                                  libdcp::Time (0, 1, 28, 208),
+                                  89,
+                                  libdcp::TOP,
+                                  "That curious creature the Sphinx",
+                                  libdcp::BORDER,
+                                  libdcp::Color (0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0)
+                                  ));
+       BOOST_CHECK_EQUAL (*(s.back().get()), libdcp::Subtitle (
+                                  "Arial",
+                                  true,
+                                  libdcp::Color (255, 255, 255),
+                                  42,
+                                  libdcp::Time (0, 1, 27, 115),
+                                  libdcp::Time (0, 1, 28, 208),
+                                  95,
+                                  libdcp::TOP,
+                                  "Is smarter than anyone thinks",
+                                  libdcp::BORDER,
+                                  libdcp::Color (0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0)
+                                  ));
+
+       s = subs.subtitles_at (libdcp::Time (0, 1, 42, 300));
+       BOOST_CHECK_EQUAL (s.size(), 2);
+       BOOST_CHECK_EQUAL (*(s.front().get()), libdcp::Subtitle (
+                                  "Arial",
+                                  false,
+                                  libdcp::Color (255, 255, 255),
+                                  42,
+                                  libdcp::Time (0, 1, 42, 229),
+                                  libdcp::Time (0, 1, 45, 62),
+                                  89,
+                                  libdcp::TOP,
+                                  "It sits there and smirks",
+                                  libdcp::BORDER,
+                                  libdcp::Color (0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0)
+                                  ));
+       BOOST_CHECK_EQUAL (*(s.back().get()), libdcp::Subtitle (
+                                  "Arial",
+                                  false,
+                                  libdcp::Color (255, 255, 255),
+                                  42,
+                                  libdcp::Time (0, 1, 42, 229),
+                                  libdcp::Time (0, 1, 45, 62),
+                                  95,
+                                  libdcp::TOP,
+                                  "And you don't think it works",
+                                  libdcp::BORDER,
+                                  libdcp::Color (0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0)
+                                  ));
+
+       s = subs.subtitles_at (libdcp::Time (0, 1, 45, 200));
+       BOOST_CHECK_EQUAL (s.size(), 2);
+       BOOST_CHECK_EQUAL (*(s.front().get()), libdcp::Subtitle (
+                                  "Arial",
+                                  false,
+                                  libdcp::Color (255, 255, 255),
+                                  42,
+                                  libdcp::Time (0, 1, 45, 146),
+                                  libdcp::Time (0, 1, 47, 94),
+                                  89,
+                                  libdcp::TOP,
+                                  "Then when you're not looking, it winks.",
+                                  libdcp::BORDER,
+                                  libdcp::Color (0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0)
+                                  ));
+       BOOST_CHECK_EQUAL (*(s.back().get()), libdcp::Subtitle (
+                                  "Arial",
+                                  false,
+                                  libdcp::Color (255, 255, 255),
+                                  42,
+                                  libdcp::Time (0, 1, 45, 146),
+                                  libdcp::Time (0, 1, 47, 94),
+                                  95,
+                                  libdcp::TOP,
+                                  "When it snows you will find Sister Sledge",
+                                  libdcp::BORDER,
+                                  libdcp::Color (0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0)
+                                  ));
+
+       s = subs.subtitles_at (libdcp::Time (0, 1, 47, 249));
+       BOOST_CHECK_EQUAL (s.size(), 2);
+       BOOST_CHECK_EQUAL (*(s.front().get()), libdcp::Subtitle (
+                                  "Arial",
+                                  false,
+                                  libdcp::Color (255, 255, 255),
+                                  42,
+                                  libdcp::Time (0, 1, 47, 146),
+                                  libdcp::Time (0, 1, 48, 167),
+                                  89,
+                                  libdcp::TOP,
+                                  "Out mooning, at night, on the ledge",
+                                  libdcp::BORDER,
+                                  libdcp::Color (0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0)
+                                  ));
+       BOOST_CHECK_EQUAL (*(s.back().get()), libdcp::Subtitle (
+                                  "Arial",
+                                  false,
+                                  libdcp::Color (255, 255, 255),
+                                  42,
+                                  libdcp::Time (0, 1, 47, 146),
+                                  libdcp::Time (0, 1, 48, 167),
+                                  95,
+                                  libdcp::TOP,
+                                  "One storey down",
+                                  libdcp::BORDER,
+                                  libdcp::Color (0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0)
+                                  ));
+
+       s = subs.subtitles_at (libdcp::Time (0, 2, 6, 210));
+       BOOST_CHECK_EQUAL (s.size(), 2);
+       BOOST_CHECK_EQUAL (*(s.front().get()), libdcp::Subtitle (
+                                  "Arial",
+                                  true,
+                                  libdcp::Color (255, 255, 255),
+                                  42,
+                                  libdcp::Time (0, 2, 5, 208),
+                                  libdcp::Time (0, 2, 7, 31),
+                                  89,
+                                  libdcp::TOP,
+                                  "HELLO",
+                                  libdcp::BORDER,
+                                  libdcp::Color (0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0)
+                                  ));
+       BOOST_CHECK_EQUAL (*(s.back().get()), libdcp::Subtitle (
+                                  "Arial",
+                                  true,
+                                  libdcp::Color (255, 255, 255),
+                                  42,
+                                  libdcp::Time (0, 2, 5, 208),
+                                  libdcp::Time (0, 2, 7, 31),
+                                  95,
+                                  libdcp::TOP,
+                                  "WORLD",
+                                  libdcp::BORDER,
+                                  libdcp::Color (0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0),
+                                  libdcp::Time (0, 0, 0, 0)
+                                  ));
+
+       
+       
+}
+
 BOOST_AUTO_TEST_CASE (dcp_time)
 {
        libdcp::Time t (977143, 24);