mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
LibPDF+Tests: Correctly decode text strings without explicit encoding
This commit is contained in:
parent
8f47acee6a
commit
57e2b5ef59
Notes:
sideshowbarker
2024-07-17 01:53:23 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/57e2b5ef59 Pull-request: https://github.com/SerenityOS/serenity/pull/22017 Reviewed-by: https://github.com/ADKaster ✅
2 changed files with 3 additions and 8 deletions
|
@ -54,15 +54,12 @@ TEST_CASE(encodig)
|
|||
auto info_dict = MUST(document->info_dict()).value();
|
||||
EXPECT_EQ(MUST(info_dict.author()).value(), "Nico Weber");
|
||||
EXPECT_EQ(MUST(info_dict.producer()).value(), (char const*)u8"Manüally Created");
|
||||
|
||||
// FIXME: Make this pass.
|
||||
// EXPECT_EQ(MUST(info_dict.title()).value(), (char const*)u8"Êñ©•ding test");
|
||||
EXPECT_EQ(MUST(info_dict.title()).value(), (char const*)u8"Êñ©•ding test");
|
||||
|
||||
auto outline_dict = document->outline();
|
||||
EXPECT_EQ(outline_dict->count, 3u);
|
||||
EXPECT_EQ(outline_dict->children[0]->title, (char const*)u8"Titlè 1");
|
||||
// FIXME: Make this pass:
|
||||
// EXPECT_EQ(outline_dict->children[1]->title, (char const*)u8"Titlè 2");
|
||||
EXPECT_EQ(outline_dict->children[1]->title, (char const*)u8"Titlè 2");
|
||||
EXPECT_EQ(outline_dict->children[2]->title, (char const*)u8"Titlè 3");
|
||||
}
|
||||
|
||||
|
|
|
@ -92,9 +92,7 @@ DeprecatedString Document::text_string_to_utf8(DeprecatedString const& text_stri
|
|||
return text_string.substring(3);
|
||||
}
|
||||
|
||||
// FIXME: Convert from PDFDocEncoding to UTF-8.
|
||||
|
||||
return text_string;
|
||||
return TextCodec::decoder_for("PDFDocEncoding"sv)->to_utf8(text_string).release_value_but_fixme_should_propagate_errors().to_deprecated_string();
|
||||
}
|
||||
|
||||
PDFErrorOr<NonnullRefPtr<Document>> Document::create(ReadonlyBytes bytes)
|
||||
|
|
Loading…
Reference in a new issue