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

Side by Side Diff: core/src/fpdfapi/fpdf_font/fpdf_font_unittest.cpp

Issue 1428593005: Add test for StringToCode and StringToWideString. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 1 month 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
OLDNEW
(Empty)
1 // Copyright 2015 PDFium 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 "testing/gtest/include/gtest/gtest.h"
6
7 #include "font_int.h"
8
9 TEST(fpdf_font, StringToCode) {
10 CPDF_ToUnicodeMap to_map;
11
12 EXPECT_EQ(0, to_map.StringToCode(""));
13 EXPECT_EQ(194, to_map.StringToCode("<c2"));
14 EXPECT_EQ(162, to_map.StringToCode("<A2"));
15 EXPECT_EQ(2802, to_map.StringToCode("<Af2"));
16 EXPECT_EQ(12, to_map.StringToCode("12"));
17 EXPECT_EQ(128, to_map.StringToCode("128"));
18 }
19
20 TEST(fpdf_font, StringToWideString) {
21 CPDF_ToUnicodeMap to_map;
22
23 EXPECT_EQ(L"", to_map.StringToWideString(""));
24 EXPECT_EQ(L"", to_map.StringToWideString("1234"));
25
26 EXPECT_EQ(L"", to_map.StringToWideString("<c2"));
27
28 CFX_WideString res = L"";
29 res += 49835;
Tom Sepez 2015/11/02 18:00:28 ????
dsinclair 2015/11/02 18:14:28 Done. Converted to res += L"\xc2ab"; to be cleare
30 EXPECT_EQ(res, to_map.StringToWideString("<c2ab"));
31 EXPECT_EQ(res, to_map.StringToWideString("<c2abab"));
32 EXPECT_EQ(res, to_map.StringToWideString("<c2ab 1234"));
33
34 res += 64171;
35 EXPECT_EQ(res, to_map.StringToWideString("<c2abFaAb"));
36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698