summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-04-30 14:52:18 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-04-30 14:54:56 -0400
commitd09b4affac36f002ce20a10c9e69a4a62b915382 (patch)
treedd5e7dcaf303e6a1bc756fd67fa6843c2aaaec9e /sc
parent9bff49e203359921cb279be373773deb13ca8b90 (diff)
Unit test for the earlier reference toggling bug.
Change-Id: If9c05add57c87f56e8514cee75b89e09c74277f5
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/ucalc.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index a2207423dcd4..4b881cd0f419 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.