Chromium Code Reviews| Index: core/src/fpdfapi/fpdf_font/fpdf_font_unittest.cpp |
| diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_unittest.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_unittest.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9101ca11c6f8c1a40a3b765062ece42e610f5265 |
| --- /dev/null |
| +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_unittest.cpp |
| @@ -0,0 +1,36 @@ |
| +// 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 "testing/gtest/include/gtest/gtest.h" |
| + |
| +#include "font_int.h" |
| + |
| +TEST(fpdf_font, StringToCode) { |
| + CPDF_ToUnicodeMap to_map; |
| + |
| + EXPECT_EQ(0, to_map.StringToCode("")); |
| + EXPECT_EQ(194, to_map.StringToCode("<c2")); |
| + EXPECT_EQ(162, to_map.StringToCode("<A2")); |
| + EXPECT_EQ(2802, to_map.StringToCode("<Af2")); |
| + EXPECT_EQ(12, to_map.StringToCode("12")); |
| + EXPECT_EQ(128, to_map.StringToCode("128")); |
| +} |
| + |
| +TEST(fpdf_font, StringToWideString) { |
| + CPDF_ToUnicodeMap to_map; |
| + |
| + EXPECT_EQ(L"", to_map.StringToWideString("")); |
| + EXPECT_EQ(L"", to_map.StringToWideString("1234")); |
| + |
| + EXPECT_EQ(L"", to_map.StringToWideString("<c2")); |
| + |
| + CFX_WideString res = L""; |
| + 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
|
| + EXPECT_EQ(res, to_map.StringToWideString("<c2ab")); |
| + EXPECT_EQ(res, to_map.StringToWideString("<c2abab")); |
| + EXPECT_EQ(res, to_map.StringToWideString("<c2ab 1234")); |
| + |
| + res += 64171; |
| + EXPECT_EQ(res, to_map.StringToWideString("<c2abFaAb")); |
| +} |