• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 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/parser/cxfa_node.h"
6 
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "testing/test_support.h"
9 
TEST(CXFA_NodeTest,NameToAttribute)10 TEST(CXFA_NodeTest, NameToAttribute) {
11   EXPECT_EQ(XFA_Attribute::Unknown, CXFA_Node::NameToAttribute(L""));
12   EXPECT_EQ(XFA_Attribute::Unknown, CXFA_Node::NameToAttribute(L"nonesuch"));
13   EXPECT_EQ(XFA_Attribute::H, CXFA_Node::NameToAttribute(L"h"));
14   EXPECT_EQ(XFA_Attribute::Short, CXFA_Node::NameToAttribute(L"short"));
15   EXPECT_EQ(XFA_Attribute::DecipherOnly,
16             CXFA_Node::NameToAttribute(L"decipherOnly"));
17 }
18 
TEST(CXFA_NodeTest,GetAttributeEnumByName)19 TEST(CXFA_NodeTest, GetAttributeEnumByName) {
20   EXPECT_FALSE(!!CXFA_Node::NameToAttributeEnum(L""));
21   EXPECT_FALSE(!!CXFA_Node::NameToAttributeEnum(L"nonesuch"));
22   EXPECT_EQ(XFA_AttributeEnum::Asterisk, *CXFA_Node::NameToAttributeEnum(L"*"));
23   EXPECT_EQ(XFA_AttributeEnum::Visible,
24             *CXFA_Node::NameToAttributeEnum(L"visible"));
25   EXPECT_EQ(XFA_AttributeEnum::Lowered,
26             *CXFA_Node::NameToAttributeEnum(L"lowered"));
27 }
28