Flutter Engine
The Flutter Engine
wstring_conversion_unittests.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "flutter/fml/platform/win/wstring_conversion.h"
6
7#include "gtest/gtest.h"
8
9namespace fml {
10namespace testing {
11
12TEST(StringConversion, Utf8ToWideStringEmpty) {
13 EXPECT_EQ(Utf8ToWideString(""), L"");
14}
15
16TEST(StringConversion, Utf8ToWideStringAscii) {
17 EXPECT_EQ(Utf8ToWideString("abc123"), L"abc123");
18}
19
20TEST(StringConversion, Utf8ToWideStringUnicode) {
21 EXPECT_EQ(Utf8ToWideString("\xe2\x98\x83"), L"\x2603");
22}
23
24TEST(StringConversion, WideStringToUtf8Empty) {
25 EXPECT_EQ(WideStringToUtf8(L""), "");
26}
27
28TEST(StringConversion, WideStringToUtf8Ascii) {
29 EXPECT_EQ(WideStringToUtf8(L"abc123"), "abc123");
30}
31
32TEST(StringConversion, WideStringToUtf8Unicode) {
33 EXPECT_EQ(WideStringToUtf8(L"\x2603"), "\xe2\x98\x83");
34}
35
36TEST(StringConversion, WideStringToUtf16Empty) {
37 EXPECT_EQ(WideStringToUtf16(L""), u"");
38}
39
40TEST(StringConversion, WideStringToUtf16Ascii) {
41 EXPECT_EQ(WideStringToUtf16(L"abc123"), u"abc123");
42}
43
44TEST(StringConversion, WideStringToUtf16Unicode) {
45 EXPECT_EQ(WideStringToUtf16(L"\xe2\x98\x83"), u"\xe2\x98\x83");
46}
47
48TEST(StringConversion, Utf16ToWideStringEmpty) {
49 EXPECT_EQ(Utf16ToWideString(u""), L"");
50}
51
52TEST(StringConversion, Utf16ToWideStringAscii) {
53 EXPECT_EQ(Utf16ToWideString(u"abc123"), L"abc123");
54}
55
56TEST(StringConversion, Utf16ToWideStringUtf8Unicode) {
57 EXPECT_EQ(Utf16ToWideString(u"\xe2\x98\x83"), L"\xe2\x98\x83");
58}
59
60} // namespace testing
61} // namespace fml
TEST(BacktraceTest, CanGatherBacktrace)
Definition: ascii_trie.cc:9
std::wstring Utf8ToWideString(const std::string_view str)
std::string WideStringToUtf8(const std::wstring_view str)
std::u16string WideStringToUtf16(const std::wstring_view str)
std::wstring Utf16ToWideString(const std::u16string_view str)