tdf#161509: Output the same special style names and identifiers as Word
Take care to match the case of the names. Some tools rely on specific case; so standardize on what Word outputs. getXPath is modified to tell which XPath has failed (needed for the unit test). Change-Id: I3e71f5905b26d7e784d68ba11ff205eefedaaa2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168755 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
This commit is contained in:
@@ -314,6 +314,57 @@ const ApiPaperSize& PaperSizeConv::getApiSizeForMSPaperSizeIndex( sal_Int32 nMSO
|
||||
|
||||
OUString CreateDOCXStyleId(std::u16string_view const aName)
|
||||
{
|
||||
// tdf#161509: some special style names have standard style IDs that don't match case
|
||||
static constexpr std::pair<std::u16string_view, OUString> specialCases[] = {
|
||||
{ u"heading 1", u"Heading1"_ustr },
|
||||
{ u"heading 2", u"Heading2"_ustr },
|
||||
{ u"heading 3", u"Heading3"_ustr },
|
||||
{ u"heading 4", u"Heading4"_ustr },
|
||||
{ u"heading 5", u"Heading5"_ustr },
|
||||
{ u"heading 6", u"Heading6"_ustr },
|
||||
{ u"heading 7", u"Heading7"_ustr },
|
||||
{ u"heading 8", u"Heading8"_ustr },
|
||||
{ u"heading 9", u"Heading9"_ustr },
|
||||
{ u"index 1", u"Index1"_ustr },
|
||||
{ u"index 2", u"Index2"_ustr },
|
||||
{ u"index 3", u"Index3"_ustr },
|
||||
{ u"index 4", u"Index4"_ustr },
|
||||
{ u"index 5", u"Index5"_ustr },
|
||||
{ u"index 6", u"Index6"_ustr },
|
||||
{ u"index 7", u"Index7"_ustr },
|
||||
{ u"index 8", u"Index8"_ustr },
|
||||
{ u"index 9", u"Index9"_ustr },
|
||||
{ u"toc 1", u"TOC1"_ustr },
|
||||
{ u"toc 2", u"TOC2"_ustr },
|
||||
{ u"toc 3", u"TOC3"_ustr },
|
||||
{ u"toc 4", u"TOC4"_ustr },
|
||||
{ u"toc 5", u"TOC5"_ustr },
|
||||
{ u"toc 6", u"TOC6"_ustr },
|
||||
{ u"toc 7", u"TOC7"_ustr },
|
||||
{ u"toc 8", u"TOC8"_ustr },
|
||||
{ u"toc 9", u"TOC9"_ustr },
|
||||
{ u"footnote text", u"FootnoteText"_ustr },
|
||||
{ u"annotation text", u"CommentText"_ustr },
|
||||
{ u"header", u"Header"_ustr },
|
||||
{ u"footer", u"Footer"_ustr },
|
||||
{ u"index heading", u"IndexHeading"_ustr },
|
||||
{ u"caption", u"Caption"_ustr },
|
||||
{ u"table of figures", u"TableofFigures"_ustr },
|
||||
{ u"envelope address", u"EnvelopeAddress"_ustr },
|
||||
{ u"envelope return", u"EnvelopeReturn"_ustr },
|
||||
{ u"footnote reference", u"FootnoteReference"_ustr },
|
||||
{ u"annotation reference", u"CommentReference"_ustr },
|
||||
{ u"line number", u"LineNumber"_ustr },
|
||||
{ u"page number", u"PageNumber"_ustr },
|
||||
{ u"endnote reference", u"EndnoteReference"_ustr },
|
||||
{ u"endnote text", u"EndnoteText"_ustr },
|
||||
{ u"table of authorities", u"TableofAuthorities"_ustr },
|
||||
{ u"macro", u"MacroText"_ustr },
|
||||
};
|
||||
for (const auto& [stiName, id] : specialCases)
|
||||
if (aName == stiName)
|
||||
return id;
|
||||
|
||||
OUStringBuffer aStyleIdBuf(aName.size());
|
||||
for (size_t i = 0; i < aName.size(); ++i)
|
||||
{
|
||||
|
BIN
sw/qa/extras/ooxmlexport/data/special_styles.docx
Normal file
BIN
sw/qa/extras/ooxmlexport/data/special_styles.docx
Normal file
Binary file not shown.
@@ -831,9 +831,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf153664)
|
||||
CPPUNIT_ASSERT(pXmlStyles);
|
||||
// Without the fix this was styleId='FigureIndex1' and name was "Figure Index 1"
|
||||
// This led to style settings being reset when ToF was updated in Word
|
||||
// TOF's paragraph style should be exported as "Table of Figures" as that's the default Word style name
|
||||
// TOF's paragraph style should be exported as "table of figures" as that's the default Word style name
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[12]"_ostr, "styleId"_ostr, u"TableofFigures"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TableofFigures']/w:name"_ostr, "val"_ostr, u"Table of Figures"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TableofFigures']/w:name"_ostr, "val"_ostr, u"table of figures"_ustr);
|
||||
}
|
||||
|
||||
DECLARE_OOXMLEXPORT_TEST(testTdf124472_hyperlink, "tdf124472.docx")
|
||||
|
@@ -614,6 +614,197 @@ CPPUNIT_TEST_FIXTURE(Test, testEmptyObjectRange)
|
||||
loadAndSave("cloud.docx");
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(Test, testTdf161509)
|
||||
{
|
||||
loadAndReload("special_styles.docx");
|
||||
xmlDocUniquePtr pXmlStyles = parseExport(u"word/styles.xml"_ustr);
|
||||
CPPUNIT_ASSERT(pXmlStyles);
|
||||
|
||||
// Check the mapping of standard style names to their IDs
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Normal']/w:name"_ostr, "val"_ostr,
|
||||
u"Normal"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading1']/w:name"_ostr, "val"_ostr,
|
||||
u"heading 1"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading2']/w:name"_ostr, "val"_ostr,
|
||||
u"heading 2"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading3']/w:name"_ostr, "val"_ostr,
|
||||
u"heading 3"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading4']/w:name"_ostr, "val"_ostr,
|
||||
u"heading 4"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading5']/w:name"_ostr, "val"_ostr,
|
||||
u"heading 5"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading6']/w:name"_ostr, "val"_ostr,
|
||||
u"heading 6"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading7']/w:name"_ostr, "val"_ostr,
|
||||
u"heading 7"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading8']/w:name"_ostr, "val"_ostr,
|
||||
u"heading 8"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading9']/w:name"_ostr, "val"_ostr,
|
||||
u"heading 9"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Index1']/w:name"_ostr, "val"_ostr,
|
||||
u"index 1"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Index2']/w:name"_ostr, "val"_ostr,
|
||||
u"index 2"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Index3']/w:name"_ostr, "val"_ostr,
|
||||
u"index 3"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Index4']/w:name"_ostr, "val"_ostr,
|
||||
u"index 4"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Index5']/w:name"_ostr, "val"_ostr,
|
||||
u"index 5"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Index6']/w:name"_ostr, "val"_ostr,
|
||||
u"index 6"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Index7']/w:name"_ostr, "val"_ostr,
|
||||
u"index 7"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Index8']/w:name"_ostr, "val"_ostr,
|
||||
u"index 8"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Index9']/w:name"_ostr, "val"_ostr,
|
||||
u"index 9"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TOC1']/w:name"_ostr, "val"_ostr,
|
||||
u"toc 1"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TOC2']/w:name"_ostr, "val"_ostr,
|
||||
u"toc 2"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TOC3']/w:name"_ostr, "val"_ostr,
|
||||
u"toc 3"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TOC4']/w:name"_ostr, "val"_ostr,
|
||||
u"toc 4"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TOC5']/w:name"_ostr, "val"_ostr,
|
||||
u"toc 5"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TOC6']/w:name"_ostr, "val"_ostr,
|
||||
u"toc 6"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TOC7']/w:name"_ostr, "val"_ostr,
|
||||
u"toc 7"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TOC8']/w:name"_ostr, "val"_ostr,
|
||||
u"toc 8"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TOC9']/w:name"_ostr, "val"_ostr,
|
||||
u"toc 9"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='NormalIndent']/w:name"_ostr, "val"_ostr,
|
||||
u"Normal Indent"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='FootnoteText']/w:name"_ostr, "val"_ostr,
|
||||
u"footnote text"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='CommentText']/w:name"_ostr, "val"_ostr,
|
||||
u"annotation text"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Header']/w:name"_ostr, "val"_ostr,
|
||||
u"header"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Footer']/w:name"_ostr, "val"_ostr,
|
||||
u"footer"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='IndexHeading']/w:name"_ostr, "val"_ostr,
|
||||
u"index heading"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Caption']/w:name"_ostr, "val"_ostr,
|
||||
u"caption"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TableofFigures']/w:name"_ostr,
|
||||
"val"_ostr, u"table of figures"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='EnvelopeAddress']/w:name"_ostr,
|
||||
"val"_ostr, u"envelope address"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='EnvelopeReturn']/w:name"_ostr,
|
||||
"val"_ostr, u"envelope return"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='FootnoteReference']/w:name"_ostr,
|
||||
"val"_ostr, u"footnote reference"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='CommentReference']/w:name"_ostr,
|
||||
"val"_ostr, u"annotation reference"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='LineNumber']/w:name"_ostr, "val"_ostr,
|
||||
u"line number"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='PageNumber']/w:name"_ostr, "val"_ostr,
|
||||
u"page number"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='EndnoteReference']/w:name"_ostr,
|
||||
"val"_ostr, u"endnote reference"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='EndnoteText']/w:name"_ostr, "val"_ostr,
|
||||
u"endnote text"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TableofAuthorities']/w:name"_ostr,
|
||||
"val"_ostr, u"table of authorities"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='MacroText']/w:name"_ostr, "val"_ostr,
|
||||
u"macro"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TOCHeading']/w:name"_ostr, "val"_ostr,
|
||||
u"TOC Heading"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='List']/w:name"_ostr, "val"_ostr,
|
||||
u"List"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='ListBullet']/w:name"_ostr, "val"_ostr,
|
||||
u"List Bullet"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='ListNumber']/w:name"_ostr, "val"_ostr,
|
||||
u"List Number"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='List2']/w:name"_ostr, "val"_ostr,
|
||||
u"List 2"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='List3']/w:name"_ostr, "val"_ostr,
|
||||
u"List 3"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='List4']/w:name"_ostr, "val"_ostr,
|
||||
u"List 4"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='List5']/w:name"_ostr, "val"_ostr,
|
||||
u"List 5"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='ListBullet2']/w:name"_ostr, "val"_ostr,
|
||||
u"List Bullet 2"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='ListBullet3']/w:name"_ostr, "val"_ostr,
|
||||
u"List Bullet 3"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='ListBullet4']/w:name"_ostr, "val"_ostr,
|
||||
u"List Bullet 4"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='ListBullet5']/w:name"_ostr, "val"_ostr,
|
||||
u"List Bullet 5"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='ListNumber2']/w:name"_ostr, "val"_ostr,
|
||||
u"List Number 2"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='ListNumber3']/w:name"_ostr, "val"_ostr,
|
||||
u"List Number 3"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='ListNumber4']/w:name"_ostr, "val"_ostr,
|
||||
u"List Number 4"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='ListNumber5']/w:name"_ostr, "val"_ostr,
|
||||
u"List Number 5"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Title']/w:name"_ostr, "val"_ostr,
|
||||
u"Title"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Closing']/w:name"_ostr, "val"_ostr,
|
||||
u"Closing"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Signature']/w:name"_ostr, "val"_ostr,
|
||||
u"Signature"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='DefaultParagraphFont']/w:name"_ostr,
|
||||
"val"_ostr, u"Default Paragraph Font"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='BodyText']/w:name"_ostr, "val"_ostr,
|
||||
u"Body Text"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='BodyTextIndent']/w:name"_ostr,
|
||||
"val"_ostr, u"Body Text Indent"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='ListContinue']/w:name"_ostr, "val"_ostr,
|
||||
u"List Continue"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='ListContinue2']/w:name"_ostr, "val"_ostr,
|
||||
u"List Continue 2"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='ListContinue3']/w:name"_ostr, "val"_ostr,
|
||||
u"List Continue 3"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='ListContinue4']/w:name"_ostr, "val"_ostr,
|
||||
u"List Continue 4"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='ListContinue5']/w:name"_ostr, "val"_ostr,
|
||||
u"List Continue 5"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='MessageHeader']/w:name"_ostr, "val"_ostr,
|
||||
u"Message Header"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Subtitle']/w:name"_ostr, "val"_ostr,
|
||||
u"Subtitle"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Salutation']/w:name"_ostr, "val"_ostr,
|
||||
u"Salutation"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Date']/w:name"_ostr, "val"_ostr,
|
||||
u"Date"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='BodyTextFirstIndent']/w:name"_ostr,
|
||||
"val"_ostr, u"Body Text First Indent"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='BodyTextFirstIndent2']/w:name"_ostr,
|
||||
"val"_ostr, u"Body Text First Indent 2"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='NoteHeading']/w:name"_ostr, "val"_ostr,
|
||||
u"Note Heading"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='BodyText2']/w:name"_ostr, "val"_ostr,
|
||||
u"Body Text 2"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='BodyText3']/w:name"_ostr, "val"_ostr,
|
||||
u"Body Text 3"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='BodyTextIndent2']/w:name"_ostr,
|
||||
"val"_ostr, u"Body Text Indent 2"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='BodyTextIndent3']/w:name"_ostr,
|
||||
"val"_ostr, u"Body Text Indent 3"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='BlockText']/w:name"_ostr, "val"_ostr,
|
||||
u"Block Text"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Hyperlink']/w:name"_ostr, "val"_ostr,
|
||||
u"Hyperlink"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='FollowedHyperlink']/w:name"_ostr,
|
||||
"val"_ostr, u"FollowedHyperlink"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Strong']/w:name"_ostr, "val"_ostr,
|
||||
u"Strong"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Emphasis']/w:name"_ostr, "val"_ostr,
|
||||
u"Emphasis"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='DocumentMap']/w:name"_ostr, "val"_ostr,
|
||||
u"Document Map"_ustr);
|
||||
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='PlainText']/w:name"_ostr, "val"_ostr,
|
||||
u"Plain Text"_ustr);
|
||||
}
|
||||
|
||||
} // end of anonymous namespace
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
|
@@ -27,54 +27,55 @@ namespace
|
||||
const char **GetStiNames() noexcept
|
||||
{
|
||||
// Matches enum ww::sti in sw/source/filter/inc/wwstyles.hxx
|
||||
// tdf#161509: The case of the names must match Word-generated document's w:latentStyles
|
||||
static const char *stiName[] =
|
||||
{
|
||||
"Normal", // stiNormal
|
||||
"Heading 1", // stiLev1
|
||||
"Heading 2", // stiLev2
|
||||
"Heading 3", // stiLev3
|
||||
"Heading 4", // stiLev4
|
||||
"Heading 5", // stiLev5
|
||||
"Heading 6", // stiLev6
|
||||
"Heading 7", // stiLev7
|
||||
"Heading 8", // stiLev8
|
||||
"Heading 9", // stiLev9
|
||||
"Index 1", // stiIndex1
|
||||
"Index 2", // stiIndex2
|
||||
"Index 3", // stiIndex3
|
||||
"Index 4", // stiIndex4
|
||||
"Index 5", // stiIndex5
|
||||
"Index 6", // stiIndex6
|
||||
"Index 7", // stiIndex7
|
||||
"Index 8", // stiIndex8
|
||||
"Index 9", // stiIndex9
|
||||
"TOC 1", // stiToc1
|
||||
"TOC 2", // stiToc2
|
||||
"TOC 3", // stiToc3
|
||||
"TOC 4", // stiToc4
|
||||
"TOC 5", // stiToc5
|
||||
"TOC 6", // stiToc6
|
||||
"TOC 7", // stiToc7
|
||||
"TOC 8", // stiToc8
|
||||
"TOC 9", // stiToc9
|
||||
"heading 1", // stiLev1
|
||||
"heading 2", // stiLev2
|
||||
"heading 3", // stiLev3
|
||||
"heading 4", // stiLev4
|
||||
"heading 5", // stiLev5
|
||||
"heading 6", // stiLev6
|
||||
"heading 7", // stiLev7
|
||||
"heading 8", // stiLev8
|
||||
"heading 9", // stiLev9
|
||||
"index 1", // stiIndex1
|
||||
"index 2", // stiIndex2
|
||||
"index 3", // stiIndex3
|
||||
"index 4", // stiIndex4
|
||||
"index 5", // stiIndex5
|
||||
"index 6", // stiIndex6
|
||||
"index 7", // stiIndex7
|
||||
"index 8", // stiIndex8
|
||||
"index 9", // stiIndex9
|
||||
"toc 1", // stiToc1
|
||||
"toc 2", // stiToc2
|
||||
"toc 3", // stiToc3
|
||||
"toc 4", // stiToc4
|
||||
"toc 5", // stiToc5
|
||||
"toc 6", // stiToc6
|
||||
"toc 7", // stiToc7
|
||||
"toc 8", // stiToc8
|
||||
"toc 9", // stiToc9
|
||||
"Normal Indent", // stiNormIndent
|
||||
"Footnote Text", // stiFootnoteText
|
||||
"Annotation Text", // stiAtnText
|
||||
"Header", // stiHeader
|
||||
"Footer", // stiFooter
|
||||
"Index Heading", // stiIndexHeading
|
||||
"Caption", // stiCaption
|
||||
"Table of Figures", // stiToCaption
|
||||
"Envelope Address", // stiEnvAddr
|
||||
"Envelope Return", // stiEnvRet
|
||||
"Footnote Reference", // stiFootnoteRef
|
||||
"Annotation Reference", // stiAtnRef
|
||||
"Line Number", // stiLnn
|
||||
"Page Number", // stiPgn
|
||||
"Endnote Reference", // stiEdnRef
|
||||
"Endnote Text", // stiEdnText
|
||||
"Table of Authorities", // stiToa
|
||||
"Macro Text", // stiMacro
|
||||
"footnote text", // stiFootnoteText
|
||||
"annotation text", // stiAtnText
|
||||
"header", // stiHeader
|
||||
"footer", // stiFooter
|
||||
"index heading", // stiIndexHeading
|
||||
"caption", // stiCaption
|
||||
"table of figures", // stiToCaption
|
||||
"envelope address", // stiEnvAddr
|
||||
"envelope return", // stiEnvRet
|
||||
"footnote reference", // stiFootnoteRef
|
||||
"annotation reference", // stiAtnRef
|
||||
"line number", // stiLnn
|
||||
"page number", // stiPgn
|
||||
"endnote reference", // stiEdnRef
|
||||
"endnote text", // stiEdnText
|
||||
"table of authorities", // stiToa
|
||||
"macro", // stiMacro
|
||||
"TOC Heading", // stiToaHeading - tdf143726
|
||||
"List", // stiList
|
||||
"List Bullet", // stiListBullet
|
||||
|
@@ -90,16 +90,16 @@ OUString XmlTestTools::getXPath(const xmlDocUniquePtr& pXmlDoc, const OString& r
|
||||
{
|
||||
CPPUNIT_ASSERT(pXmlDoc);
|
||||
xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath);
|
||||
CPPUNIT_ASSERT(pXmlObj);
|
||||
OString docAndXPath = OString::Concat("In <") + pXmlDoc->name + ">, XPath '" + rXPath;
|
||||
CPPUNIT_ASSERT_MESSAGE(docAndXPath.getStr(), pXmlObj);
|
||||
xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
|
||||
CPPUNIT_ASSERT(pXmlNodes);
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OString::Concat("In <") + pXmlDoc->name + ">, XPath '" + rXPath + "' number of nodes is incorrect").getStr(),
|
||||
CPPUNIT_ASSERT_MESSAGE(OString(docAndXPath + "' not found").getStr(), pXmlNodes);
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(docAndXPath + "' number of nodes is incorrect").getStr(),
|
||||
1, xmlXPathNodeSetGetLength(pXmlNodes));
|
||||
CPPUNIT_ASSERT(!rAttribute.isEmpty());
|
||||
xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
|
||||
xmlChar * prop = xmlGetProp(pXmlNode, BAD_CAST(rAttribute.getStr()));
|
||||
OString sAttAbsent = OString::Concat("In <") + pXmlDoc->name + ">, XPath '" + rXPath
|
||||
+ "' no attribute '" + rAttribute + "' exist";
|
||||
OString sAttAbsent = docAndXPath + "' no attribute '" + rAttribute + "' exist";
|
||||
CPPUNIT_ASSERT_MESSAGE(sAttAbsent.getStr(), prop);
|
||||
OUString s(convert(prop));
|
||||
xmlFree(prop);
|
||||
|
Reference in New Issue
Block a user