#include "lib/text_content.h"
#include "lib/text_decoder.h"
#include "test.h"
-#include <dcp/mono_picture_asset.h>
+#include <dcp/mono_j2k_picture_asset.h>
#include <dcp/openjpeg_image.h>
#include <dcp/smpte_subtitle_asset.h>
#include <boost/test/unit_test.hpp>
dcp::VerificationNote::Code::MISSING_CPL_METADATA
});
- check_dcp ("test/data/dcp_subtitle_test", film->dir(film->dcp_name()));
+ /* This test is concerned with the subtitles, so we'll ignore any
+ * differences in sound between the DCP and the reference to avoid test
+ * failures for unrelated reasons.
+ */
+ check_dcp("test/data/dcp_subtitle_test", film->dir(film->dcp_name()), true);
}
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<DCPDecoder> decoder (new DCPDecoder (film, content, false, false, shared_ptr<DCPDecoder>()));
+ auto decoder = make_shared<DCPDecoder>(film, content, false, false, shared_ptr<DCPDecoder>());
decoder->only_text()->PlainStart.connect (bind (store, _1));
stored = optional<ContentStringText> ();
stored = optional<ContentStringText> ();
while (!decoder->pass()) {
if (stored && stored->from() == ContentTime(0)) {
- BOOST_CHECK_EQUAL (stored->subs.front().text(), "<b>Hello world!</b>");
+ /* Text passed around by the player should be unescaped */
+ BOOST_CHECK_EQUAL(stored->subs.front().text(), "<b>Hello world!</b>");
}
}
}
film->set_interop (true);
auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub3.xml");
film->examine_and_add_content (content);
+ content->only_text()->set_language(dcp::LanguageTag("de"));
BOOST_REQUIRE (!wait_for_jobs ());
make_and_verify_dcp (film, { dcp::VerificationNote::Code::INVALID_STANDARD });
content->only_text()->add_font(make_shared<Font>("font1"));
content2->only_text()->add_font(make_shared<Font>("font2"));
+ content->only_text()->set_language(dcp::LanguageTag("de"));
+ content2->only_text()->set_language(dcp::LanguageTag("de"));
make_and_verify_dcp (film, { dcp::VerificationNote::Code::INVALID_STANDARD });
auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub6.xml");
auto film = new_test_film2 ("dcp_subtitle_test5", {content});
film->set_interop (true);
+ content->only_text()->set_language(dcp::LanguageTag("de"));
make_and_verify_dcp (film, { dcp::VerificationNote::Code::INVALID_STANDARD });
auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub4.xml");
auto film = new_test_film2("test_font_override", {content});
film->set_interop(true);
+ content->only_text()->set_language(dcp::LanguageTag("de"));
BOOST_REQUIRE_EQUAL(content->text.size(), 1U);
- content->text.front()->get_font("theFontId")->set_file("test/data/Inconsolata-VF.ttf");
+ auto font = content->text.front()->get_font("0_theFontId");
+ BOOST_REQUIRE(font);
+ font->set_file("test/data/Inconsolata-VF.ttf");
make_and_verify_dcp (film, { dcp::VerificationNote::Code::INVALID_STANDARD });
check_file (subtitle_file(film).parent_path() / "font_0.ttf", "test/data/Inconsolata-VF.ttf");
/* Remake with burn */
content->only_text()->set_burn(true);
+ boost::filesystem::remove_all(film->dir(film->dcp_name()));
make_and_verify_dcp (
film,
{
dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING,
});
- dcp::MonoPictureAsset burnt(dcp_file(film, "j2c_"));
+ dcp::MonoJ2KPictureAsset burnt(dcp_file(film, "j2c_"));
auto frame = burnt.start_read()->get_frame(12)->xyz_image();
auto const size = frame->size();
int max_X = 0;