Kaydet (Commit) acdf113b authored tarafından Caolán McNamara's avatar Caolán McNamara

crashtesting: fix asserts on exporting fdo66304-1.odt to doc

Change-Id: Ia08207143d27f88d09bd45e64ba7c3c12cd2c1a1
üst df5ec49b
...@@ -529,6 +529,11 @@ DECLARE_WW8EXPORT_TEST(testCommentExport, "comment-export.odt") ...@@ -529,6 +529,11 @@ DECLARE_WW8EXPORT_TEST(testCommentExport, "comment-export.odt")
} }
} }
DECLARE_WW8EXPORT_TEST(testMoveRange, "fdo66304-1.odt")
{
//the save must survive without asserting
}
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -1961,8 +1961,33 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& rPaM, SwPosition& rPos, ...@@ -1961,8 +1961,33 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& rPaM, SwPosition& rPos,
const std::shared_ptr<sw::mark::ContentIdxStore> pContentStore(sw::mark::ContentIdxStore::Create()); const std::shared_ptr<sw::mark::ContentIdxStore> pContentStore(sw::mark::ContentIdxStore::Create());
pContentStore->Save( &m_rDoc, rPos.nNode.GetIndex(), rPos.nContent.GetIndex(), true ); pContentStore->Save( &m_rDoc, rPos.nNode.GetIndex(), rPos.nContent.GetIndex(), true );
SwTextNode * pOrigNode = pTNd;
assert(*aSavePam.GetPoint() == *aSavePam.GetMark() &&
*aSavePam.GetPoint() == rPos);
assert(aSavePam.GetPoint()->nContent.GetIdxReg() == pOrigNode);
assert(aSavePam.GetPoint()->nNode == rPos.nNode.GetIndex());
assert(rPos.nNode.GetIndex() == pOrigNode->GetIndex());
pTNd = pTNd->SplitContentNode( rPos )->GetTextNode(); pTNd = pTNd->SplitContentNode( rPos )->GetTextNode();
//A new node was inserted before the orig pTNd and the content up to
//rPos moved into it. The old node is returned with the remainder
//of the content in it.
//
//aSavePam was created with rPos, it continues to point to the
//old node, but with the *original* content index into the node.
//Seeing as all the orignode content before that index has
//been removed, the new index into the original node should now be set
//to 0 and the content index of rPos should also be adapted to the
//truncated node
assert(*aSavePam.GetPoint() == *aSavePam.GetMark() &&
*aSavePam.GetPoint() == rPos);
assert(aSavePam.GetPoint()->nContent.GetIdxReg() == pOrigNode);
assert(aSavePam.GetPoint()->nNode == rPos.nNode.GetIndex());
assert(rPos.nNode.GetIndex() == pOrigNode->GetIndex());
aSavePam.GetPoint()->nContent.Assign(pOrigNode, 0);
rPos = *aSavePam.GetMark() = *aSavePam.GetPoint();
if( !pContentStore->Empty() ) if( !pContentStore->Empty() )
pContentStore->Restore( &m_rDoc, rPos.nNode.GetIndex()-1, 0, true ); pContentStore->Restore( &m_rDoc, rPos.nNode.GetIndex()-1, 0, true );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment