Accept V4+ styles as well as V4 ones in SSA.
[libsub.git] / test / dcp_to_stl_binary_test.cc
index 878386c8bf43e0a3486c6d5add422540077ebf43..6199c692ecd37ef914f2fe69d676507dbc7650ae 100644 (file)
 */
 
 #include "test.h"
-#include "dcp_reader.h"
+#include "interop_dcp_reader.h"
+#include "smpte_dcp_reader.h"
 #include "stl_binary_writer.h"
 #include "collect.h"
 #include <boost/test/unit_test.hpp>
 #include <fstream>
 
 using std::ifstream;
+using std::list;
 
-BOOST_AUTO_TEST_CASE (dcp_to_stl_binary_test)
+BOOST_AUTO_TEST_CASE (dcp_to_stl_binary_test1)
 {
        if (private_test.empty ()) {
                return;
        }
 
        boost::filesystem::path p = private_test / "fd586c30-6d38-48f2-8241-27359acf184c_sub.xml";
-       ifstream f (p.string().c_str ());
        sub::write_stl_binary (
-               sub::collect (sub::DCPReader(f).subtitles ()),
+               sub::collect<list<sub::Subtitle> > (sub::InteropDCPReader(p).subtitles ()),
                25,
                sub::LANGUAGE_FRENCH,
                "", "",
@@ -47,4 +48,107 @@ BOOST_AUTO_TEST_CASE (dcp_to_stl_binary_test)
                "", "",
                "build/test/fd586c30-6d38-48f2-8241-27359acf184c_sub.stl"
                );
+
+       check_file (
+               private_test / "fd586c30-6d38-48f2-8241-27359acf184c_sub.stl",
+               "build/test/fd586c30-6d38-48f2-8241-27359acf184c_sub.stl"
+               );
+}
+
+BOOST_AUTO_TEST_CASE (dcp_to_stl_binary_test2)
+{
+       if (private_test.empty ()) {
+               return;
+       }
+
+       boost::filesystem::path p = private_test / "93e8a6bf-499e-4d36-9350-a9bfa2e6758a_sub.xml";
+       sub::write_stl_binary (
+               sub::collect<list<sub::Subtitle> > (sub::InteropDCPReader(p).subtitles ()),
+               25,
+               sub::LANGUAGE_FRENCH,
+               "", "",
+               "", "",
+               "", "",
+               "300514", "300514", 0,
+               "GBR",
+               "",
+               "", "",
+               "build/test/93e8a6bf-499e-4d36-9350-a9bfa2e6758a_sub.stl"
+               );
+
+       check_file (
+               private_test / "93e8a6bf-499e-4d36-9350-a9bfa2e6758a_sub.stl",
+               "build/test/93e8a6bf-499e-4d36-9350-a9bfa2e6758a_sub.stl"
+               );
+}
+
+BOOST_AUTO_TEST_CASE (dcp_to_stl_binary_test3)
+{
+       if (private_test.empty ()) {
+               return;
+       }
+
+       boost::filesystem::path p = private_test / "Paddington_FTR_Subs_DE-FR_24fps_R1.xml";
+       sub::write_stl_binary (
+               sub::collect<list<sub::Subtitle> > (sub::InteropDCPReader(p).subtitles ()),
+               25,
+               sub::LANGUAGE_FRENCH,
+               "", "",
+               "", "",
+               "", "",
+               "300514", "300514", 0,
+               "GBR",
+               "",
+               "", "",
+               "build/test/Paddington_FTR_Subs_DE-FR_24fps_R1.stl"
+               );
+
+       check_file (
+               private_test / "Paddington_FTR_Subs_DE-FR_24fps_R1.stl",
+               "build/test/Paddington_FTR_Subs_DE-FR_24fps_R1.stl"
+               );
+}
+
+BOOST_AUTO_TEST_CASE (dcp_to_stl_binary_test4)
+{
+       sub::write_stl_binary (
+               sub::collect<list<sub::Subtitle> > (sub::InteropDCPReader("test/data/test1.xml").subtitles ()),
+               25,
+               sub::LANGUAGE_FRENCH,
+               "", "",
+               "", "",
+               "", "",
+               "300514", "300514", 0,
+               "GBR",
+               "",
+               "", "",
+               "build/test/test1.stl"
+               );
+}
+
+BOOST_AUTO_TEST_CASE (dcp_to_stl_binary_test5)
+{
+       if (private_test.empty ()) {
+               return;
+       }
+
+       boost::filesystem::path p = private_test / "065d39ff-6723-4dbf-a94f-849cde82f5e1_sub.mxf";
+       sub::write_stl_binary (
+               sub::collect<list<sub::Subtitle> > (sub::SMPTEDCPReader(p, true).subtitles ()),
+               25,
+               sub::LANGUAGE_FRENCH,
+               "", "",
+               "", "",
+               "", "",
+               "300514", "300514", 0,
+               "GBR",
+               "",
+               "", "",
+               "build/test/065d39ff-6723-4dbf-a94f-849cde82f5e1_sub.stl"
+               );
+
+       check_file (
+               private_test / "065d39ff-6723-4dbf-a94f-849cde82f5e1_sub.stl",
+               "build/test/065d39ff-6723-4dbf-a94f-849cde82f5e1_sub.stl"
+               );
 }