Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cxfa_textparser_unittest.cpp
Go to the documentation of this file.
1// Copyright 2016 The PDFium Authors
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 "fxjs/gc/heap.h"
8#include "testing/fxgc_unittest.h"
9#include "testing/gtest/include/gtest/gtest.h"
10#include "v8/include/cppgc/heap.h"
11
12class CXFA_TestTextParser final : public CXFA_TextParser {
13 public:
15
16 private:
17 CXFA_TestTextParser() = default;
18
19 // Add test cases as friends to access protected member functions.
20 FRIEND_TEST(CXFATextParserTest, TagValidate);
21};
22
24
26 auto* parser = cppgc::MakeGarbageCollected<CXFA_TestTextParser>(
27 heap()->GetAllocationHandle());
28 EXPECT_TRUE(parser->TagValidate(L"br"));
29 EXPECT_TRUE(parser->TagValidate(L"Br"));
30 EXPECT_TRUE(parser->TagValidate(L"BR"));
31 EXPECT_TRUE(parser->TagValidate(L"a"));
32 EXPECT_TRUE(parser->TagValidate(L"b"));
33 EXPECT_TRUE(parser->TagValidate(L"i"));
34 EXPECT_TRUE(parser->TagValidate(L"p"));
35 EXPECT_TRUE(parser->TagValidate(L"li"));
36 EXPECT_TRUE(parser->TagValidate(L"ol"));
37 EXPECT_TRUE(parser->TagValidate(L"ul"));
38 EXPECT_TRUE(parser->TagValidate(L"sub"));
39 EXPECT_TRUE(parser->TagValidate(L"sup"));
40 EXPECT_TRUE(parser->TagValidate(L"span"));
41 EXPECT_TRUE(parser->TagValidate(L"body"));
42 EXPECT_TRUE(parser->TagValidate(L"html"));
43
44 EXPECT_FALSE(parser->TagValidate(L""));
45 EXPECT_FALSE(parser->TagValidate(L"tml"));
46 EXPECT_FALSE(parser->TagValidate(L"xhtml"));
47 EXPECT_FALSE(parser->TagValidate(L"htmlx"));
48}
TEST_F(CXFATextParserTest, TagValidate)
#define CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED
Definition heap.h:32