diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-04-07 21:11:04 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-04-07 21:12:46 +0200 |
commit | 8b9207f49f436a886bcb94ae902e16c47484b3cb (patch) | |
tree | 33a0b1f0a7d3318a73d2bca616dd160ab9501ed1 | |
parent | f57c9921de4d64fbe27e80e2e7c13dea23853089 (diff) |
add test for tdf#99093
Change-Id: Id47abea42867f418e80a40357baa5f6435ecbdd6
-rw-r--r-- | sc/qa/unit/data/xls/validation.xls | bin | 0 -> 25600 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 31 |
2 files changed, 31 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/validation.xls b/sc/qa/unit/data/xls/validation.xls Binary files differnew file mode 100644 index 000000000000..46bbbf79dbff --- /dev/null +++ b/sc/qa/unit/data/xls/validation.xls diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index efd18592c3c6..8106d2166b75 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" ) { |