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

Caolán McNamara caolanm at redhat.com
Mon May 11 05:31:07 PDT 2015


 sw/qa/core/uwriter.cxx |   38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

New commits:
commit 3fa5ac20a003d2eb0b718a98eb2217749e3133da
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 11 13:30:13 2015 +0100

    Related: tdf#66353 make a basic regression test for formula parser
    
    Change-Id: I7f79aff38899fd814d707b40f3fd77b2c87b1328

diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 1d5986c..a2b2d74 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();


More information about the Libreoffice-commits mailing list