summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-05-11 13:30:13 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-05-11 13:30:43 +0100
commit3fa5ac20a003d2eb0b718a98eb2217749e3133da (patch)
tree838a06cf865a7b33e6f5c70dfc0f002ff99042b0 /sw/qa
parent36c2e811539cd1a32a7a6f9a71c8ec996e250b14 (diff)
Related: tdf#66353 make a basic regression test for formula parser
Change-Id: I7f79aff38899fd814d707b40f3fd77b2c87b1328
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/core/uwriter.cxx38
1 files changed, 38 insertions, 0 deletions
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 1d5986c06dc2..a2b2d7441555 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -36,6 +36,7 @@
#include <IDocumentRedlineAccess.hxx>
#include <IDocumentFieldsAccess.hxx>
#include <IDocumentStatistics.hxx>
+#include "cellfml.hxx"
#include "docsh.hxx"
#include "docstat.hxx"
#include "docufld.hxx"
@@ -105,6 +106,7 @@ public:
void testGraphicAnchorDeletion();
void testTransliterate();
void testMarkMove();
+ void testFormulas();
void testIntrusiveRing();
void testClientModify();
@@ -136,6 +138,7 @@ public:
CPPUNIT_TEST(testMergePortionsDeleteNotSorted);
CPPUNIT_TEST(testGraphicAnchorDeletion);
CPPUNIT_TEST(testMarkMove);
+ CPPUNIT_TEST(testFormulas);
CPPUNIT_TEST(testIntrusiveRing);
CPPUNIT_TEST(testClientModify);
CPPUNIT_TEST_SUITE_END();
@@ -1173,6 +1176,41 @@ void SwDocTest::testTransliterate()
i18n::TransliterationModules_HIRAGANA_KATAKANA));
}
+namespace
+{
+ class SwTableFormulaTest : public SwTableFormula
+ {
+ SwTableNode *m_pNode;
+ public:
+ SwTableFormulaTest(const OUString &rStr, SwTableNode *pNode)
+ : SwTableFormula(rStr)
+ , m_pNode(pNode)
+ {
+ m_eNmType = INTRNL_NAME;
+ }
+ virtual const SwNode* GetNodeOfFormula() const SAL_OVERRIDE
+ {
+ return m_pNode;
+ }
+ };
+}
+
+//tdf#66353 Expression is faulty
+void SwDocTest::testFormulas()
+{
+ SwNodeIndex aIdx(m_pDoc->GetNodes().GetEndOfContent(), -1);
+ SwPosition aPos(aIdx);
+
+ const SwTable *pTable = m_pDoc->InsertTable(
+ SwInsertTableOptions(tabopts::HEADLINE_NO_BORDER, 0), aPos, 1, 3, 0);
+ SwTableNode* pTableNode = pTable->GetTableNode();
+ SwTableFormulaTest aFormula("<\x12-1,0>+<Table1.A1>", pTableNode);
+
+ aFormula.PtrToBoxNm(pTable);
+
+ CPPUNIT_ASSERT_EQUAL(OUString("<?>+<Table1.?>"), aFormula.GetFormula());
+}
+
void SwDocTest::testMarkMove()
{
IDocumentMarkAccess* pMarksAccess = m_pDoc->getIDocumentMarkAccess();