diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-08-08 22:20:29 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-08-08 22:20:29 +0000 |
commit | f765805983d157e9a21d7202ba49148f24d226f3 (patch) | |
tree | afae705a3a6c1fe55028cdebc5772ac244c7e762 /core/fxcrt/widestring_unittest.cpp | |
parent | 4b17aea63fede24925cd7579c27f55298e5e9937 (diff) | |
download | pdfium-f765805983d157e9a21d7202ba49148f24d226f3.tar.xz |
Remove unused codepage from WideString::GetWideString().
Consolidate code into sole caller, which always retrieves a string
from the "default ANSI code page". Add unit test for this code path.
Fix sign extension bug giving bogus 0xffffff80 codepoint uncovered
by unit test on non-windows. Note windows result is different because
the system conversion routine does actually work.
Change-Id: I1c1246b203ee66e9ff0b6fccf97594788bcd0fca
Reviewed-on: https://pdfium-review.googlesource.com/39730
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcrt/widestring_unittest.cpp')
-rw-r--r-- | core/fxcrt/widestring_unittest.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/core/fxcrt/widestring_unittest.cpp b/core/fxcrt/widestring_unittest.cpp index 9d38aa45e9..160dc929db 100644 --- a/core/fxcrt/widestring_unittest.cpp +++ b/core/fxcrt/widestring_unittest.cpp @@ -1025,6 +1025,27 @@ TEST(WideString, ToDefANSI) { .ToDefANSI()); } +TEST(WideString, FromLocal) { + EXPECT_EQ(L"", WideString::FromLocal(ByteStringView())); +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ + const wchar_t* kResult = + L"x" + L"\u20ac" + L"\u00ff" + L"y"; +#else + const wchar_t* kResult = + L"x" + L"\u0080" + L"\u00ff" + L"y"; +#endif + EXPECT_EQ(kResult, WideString::FromLocal("x" + "\x80" + "\xff" + "y")); +} + TEST(WideStringView, FromVector) { std::vector<WideStringView::UnsignedType> null_vec; WideStringView null_string(null_vec); |