• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "xfa/fxfa/cxfa_textparser.h"
6 
7 #include "testing/gtest/include/gtest/gtest.h"
8 
9 class CXFA_TestTextParser final : public CXFA_TextParser {
10  public:
CXFA_TestTextParser()11   CXFA_TestTextParser() : CXFA_TextParser() {}
12 
13  private:
14   // Add test cases as friends to access protected member functions.
15   FRIEND_TEST(CXFA_TextParser, TagValidate);
16 };
17 
TEST(CXFA_TextParser,TagValidate)18 TEST(CXFA_TextParser, TagValidate) {
19   CXFA_TestTextParser parser;
20   EXPECT_TRUE(parser.TagValidate(L"br"));
21   EXPECT_TRUE(parser.TagValidate(L"Br"));
22   EXPECT_TRUE(parser.TagValidate(L"BR"));
23   EXPECT_TRUE(parser.TagValidate(L"a"));
24   EXPECT_TRUE(parser.TagValidate(L"b"));
25   EXPECT_TRUE(parser.TagValidate(L"i"));
26   EXPECT_TRUE(parser.TagValidate(L"p"));
27   EXPECT_TRUE(parser.TagValidate(L"li"));
28   EXPECT_TRUE(parser.TagValidate(L"ol"));
29   EXPECT_TRUE(parser.TagValidate(L"ul"));
30   EXPECT_TRUE(parser.TagValidate(L"sub"));
31   EXPECT_TRUE(parser.TagValidate(L"sup"));
32   EXPECT_TRUE(parser.TagValidate(L"span"));
33   EXPECT_TRUE(parser.TagValidate(L"body"));
34   EXPECT_TRUE(parser.TagValidate(L"html"));
35 
36   EXPECT_FALSE(parser.TagValidate(L""));
37   EXPECT_FALSE(parser.TagValidate(L"tml"));
38   EXPECT_FALSE(parser.TagValidate(L"xhtml"));
39   EXPECT_FALSE(parser.TagValidate(L"htmlx"));
40 }
41