summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-10-20 08:14:07 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-10-20 08:25:02 +0000
commitef7ab996d8e4479b1944f7eaf506a506647a90dd (patch)
treeab66eef5336b081dc8c8be43148f68407c85a8ea /desktop
parent553ee72041d6f66e26156eb1ad0d9e3c13457f7a (diff)
CppunitTest_desktop_lib: fix valgrind errors
With this, 'make -sr CppunitTest_desktop_lib CPPUNIT_TEST_NAME="DesktopLOKTest::testPaintPartTile DesktopLOKTest::testWriterCommentInsertCursor" VALGRIND=memcheck' finishes with 'ERROR SUMMARY: 0 errors from 0 contexts'. The problem is that in sw/sc/sd code it's enough to make sure that the on-stack ViewCallback instances are destroyed after the loaded component, but in desktop/ code also the emit-callbacks-on-idle code is under test, so we need to make sure first the LOK document wrapper is destroyed, and only after that the ViewCallback instances are destroyed. Change-Id: Ie8361233461d00fd252da929fb912a1a0b835c30 Reviewed-on: https://gerrit.libreoffice.org/30072 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 1c92165bf25b..11c8db46ebc5 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -1541,16 +1541,17 @@ void DesktopLOKTest::testPaintPartTile()
{
// Load an impress doc of 2 slides.
comphelper::LibreOfficeKit::setActive();
- LibLODocument_Impl* pDocument = loadDoc("2slides.odp");
- pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
ViewCallback aView1;
+ ViewCallback aView2;
+ std::unique_ptr<LibLODocument_Impl> xDocument(loadDoc("2slides.odp"));
+ LibLODocument_Impl* pDocument = xDocument.get();
+ pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
pDocument->m_pDocumentClass->registerCallback(pDocument, &ViewCallback::callback, &aView1);
int nView1 = pDocument->m_pDocumentClass->getView(pDocument);
// Create a second view.
pDocument->m_pDocumentClass->createView(pDocument);
pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
- ViewCallback aView2;
pDocument->m_pDocumentClass->registerCallback(pDocument, &ViewCallback::callback, &aView2);
// Go to the second slide in the second view.
@@ -1578,7 +1579,6 @@ void DesktopLOKTest::testPaintPartTile()
CPPUNIT_ASSERT(aView1.m_bTilesInvalidated);
Scheduler::ProcessEventsToIdle();
- mxComponent->dispose();
mxComponent.clear();
comphelper::LibreOfficeKit::setActive(false);
}
@@ -1587,13 +1587,14 @@ void DesktopLOKTest::testWriterCommentInsertCursor()
{
// Load a document and type a character into the body text of the second view.
comphelper::LibreOfficeKit::setActive();
- LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
- pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
ViewCallback aView1;
+ ViewCallback aView2;
+ std::unique_ptr<LibLODocument_Impl> xDocument(loadDoc("blank_text.odt"));
+ LibLODocument_Impl* pDocument = xDocument.get();
+ pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
pDocument->m_pDocumentClass->registerCallback(pDocument, &ViewCallback::callback, &aView1);
pDocument->m_pDocumentClass->createView(pDocument);
pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
- ViewCallback aView2;
pDocument->m_pDocumentClass->registerCallback(pDocument, &ViewCallback::callback, &aView2);
pDocument->m_pDocumentClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'x', 0);
pDocument->m_pDocumentClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYUP, 'x', 0);
@@ -1618,7 +1619,6 @@ void DesktopLOKTest::testWriterCommentInsertCursor()
CPPUNIT_ASSERT(aView1.m_aOwnCursor.IsEmpty());
Scheduler::ProcessEventsToIdle();
- mxComponent->dispose();
mxComponent.clear();
comphelper::LibreOfficeKit::setActive(false);
}