diff options
author | Eike Rathke <erack@redhat.com> | 2019-12-06 14:54:22 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2019-12-06 16:35:42 +0100 |
commit | e749fd947c3eead198a4b702428a41ae3d6e2c9d (patch) | |
tree | 151c13953097a7b1669581df27fd821b61ebb6f5 /test/source | |
parent | fe2baf9e84e0ca9aeaa683e37076f57fa3f38dca (diff) |
Use correct destination sheet instead of arbitrary leftover of expected name
Tests are executed in sequence, inserting a sheet with each
importSheetToCopy(), ended up with 'SheetToCopy_4' as the first
sheet (last sheet inserted), but obtained "destination" values
from sheet 'SheetToCopy' (the first sheet inserted) whatever may
have happened to its references during the previous tests or by
inserting more sheets in front of it.
Instead of obtaining the destination sheet by name 'SheetToCopy',
obtain it by index 0 where it was inserted
We could also remove the inserted sheet after each test, but
likely a cleaner approach would be to setup a fresh document to be
inserted into for each test to avoid any side effects like names
already being present from a previous insertion.
Change-Id: I38f35ccac7d656026b6fec8d3c5faa68d6f4a642
Reviewed-on: https://gerrit.libreoffice.org/84631
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'test/source')
-rw-r--r-- | test/source/sheet/xspreadsheets2.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/source/sheet/xspreadsheets2.cxx b/test/source/sheet/xspreadsheets2.cxx index 9b500977fe5d..a65d68716c9a 100644 --- a/test/source/sheet/xspreadsheets2.cxx +++ b/test/source/sheet/xspreadsheets2.cxx @@ -309,8 +309,8 @@ void XSpreadsheets2::importSheetToCopy() 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); + uno::Reference< container::XIndexAccess > xDestSheetIndexAccess (xDestDoc->getSheets(), UNO_QUERY_THROW); + xDestSheet.set( xDestSheetIndexAccess->getByIndex(nDestPosEffective), UNO_QUERY_THROW); } bool XSpreadsheets2::isExternalReference(const OUString& aDestContent, const OUString& aSrcContent ) |