summaryrefslogtreecommitdiff
path: root/core/fxcrt/widestring_unittest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt/widestring_unittest.cpp')
-rw-r--r--core/fxcrt/widestring_unittest.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/core/fxcrt/widestring_unittest.cpp b/core/fxcrt/widestring_unittest.cpp
index 9017fe0c54..9d38aa45e9 100644
--- a/core/fxcrt/widestring_unittest.cpp
+++ b/core/fxcrt/widestring_unittest.cpp
@@ -999,6 +999,32 @@ TEST(WideString, UTF16LE_Encode) {
}
}
+TEST(WideString, ToDefANSI) {
+ EXPECT_EQ("", WideString().ToDefANSI());
+#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+ const char* kResult =
+ "x"
+ "?"
+ "\xff"
+ "A"
+ "?"
+ "y";
+#else
+ const char* kResult =
+ "x"
+ "\x80"
+ "\xff"
+ "y";
+#endif
+ EXPECT_EQ(kResult, WideString(L"x"
+ L"\u0080"
+ L"\u00ff"
+ L"\u0100"
+ L"\u208c"
+ L"y")
+ .ToDefANSI());
+}
+
TEST(WideStringView, FromVector) {
std::vector<WideStringView::UnsignedType> null_vec;
WideStringView null_string(null_vec);