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