Kaydet (Commit) b3566715 authored tarafından Mike Kaganski's avatar Mike Kaganski Kaydeden (comit) Michael Meeks

tdf#89972: unit test: check proper external ref manager registration

depends on gerrit#16066

Change-Id: I3dde8acfbf0170d0c2cd3ef0b626f3b286922b65
Reviewed-on: https://gerrit.libreoffice.org/16210Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
Tested-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
üst 85f75042
...@@ -591,21 +591,30 @@ ScDocShellRef ScBootstrapFixture::loadDoc( ...@@ -591,21 +591,30 @@ ScDocShellRef ScBootstrapFixture::loadDoc(
ScBootstrapFixture::ScBootstrapFixture( const OUString& rsBaseString ) : m_aBaseString( rsBaseString ) {} ScBootstrapFixture::ScBootstrapFixture( const OUString& rsBaseString ) : m_aBaseString( rsBaseString ) {}
ScBootstrapFixture::~ScBootstrapFixture() {} ScBootstrapFixture::~ScBootstrapFixture() {}
namespace {
OUString EnsureSeparator(const OUStringBuffer& rFilePath)
{
return (rFilePath.getLength() == 0) || (rFilePath[rFilePath.getLength() - 1] != '/') ?
OUString("/") :
OUString("");
}
}
void ScBootstrapFixture::createFileURL( void ScBootstrapFixture::createFileURL(
const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath) const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath)
{ {
OUString aSep("/");
OUStringBuffer aBuffer( getSrcRootURL() ); OUStringBuffer aBuffer( getSrcRootURL() );
aBuffer.append(m_aBaseString).append(aSep).append(aFileExtension); aBuffer.append(EnsureSeparator(aBuffer)).append(m_aBaseString);
aBuffer.append(aSep).append(aFileBase).append(aFileExtension); aBuffer.append(EnsureSeparator(aBuffer)).append(aFileExtension);
aBuffer.append(EnsureSeparator(aBuffer)).append(aFileBase).append(aFileExtension);
rFilePath = aBuffer.makeStringAndClear(); rFilePath = aBuffer.makeStringAndClear();
} }
void ScBootstrapFixture::createCSVPath(const OUString& aFileBase, OUString& rCSVPath) void ScBootstrapFixture::createCSVPath(const OUString& aFileBase, OUString& rCSVPath)
{ {
OUStringBuffer aBuffer( getSrcRootPath()); OUStringBuffer aBuffer( getSrcRootPath());
aBuffer.append(m_aBaseString).append("/contentCSV/"); aBuffer.append(EnsureSeparator(aBuffer)).append(m_aBaseString);
aBuffer.append(aFileBase).append("csv"); aBuffer.append(EnsureSeparator(aBuffer)).append("contentCSV/").append(aFileBase).append("csv");
rCSVPath = aBuffer.makeStringAndClear(); rCSVPath = aBuffer.makeStringAndClear();
} }
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
#include <columnspanset.hxx> #include <columnspanset.hxx>
#include <tokenstringcontext.hxx> #include <tokenstringcontext.hxx>
#include <formula/errorcodes.hxx> #include <formula/errorcodes.hxx>
#include "externalrefmgr.hxx"
#include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
...@@ -2909,6 +2910,10 @@ void ScFiltersTest::testExternalRefCacheODS() ...@@ -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,2,0)));
CPPUNIT_ASSERT_EQUAL(OUString("text"), rDoc.GetString(ScAddress(1,3,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(); xDocSh->DoClose();
} }
...@@ -3067,7 +3072,7 @@ void ScFiltersTest::testRefStringXLSX() ...@@ -3067,7 +3072,7 @@ void ScFiltersTest::testRefStringXLSX()
} }
ScFiltersTest::ScFiltersTest() ScFiltersTest::ScFiltersTest()
: ScBootstrapFixture( "/sc/qa/unit/data" ) : ScBootstrapFixture( "sc/qa/unit/data" )
{ {
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment