summaryrefslogtreecommitdiff
path: root/test/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-03-26 15:54:47 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-03-27 07:40:12 +0100
commit705558aa455403cd006993f95b5b13981fdb3483 (patch)
tree29fb2e48aa3b5c5537a1d1ba37117009b91d8c3e /test/source
parentac35a51eb5071948ab50fcf0be029a37a1721fad (diff)
condition always true in XSpreadsheets2::importSheetToCopy
leftover from commit ed45c87896de74048708d51c050ecd42c9f4a0a0 Date: Mon Oct 20 21:08:54 2014 +0200 sc: fix temp file leak in ScTableSheetsObj Change-Id: Ic108fb36cc0caccbe57f2b47f7fcbe80156842dc Reviewed-on: https://gerrit.libreoffice.org/69749 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'test/source')
-rw-r--r--test/source/sheet/xspreadsheets2.cxx29
1 files changed, 10 insertions, 19 deletions
diff --git a/test/source/sheet/xspreadsheets2.cxx b/test/source/sheet/xspreadsheets2.cxx
index cea68e1cfad9..ab3ef3e75688 100644
--- a/test/source/sheet/xspreadsheets2.cxx
+++ b/test/source/sheet/xspreadsheets2.cxx
@@ -275,13 +275,12 @@ void XSpreadsheets2::testImportCellStyle()
CPPUNIT_ASSERT_EQUAL_MESSAGE("New style: VertJustify not set", table::CellVertJustify_CENTER, static_cast<table::CellVertJustify>(aVertJustify));
}
-uno::Reference< sheet::XSpreadsheetDocument> XSpreadsheets2::getDoc(const OUString& aFileBase, uno::Reference< lang::XComponent >& xComp)
+uno::Reference< sheet::XSpreadsheetDocument> XSpreadsheets2::getDoc(const OUString& aFileBase)
{
OUString aFileURL;
createFileURL(aFileBase, aFileURL);
- if (!xComp.is())
- xComp = loadFromDesktop(aFileURL);
+ uno::Reference< lang::XComponent > xComp = loadFromDesktop(aFileURL);
CPPUNIT_ASSERT(xComp.is());
@@ -301,22 +300,14 @@ void XSpreadsheets2::importSheetToCopy()
uno::Reference< container::XNameAccess> xSrcNameAccess(init(),UNO_QUERY_THROW);
xSrcSheet.set( xSrcNameAccess->getByName(gaSrcSheetName), UNO_QUERY_THROW);
- uno::Reference< lang::XComponent > xDestComponent;
- if (!xDestComponent.is())
- {
- xDestDoc = getDoc(gaDestFileBase, xDestComponent);
- CPPUNIT_ASSERT(xDestDoc.is());
-
- // import sheet
- uno::Reference< sheet::XSpreadsheets2 > xDestSheets (xDestDoc->getSheets(), UNO_QUERY_THROW);
- sal_Int32 nDestPos = 0;
- sal_Int32 nDestPosEffective = xDestSheets->importSheet(xDocument, gaSrcSheetName, nDestPos);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong sheet index", nDestPosEffective, nDestPos);
- }
- else
- {
- xDestDoc.set(xDestComponent,UNO_QUERY_THROW);
- }
+ xDestDoc = getDoc(gaDestFileBase);
+ CPPUNIT_ASSERT(xDestDoc.is());
+
+ // import sheet
+ uno::Reference< sheet::XSpreadsheets2 > xDestSheets (xDestDoc->getSheets(), UNO_QUERY_THROW);
+ sal_Int32 nDestPos = 0;
+ sal_Int32 nDestPosEffective = xDestSheets->importSheet(xDocument, gaSrcSheetName, nDestPos);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong sheet index", nDestPosEffective, nDestPos);
uno::Reference< container::XNameAccess > xDestSheetNameAccess (xDestDoc->getSheets(), UNO_QUERY_THROW);
xDestSheet.set( xDestSheetNameAccess->getByName(gaSrcSheetName), UNO_QUERY_THROW);