X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=test%2Fvideo_content_scale_test.cc;h=f1edce04150fb1997fe1fc622d8a535761d9e532;hb=5a5324ed3a381a86dfe0a6e3932c1d58fdcd596f;hp=d2ee4c0d83c8408b0b98eaf9e2be744279a7668f;hpb=ae15eeca8588c6928d7671894db98c2e289fa601;p=dcpomatic.git diff --git a/test/video_content_scale_test.cc b/test/video_content_scale_test.cc index d2ee4c0d8..f1edce041 100644 --- a/test/video_content_scale_test.cc +++ b/test/video_content_scale_test.cc @@ -1,31 +1,34 @@ /* Copyright (C) 2015 Carl Hetherington - This program is free software; you can redistribute it and/or modify + This file is part of DCP-o-matic. + + DCP-o-matic 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, + DCP-o-matic 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 DCP-o-matic. If not, see . */ -#include #include "lib/ffmpeg_content.h" #include "lib/ratio.h" +#include "lib/video_content.h" +#include +#include using std::list; using std::string; using std::cerr; -using std::stringstream; using boost::shared_ptr; +using boost::make_shared; using boost::optional; static @@ -33,7 +36,7 @@ void test (dcp::Size content_size, dcp::Size display_size, dcp::Size film_size, Crop crop, Ratio const * ratio, bool scale, dcp::Size correct) { shared_ptr film; - stringstream s; + SafeStringStream s; s << "" "" "FFmpeg" @@ -49,6 +52,7 @@ test (dcp::Size content_size, dcp::Size display_size, dcp::Size film_size, Crop "23.97602462768555" "0" "1" + "12" "" << crop.left << "" "" << crop.right << "" "" << crop.top << "" @@ -84,11 +88,11 @@ test (dcp::Size content_size, dcp::Size display_size, dcp::Size film_size, Crop "0" ""; - shared_ptr doc (new cxml::Document ()); + shared_ptr doc = make_shared (); doc->read_string(s.str ()); list notes; - shared_ptr vc (new FFmpegContent (film, doc, 10, notes)); + shared_ptr vc = boost::make_shared (film, doc, 10, notes); optional sc; if (ratio) { @@ -97,15 +101,15 @@ test (dcp::Size content_size, dcp::Size display_size, dcp::Size film_size, Crop sc = VideoContentScale (scale); } - dcp::Size answer = sc.get().size (vc, display_size, film_size); + dcp::Size answer = sc.get().size (vc->video, display_size, film_size); if (answer != correct) { - cerr << "Testing " << vc->video_size().width << "x" << vc->video_size().height << "\n"; + cerr << "Testing " << vc->video->size().width << "x" << vc->video->size().height << "\n"; cerr << "Testing " << display_size.width << "x" << display_size.height << "\n"; cerr << answer.width << "x" << answer.height << " instead of " << correct.width << "x" << correct.height << "\n"; } BOOST_CHECK (answer == correct); } - + /* Test scale and stretch to specified ratio */ BOOST_AUTO_TEST_CASE (video_content_scale_test_to_ratio) { @@ -132,7 +136,7 @@ BOOST_AUTO_TEST_CASE (video_content_scale_test_to_ratio) true, dcp::Size (1998, 837) ); - + // Flat in scope container test ( dcp::Size (400, 200), @@ -144,7 +148,7 @@ BOOST_AUTO_TEST_CASE (video_content_scale_test_to_ratio) dcp::Size (1587, 858) ); - + /* To player */ // Flat in flat container @@ -168,7 +172,7 @@ BOOST_AUTO_TEST_CASE (video_content_scale_test_to_ratio) true, dcp::Size (185, 78) ); - + // Flat in scope container test ( dcp::Size (400, 200),