sc/qa/unit/data/ods/external-ref-cache.ods |binary
 sc/qa/unit/helper/qahelper.cxx             |   19 ++++++++++++++-----
 sc/qa/unit/subsequent_filters-test.cxx     |    7 ++++++-
 3 files changed, 20 insertions(+), 6 deletions(-)

New commits:
commit b3566715c181913c8efa8b1bce8941a760748689
Author: Mike Kaganski <mike.kagan...@collabora.com>
Date:   Wed Jun 10 23:51:41 2015 +1000

    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.me...@collabora.com>
    Tested-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/sc/qa/unit/data/ods/external-ref-cache.ods 
b/sc/qa/unit/data/ods/external-ref-cache.ods
index b83ba07..c4c1be8 100644
Binary files a/sc/qa/unit/data/ods/external-ref-cache.ods and 
b/sc/qa/unit/data/ods/external-ref-cache.ods differ
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index 96307e1..654df89 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 a110cb56..4ac4bf8 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" )
 {
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to