[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - 2 commits - sw/qa
Szymon Kłos
szymon.klos at collabora.com
Fri May 12 09:48:20 UTC 2017
sw/qa/extras/uiwriter/uiwriter.cxx | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
New commits:
commit cd26c9bbd3e045d71d7645454c959ceb995c392f
Author: Szymon Kłos <szymon.klos at collabora.com>
Date: Fri May 12 11:09:25 2017 +0200
AutoText: fix build
Change-Id: I457d03e6f000957ec7a276f9cc5d35eda8937f81
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 355e863368d6..4dda340ddd71 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -805,7 +805,7 @@ void SwUiWriterTest::testDOCXAutoTextGallery()
{
// this file contains one AutoText entry and other
// entries which are not AutoText (have different "gallery" value)
- SwTextBlocks *pGlossary = readDOCXAutotext("autotext-gallery.dotx");
+ std::unique_ptr<SwTextBlocks> pGlossary = readDOCXAutotext("autotext-gallery.dotx");
SwDoc* pDoc = pGlossary->GetDoc();
CPPUNIT_ASSERT(pDoc != nullptr);
commit b1dc1e602ad680ad2bd6a6ff04f700cedf35ce43
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date: Sun May 7 21:48:45 2017 +0200
silence cppcheck memleak in unit test
line 825: Memory leak 'pGlossary'
Change-Id: Id7f103c4e6f8bd4b4941edfe815508305d9a5f55
Reviewed-on: https://gerrit.libreoffice.org/37377
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Jochen Nitschke <j.nitschke+logerrit at ok.de>
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index b417faa26eab..355e863368d6 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -84,6 +84,7 @@
#include "com/sun/star/text/TextMarkupType.hpp"
#include <com/sun/star/chart2/data/XDataSource.hpp>
#include <com/sun/star/document/XEmbeddedObjectSupplier2.hpp>
+#include <o3tl/make_unique.hxx>
#include <osl/file.hxx>
#include <paratr.hxx>
#include <drawfont.hxx>
@@ -352,7 +353,7 @@ public:
private:
SwDoc* createDoc(const char* pName = nullptr);
- SwTextBlocks* readDOCXAutotext(const OUString& sFileName, bool bEmpty = false);
+ std::unique_ptr<SwTextBlocks> readDOCXAutotext(const OUString& sFileName, bool bEmpty = false);
};
SwDoc* SwUiWriterTest::createDoc(const char* pName)
@@ -367,16 +368,16 @@ SwDoc* SwUiWriterTest::createDoc(const char* pName)
return pTextDoc->GetDocShell()->GetDoc();
}
-SwTextBlocks* SwUiWriterTest::readDOCXAutotext(const OUString& sFileName, bool bEmpty)
+std::unique_ptr<SwTextBlocks> SwUiWriterTest::readDOCXAutotext(const OUString& sFileName, bool bEmpty)
{
OUString rURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + sFileName;
- SfxMedium* pSrcMed = new SfxMedium(rURL, StreamMode::STD_READ);
+ SfxMedium aSrcMed(rURL, StreamMode::STD_READ);
SwDoc* pDoc = createDoc();
- SwReader aReader(*pSrcMed, rURL, pDoc);
+ SwReader aReader(aSrcMed, rURL, pDoc);
Reader* pDOCXReader = SwReaderWriter::GetDOCXReader();
- SwTextBlocks* pGlossary = new SwTextBlocks(rURL);
+ auto pGlossary = o3tl::make_unique<SwTextBlocks>(rURL);
CPPUNIT_ASSERT(pDOCXReader != nullptr);
CPPUNIT_ASSERT_EQUAL(!bEmpty, aReader.ReadGlossaries(*pDOCXReader, *pGlossary, false));
@@ -748,14 +749,14 @@ void SwUiWriterTest::testExportRTF()
void SwUiWriterTest::testDOCXAutoTextEmpty()
{
// file contains normal content but no AutoText
- SwTextBlocks* pGlossary = readDOCXAutotext("autotext-empty.dotx", true);
+ std::unique_ptr<SwTextBlocks> pGlossary = readDOCXAutotext("autotext-empty.dotx", true);
CPPUNIT_ASSERT(pGlossary != nullptr);
}
void SwUiWriterTest::testDOCXAutoTextMultiple()
{
// file contains three AutoText entries
- SwTextBlocks* pGlossary = readDOCXAutotext("autotext-multiple.dotx");
+ std::unique_ptr<SwTextBlocks> pGlossary = readDOCXAutotext("autotext-multiple.dotx");
// check entries count
CPPUNIT_ASSERT_EQUAL((sal_uInt16)3, pGlossary->GetCount());
@@ -788,7 +789,7 @@ void SwUiWriterTest::testDOTMAutoText()
{
// this is dotm file difference is that in the dotm
// there are no empty paragraphs at the end of each entry
- SwTextBlocks* pGlossary = readDOCXAutotext("autotext-dotm.dotm");
+ std::unique_ptr<SwTextBlocks> pGlossary = readDOCXAutotext("autotext-dotm.dotm");
SwDoc* pDoc = pGlossary->GetDoc();
CPPUNIT_ASSERT(pDoc != nullptr);
More information about the Libreoffice-commits
mailing list