summaryrefslogtreecommitdiff
path: root/sc/qa/unit
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2015-06-10 23:51:41 +1000
committerMichael Meeks <michael.meeks@collabora.com>2015-06-10 20:28:19 +0000
commitb3566715c181913c8efa8b1bce8941a760748689 (patch)
tree0f27142098fd8e175e49f7d17d3509ad970ab073 /sc/qa/unit
parent85f75042f6d62bf3da182311c4396392d9730521 (diff)
tdf#89972: unit test: check proper external ref manager registration
depends on gerrit#16066 Change-Id: I3dde8acfbf0170d0c2cd3ef0b626f3b286922b65 Reviewed-on: https://gerrit.libreoffice.org/16210 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sc/qa/unit')
-rw-r--r--sc/qa/unit/data/ods/external-ref-cache.odsbin13425 -> 10193 bytes
-rw-r--r--sc/qa/unit/helper/qahelper.cxx19
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx7
3 files changed, 20 insertions, 6 deletions
diff --git a/sc/qa/unit/data/ods/external-ref-cache.ods b/sc/qa/unit/data/ods/external-ref-cache.ods
index b83ba072305b..c4c1be891d59 100644
--- a/sc/qa/unit/data/ods/external-ref-cache.ods
+++ b/sc/qa/unit/data/ods/external-ref-cache.ods
Binary files differ
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index 96307e1bf2b8..654df89b0308 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -591,21 +591,30 @@ ScDocShellRef ScBootstrapFixture::loadDoc(
ScBootstrapFixture::ScBootstrapFixture( const OUString& rsBaseString ) : m_aBaseString( rsBaseString ) {}
ScBootstrapFixture::~ScBootstrapFixture() {}
+namespace {
+OUString EnsureSeparator(const OUStringBuffer& rFilePath)
+{
+ return (rFilePath.getLength() == 0) || (rFilePath[rFilePath.getLength() - 1] != '/') ?
+ OUString("/") :
+ OUString("");
+}
+}
+
void ScBootstrapFixture::createFileURL(
const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath)
{
- OUString aSep("/");
OUStringBuffer aBuffer( getSrcRootURL() );
- aBuffer.append(m_aBaseString).append(aSep).append(aFileExtension);
- aBuffer.append(aSep).append(aFileBase).append(aFileExtension);
+ aBuffer.append(EnsureSeparator(aBuffer)).append(m_aBaseString);
+ aBuffer.append(EnsureSeparator(aBuffer)).append(aFileExtension);
+ aBuffer.append(EnsureSeparator(aBuffer)).append(aFileBase).append(aFileExtension);
rFilePath = aBuffer.makeStringAndClear();
}
void ScBootstrapFixture::createCSVPath(const OUString& aFileBase, OUString& rCSVPath)
{
OUStringBuffer aBuffer( getSrcRootPath());
- aBuffer.append(m_aBaseString).append("/contentCSV/");
- aBuffer.append(aFileBase).append("csv");
+ aBuffer.append(EnsureSeparator(aBuffer)).append(m_aBaseString);
+ aBuffer.append(EnsureSeparator(aBuffer)).append("contentCSV/").append(aFileBase).append("csv");
rCSVPath = aBuffer.makeStringAndClear();
}
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index a110cb56dbf3..4ac4bf86e7cb 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -57,6 +57,7 @@
#include <columnspanset.hxx>
#include <tokenstringcontext.hxx>
#include <formula/errorcodes.hxx>
+#include "externalrefmgr.hxx"
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
@@ -2909,6 +2910,10 @@ void ScFiltersTest::testExternalRefCacheODS()
CPPUNIT_ASSERT_EQUAL(OUString("text"), rDoc.GetString(ScAddress(1,2,0)));
CPPUNIT_ASSERT_EQUAL(OUString("text"), rDoc.GetString(ScAddress(1,3,0)));
+ // Both cells A6 and A7 should be registered with scExternalRefManager properly
+ CPPUNIT_ASSERT_EQUAL(true, rDoc.GetExternalRefManager()->hasCellExternalReference(ScAddress(0, 5, 0)));
+ CPPUNIT_ASSERT_EQUAL(true, rDoc.GetExternalRefManager()->hasCellExternalReference(ScAddress(0, 6, 0)));
+
xDocSh->DoClose();
}
@@ -3067,7 +3072,7 @@ void ScFiltersTest::testRefStringXLSX()
}
ScFiltersTest::ScFiltersTest()
- : ScBootstrapFixture( "/sc/qa/unit/data" )
+ : ScBootstrapFixture( "sc/qa/unit/data" )
{
}