Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(428)

Side by Side Diff: core/src/fxcrt/fx_basic_wstring_unittest.cpp

Issue 1511773002: Revert "Merge to master: Take Jun's UTF16LE patches." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxcrt/fx_basic_wstring.cpp ('k') | fpdfsdk/src/fpdfdoc_embeddertest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/include/fxcrt/fx_basic.h" 5 #include "core/include/fxcrt/fx_basic.h"
6 #include "testing/fx_string_testhelpers.h" 6 #include "testing/fx_string_testhelpers.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 TEST(fxcrt, WideStringOperatorSubscript) { 9 TEST(fxcrt, WideStringOperatorSubscript) {
10 // CFX_WideString includes the NUL terminator for non-empty strings. 10 // CFX_WideString includes the NUL terminator for non-empty strings.
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 EXPECT_EQ(L"xxxxxx", not_aliased); 276 EXPECT_EQ(L"xxxxxx", not_aliased);
277 } 277 }
278 278
279 #define ByteStringLiteral(str) CFX_ByteString(FX_BSTRC(str)) 279 #define ByteStringLiteral(str) CFX_ByteString(FX_BSTRC(str))
280 280
281 TEST(fxcrt, WideStringUTF16LE_Encode) { 281 TEST(fxcrt, WideStringUTF16LE_Encode) {
282 struct UTF16LEEncodeCase { 282 struct UTF16LEEncodeCase {
283 CFX_WideString ws; 283 CFX_WideString ws;
284 CFX_ByteString bs; 284 CFX_ByteString bs;
285 } utf16le_encode_cases[] = { 285 } utf16le_encode_cases[] = {
286 {L"", ByteStringLiteral("")}, 286 {L"", ByteStringLiteral("\0\0")},
287 {L"abc", ByteStringLiteral("a\0b\0c\0")}, 287 {L"abc", ByteStringLiteral("a\0b\0c\0\0\0")},
288 {L"abcdef", ByteStringLiteral("a\0b\0c\0d\0e\0f\0")}, 288 {L"abcdef", ByteStringLiteral("a\0b\0c\0d\0e\0f\0\0\0")},
289 {L"abc\0def", ByteStringLiteral("a\0b\0c\0")}, 289 {L"abc\0def", ByteStringLiteral("a\0b\0c\0\0\0")},
290 {L"\xaabb\xccdd", ByteStringLiteral("\xbb\xaa\xdd\xcc")}, 290 {L"\xaabb\xccdd", ByteStringLiteral("\xbb\xaa\xdd\xcc\0\0")},
291 {L"\x3132\x6162", ByteStringLiteral("\x32\x31\x62\x61")}, 291 {L"\x3132\x6162", ByteStringLiteral("\x32\x31\x62\x61\0\0")},
292 }; 292 };
293 293
294 for (size_t i = 0; i < FX_ArraySize(utf16le_encode_cases); ++i) { 294 for (size_t i = 0; i < FX_ArraySize(utf16le_encode_cases); ++i) {
295 EXPECT_EQ(utf16le_encode_cases[i].bs, 295 EXPECT_EQ(utf16le_encode_cases[i].bs,
296 utf16le_encode_cases[i].ws.UTF16LE_Encode()) 296 utf16le_encode_cases[i].ws.UTF16LE_Encode())
297 << " for case number " << i; 297 << " for case number " << i;
298 } 298 }
299 } 299 }
300 300
301 TEST(fxcrt, WideStringCOperatorSubscript) { 301 TEST(fxcrt, WideStringCOperatorSubscript) {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 } 517 }
518 } 518 }
519 519
520 TEST(fxcrt, EmptyWideString) { 520 TEST(fxcrt, EmptyWideString) {
521 CFX_WideString empty_str; 521 CFX_WideString empty_str;
522 EXPECT_TRUE(empty_str.IsEmpty()); 522 EXPECT_TRUE(empty_str.IsEmpty());
523 EXPECT_EQ(0, empty_str.GetLength()); 523 EXPECT_EQ(0, empty_str.GetLength());
524 const FX_WCHAR* cstr = empty_str.c_str(); 524 const FX_WCHAR* cstr = empty_str.c_str();
525 EXPECT_EQ(0, FXSYS_wcslen(cstr)); 525 EXPECT_EQ(0, FXSYS_wcslen(cstr));
526 } 526 }
OLDNEW
« no previous file with comments | « core/src/fxcrt/fx_basic_wstring.cpp ('k') | fpdfsdk/src/fpdfdoc_embeddertest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698