Take DCP-o-matic's version of Data class.
[libdcp.git] / test / reel_asset_test.cc
1 /*
2     Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #include "reel_mono_picture_asset.h"
21 #include <libcxml/cxml.h>
22 #include <boost/test/unit_test.hpp>
23
24 using boost::shared_ptr;
25
26 /** Test the XML constructor of ReelPictureAsset */
27 BOOST_AUTO_TEST_CASE (reel_picture_asset_test)
28 {
29         shared_ptr<cxml::Document> doc (new cxml::Document ("MainPicture"));
30
31         doc->read_string (
32                 "<MainPicture>"
33                 "<Id>urn:uuid:06ac1ca7-9c46-4107-8864-a6448e24b04b</Id>"
34                 "<AnnotationText></AnnotationText>"
35                 "<EditRate>24 1</EditRate>"
36                 "<IntrinsicDuration>187048</IntrinsicDuration>"
37                 "<EntryPoint>0</EntryPoint>"
38                 "<Duration>187048</Duration>"
39                 "<Hash>6EQX4NjG8vxIWhLUtHhrGSyLgOY=</Hash>"
40                 "<FrameRate>24 1</FrameRate>"
41                 "<ScreenAspectRatio>2048 858</ScreenAspectRatio>"
42                 "</MainPicture>"
43                 );
44
45         dcp::ReelMonoPictureAsset pa (doc);
46         BOOST_CHECK_EQUAL (pa.screen_aspect_ratio(), dcp::Fraction (2048, 858));
47 }