[Libreoffice-commits] core.git: sc/qa

Markus Mohrhard markus.mohrhard at googlemail.com
Thu Apr 7 19:13:22 UTC 2016


 sc/qa/unit/data/xls/validation.xls     |binary
 sc/qa/unit/subsequent_filters-test.cxx |   31 +++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

New commits:
commit 8b9207f49f436a886bcb94ae902e16c47484b3cb
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Apr 7 21:11:04 2016 +0200

    add test for tdf#99093
    
    Change-Id: Id47abea42867f418e80a40357baa5f6435ecbdd6

diff --git a/sc/qa/unit/data/xls/validation.xls b/sc/qa/unit/data/xls/validation.xls
new file mode 100644
index 0000000..46bbbf7
Binary files /dev/null and b/sc/qa/unit/data/xls/validation.xls differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index efd1859..8106d21 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -206,6 +206,7 @@ public:
     void testEditEngStrikeThroughXLSX();
     void testRefStringXLSX();
     void testHiddenSheetsXLSX();
+    void testRelFormulaValidationXLS();
 
     void testBnc762542();
 
@@ -304,6 +305,7 @@ public:
     CPPUNIT_TEST(testErrorOnExternalReferences);
     CPPUNIT_TEST(testEditEngStrikeThroughXLSX);
     CPPUNIT_TEST(testRefStringXLSX);
+    CPPUNIT_TEST(testRelFormulaValidationXLS);
 
     CPPUNIT_TEST(testBnc762542);
 
@@ -3197,6 +3199,35 @@ void ScFiltersTest::testHiddenSheetsXLSX()
     xDocSh->DoClose();
 }
 
+namespace {
+
+void checkValidationFormula(const ScAddress& rPos, ScDocument& rDoc, const OUString& rExpectedFormula)
+{
+    const SfxUInt32Item* pItem = static_cast<const SfxUInt32Item*>(rDoc.GetAttr(rPos, ATTR_VALIDDATA) );
+    CPPUNIT_ASSERT(pItem);
+    sal_uLong nKey = pItem->GetValue();
+    const ScValidationData* pData = rDoc.GetValidationEntry(nKey);
+    CPPUNIT_ASSERT(pData);
+
+    OUString aFormula = pData->GetExpression(rPos, 0);
+    CPPUNIT_ASSERT_EQUAL(rExpectedFormula, aFormula);
+}
+
+}
+
+void ScFiltersTest::testRelFormulaValidationXLS()
+{
+    ScDocShellRef xDocSh = loadDoc("validation.", FORMAT_XLS);
+    CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.Is());
+
+    ScDocument& rDoc = xDocSh->GetDocument();
+
+    checkValidationFormula(ScAddress(3, 4, 0), rDoc, "Sheet1.C5");
+    checkValidationFormula(ScAddress(5, 8, 0), rDoc, "Sheet1.D7");
+
+    xDocSh->DoClose();
+}
+
 ScFiltersTest::ScFiltersTest()
       : ScBootstrapFixture( "sc/qa/unit/data" )
 {


More information about the Libreoffice-commits mailing list