summaryrefslogtreecommitdiff
path: root/test/2986_regression_test.cc
blob: 29aabf8ad0a14673c158e22ee706ae1df4c3f6f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
    Copyright (C) 2025 Carl Hetherington <cth@carlh.net>

    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.

    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 DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.

*/


#include "lib/content_factory.h"
#include "lib/film.h"
#include "lib/find_missing.h"
#include "lib/font.h"
#include "lib/player.h"
#include "lib/text_content.h"
#include "test.h"
#include <boost/filesystem.hpp>
#include <boost/test/unit_test.hpp>


using std::make_shared;


BOOST_AUTO_TEST_CASE(font_error_after_find_missing_test)
{
	boost::filesystem::path dir("build/test/font_error_after_find_missing_test_assets");
	boost::filesystem::remove_all(dir);
	boost::filesystem::create_directories(dir);

	boost::filesystem::copy_file("test/data/15s.srt", dir / "15s.srt");
	boost::filesystem::copy_file("test/data/Inconsolata-VF.ttf", dir / "Inconsolata-VF.ttf");

	{
		auto content = content_factory(dir / "15s.srt");
		auto film = new_test_film("font_error_after_find_missing_test", content);
		auto fonts = content[0]->text[0]->fonts();
		fonts.front()->set_file(dir / "Inconsolata-VF.ttf");
		film->write_metadata();
	}

	boost::filesystem::remove_all(dir);

	auto film2 = make_shared<Film>(boost::filesystem::path("build/test/font_error_after_find_missing_test"));
	film2->read_metadata();

	dcpomatic::find_missing(film2->content(), "test/data/15s.srt");

	Player player(film2, Image::Alignment::PADDED, false);
	player.set_always_burn_open_subtitles();
	for (int i = 0; i < 48; ++i) {
		player.pass();
	}
}