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
cfx_xmlchardata_unittest.cpp
Go to the documentation of this file.
1
// Copyright 2018 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
"core/fxcrt/xml/cfx_xmlchardata.h"
6
#
include
"core/fxcrt/xml/cfx_xmldocument.h"
7
#
include
"testing/gtest/include/gtest/gtest.h"
8
#
include
"testing/string_write_stream.h"
9
10
TEST
(
CFX_XMLCharDataTest
,
GetType
) {
11
CFX_XMLCharData data
(
L"My Data"
)
;
12
EXPECT_EQ(
CFX_XMLNode
::
Type
::
kCharData
, data
.
GetType
(
)
);
13
}
14
15
TEST
(
CFX_XMLCharDataTest
,
GetText
) {
16
CFX_XMLCharData data
(
L"My Data"
)
;
17
EXPECT_EQ(L"My Data", data
.
GetText
());
18
}
19
20
TEST
(
CFX_XMLCharDataTest
,
Clone
) {
21
CFX_XMLDocument
doc;
22
23
CFX_XMLCharData data
(
L"My Data"
)
;
24
CFX_XMLNode
* clone = data
.
Clone
(
&doc
)
;
25
EXPECT_TRUE(clone !=
nullptr
);
26
EXPECT_NE(&data, clone);
27
ASSERT_EQ(
CFX_XMLNode
::
Type
::
kCharData
, clone
->
GetType
(
)
);
28
EXPECT_EQ(L"My Data",
ToXMLCharData
(
clone
)
->
GetText
());
29
}
30
31
TEST
(
CFX_XMLCharDataTest
,
Save
) {
32
auto
stream = pdfium::MakeRetain<StringWriteStream>();
33
CFX_XMLCharData data
(
L"My Data"
)
;
34
data
.
Save
(
stream
)
;
35
EXPECT_EQ(
"<![CDATA[My Data]]>"
, stream->ToString());
36
}
ToXMLCharData
CFX_XMLCharData * ToXMLCharData(CFX_XMLNode *pNode)
Definition
cfx_xmlchardata.h:26
CFX_XMLCharData::GetType
Type GetType() const override
Definition
cfx_xmlchardata.cpp:16
CFX_XMLCharData::CFX_XMLCharData
CFX_XMLCharData(const WideString &wsCData)
Definition
cfx_xmlchardata.cpp:11
CFX_XMLCharData::Save
void Save(const RetainPtr< IFX_RetainableWriteStream > &pXMLStream) override
Definition
cfx_xmlchardata.cpp:24
CFX_XMLCharData::Clone
CFX_XMLNode * Clone(CFX_XMLDocument *doc) override
Definition
cfx_xmlchardata.cpp:20
CFX_XMLDocument
Definition
cfx_xmldocument.h:17
CFX_XMLNode
Definition
cfx_xmlnode.h:16
CFX_XMLNode::GetType
virtual Type GetType() const =0
CFX_XMLNode::Type
Type
Definition
cfx_xmlnode.h:18
CFX_XMLNode::Type::kCharData
@ kCharData
CFX_XMLText::GetText
const WideString & GetText() const
Definition
cfx_xmltext.h:25
TEST
TEST(FXCRYPT, MD5GenerateEmtpyData)
Definition
fx_crypt_unittest.cpp:45
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fxcrt
xml
cfx_xmlchardata_unittest.cpp
Generated on Sat Sep 21 2024 00:55:48 for Qt by
1.12.0