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