sc/qa/unit/ucalc.cxx | 15 +++++++++++++++ sc/source/core/data/postit.cxx | 4 +++- 2 files changed, 18 insertions(+), 1 deletion(-)
New commits: commit da3d56b077ce81f6f399a68f53895590dbb1357f Author: Eike Rathke <er...@redhat.com> Date: Thu Mar 9 23:15:42 2017 +0100 finally turn this into a hard assert Change-Id: Iba6abafeaa2542fc94b76a642ddb0eb5b70b572d diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index c01b6d7..3addea4 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -959,7 +959,9 @@ void ScPostIt::UpdateCaptionPos( const ScAddress& rPos ) void ScPostIt::CreateCaptionFromInitData( const ScAddress& rPos ) const { - OSL_ENSURE( maNoteData.mxCaption || maNoteData.mxInitData.get(), "ScPostIt::CreateCaptionFromInitData - need caption object or initial caption data" ); + // Captions are not created in Undo documents and only rarely in Clipboard, + // but otherwise we need caption or initial data. + assert((maNoteData.mxCaption || maNoteData.mxInitData.get()) || mrDoc.IsUndo() || mrDoc.IsClipboard()); if( maNoteData.mxInitData.get() ) { /* This function is called from ScPostIt::Clone() when copying cells commit 96175e7ed24fc007f88c418f8d449b6bd07563ad Author: Eike Rathke <er...@redhat.com> Date: Thu Mar 9 22:38:57 2017 +0100 it's raining drawing layers Change-Id: Ieee5cb5792535185ef09c3775072ed739fb0e4b0 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index dcb9a90..40a2801 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -776,6 +776,9 @@ void Test::testCopyToDocument() { CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet", m_pDoc->InsertTab (0, "src")); + // We need a drawing layer in order to create caption objects. + m_pDoc->InitDrawLayer(&getDocShell()); + m_pDoc->SetString(0, 0, 0, "Header"); m_pDoc->SetString(0, 1, 0, "1"); m_pDoc->SetString(0, 2, 0, "2"); @@ -1986,6 +1989,9 @@ void Test::testSheetCopy() CPPUNIT_ASSERT_EQUAL_MESSAGE("document should have one sheet to begin with.", static_cast<SCTAB>(1), m_pDoc->GetTableCount()); + // We need a drawing layer in order to create caption objects. + m_pDoc->InitDrawLayer(&getDocShell()); + // Insert text in A1. m_pDoc->SetString(ScAddress(0,0,0), "copy me"); @@ -5247,6 +5253,9 @@ void Test::testNoteDeleteCol() ScDocument& rDoc = getDocShell().GetDocument(); rDoc.InsertTab(0, "Sheet1"); + // We need a drawing layer in order to create caption objects. + m_pDoc->InitDrawLayer(&getDocShell()); + ScAddress rAddr(1, 1, 0); ScPostIt* pNote = m_pDoc->GetOrCreateNote(rAddr); pNote->SetText(rAddr, "Hello"); @@ -5471,6 +5480,9 @@ void Test::testAreasWithNotes() ScDocument& rDoc = getDocShell().GetDocument(); rDoc.InsertTab(0, "Sheet1"); + // We need a drawing layer in order to create caption objects. + m_pDoc->InitDrawLayer(&getDocShell()); + ScAddress rAddr(1, 5, 0); ScPostIt* pNote = m_pDoc->GetOrCreateNote(rAddr); pNote->SetText(rAddr, "Hello"); @@ -6270,6 +6282,9 @@ void Test::testSetStringAndNote() { m_pDoc->InsertTab(0, "Test"); + // We need a drawing layer in order to create caption objects. + m_pDoc->InitDrawLayer(&getDocShell()); + //note on A1 ScAddress aAdrA1 (0, 0, 0); ScPostIt* pNote = m_pDoc->GetOrCreateNote(aAdrA1); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits