sc/qa/unit/ucalc.cxx |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

New commits:
commit d09b4affac36f002ce20a10c9e69a4a62b915382
Author: Kohei Yoshida <kohei.yosh...@gmail.com>
Date:   Tue Apr 30 14:52:18 2013 -0400

    Unit test for the earlier reference toggling bug.
    
    Change-Id: If9c05add57c87f56e8514cee75b89e09c74277f5

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index a220742..4b881cd 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -5116,6 +5116,33 @@ void Test::testToggleRefFlag()
         CPPUNIT_ASSERT_EQUAL(OUString("=R1C1"), aFormula);
     }
 
+    {
+        // Calc A1:
+        OUString aFormula("=A1+4");
+        ScAddress aPos(1, 1, 0);
+        ScRefFinder aFinder(aFormula, aPos, m_pDoc, 
formula::FormulaGrammar::CONV_OOO);
+
+        // Original
+        CPPUNIT_ASSERT_EQUAL(aFormula, aFinder.GetText());
+
+        // Set the cursor over the 'A1' part and toggle.
+        aFinder.ToggleRel(2, 2);
+        aFormula = aFinder.GetText();
+        CPPUNIT_ASSERT_EQUAL(OUString("=$A$1+4"), aFormula);
+
+        aFinder.ToggleRel(2, 2);
+        aFormula = aFinder.GetText();
+        CPPUNIT_ASSERT_EQUAL(OUString("=A$1+4"), aFormula);
+
+        aFinder.ToggleRel(2, 2);
+        aFormula = aFinder.GetText();
+        CPPUNIT_ASSERT_EQUAL(OUString("=$A1+4"), aFormula);
+
+        aFinder.ToggleRel(2, 2);
+        aFormula = aFinder.GetText();
+        CPPUNIT_ASSERT_EQUAL(OUString("=A1+4"), aFormula);
+    }
+
     // TODO: Add more test cases esp. for 3D references, Excel A1 syntax, and
     // partial selection within formula string.
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to