[Libreoffice-commits] core.git: sc/qa
Kohei Yoshida
kohei.yoshida at gmail.com
Tue Apr 30 11:52:25 PDT 2013
sc/qa/unit/ucalc.cxx | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
New commits:
commit d09b4affac36f002ce20a10c9e69a4a62b915382
Author: Kohei Yoshida <kohei.yoshida at 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.
More information about the Libreoffice-commits
mailing list