OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/fpdfapi/fpdf_page/pageint.h" | 5 #include "core/fpdfapi/page/pageint.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 | 7 |
8 TEST(fpdf_page_parser, PDF_FindKeyAbbreviation) { | 8 TEST(fpdf_page_parser, PDF_FindKeyAbbreviation) { |
9 EXPECT_EQ(CFX_ByteStringC("BitsPerComponent"), | 9 EXPECT_EQ(CFX_ByteStringC("BitsPerComponent"), |
10 PDF_FindKeyAbbreviationForTesting(CFX_ByteStringC("BPC"))); | 10 PDF_FindKeyAbbreviationForTesting(CFX_ByteStringC("BPC"))); |
11 EXPECT_EQ(CFX_ByteStringC("Width"), | 11 EXPECT_EQ(CFX_ByteStringC("Width"), |
12 PDF_FindKeyAbbreviationForTesting(CFX_ByteStringC("W"))); | 12 PDF_FindKeyAbbreviationForTesting(CFX_ByteStringC("W"))); |
13 EXPECT_EQ(CFX_ByteStringC(""), | 13 EXPECT_EQ(CFX_ByteStringC(""), |
14 PDF_FindKeyAbbreviationForTesting(CFX_ByteStringC(""))); | 14 PDF_FindKeyAbbreviationForTesting(CFX_ByteStringC(""))); |
15 EXPECT_EQ(CFX_ByteStringC(""), | 15 EXPECT_EQ(CFX_ByteStringC(""), |
16 PDF_FindKeyAbbreviationForTesting(CFX_ByteStringC("NoInList"))); | 16 PDF_FindKeyAbbreviationForTesting(CFX_ByteStringC("NoInList"))); |
17 // Prefix should not match. | 17 // Prefix should not match. |
18 EXPECT_EQ(CFX_ByteStringC(""), | 18 EXPECT_EQ(CFX_ByteStringC(""), |
19 PDF_FindKeyAbbreviationForTesting(CFX_ByteStringC("WW"))); | 19 PDF_FindKeyAbbreviationForTesting(CFX_ByteStringC("WW"))); |
20 } | 20 } |
21 | 21 |
22 TEST(fpdf_page_parser, PDF_FindValueAbbreviation) { | 22 TEST(fpdf_page_parser, PDF_FindValueAbbreviation) { |
23 EXPECT_EQ(CFX_ByteStringC("DeviceGray"), | 23 EXPECT_EQ(CFX_ByteStringC("DeviceGray"), |
24 PDF_FindValueAbbreviationForTesting(CFX_ByteStringC("G"))); | 24 PDF_FindValueAbbreviationForTesting(CFX_ByteStringC("G"))); |
25 EXPECT_EQ(CFX_ByteStringC("DCTDecode"), | 25 EXPECT_EQ(CFX_ByteStringC("DCTDecode"), |
26 PDF_FindValueAbbreviationForTesting(CFX_ByteStringC("DCT"))); | 26 PDF_FindValueAbbreviationForTesting(CFX_ByteStringC("DCT"))); |
27 EXPECT_EQ(CFX_ByteStringC(""), | 27 EXPECT_EQ(CFX_ByteStringC(""), |
28 PDF_FindValueAbbreviationForTesting(CFX_ByteStringC(""))); | 28 PDF_FindValueAbbreviationForTesting(CFX_ByteStringC(""))); |
29 EXPECT_EQ(CFX_ByteStringC(""), | 29 EXPECT_EQ(CFX_ByteStringC(""), |
30 PDF_FindValueAbbreviationForTesting(CFX_ByteStringC("NoInList"))); | 30 PDF_FindValueAbbreviationForTesting(CFX_ByteStringC("NoInList"))); |
31 // Prefix should not match. | 31 // Prefix should not match. |
32 EXPECT_EQ(CFX_ByteStringC(""), | 32 EXPECT_EQ(CFX_ByteStringC(""), |
33 PDF_FindValueAbbreviationForTesting(CFX_ByteStringC("II"))); | 33 PDF_FindValueAbbreviationForTesting(CFX_ByteStringC("II"))); |
34 } | 34 } |
OLD | NEW |