diff options
author | dsinclair <dsinclair@chromium.org> | 2016-10-04 11:08:49 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-04 11:08:49 -0700 |
commit | bc5e6d289ed40efec2b0e03427e8fc2947bf53e3 (patch) | |
tree | fa1509c1fe1a46a6ebe8861768804883041973be /core/fpdfapi/font/fpdf_font_unittest.cpp | |
parent | 241543581696e996093bf0c2ae09ece6afe13ba2 (diff) | |
download | pdfium-bc5e6d289ed40efec2b0e03427e8fc2947bf53e3.tar.xz |
Move core/fpdfapi/fpdf_font to core/fpdfapi/font
BUG=pdfium:603
Review-Url: https://codereview.chromium.org/2392773003
Diffstat (limited to 'core/fpdfapi/font/fpdf_font_unittest.cpp')
-rw-r--r-- | core/fpdfapi/font/fpdf_font_unittest.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/core/fpdfapi/font/fpdf_font_unittest.cpp b/core/fpdfapi/font/fpdf_font_unittest.cpp new file mode 100644 index 0000000000..977ae8a3bb --- /dev/null +++ b/core/fpdfapi/font/fpdf_font_unittest.cpp @@ -0,0 +1,30 @@ +// Copyright 2015 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "core/fpdfapi/font/font_int.h" +#include "testing/gtest/include/gtest/gtest.h" + +TEST(fpdf_font, StringToCode) { + EXPECT_EQ(0u, CPDF_ToUnicodeMap::StringToCode("")); + EXPECT_EQ(194u, CPDF_ToUnicodeMap::StringToCode("<c2")); + EXPECT_EQ(162u, CPDF_ToUnicodeMap::StringToCode("<A2")); + EXPECT_EQ(2802u, CPDF_ToUnicodeMap::StringToCode("<Af2")); + EXPECT_EQ(12u, CPDF_ToUnicodeMap::StringToCode("12")); + EXPECT_EQ(128u, CPDF_ToUnicodeMap::StringToCode("128")); +} + +TEST(fpdf_font, StringToWideString) { + EXPECT_EQ(L"", CPDF_ToUnicodeMap::StringToWideString("")); + EXPECT_EQ(L"", CPDF_ToUnicodeMap::StringToWideString("1234")); + + EXPECT_EQ(L"", CPDF_ToUnicodeMap::StringToWideString("<c2")); + + CFX_WideString res = L"\xc2ab"; + EXPECT_EQ(res, CPDF_ToUnicodeMap::StringToWideString("<c2ab")); + EXPECT_EQ(res, CPDF_ToUnicodeMap::StringToWideString("<c2abab")); + EXPECT_EQ(res, CPDF_ToUnicodeMap::StringToWideString("<c2ab 1234")); + + res += L"\xfaab"; + EXPECT_EQ(res, CPDF_ToUnicodeMap::StringToWideString("<c2abFaAb")); +} |