Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
f87859b8
Kaydet (Commit)
f87859b8
authored
Haz 02, 2014
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix memory leaks in test code
Change-Id: Ifa756a5da636e0b37654ad83900115872bc40f0e
üst
7e4a51ee
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
23 deletions
+48
-23
xmltesttools.hxx
include/test/xmltesttools.hxx
+2
-1
ooxmlexport.cxx
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+9
-3
ooxmlsdrexport.cxx
sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
+13
-10
xmltesttools.cxx
test/source/xmltesttools.cxx
+24
-9
No files found.
include/test/xmltesttools.hxx
Dosyayı görüntüle @
f87859b8
...
@@ -36,7 +36,8 @@ protected:
...
@@ -36,7 +36,8 @@ protected:
virtual
void
registerNamespaces
(
xmlXPathContextPtr
&
pXmlXpathCtx
);
virtual
void
registerNamespaces
(
xmlXPathContextPtr
&
pXmlXpathCtx
);
xmlNodeSetPtr
getXPathNode
(
xmlDocPtr
pXmlDoc
,
const
OString
&
rXPath
);
// Caller must call xmlXPathFreeObject:
xmlXPathObjectPtr
getXPathNode
(
xmlDocPtr
pXmlDoc
,
const
OString
&
rXPath
);
/**
/**
* Same as the assertXPath(), but don't assert: return the string instead.
* Same as the assertXPath(), but don't assert: return the string instead.
*/
*/
...
...
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Dosyayı görüntüle @
f87859b8
...
@@ -1541,7 +1541,8 @@ DECLARE_OOXMLEXPORT_TEST(testFontNameIsEmpty, "font-name-is-empty.docx")
...
@@ -1541,7 +1541,8 @@ DECLARE_OOXMLEXPORT_TEST(testFontNameIsEmpty, "font-name-is-empty.docx")
xmlDocPtr
pXmlFontTable
=
parseExport
(
"word/fontTable.xml"
);
xmlDocPtr
pXmlFontTable
=
parseExport
(
"word/fontTable.xml"
);
if
(
!
pXmlFontTable
)
if
(
!
pXmlFontTable
)
return
;
return
;
xmlNodeSetPtr
pXmlNodes
=
getXPathNode
(
pXmlFontTable
,
"/w:fonts/w:font"
);
xmlXPathObjectPtr
pXmlObj
=
getXPathNode
(
pXmlFontTable
,
"/w:fonts/w:font"
);
xmlNodeSetPtr
pXmlNodes
=
pXmlObj
->
nodesetval
;
sal_Int32
length
=
xmlXPathNodeSetGetLength
(
pXmlNodes
);
sal_Int32
length
=
xmlXPathNodeSetGetLength
(
pXmlNodes
);
for
(
sal_Int32
index
=
0
;
index
<
length
;
index
++
){
for
(
sal_Int32
index
=
0
;
index
<
length
;
index
++
){
xmlNodePtr
pXmlNode
=
pXmlNodes
->
nodeTab
[
index
];
xmlNodePtr
pXmlNode
=
pXmlNodes
->
nodeTab
[
index
];
...
@@ -1550,6 +1551,7 @@ DECLARE_OOXMLEXPORT_TEST(testFontNameIsEmpty, "font-name-is-empty.docx")
...
@@ -1550,6 +1551,7 @@ DECLARE_OOXMLEXPORT_TEST(testFontNameIsEmpty, "font-name-is-empty.docx")
CPPUNIT_FAIL
(
"Font name is empty."
);
CPPUNIT_FAIL
(
"Font name is empty."
);
}
}
}
}
xmlXPathFreeObject
(
pXmlObj
);
}
}
DECLARE_OOXMLEXPORT_TEST
(
testMultiColumnLineSeparator
,
"multi-column-line-separator-SAVED.docx"
)
DECLARE_OOXMLEXPORT_TEST
(
testMultiColumnLineSeparator
,
"multi-column-line-separator-SAVED.docx"
)
...
@@ -2816,10 +2818,12 @@ DECLARE_OOXMLEXPORT_TEST(testGenericTextField, "Unsupportedtextfields.docx")
...
@@ -2816,10 +2818,12 @@ DECLARE_OOXMLEXPORT_TEST(testGenericTextField, "Unsupportedtextfields.docx")
xmlDocPtr
pXmlDoc
=
parseExport
();
xmlDocPtr
pXmlDoc
=
parseExport
();
if
(
!
pXmlDoc
)
if
(
!
pXmlDoc
)
return
;
return
;
xmlNodeSetPtr
pXmlNodes
=
getXPathNode
(
pXmlDoc
,
"/w:document/w:body/w:p[2]/w:r[2]/w:instrText"
);
xmlXPathObjectPtr
pXmlObj
=
getXPathNode
(
pXmlDoc
,
"/w:document/w:body/w:p[2]/w:r[2]/w:instrText"
);
xmlNodeSetPtr
pXmlNodes
=
pXmlObj
->
nodesetval
;
xmlNodePtr
pXmlNode
=
pXmlNodes
->
nodeTab
[
0
];
xmlNodePtr
pXmlNode
=
pXmlNodes
->
nodeTab
[
0
];
OUString
contents
=
OUString
::
createFromAscii
((
const
char
*
)((
pXmlNode
->
children
[
0
]).
content
));
OUString
contents
=
OUString
::
createFromAscii
((
const
char
*
)((
pXmlNode
->
children
[
0
]).
content
));
CPPUNIT_ASSERT
(
contents
.
match
(
"PRINTDATE
\\
* MERGEFORMAT"
));
CPPUNIT_ASSERT
(
contents
.
match
(
"PRINTDATE
\\
* MERGEFORMAT"
));
xmlXPathFreeObject
(
pXmlObj
);
}
}
DECLARE_OOXMLEXPORT_TEST
(
testDateControl
,
"date-control.docx"
)
DECLARE_OOXMLEXPORT_TEST
(
testDateControl
,
"date-control.docx"
)
...
@@ -2966,12 +2970,14 @@ DECLARE_OOXMLEXPORT_TEST(testCitation,"FDO74775.docx")
...
@@ -2966,12 +2970,14 @@ DECLARE_OOXMLEXPORT_TEST(testCitation,"FDO74775.docx")
xmlDocPtr
pXmlDoc
=
parseExport
();
xmlDocPtr
pXmlDoc
=
parseExport
();
if
(
!
pXmlDoc
)
if
(
!
pXmlDoc
)
return
;
return
;
xmlNodeSetPtr
pXmlNodes
=
getXPathNode
(
pXmlDoc
,
"/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r[3]/w:instrText"
);
xmlXPathObjectPtr
pXmlObj
=
getXPathNode
(
pXmlDoc
,
"/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r[3]/w:instrText"
);
xmlNodeSetPtr
pXmlNodes
=
pXmlObj
->
nodesetval
;
CPPUNIT_ASSERT
(
pXmlNodes
!=
0
);
CPPUNIT_ASSERT
(
pXmlNodes
!=
0
);
CPPUNIT_ASSERT
(
pXmlNodes
->
nodeNr
>
0
);
CPPUNIT_ASSERT
(
pXmlNodes
->
nodeNr
>
0
);
xmlNodePtr
pXmlNode
=
pXmlNodes
->
nodeTab
[
0
];
xmlNodePtr
pXmlNode
=
pXmlNodes
->
nodeTab
[
0
];
OUString
contents
=
OUString
::
createFromAscii
((
const
char
*
)((
pXmlNode
->
children
[
0
]).
content
));
OUString
contents
=
OUString
::
createFromAscii
((
const
char
*
)((
pXmlNode
->
children
[
0
]).
content
));
CPPUNIT_ASSERT
(
contents
.
match
(
" CITATION [Kra06]"
));
CPPUNIT_ASSERT
(
contents
.
match
(
" CITATION [Kra06]"
));
xmlXPathFreeObject
(
pXmlObj
);
}
}
DECLARE_OOXMLEXPORT_TEST
(
testFdo76016
,
"fdo76016.docx"
)
DECLARE_OOXMLEXPORT_TEST
(
testFdo76016
,
"fdo76016.docx"
)
...
...
sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
Dosyayı görüntüle @
f87859b8
...
@@ -1519,8 +1519,10 @@ DECLARE_OOXMLEXPORT_TEST(testFdo76101, "fdo76101.docx")
...
@@ -1519,8 +1519,10 @@ DECLARE_OOXMLEXPORT_TEST(testFdo76101, "fdo76101.docx")
if
(
!
pXmlDoc
)
if
(
!
pXmlDoc
)
return
;
return
;
xmlNodeSetPtr
pXmlNodes
=
getXPathNode
(
pXmlDoc
,
"/w:styles/w:style"
);
xmlXPathObjectPtr
pXmlObj
=
getXPathNode
(
pXmlDoc
,
"/w:styles/w:style"
);
xmlNodeSetPtr
pXmlNodes
=
pXmlObj
->
nodesetval
;
CPPUNIT_ASSERT
(
4091
>=
xmlXPathNodeSetGetLength
(
pXmlNodes
));
CPPUNIT_ASSERT
(
4091
>=
xmlXPathNodeSetGetLength
(
pXmlNodes
));
xmlXPathFreeObject
(
pXmlObj
);
}
}
DECLARE_OOXMLEXPORT_TEST
(
testSdtAndShapeOverlapping
,
"ShapeOverlappingWithSdt.docx"
)
DECLARE_OOXMLEXPORT_TEST
(
testSdtAndShapeOverlapping
,
"ShapeOverlappingWithSdt.docx"
)
...
@@ -1561,22 +1563,23 @@ DECLARE_OOXMLEXPORT_TEST(testAbsolutePositionOffsetValue,"fdo78432.docx")
...
@@ -1561,22 +1563,23 @@ DECLARE_OOXMLEXPORT_TEST(testAbsolutePositionOffsetValue,"fdo78432.docx")
sal_Int32
IntMax
=
SAL_MAX_INT32
;
sal_Int32
IntMax
=
SAL_MAX_INT32
;
xml
NodeSetPtr
pXmlNode
s
[
6
];
xml
XPathObjectPtr
pXmlObj
s
[
6
];
pXml
Node
s
[
0
]
=
getXPathNode
(
pXmlDoc
,
"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionH[1]/wp:posOffset[1]"
);
pXml
Obj
s
[
0
]
=
getXPathNode
(
pXmlDoc
,
"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionH[1]/wp:posOffset[1]"
);
pXml
Node
s
[
1
]
=
getXPathNode
(
pXmlDoc
,
"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionV[1]/wp:posOffset[1]"
);
pXml
Obj
s
[
1
]
=
getXPathNode
(
pXmlDoc
,
"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionV[1]/wp:posOffset[1]"
);
pXml
Node
s
[
2
]
=
getXPathNode
(
pXmlDoc
,
"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[2]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionH[1]/wp:posOffset[1]"
);
pXml
Obj
s
[
2
]
=
getXPathNode
(
pXmlDoc
,
"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[2]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionH[1]/wp:posOffset[1]"
);
pXml
Node
s
[
3
]
=
getXPathNode
(
pXmlDoc
,
"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[2]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionV[1]/wp:posOffset[1]"
);
pXml
Obj
s
[
3
]
=
getXPathNode
(
pXmlDoc
,
"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[2]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionV[1]/wp:posOffset[1]"
);
pXml
Node
s
[
4
]
=
getXPathNode
(
pXmlDoc
,
"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[3]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionH[1]/wp:posOffset[1]"
);
pXml
Obj
s
[
4
]
=
getXPathNode
(
pXmlDoc
,
"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[3]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionH[1]/wp:posOffset[1]"
);
pXml
Node
s
[
5
]
=
getXPathNode
(
pXmlDoc
,
"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[3]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionV[1]/wp:posOffset[1]"
);
pXml
Obj
s
[
5
]
=
getXPathNode
(
pXmlDoc
,
"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[3]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionV[1]/wp:posOffset[1]"
);
for
(
sal_Int32
index
=
0
;
index
<
6
;
++
index
)
for
(
sal_Int32
index
=
0
;
index
<
6
;
++
index
)
{
{
CPPUNIT_ASSERT
(
pXml
Nodes
[
index
]
!=
0
);
CPPUNIT_ASSERT
(
pXml
Objs
[
index
]
->
nodesetval
!=
0
);
xmlNodePtr
pXmlNode
=
pXml
Nodes
[
index
]
->
nodeTab
[
0
];
xmlNodePtr
pXmlNode
=
pXml
Objs
[
index
]
->
nodesetval
->
nodeTab
[
0
];
OUString
contents
=
OUString
::
createFromAscii
((
const
char
*
)((
pXmlNode
->
children
[
0
]).
content
));
OUString
contents
=
OUString
::
createFromAscii
((
const
char
*
)((
pXmlNode
->
children
[
0
]).
content
));
CPPUNIT_ASSERT
(
contents
.
toInt64
()
<=
IntMax
);
CPPUNIT_ASSERT
(
contents
.
toInt64
()
<=
IntMax
);
xmlXPathFreeObject
(
pXmlObjs
[
index
]);
}
}
}
}
...
...
test/source/xmltesttools.cxx
Dosyayı görüntüle @
f87859b8
...
@@ -32,12 +32,13 @@ xmlDocPtr XmlTestTools::parseXmlStream(SvStream* pStream)
...
@@ -32,12 +32,13 @@ xmlDocPtr XmlTestTools::parseXmlStream(SvStream* pStream)
return
xmlParseDoc
(
reinterpret_cast
<
xmlChar
*>
(
pBuffer
.
get
()));
return
xmlParseDoc
(
reinterpret_cast
<
xmlChar
*>
(
pBuffer
.
get
()));
}
}
xml
NodeSe
tPtr
XmlTestTools
::
getXPathNode
(
xmlDocPtr
pXmlDoc
,
const
OString
&
rXPath
)
xml
XPathObjec
tPtr
XmlTestTools
::
getXPathNode
(
xmlDocPtr
pXmlDoc
,
const
OString
&
rXPath
)
{
{
xmlXPathContextPtr
pXmlXpathCtx
=
xmlXPathNewContext
(
pXmlDoc
);
xmlXPathContextPtr
pXmlXpathCtx
=
xmlXPathNewContext
(
pXmlDoc
);
registerNamespaces
(
pXmlXpathCtx
);
registerNamespaces
(
pXmlXpathCtx
);
xmlXPathObjectPtr
pXmlXpathObj
=
xmlXPathEvalExpression
(
BAD_CAST
(
rXPath
.
getStr
()),
pXmlXpathCtx
);
xmlXPathObjectPtr
pXmlXpathObj
=
xmlXPathEvalExpression
(
BAD_CAST
(
rXPath
.
getStr
()),
pXmlXpathCtx
);
return
pXmlXpathObj
->
nodesetval
;
xmlXPathFreeContext
(
pXmlXpathCtx
);
return
pXmlXpathObj
;
}
}
void
XmlTestTools
::
registerNamespaces
(
xmlXPathContextPtr
&
/*pXmlXpathCtx*/
)
void
XmlTestTools
::
registerNamespaces
(
xmlXPathContextPtr
&
/*pXmlXpathCtx*/
)
...
@@ -46,24 +47,32 @@ void XmlTestTools::registerNamespaces(xmlXPathContextPtr& /*pXmlXpathCtx*/)
...
@@ -46,24 +47,32 @@ void XmlTestTools::registerNamespaces(xmlXPathContextPtr& /*pXmlXpathCtx*/)
OUString
XmlTestTools
::
getXPath
(
xmlDocPtr
pXmlDoc
,
const
OString
&
rXPath
,
const
OString
&
rAttribute
)
OUString
XmlTestTools
::
getXPath
(
xmlDocPtr
pXmlDoc
,
const
OString
&
rXPath
,
const
OString
&
rAttribute
)
{
{
xmlNodeSetPtr
pXmlNodes
=
getXPathNode
(
pXmlDoc
,
rXPath
);
xmlXPathObjectPtr
pXmlObj
=
getXPathNode
(
pXmlDoc
,
rXPath
);
xmlNodeSetPtr
pXmlNodes
=
pXmlObj
->
nodesetval
;
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
OString
(
"XPath '"
+
rXPath
+
"' number of nodes is incorrect"
).
getStr
(),
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
OString
(
"XPath '"
+
rXPath
+
"' number of nodes is incorrect"
).
getStr
(),
1
,
xmlXPathNodeSetGetLength
(
pXmlNodes
));
1
,
xmlXPathNodeSetGetLength
(
pXmlNodes
));
if
(
rAttribute
.
isEmpty
())
if
(
rAttribute
.
isEmpty
())
return
OUString
();
return
OUString
();
xmlNodePtr
pXmlNode
=
pXmlNodes
->
nodeTab
[
0
];
xmlNodePtr
pXmlNode
=
pXmlNodes
->
nodeTab
[
0
];
return
OUString
::
createFromAscii
((
const
char
*
)
xmlGetProp
(
pXmlNode
,
BAD_CAST
(
rAttribute
.
getStr
())));
xmlChar
*
prop
=
xmlGetProp
(
pXmlNode
,
BAD_CAST
(
rAttribute
.
getStr
()));
OUString
s
(
OUString
::
createFromAscii
((
const
char
*
)
prop
));
xmlFree
(
prop
);
xmlXPathFreeObject
(
pXmlObj
);
return
s
;
}
}
OUString
XmlTestTools
::
getXPathContent
(
xmlDocPtr
pXmlDoc
,
const
OString
&
rXPath
)
OUString
XmlTestTools
::
getXPathContent
(
xmlDocPtr
pXmlDoc
,
const
OString
&
rXPath
)
{
{
xmlNodeSetPtr
pXmlNodes
=
getXPathNode
(
pXmlDoc
,
rXPath
);
xmlXPathObjectPtr
pXmlObj
=
getXPathNode
(
pXmlDoc
,
rXPath
);
xmlNodeSetPtr
pXmlNodes
=
pXmlObj
->
nodesetval
;
CPPUNIT_ASSERT_MESSAGE
(
OString
(
"XPath '"
+
rXPath
+
"' not found"
).
getStr
(),
CPPUNIT_ASSERT_MESSAGE
(
OString
(
"XPath '"
+
rXPath
+
"' not found"
).
getStr
(),
xmlXPathNodeSetGetLength
(
pXmlNodes
)
>
0
);
xmlXPathNodeSetGetLength
(
pXmlNodes
)
>
0
);
xmlNodePtr
pXmlNode
=
pXmlNodes
->
nodeTab
[
0
];
xmlNodePtr
pXmlNode
=
pXmlNodes
->
nodeTab
[
0
];
return
OUString
::
createFromAscii
((
const
char
*
)((
pXmlNode
->
children
[
0
]).
content
));
OUString
s
(
OUString
::
createFromAscii
((
const
char
*
)((
pXmlNode
->
children
[
0
]).
content
)));
xmlXPathFreeObject
(
pXmlObj
);
return
s
;
}
}
void
XmlTestTools
::
assertXPath
(
xmlDocPtr
pXmlDoc
,
const
OString
&
rXPath
,
const
OString
&
rAttribute
,
const
OUString
&
rExpectedValue
)
void
XmlTestTools
::
assertXPath
(
xmlDocPtr
pXmlDoc
,
const
OString
&
rXPath
,
const
OString
&
rAttribute
,
const
OUString
&
rExpectedValue
)
...
@@ -75,9 +84,11 @@ void XmlTestTools::assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const O
...
@@ -75,9 +84,11 @@ void XmlTestTools::assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const O
void
XmlTestTools
::
assertXPath
(
xmlDocPtr
pXmlDoc
,
const
OString
&
rXPath
,
int
nNumberOfNodes
)
void
XmlTestTools
::
assertXPath
(
xmlDocPtr
pXmlDoc
,
const
OString
&
rXPath
,
int
nNumberOfNodes
)
{
{
xmlNodeSetPtr
pXmlNodes
=
getXPathNode
(
pXmlDoc
,
rXPath
);
xmlXPathObjectPtr
pXmlObj
=
getXPathNode
(
pXmlDoc
,
rXPath
);
xmlNodeSetPtr
pXmlNodes
=
pXmlObj
->
nodesetval
;
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
OString
(
"XPath '"
+
rXPath
+
"' number of nodes is incorrect"
).
getStr
(),
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
OString
(
"XPath '"
+
rXPath
+
"' number of nodes is incorrect"
).
getStr
(),
nNumberOfNodes
,
xmlXPathNodeSetGetLength
(
pXmlNodes
));
nNumberOfNodes
,
xmlXPathNodeSetGetLength
(
pXmlNodes
));
xmlXPathFreeObject
(
pXmlObj
);
}
}
void
XmlTestTools
::
assertXPathContent
(
xmlDocPtr
pXmlDoc
,
const
OString
&
rXPath
,
const
OUString
&
rContent
)
void
XmlTestTools
::
assertXPathContent
(
xmlDocPtr
pXmlDoc
,
const
OString
&
rXPath
,
const
OUString
&
rContent
)
...
@@ -87,17 +98,20 @@ void XmlTestTools::assertXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath,
...
@@ -87,17 +98,20 @@ void XmlTestTools::assertXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath,
void
XmlTestTools
::
assertXPathChildren
(
xmlDocPtr
pXmlDoc
,
const
OString
&
rXPath
,
int
nNumberOfChildNodes
)
void
XmlTestTools
::
assertXPathChildren
(
xmlDocPtr
pXmlDoc
,
const
OString
&
rXPath
,
int
nNumberOfChildNodes
)
{
{
xmlNodeSetPtr
pXmlNodes
=
getXPathNode
(
pXmlDoc
,
rXPath
);
xmlXPathObjectPtr
pXmlObj
=
getXPathNode
(
pXmlDoc
,
rXPath
);
xmlNodeSetPtr
pXmlNodes
=
pXmlObj
->
nodesetval
;
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
OString
(
"XPath '"
+
rXPath
+
"' number of nodes is incorrect"
).
getStr
(),
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
OString
(
"XPath '"
+
rXPath
+
"' number of nodes is incorrect"
).
getStr
(),
1
,
xmlXPathNodeSetGetLength
(
pXmlNodes
));
1
,
xmlXPathNodeSetGetLength
(
pXmlNodes
));
xmlNodePtr
pXmlNode
=
pXmlNodes
->
nodeTab
[
0
];
xmlNodePtr
pXmlNode
=
pXmlNodes
->
nodeTab
[
0
];
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
OString
(
"XPath '"
+
rXPath
+
"' number of child-nodes is incorrect"
).
getStr
(),
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
OString
(
"XPath '"
+
rXPath
+
"' number of child-nodes is incorrect"
).
getStr
(),
nNumberOfChildNodes
,
(
int
)
xmlChildElementCount
(
pXmlNode
));
nNumberOfChildNodes
,
(
int
)
xmlChildElementCount
(
pXmlNode
));
xmlXPathFreeObject
(
pXmlObj
);
}
}
int
XmlTestTools
::
getXPathPosition
(
xmlDocPtr
pXmlDoc
,
const
OString
&
rXPath
,
const
OUString
&
rChildName
)
int
XmlTestTools
::
getXPathPosition
(
xmlDocPtr
pXmlDoc
,
const
OString
&
rXPath
,
const
OUString
&
rChildName
)
{
{
xmlNodeSetPtr
pXmlNodes
=
getXPathNode
(
pXmlDoc
,
rXPath
);
xmlXPathObjectPtr
pXmlObj
=
getXPathNode
(
pXmlDoc
,
rXPath
);
xmlNodeSetPtr
pXmlNodes
=
pXmlObj
->
nodesetval
;
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
OString
(
"XPath '"
+
rXPath
+
"' number of nodes is incorrect"
).
getStr
(),
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
OString
(
"XPath '"
+
rXPath
+
"' number of nodes is incorrect"
).
getStr
(),
1
,
1
,
xmlXPathNodeSetGetLength
(
pXmlNodes
));
xmlXPathNodeSetGetLength
(
pXmlNodes
));
...
@@ -109,6 +123,7 @@ int XmlTestTools::getXPathPosition(xmlDocPtr pXmlDoc, const OString& rXPath, con
...
@@ -109,6 +123,7 @@ int XmlTestTools::getXPathPosition(xmlDocPtr pXmlDoc, const OString& rXPath, con
break
;
break
;
++
nRet
;
++
nRet
;
}
}
xmlXPathFreeObject
(
pXmlObj
);
return
nRet
;
return
nRet
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment