Bv2.1 6.2.1: Check that the sound MXF Language tag conforms to RFC 5646.
[libdcp.git] / test / test.h
index 31b4bf0ab6122b270567ac756509820a5767142d..1368973a65c44df69bf370454736e730f152c8e3 100644 (file)
@@ -1,39 +1,64 @@
 /*
-    Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2020 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/>.
 */
 
-extern std::string test_corpus;
 
-class TestFile
+#include "cpl.h"
+#include "dcp.h"
+#include "reel.h"
+#include "reel_subtitle_asset.h"
+#include "subtitle.h"
+#include "reel_asset.h"
+#include <boost/filesystem.hpp>
+#include <boost/optional.hpp>
+
+namespace xmlpp {
+       class Element;
+}
+
+namespace dcp {
+       class DCP;
+       class MonoPictureAsset;
+       class SoundAsset;
+}
+
+extern boost::filesystem::path private_test;
+extern boost::filesystem::path xsd_test;
+
+extern void check_xml (xmlpp::Element* ref, xmlpp::Element* test, std::list<std::string> ignore_tags, bool ignore_whitespace = false);
+extern void check_xml (std::string ref, std::string test, std::list<std::string> ignore, bool ignore_whitespace = false);
+extern void check_file (boost::filesystem::path ref, boost::filesystem::path check);
+extern std::shared_ptr<dcp::MonoPictureAsset> simple_picture (boost::filesystem::path path, std::string suffix);
+extern std::shared_ptr<dcp::SoundAsset> simple_sound (boost::filesystem::path path, std::string suffix, dcp::MXFMetadata mxf_meta, std::string language);
+extern std::shared_ptr<dcp::DCP> make_simple (boost::filesystem::path path, int reels = 1);
+extern std::shared_ptr<dcp::DCP> make_simple_with_interop_subs (boost::filesystem::path path);
+extern std::shared_ptr<dcp::DCP> make_simple_with_smpte_subs (boost::filesystem::path path);
+extern std::shared_ptr<dcp::DCP> make_simple_with_interop_ccaps (boost::filesystem::path path);
+extern std::shared_ptr<dcp::DCP> make_simple_with_smpte_ccaps (boost::filesystem::path path);
+extern std::shared_ptr<dcp::OpenJPEGImage> black_image ();
+extern std::shared_ptr<dcp::ReelAsset> black_picture_asset (boost::filesystem::path dir, int frames = 24);
+
+/** Creating an object of this class will make asdcplib's random number generation
+ *  (more) predictable.
+ */
+class RNGFixer
 {
 public:
-       TestFile (boost::filesystem::path file);
-       ~TestFile ();
-       
-       uint8_t* data () const {
-               return _data;
-       }
-
-       int64_t size () const {
-               return _size;
-       }
-
-private:
-       uint8_t* _data;
-       int64_t _size;
+       RNGFixer ();
+       ~RNGFixer ();
 };