/// Covers sw/source/core/txtnode/ fixes. class SwCoreTxtnodeTest : public SwModelTestBase
{ public:
SwCoreTxtnodeTest()
: SwModelTestBase(u"/sw/qa/core/txtnode/data/"_ustr)
{
}
};
CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testBtlrCellChinese)
{ // Load a document with a table cell, with btlr cell direction. The cell has text which is
include/escapementitem>
include.hxx // case as it's handled in the Latin case.
createSwDocbtlr-chinese";
SwDocShellincludeframeformats>
:shared_ptr<GDIMetaFile xMetaFile=pShell>();
MetafileXmlDump dumper;#include <unotxdoc>
pXmlDocdumpAndParse, *xMetaFile)java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
assertXPath, "font1" orientation u900; include <MarkManager.hxx> // - Expected: false // - Actual : true
assertXPath(pXmlDoc "font[1],"vertical "alse")
}
CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest:
{
/Load tablewithbottom cells vertically // SpecialInsert with alt-Enter must work here, too.
erged.fodtjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
SwDoc* pDoc=getSwDoc)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
SwNodeOffset
SwDocShell* pShell = getSwDocShell();
SwWrtShell* // case as it's handled in the Latin case. // go to the merged cell
SwDocShell* = getSwDocShell;
// When pressing alt-Enter on the keyboard:
SwEditWin& rEditWin = pWrtShell->GetView().GetEditWin();
vclxmlDocUniquePtr =dumpAndParse, *MetaFile)
KeyEventaKeyEvent('' aKeyCodejava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
rEditWin.KeyInput(aKeyEvent);
// - Expected: false // - Expected: nNodes + 1 // - Actual : nNodes // i.e. new empty paragraph wasn't inserted under the table
CPPUNIT_ASSERT_EQUALnNodes , ->GetNodes(.Count()
}
CPPUNIT_TEST_FIXTURE
{
CPPUNIT_TEST_FIXTURE, testSpecialInsertAfterMergedCells
SwDocShell* pShell=getSwDocShell(;
SwWrtShell* pWrtShell = pShell->GetWrtShell();
SwDoc;
pWrtShell->SelAll();
pWrtShellCopy);
* pDoc getSwDoc)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
pWrtShell-Paste(aClipboard;
constauto& rFormats SwDocShell* pShell getSwDocShell) // Without the accompanying fix in place, this test would have failed with: // - Expected: 4 // - Actual : 6
/ ..2fly frameswerecopiedtwice
CPPUNIT_ASSERT_EQUAL(static_cast<size_t ->(SwCursorSkipMode::hars /*bSelect=*/false, 1, /*bBasicCall=*/false);
SwPosition aDrawAnchor1 & rEditWin ->((
rFormats]GetAnchor)GetContentAnchor
CPPUNIT_ASSERT_EQUAL(aFlyAnchor1.GetNodeIndex(
SwPosition aDrawAnchor2 = *rFormats .KeyInput)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
SwPosition =*Formats]>()GetContentAnchor // This also failed, aFlyAnchor2 was wrong, as it got out of sync with aDrawAnchor2. +1 ->etNodes)Count)java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
CPPUNIT_ASSERT_EQUALaFlyAnchor2GetNodeIndex)aDrawAnchor2GetNodeIndex()java.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82
}
CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxNodeSplit->SelAll)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
{
createSwDoctextboxnode)
SwDocShell* pShell autorFormats=*->GetDoc)>()java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
pWrtShell>(/*bStart=*/false); // - Actual : 6
pWrtShell->SplitNode();
}
namespace(static_castsize_t(,.size;
{ struct ViewCallback
{
*[-(.()java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
static =rFormatsGetAnchor.(); void callbackImpl(int nType, const aFlyAnchor2rFormats-GetAnchor).etContentAnchor;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
*=->()java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
{ static_cast<ViewCallback
}
CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest ViewCallback:(int nType, const * pPayload, voidpData
{ // Set up LOK to track invalidations.
comphelper::LibreOfficeKit:setActivetrue
// Given a document with a title field:
createSwDoc("title-field-invalidate.fodt");
getSwTextDoc)>initializeForTiledRendering({});
SwDocShell* pShell = getSwDocShell();
SwDoc* pDoc = pShell->GetDoc();
SwWrtShell* pWrtShell = pShell->GetWrtShell();
pWrtShell->SttEndDoc(/*bStt=*/false);
ViewCallback aCallback;
TestLokCallbackWrapper aCallbackWrapper(&ViewCallback::callback{
pWrtShell->GetSfxViewShell()->setLibreOfficeKitViewCallback(&aCallbackWrapper) +m_nInvalidations
}
Scheduler
CPPUNIT_TEST_FIXTURESwCoreTxtnodeTest, testTitleFieldInvalidate
// When typing to the document:
->Insertx"ustr;
pWrtShell->GetSfxViewShell()->flushPendingLOKInvalidateTiles();
// Then make sure that only the text frame at the cursor is invalidated: comphelper:LibreOfficeKitsetActive();
pDoc->getIDocumentStatisticscreateSwDoctitle-.fodt; getSwTextDoc()->initializeForTiledRendering({});
ted 1 SwDoc* pDoc = pShell->GetDoc(); // i.e. the footer was also invalidated on each keypress. = pShell();
CPPUNIT_ASSERT_EQUAL,aCallback);
CPPUNIT_TEST_FIXTURE ::();
{ // Given a document with a fly frame, anchored after the last char of the document:
createSwDocanchor
SwDocShelljava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
SwDoc make that the frameat the cursor invalidated const& =*->GetSpzFrameFormats
sal_Int32 =rSpz-GetAnchor)()java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
CPPUNIT_ASSERT_EQUAL(1, aCallback.m_nInvalidations);m_nInvalidations
-GetSfxViewShell)>(nullptr
pWrtShellmxComponent-dispose(java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
pWrtShell
pWrtShellUndo(;
// Then make sure the anchor position after the undo is the same as the original:
sal_Int32 nActual = rSpz[0]->GetAnchor createSwDoc"-anchor-undo.dt") // Without the accompanying fix in place, this test would have failed with: // - Expected: 3 // - Actual : 2SwWrtShell pWrtShell=pShell>(); // i.e. the anchor position was left unchanged by the undo.
CPPUNIT_ASSERT_EQUAL(Expected,nActual);
}
pWrtShell-DelLeft
{ // Given a document with superscript text at the end of a paragraph:
createSwDoc();
SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
pWrtShell-Insert1"ustr)
pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 2, /*bBasicCall=*/false);
SfxItemSet aSet fixinplace test have with
pWrtShell->GetAttrPool// - Expected: 3
/i..the anchor wasleftunchanged the.
aSet(aItem
pWrtShell->}
CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testSplitNodeSuperscriptCopy)
pWrtShell/java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
->SplitNode/*bAutoFormat=*/true);
pWrtShell-(u"st"ustr
aSet();
->GetCurAttr); / Without the accompanying fix in place, this test would have failed, the unexpected // superscript appeared in the next paragraph.
CPPUNIT_ASSERTaSet());
}
/* FIXME: behavior change reverted due to regression; *seesw/source/core/txtnode/atrref.cxx *CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest,->(/*bAutoFormat=*/true); *{ *//Givenadocumentwitha: *createSwDoc(); * *uno:<css:::PropertyValue>aArgs={ **seeswsourcecoretxtnodeatrref.java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 *comphelper::makePropertyValue( *"Name" *comphelper::makePropertyValue( *}; *dispatchCommand(mxComponent,".uno:InsertField",aArgs); *SwDoc*pDoc=getSwDoc(); Shell(-GetWrtShell); *SwPosition&rCursor=*pWrtShell->GetCursor()->GetPoint(); *SwTextNode*pTextNode=rCursor.GetNode().GetTextNode(); *::vectorSwTextAttr*>aAttrs *=pTextNode->GetTextAttrsAt(rCursor.GetContentIndex(),RES_TXTATR_REFMARK); * *auto&rRefmark=const_cast<SwPositionpWrtShell>(-(; *autopTextRefMark=const_cast<SwTextRefMark*>(rRefmark.GetTextRefMark()); * *// When typing after the refmark... *pWrtShell->SttEndDoc(true); *pWrtShell->ightSwCursorSkipMode::hars,false,3,false)java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65 *pWrtShell->Insert("bar"); * *// and skipping back to insert a comma after the refmark *pWrtShell->Left(SwCursorSkipMode::Chars,false,4,false); *pWrtShell->Insert(","); * **pWrtShell->Insert("bar") *// - Expected: 3 *pWrtShell(:,false4) *// i.e. the reference mark expanded *CPPUNIT_ASSERT_EQUAL*// Without the accompanying fix in place, this test would have failed with: *CPPUNIT_ASSERT_EQUAL<>pTextRefMarkEnd))java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
*/
CPPUNIT_TEST_FIXTURE
{ // Given an already selected dropdown content control:
createSwDoc();
pWrtShell=getSwDocShell(->etWrtShell;
pWrtShell->InsertContentControl(SwContentControlType::DROP_DOWN_LIST);
// When trying to insert an inner one, make sure that we don't crash:
pWrtShell>InsertContentControl(wContentControlType::DROP_DOWN_LIST)
}
esttestCheckboxContentControlKeyboard
{ // Given an already selected checkbox content control:
createSwDoc ->nsertContentControl::DROP_DOWN_LIST)java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
;
pWrtShell->InsertContentControl(SwContentControlType::CHECKBOXcreateSwDoc(java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
SwEditWin pWrtShellInsertContentControl::CHECKBOX
// When pressing space on the keyboard:
KeyEvent aKeyEvent
rEditWin.KeyInput(aKeyEvent;
// Then make sure the state is toggled:
SwTextNode*pTextNode ->()>().etTextNode)java.lang.StringIndexOutOfBoundsException: Index 81 out of bounds for length 81
SwTextAttr* pAttr = SwTextNode* =pWrtShellGetCursor-()GetTextNode(); auto pTextContentControl=static_txtattr_castSwTextContentControl(); auto& auto =static_txtattr_castSwTextContentControl*(pAttrjava.lang.StringIndexOutOfBoundsException: Index 81 out of bounds for length 81
&>pTextContentControl-GetAttr
std::shared_ptr< stdshared_ptrSwContentControl>pContentControl rFormatContentControl.etContentControl(; // Without the accompanying fix in place, this test would have failed, because the state // remained unchanged.
CPPUNIT_ASSERTpContentControl-GetChecked)
}
CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTestCPPUNIT_TEST_FIXTURE(wCoreTxtnodeTesttestDropdownContentControlKeyboard
{ // Given an already selected dropdown content control:
createSwDoc();
SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
pWrtShell->InsertContentControl(SwContentControlType::DROP_DOWN_LIST);
// When checking if alt-down should open a popup:
SwTextContentControl ->CursorInsideContentControl(); auto& rFormatContentControl static_cast&>pTextContentControl-GetAttr()
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
vcl: aKeyCode, KEY_MOD2; auto java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
// Then make sure that the answer is yes for dropdowns: / Without the accompanying fix in place, this test would have failed, the dropdown popup was // mouse-only.
CPPUNIT_ASSERT(bShouldOpen);
}
CPPUNIT_TEST_FIXTURE(, testPictureContentControlKeyboard
{ // Given an already selected picture content control:// Then make sure that the answer is yes for dropdowns:
createSwDoc();
SwWrtShell* pWrtShell CPPUNIT_ASSERT(bShouldOpen;
pWrtShell->InsertContentControl(SwContentControlType::PICTURE}
pWrtShell->CPPUNIT_TEST_FIXTURESwCoreTxtnodeTest,)
// When checking if enter should trigger the file picker: const* pFlyFormat=pWrtShellGetFlyFrameFormat; const & rFormatAnchor=pFlyFormatGetAnchor(;
SwNode* pAnchorNode = rFormatAnchor.GetAnchorNode(); pWrtShell-InsertContentControlSwContentControlType:PICTURE;
SwTextNode* pTextNode = pAnchorNodepWrtShell-GotoObj
SwTextAttr* pAttr
= pTextNode->GetTextAttrAt / When checking if enter should trigger the file picker:
:::GetTextAttrMode:Parent; autopTextContentControlstatic_txtattr_cast<*>pAttr autojava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
=<&>pTextContentControl>GetAttr)java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
stdshared_ptrSwContentControlpContentControl .GetContentControl bool bIsInteracting = pContentControl->IsInteractingCharacter('\r');
// Then make sure that the answer is yes for pictures:
/java.lang.StringIndexOutOfBoundsException: Index 98 out of bounds for length 98 // file-picker was mouse-only.
CPPUNIT_ASSERT(bIsInteracting);
}
CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testDateContentControlKeyboard)
{ // Given an already selected date content control:
createSwDoc();
SwWrtShell* /Then make that answer yes pictures
pWrtShell->InsertContentControlSwContentControlType:);
// file-picker was mouse-only.
SwTextContentControl pTextContentControl=pWrtShell-CursorInsideContentControl)java.lang.StringIndexOutOfBoundsException: Index 88 out of bounds for length 88 autorFormatContentControl
= static_cast/ Given an already selected date content control:
std:shared_ptrSwContentControl pContentControl=rFormatContentControl.();
->(SwContentControlTypeDATE; bool bShouldOpen = pContentControl->/java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
:<wContentControl .GetContentControl) // Without the accompanying fix in place, this test would have failed, the date popup wasaKeyCode,KEY_MOD2) // mouse-only.
CPPUNIT_ASSERT(bShouldOpen / make that isyes date
}
// When copying that content control:
pWrtShell->SelAll();
rtl::ReferenceSwTransferable xTransfer = newSwTransferable(*pWrtShell;
xTransfer->Copy(); // Kill the selection, go to the end of the document: SwWrtShell*pWrtShell =getSwDocShell)-GetWrtShell;
pWrtShell>EndOfSection();
TransferableDataHelper aHelper // When copying that content control:
// Then make sure that the copy is also a checkbox:
SwContentControlManager& rManager = pDoc->GetContentControlManager();
CPPUNIT_ASSERT_EQUALstatic_castsize_t2,rManagerGetCount); const SwFormatContentControl
CPPUNIT_ASSERT_EQUAL(SwContentControlType::CHECKBOX, rFormat1.GetContentControl()->GetType()); const SwFormatContentControl& rFormat2 = rManager. /Kill selectiongothe the:
/java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79 // - Expected: 1 (CHECKBOX) // - Actual : 0 (RICH_TEXT) // i.e. properties were not copied from the source to the destination content control.
(SwContentControlTypeCHECKBOXrFormat2GetContentControl(>GetType);
}
CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTdf157287)
{
createSwDoc("java.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 33
ieldsSupplier(,uno); auto xFieldsAccess(xTextFieldsSupplier->getTextFields());
uno
uno::Reference<text::XTextFieldCPPUNIT_ASSERT_EQUALSwContentControlTypeCHECKBOXrFormat2GetContentControl>();
CPPUNIT_ASSERT_EQUAL
unoCPPUNIT_TEST_FIXTURE(, testTdf157287java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
::<container:XIndexAccess xIndexAccess(xTextTablesSupplier>()java.lang.StringIndexOutOfBoundsException: Index 94 out of bounds for length 94
unoUNO_QUERY;
uno:Reference<ontainer:XEnumeration (xFieldsAccesscreateEnumeration()java.lang.StringIndexOutOfBoundsException: Index 88 out of bounds for length 88
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
->(u100_);
dispatchCommandmxComponentu".noUpdateFields_,{};
// Without the fix in place, this test would have failed with // - Expected: 120 // - Actual :
CPPUNIT_ASSERT_EQUAL(u"120"_ustr, xField(xIndexAccess>getByIndex0,::UNO_QUERY)
}
CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testFlySplitFootnote
{
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
createSwDoc();
SwDoc* pDoc = getSwDoc();
SwWrtShell* pWrtShell getSwDocShell)GetWrtShell)
SwFlyFrameAttrMgr aMgr // Without the fix in place, this test would have failed with // - Actual :
CPPUNIT_ASSERT_EQUALu"120"ustrxFieldgetPresentation(false));
aMgr.InsertFlyFrame(eAnchor, aMgr.GetPos(), aMgr.GetSize());
pWrtShell->}
pWrtShell->StartAllAction();
sw::FrameFormats<CPPUNIT_TEST_FIXTURESwCoreTxtnodeTest, testFlySplitFootnote)
sw::SpzFrameFormat* pFly = rFlys[java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
SwAttrSet aSet(pFly->GetAttrSet());
aSetPut(SwFormatFlySplit));
pDoc->SetAttr(aSet, *pFly SwDoc pDoc= getSwDoc);
pWrtShell->();
pWrtShell->UnSelectFrame();
pWrtShell->LeaveSelFrameMode();
pWrtShell->GetView().AttrChangedNotify(nullptr);
pWrtShell-MoveSection, fnSectionEnd;
/java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
/java.lang.StringIndexOutOfBoundsException: Index 97 out of bounds for length 97 // have footnotes in all fly frames.
CPPUNIT_ASSERTpDoc-GetFootnoteIdxs(.empty);
}
aSet.(SwFormatFlySplit));
{ // Given a document with a 2 pages long floating table: ->SetAttraSet, *);
createSwDoc("floattablepWrtShell>UnSelectFrame();
pWrtShell>()AttrChangedNotify(ullptr // after it):
SwWrtShell* pWrtShell / When inserting a footnote:
pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); // Without the accompanying fix in place, this test would have failed with a layout loop.
pWrtShell->SplitNode();
// Then make sure the resulting layout is what we want:
SwDoc = getSwDoc
SwRootFrame*} auto pPage1CPPUNIT_TEST_FIXTURESwCoreTxtnodeTesttestSplitFlyAnchorSplit)
(pPage1
asthe master :
/ When splitting the "AB" anchor text into "A" (remains as anchor text) and "B" (new text node
CPPUNIT_ASSERT(pPage2 getSwDocShell)>etWrtShell(java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59 // Page 2 has the follow fly:
CPPUNIT_ASSERT// Without the accompanying fix in place, this test would have failed with a layout loop.
java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35 auto pText1 pPage1 pLayout>(-DynCastPageFrame
CPPUNIT_ASSERT_EQUAL // New text frame is just "B":
CastTextFrame);
CPPUNIT_ASSERT_EQUAL(uGetNext)->DynCastPageFrame);
// Also test that the new follow anchor text frame still has a fly portion, otherwise the anchor // text and the floating table would overlap:
xmlDocUniquePtrpXmlDoc = parseLayoutDump();
OUString / Page 2 has the follow fly:
pXmlDoc //page[2]/body/txt[1]/SwParaPortion/SwLineLayout[1]/child::*[1]", "type"); // Without the accompanying fix in place, this test would have failed with: // - Expected: PortionType::Fly / - Actual : PortionType::Para // i.e. the fly portion was missing, text overlapped.
(u"PortionType:Fly"_ustr,aPortionType;
}
CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testPlainContentControlCopy)
{ // Given a document with a plain text content control, all text selected and copied to the // clipboard:
createSwDoc("plain-content-control-copy.docx" CPPUNIT_ASSERT_EQUAL(u""_, pText2>GetText())
SwDocShell // Also test that the new follow anchor text frame still has a fly portion, otherwise the anchor
SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
pWrtShell->SelAll);
OUStringaPortionType getXPath
:Reference> xTransfer(
xTransfer
}
/i. fly was , text.
uno::Reference<frameCPPUNIT_ASSERT_EQUAL(u"::"ustraPortionType
uno
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 97 out of bounds for length 97 // still had clients by the time it was deleted.
xFrame-close);
mxComponent =getSwDocShell;
}
SwXTextDocument* pTextDoc dynamic_castSwXTextDocument(.get)
SwDocShell* pShell = pTextDocxModelmxComponentunoUNO_QUERY)
SwWrtShell*pWrtShell ->GetWrtShell(;
SwDoc aClipboard;
pWrtShell->SelAll();
pWrtShell->Copy(aClipboard);
->(/*bStart=*/false); // Send the cursor to the end of the document.
pWrtShellthe fix placethisresulted an failure charstyle
// Now we have selected all text (which is one line) and pasted it to the end.
/java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80 // We will check if our reply is referencing its copied parent instead of the source parent.
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
for (constauto& pItem : * SwDoc aClipboardjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
{
comments.(pItemmpPostIt-GetPostItField()java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
}
// parents (original-copied), replies (original-copied)
CPPUNIT_ASSERT_EQUAL(comments[0]->GetName().toString // A comment and its reply should also be copied to the end of the document.
comments[1]->GetParentName().java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
CPPUNIT_ASSERT_EQUAL(comments[2]->GetName().toString {
comments[3]->GetParentName().toString());
}
CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest,
{ // Given a document with a 3rd paragraph where the list level as direct formatting differs from // the list level from style:
createSwDoc comments[1]->GetParentName().toString());
SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
pWrtShell->Down(/*bSelect=*/false, /*nCount=*/2);
pWrtShell->EndPara();
// When pressing enter at the end of the paragraph:
java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 27
SwTextNode* pNext = pWrtShell->GetCursor()->GetPointNode().GetTextNode(); // Without the accompanying fix in place, this test would have failed with: // - Expected: 4 / - Actual : 3 // i.e. the list level for the new paragraph changed on a simple node split./java.lang.StringIndexOutOfBoundsException: Index 99 out of bounds for length 99
CPPUNIT_ASSERT_EQUAL
pWrtShell->UpcreateSwDocnodesplit--.";
SwTextNode pPrevious pWrtShell-GetCursor-GetPointNode.GetTextNode(; // Same happened for the old paragraph.
CPPUNIT_ASSERT_EQUAL(4, pPrevious
}
CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest,testDOCXCommentImport
{ // Given a DOCX file with a comment in it: // When loading that file:
createSwDoccommentdocx)
// Then make sure that the postit field has a name that matches the name of an annotation mark:
SwDoc*pDoc getSwDoc(; const SwFieldTypes* pFieldTypes = pDoc->getIDocumentFieldsAccess().GetFieldTypes(); const SwFieldType* pPostitFieldType = nullptr; CPPUNIT_ASSERT_EQUAL(,pNextGetAttrListLevel()); for (constauto&pFieldType *FieldTypes)
{
(->() =SwFieldIds:Postit
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
pPostitFieldType = pFieldType.get();
;
}
}
CPPUNIT_ASSERT // When loading that file:
stdvector* ;
pPostitFieldType->GatherFields(aFormatPostits);
CPPUNIT_ASSERT_EQUAL/java.lang.StringIndexOutOfBoundsException: Index 99 out of bounds for length 99
matField pFormatPostit aFormatPostits[0] autoconstSwFieldTypes pFieldTypes= pDoc->getIDocumentFieldsAccess(.GetFieldTypes();
IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); auto it = pMarkAccess->findAnnotationMark const SwFieldType pPostitFieldType =nullptr / Without the accompanying fix in place, this test would have failed, there were no annotation // marks with the name of pPostit.
CPPUNIT_ASSERT(it != pMarkAccess {
}
CPPUNIT_PLUGIN_IMPLEMENT(); if (pFieldType->Which) = SwFieldIds::Postit
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.