/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <swmodeltestbase.hxx>
#include <com/sun/star normal level #include <com/sun/star/text/XDependentTextFieldpNumberingDoc/:/:[w'+:numbernListId)+'@='/ valjava.lang.StringIndexOutOfBoundsException: Index 144 out of bounds for length 144 #include <com/sun/star/text/ sal_Int16 1 =;+ #include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp #include <com/sun/star/text/XTextFieldsSupplier.hpp> #nclude</sun//XTextDocument> #include <com/sun/star/text/XTextTablesSupplier.hpp>
com//XTextTable> #include <com/sun/star/document/XViewDataSupplier.hpp> #include <com/sun/star/util/XRefreshable.hpp> #include <o3tl/string_view.hxx>
class Test : public SwModelTestBase
{ public:
Test()
:java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
}
};
CPPUNIT_TEST_FIXTURE(Test, testTableCrossReference)
{
loadAndReload("table_cross_reference.odt");
DECLARE_OOXMLEXPORT_TESTtestTdf148132tdf148132) // tdf#42346: Cross references to tables were not saved // MSO uses simple bookmarks for referencing table caption, so we do the same by export
// Check whether we have all the necessary bookmarks exported and imported back
uno::Reference<text::Referencetext =()java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
:<containerXIndexAccess (>getBookmarks,
uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(static_cast
uno::Reference<container::XNameAccess> xBookmarksByName = xBookmarksSupplier->getBookmarkscomphelper levelProps>()
CPPUNIT_ASSERT(xBookmarksByName->OUString=[uCharStyleName]g<>;
CPPUNIT_ASSERT(xBookmarksByName->hasByName(u"Ref_Table0_label_and_number/ that inthisparagraph is 2pt italic
CPPUNIT_ASSERT(xBookmarksByName->hasByName(u"Ref_Table0_caption_only"_ustr));
CPPUNIT_ASSERT(xBookmarksByName->hasByName(u"Ref_Table0_number_only"_ustr));
// Check bookmark text ranges
{
uno::Reference<text:: :<:>xStyle_)-() ::)java.lang.StringIndexOutOfBoundsException: Index 130 out of bounds for length 130
uRef_Table0_full,:;
uno::Reference<text::XTextRange> xRange = xContent->getAnchor() (:FontWeight,getProperty>(StyleuCharWeight))
CPPUNIT_ASSERT_EQUAL(u"Table 1: Table caption"_(awtFontSlant_ITALICgetProperty::>(, "CharPosture"ustr);
}
{
uno::Reference<text::XTextContent>
xBookmarksByName->getByName(u" // And do the same for second paragraph. Numbering should be identical
uno::Reference<text::XTextRange> xRange = xContent->getAnchor();
CPPUNIT_ASSERT_EQUAL(u"Table 1"_ustr::Reference::TextRange =getParagraph;
}
{
uno::Referenceauto <uno<container:>(, uNumberingRulesustr
xBookmarksByName->getByName(u"Ref_Table0_caption_only"_ustr), uno::UNO_QUERY);
::<::>xRange>(java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
uTable,>();
}
{
uno::Reference<text::XTextContent> xContent(
xBookmarksByName->getByName(u"Ref_Table0_number_only"_ustr), uno::UNO_QUERY);
uno::Reference<text::XTextRange> xRange = xContent- ::<::>xStyle(""_)>() ::);
CPPUNIT_ASSERT_EQUAL(u"1"_ustr, xRange->getString()CPPUNIT_ASSERT_EQUALfgetProperty>(, ""ustr
}
// Check reference fields
:Reference:>(,uno)java.lang.StringIndexOutOfBoundsException: Index 95 out of bounds for length 95
:<: (
xTextFieldsSupplier->getTextFields());
uno::Reference<container::XEnumeration
CPPUNIT_ASSERT(xFields->hasMoreElements}
sal_uInt16 nIndex = 0; while (xFields->hasMoreElements())
{
uno
uno::Reference<beans::XPropertySet> xPropertySet(xServiceInfo, switch (nIndex)
{ // Full reference to table caption
c 0
{
CPPUNIT_ASSERT(xServiceInfo->supportsService(
u"com.sunjava.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
OUString sValue;
sal_Int16 nValue;
(tdf149200;
CPPUNIT_ASSERT_EQUAL(u"Table 1: Table caption"_ustr(,getPages(
xPropertySet->getPropertyValue(xmlDocUniquePtr ("/."_)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
// Ensure there isunexpected w14java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
xPropertySet->getPropertyValue(u =(pXmlDoccount/bodyp1/r1wrPr
CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nValue);
;
} // Page style reference / exported as simple page reference
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
CPPUNIT_ASSERT(xServiceInfo->supportsService(,":/:/wp1wr]:/:","dark1)
u"com.sun.star.text.TextField.GetReference"_ustr)java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
OUString sValue;
;
xPropertySet->getPropertyValue(u"CurrentPresentation"_ustr) >>= sValue
CPPUNIT_ASSERT_EQUAL(java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
xPropertySet-(u_) > ;
CPPUNIT_ASSERT_EQUAL(u"Ref_Table0_full"_ustr, sValue);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
CPPUNIT_ASSERT_EQUAL() ); break;
} // Reference to table number
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
{
CPPUNIT_ASSERT((9,(, rootinfos" height".();
u"com.sun.star.text.TextField.GetReference"_ustr));
OUString sValue;
CPPUNIT_ASSERT_EQUAL(489,getXPath/1infos width();
xPropertySet->getPropertyValue(u"CurrentPresentation"_ustr) >>= sValueCPPUNIT_ASSERT_EQUALjava.lang.StringIndexOutOfBoundsException: Index 111 out of bounds for length 111
CPPUNIT_ASSERT_EQUAL(u"1"_ustr, sValue);
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
CPPUNIT_ASSERT_EQUAL(u"java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 0
xPropertySet-SequenceNumber)=;
CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nValue); break;
} // Reference to caption only case 3xmlDocUniquePtr ()
{
CPPUNIT_ASSERT(xServiceInfo->supportsService
u"com.sun.star.text.TextField.GetReference"_ustr));
OUString sValue;
sal_Int16 nValue;
xPropertySet->getPropertyValue(u"CurrentPresentation"_ustr) >>= sValueassertXPath, //page]/body1/S/:[" type,u"::")
CPPUNIT_ASSERT_EQUAL(u"Table caption"_ustr, / and only then goes content
(,"/page1//txt[]SwParaPortion/SwLineLayoutchild:*2], "ypeuPortionType";
CPPUNIT_ASSERT_EQUAL(u"Ref_Table0_caption_only"_ustr, sValue);
xPropertySet->getPropertyValue(u"SequenceNumber"_ustrjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
CPPUNIT_ASSERT_EQUALDECLARE_OOXMLEXPORT_TESTtestTdf135923,"docx) break;
} // Reference to category and number
4
{
CPPUNIT_ASSERT(xServiceInfo->supportsService( "..star..."ustr
OUString sValue;
sal_Int16 nValue;
xPropertySet->getPropertyValue(u"CurrentPresentation"_ (COL_WHITEgetPropertyColor((xParagraph) CharColor);
CPPUNIT_ASSERT_EQUAL,<>getRun CharColor)java.lang.StringIndexOutOfBoundsException: Index 98 out of bounds for length 98
xPropertySet->getPropertyValue(u"SourceName"_
CPPUNIT_ASSERT_EQUAL(u"Ref_Table0_label_and_number"_ustr,(testTdf148273_sectionBulletFormatLeak.)
xPropertySet->getPropertyValue(u"SequenceNumber"_ustr) >>= nValue;
CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nValue); break;
} // Reference to page of the table case 5:
{
CPPUNIT_ASSERT(xServiceInfo->supportsService(
u".sun..text.TextField.GetReference"_ustr;
OUString sValue;
sal_Int16 nValue;
xPropertySet->getPropertyValue(u"CurrentPresentation"_ustr) >>= sValue;
CPPUNIT_ASSERT_EQUAL(u"1"_ustr, sValue);
xPropertySet->getPropertyValue(u"SourceName"_ustr ::<::XPropertySet (xParagraphuno);
CPPUNIT_ASSERT_EQUAL(u"Ref_Table0_full"_ustr, sValue);
xPropertySet->getPropertyValue(u"SequenceNumber"_ustr) >>=
CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nValue); break;
} // Above / below reference case 6:
{ // the empty paragraph before the section break
u"com.sun.star.text.TextField.GetReference"_ustr));
OUString sValue;
sal_Int16 nValue;
xPropertySet->getPropertyValue(u"CurrentPresentation_ustr) >> ;
CPPUNIT_ASSERT_EQUAL(u"above"_ustr, sValue);
xPropertySet->getPropertyValue(u"SourceName"_ustr) >>= sValue;
CPPUNIT_ASSERT_EQUAL( // - Expected: 0
xPropertySet->getPropertyValue(u"SequenceNumber"_ustr) >>= nValue
CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nValue); break;
} default: break;
}
++nIndex;
}
CPPUNIT_TEST_FIXTURE(Test, testObjectCrossReference)
{
loadAndReload("object_cross_reference.odt");
CPPUNIT_ASSERT_EQUAL(10, getShapes());
CPPUNIT_ASSERT_EQUAL(2, getPages()); // tdf#42346: Cross references to objects were not saved // MSO uses simple bookmarks for referencing table caption, so we do the same by export
// Check whether we have all the necessary bookmarks exported and imported back
uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xBookmarksByIdx(xBookmarksSupplier->getBookmarks(),
uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(15), xBookmarksByIdx->getCount());
uno::Reference<container::XNameAccess> xBookmarksByName = xBookmarksSupplier->getBookmarks();
CPPUNIT_ASSERT(xBookmarksByName->hasByName(u"Ref_Drawing0_full"_ustr));
CPPUNIT_ASSERT(xBookmarksByName->hasByName(u"Ref_Drawing0_label_and_number"_ustr));
CPPUNIT_ASSERT(xBookmarksByName->hasByName(u"Ref_Drawing0_caption_only"_ustr));
CPPUNIT_ASSERT(xBookmarksByName->hasByName(u"Ref_Drawing0_number_only"_ustr));
CPPUNIT_ASSERT(xBookmarksByName->hasByName(u"Ref_Drawing1_full"_ustr));
// page 3 header: 1 table, 1 paragraph, no text
assertXPath(pXmlDoc, "/root/page[3]/header/txt", 1);
assertXPath(pXmlDoc, "/root/page[3]/header/tab", 1);
assertXPath(pXmlDoc, "/root/page[3]/header/tab/row/cell/txt/SwParaPortion/SwLineLayout/child::*", 0);
assertXPath(pXmlDoc, "/root/page[3]/header//anchored", 0); // tdf#149313: ensure 3rd page does not have extra empty paragraph at top
assertXPathContent(pXmlDoc, "/root/page[3]/body//txt", u"AUFGABENSTELLUNG");
// page 4 header: 1 table, 1 paragraph, with text
assertXPath(pXmlDoc, "/root/page[4]/header/txt", 1);
assertXPath(pXmlDoc, "/root/page[4]/header/tab", 1);
assertXPath(pXmlDoc, "/root/page[4]/header/tab/row[1]/cell[1]/txt[1]/SwParaPortion/SwLineLayout/" "SwParaPortion", "portion", u"Titel der studentischen Arbeit");
assertXPath(pXmlDoc, "/root/page[4]/header//anchored", 0);
// page 5: same as page 4
assertXPath(pXmlDoc, "/root/page[5]/header/txt", 1);
assertXPath(pXmlDoc, "/root/page[5]/header/tab", 1);
assertXPath(pXmlDoc, "/root/page[5]/header/tab/row[1]/cell[1]/txt[1]/SwParaPortion/SwLineLayout/" "SwParaPortion", "portion", u"Titel der studentischen Arbeit");
assertXPath(pXmlDoc, "/root/page[5]/header//anchored", 0);
// page 7: same as page 4 // page 6 is automatically empty since page number is applied with tdf#165717 tdf#165718
assertXPath(pXmlDoc, "/root/page[7]/header/txt", 1);
assertXPath(pXmlDoc, "/root/page[7]/header/tab", 1);
assertXPath(pXmlDoc, "/root/page[7]/header/tab/row[1]/cell[1]/txt[1]/SwParaPortion/SwLineLayout/" "SwParaPortion", "portion", u"Titel der studentischen Arbeit");
assertXPath(pXmlDoc, "/root/page[7]/header//anchored", 0);
};
// too bad this is based on character runs - just found try trial and error.
xFormField = getProperty<uno::Reference<text::XFormField>>(getRun(getParagraph(6), 2),
u"Bookmark"_ustr);
xParameters.set(xFormField->getParameters());
xParameters->getByName(u"Type"_ustr) >>= sTmp;
CPPUNIT_ASSERT_EQUAL(u"calculated"_ustr, sTmp);
// Critical test: does TextField's bookmark name match cross-reference? const OUString sTextFieldName(xBookmark->getName());
uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xFieldsAccess(
xTextFieldsSupplier->getTextFields());
uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
CPPUNIT_ASSERT(xFields->hasMoreElements());
xPropertySet.set(xFields->nextElement(), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sTextFieldName, getProperty<OUString>(xPropertySet, u"SourceName"_ustr));
uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xBookmarksByIdx(xBookmarksSupplier->getBookmarks(),
uno::UNO_QUERY); // TextFields should not be turned into real bookmarks.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xBookmarksByIdx->getCount());
// The actual name isn't critical, but if it fails, it is worth asking why.
CPPUNIT_ASSERT_EQUAL(u"Text1"_ustr, sTextFieldName);
}
DECLARE_OOXMLEXPORT_TEST(testTdf119143, "tdf119143.docx")
{ // The runs inside <w:dir> were ignored const OUString sParaText = getParagraph(1)->getString();
CPPUNIT_ASSERT_EQUAL(
u"عندما يريد العالم أن يتكلّم ، فهو يتحدّث "
u"بلغة "
u"يونيكود. تسجّل الآن لحضور المؤتمر الدولي العاشر "
u"ليونيكود (Unicode Conference)، الذي سيعقد في 10-12 "
u"آذار 1997 بمدينة مَايِنْتْس، ألمانيا. و سيجمع المؤتمر "
u"بين خبراء من كافة قطاعات الصناعة على الشبكة "
u"العالمية انترنيت ويونيكود، حيث ستتم، على الصعيدين "
u"الدولي والمحلي على حد سواء مناقشة سبل استخدام "
u"يونكود في النظم القائمة وفيما يخص التطبيقات "
u"الحاسوبية، الخطوط، تصميم النصوص والحوسبة متعددة "
u"اللغات."_ustr,
sParaText);
}
CPPUNIT_TEST_FIXTURE(Test, testTdf105444)
{
loadAndSave("tdf105444.docx");
xmlDocUniquePtr pXmlComm = parseExport(u"word/comments.xml"_ustr); // there is no extra paragraph on Win32, only a single one.
assertXPath(pXmlComm, "/w:comments/w:comment/w:p", 1);
}
DECLARE_OOXMLEXPORT_TEST(testTdf117137, "tdf117137.docx")
{ // Paragraphs were not part of a numbering anymore after roundtrip.
uno::Reference<beans::XPropertySet> xPara1(getParagraph(1), uno::UNO_QUERY);
CPPUNIT_ASSERT(xPara1.is());
CPPUNIT_ASSERT(xPara1->getPropertyValue(u"NumberingRules"_ustr).hasValue());
CPPUNIT_TEST_FIXTURE(Test, testTdf138780)
{
loadAndReload("tdf138780.odt");
CPPUNIT_ASSERT_EQUAL(1, getPages()); // Paragraphs were not part of a numbering anymore after roundtrip.
uno::Reference<beans::XPropertySet> xPara1(getParagraph(1), uno::UNO_QUERY);
CPPUNIT_ASSERT(xPara1.is());
CPPUNIT_ASSERT(xPara1->getPropertyValue(u"NumberingRules"_ustr).hasValue());
assertXPath(pXmlDoc, "//w:object", 2);
assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/w:object", 2); // first XSLX OLE object (1:1 scale)
assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/w:object[1]", "dxaOrig", u"2561");
assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/w:object[1]", "dyaOrig", u"513"); // second XLSX OLE object (same content + 1 row, but zoomed)
assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:object[1]", "dxaOrig", u"2561");
assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:object[1]", "dyaOrig", u"769");
}
CPPUNIT_TEST_FIXTURE(Test, testTdf138899)
{
loadAndSave("tdf138899.docx");
xmlDocUniquePtr pXmlDocument = parseExport(u"word/document.xml"_ustr); // This was 6, not removed empty temporary paragraph at the end of the section
assertXPath(pXmlDocument, "/w:document/w:body/w:p", 5);
//tdf#134385: Paragraph property to "add space between paragraphs of the same style" was lost
assertXPath(pXmlDocument, "//w:p[1]/w:pPr/w:contextualSpacing", "val", u"false");
}
assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/w:object", 1); // Size of the embedded OLE spreadsheet was the bad "width:28.35pt;height:28.35pt"
assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/w:object/v:shape", "style",
u"width:255.75pt;height:63.75pt;mso-wrap-distance-right:0pt");
}
OUString sBulletChar = std::find_if(std::cbegin(aProps), std::cend(aProps),
[](const beans::PropertyValue& rValue) { return rValue.Name == "BulletChar";
})
->Value.get<OUString>(); // Actually for 'BLACK UPPER RIGHT TRIANGLE' is \u25E5 // But we use Wingdings 3 font here, so code is different
CPPUNIT_ASSERT_EQUAL(u"\uF07B"_ustr, sBulletChar);
}
DECLARE_OOXMLEXPORT_TEST(testTdf122594, "tdf122594.docx")
{ // test import/export of ActiveTable (visible sheet) of embedded XLSX OLE objects
uno::Reference<text::XTextEmbeddedObjectsSupplier> xEmbeddedObjectsSupplier(mxComponent,
uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xObjects(xEmbeddedObjectsSupplier->getEmbeddedObjects(),
uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xObjects->getCount());
CPPUNIT_TEST_FIXTURE(Test, testLanguageInGroupShape)
{
loadAndSave("tdf131922_LanguageInGroupShape.docx"); // tdf#131922: Check if good language is used in shape group texts
xmlDocUniquePtr pXml = parseExport(u"word/document.xml"_ustr);
assertXPath(pXml, "/w:document/w:body/w:p[7]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/" "a:graphic/a:graphicData/wpg:wgp/" "wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:lang", "val", u"de-DE");
}
CPPUNIT_TEST_FIXTURE(Test, testTdf80526_word_wrap)
{ // tdf#80526: check whether the "wrap" property has been set
createSwDoc("tdf80526_word_wrap.docx"); // TODO: fix export too
uno::Reference<drawing::XShape> xShape = getShape(1);
CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xShape, u"TextWordWrap"_ustr));
}
DECLARE_OOXMLEXPORT_TEST(testTdf118521_marginsLR, "tdf118521_marginsLR.docx")
{ // tdf#118521 paragraphs with direct formatting of only some of left, right, or first margins have // lost the other unset margins coming from paragraph style, getting a bad margin from the default style instead
uno::Reference<beans::XPropertySet> xMyStyle(
getStyles(u"ParagraphStyles"_ustr)->getByName(u"MyStyle"_ustr), uno::UNO_QUERY); // from paragraph style - this is what direct formatting should equal
sal_Int32 nMargin = getProperty<sal_Int32>(xMyStyle, u"ParaLeftMargin"_ustr);
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nMargin); // from direct formatting
CPPUNIT_ASSERT_EQUAL(nMargin, getProperty<sal_Int32>(getParagraph(1), u"ParaLeftMargin"_ustr));
// mandatory authors and dates
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:moveFromRangeStart", "author", u"Tekijä");
assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:moveToRangeStart", "author", u"Tekijä"); // no date (anonymized change) // This failed, date was exported as w:date="0-00-00T00:00:00Z", and later "1970-01-01T00:00:00Z"
assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:p[1]/w:moveFromRangeStart", "date");
assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:p[2]/w:moveToRangeStart", "date");
}
CPPUNIT_TEST_FIXTURE(Test, testTdf150166)
{ // check moveFromRangeStart/End and moveToRangeStart/End (to keep tracked text moving)
loadAndSave("tdf150166.docx");
xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr);
assertXPath(pXmlDoc, "//w:moveFromRangeStart", 0); // This was 2 (missing RangeStart elements, but bad unpaired RangeEnds)
assertXPath(pXmlDoc, "//w:moveFromRangeEnd", 0);
// These were 0 (moveFrom, moveTo and t)
assertXPath(pXmlDoc, "//w:del", 11);
assertXPath(pXmlDoc, "//w:ins", 12);
assertXPath(pXmlDoc, "//w:delText", 7);
// no more moveFrom/moveTo to avoid of problems with ToC
assertXPath(pXmlDoc, "//w:moveFrom", 0);
assertXPath(pXmlDoc, "//w:moveTo", 0);
}
CPPUNIT_TEST_FIXTURE(Test, testTdf143510)
{ // check moveFromRangeStart/End and moveToRangeStart/End for tracked table move by drag & drop
loadAndSave("TC-table-DnD-move.docx");
xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // This was 0 (missing tracked table row deletion/insertion)
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr/w:trPr/w:del", 2);
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[2]/w:tr/w:trPr/w:ins", 2);
}
CPPUNIT_TEST_FIXTURE(Test, testTdf143510_table_from_row)
{ // check moveFromRangeStart/End and moveToRangeStart/End for tracked table move by drag & drop
loadAndSave("TC-table-Separate-Move.docx");
xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // This was 0 (missing tracked table row deletion/insertion)
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr/w:trPr/w:del", 1);
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr[3]/w:trPr/w:del", 1);
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[2]/w:tr", 1);
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[2]/w:tr/w:trPr/w:ins", 1);
}
CPPUNIT_TEST_FIXTURE(Test, testTdf143510_within_table)
{ // check moveFromRangeStart/End and moveToRangeStart/End for tracked table row move by DnD
loadAndSave("TC-table-rowDND.docx");
xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // This was 0 (missing tracked table row deletion/insertion)
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:trPr/w:del", 1);
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[4]/w:trPr/w:ins", 1);
}
CPPUNIT_TEST_FIXTURE(Test, testTdf143510_within_table2)
{ // check moveFromRangeStart/End and moveToRangeStart/End for tracked table row move by DnD
loadAndSave("TC-table-rowDND-front.docx");
xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // This was 0 (missing tracked table row deletion/insertion)
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:trPr/w:ins", 1);
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[4]/w:trPr/w:del", 1);
}
CPPUNIT_TEST_FIXTURE(Test, testTdf150824)
{ // check tracked table row insertion (stored in a single redline)
loadAndSave("tdf150824.fodt");
xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // This was 0 (missing tracked table row deletion/insertion)
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:trPr/w:ins", 1);
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[2]/w:trPr/w:ins", 1);
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[3]/w:trPr/w:ins", 1);
}
CPPUNIT_TEST_FIXTURE(Test, testTdf157011)
{ // check tracked table column insertions and deletions with empty cells
loadAndSave("tdf157011_ins_del_empty_cols.docx");
xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr);
// This was 1 (missing tracked table cell insertions)
assertXPath(pXmlDoc, "//w:ins", 3);
// This was 4 (missing tracked table cell deletions)
assertXPath(pXmlDoc, "//w:del", 6);
// tdf#157187 This was false (dummy w:tc/w:p/w:sdt/w:sdtContent content box)
assertXPath(pXmlDoc, "//w:tc/w:p/w:del", 6);
assertXPath(pXmlDoc, "//w:tc/w:p/w:ins", 3);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.