summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-05-14 17:30:11 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-05-20 20:13:06 -0400
commit3a9b560825308e43d0a946c8504dc023e28fa2af (patch)
tree7b33ab11a72933e3037a7a4bfb37de057b8a3248
parent063d91ee77994f7827e3cff1ff0a8bb008cafa68 (diff)
Add perf test for removal of large array of formula cells.
Change-Id: I2fdf38b23e74a9f4cad7abd9a943e8817f39474c
-rw-r--r--sc/qa/unit/ucalc.cxx27
1 files changed, 26 insertions, 1 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index d05190804715..07fa33fe44a0 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -112,7 +112,8 @@ public:
/**
* Basic performance regression test. Pick some actions that *should* take
* only a fraction of a second to complete, and make sure they stay that
- * way.
+ * way. We set the threshold to 1 second for each action which should be
+ * large enough to accommodate slower machines or machines with high load.
*/
void testPerf();
void testCollator();
@@ -486,6 +487,30 @@ void Test::testPerf()
CPPUNIT_FAIL(os.str().c_str());
}
+ {
+ // Switch to R1C1 to make it easier to input relative references in multiple cells.
+ FormulaGrammarSwitch aFGSwitch(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1);
+
+ // Insert formulas in B1:B100000. This shouldn't take long, but may take
+ // close to a second on a slower machine. We don't measure this yet, for
+ // now.
+ for (SCROW i = 0; i < 100000; ++i)
+ m_pDoc->SetString(ScAddress(1,i,0), "=RC[-1]");
+
+ // Now, Delete B2:B100000. This should complete in a fraction of a second
+ // (0.06 sec on my machine).
+ osl_getSystemTime(&aTimeBefore);
+ clearRange(m_pDoc, ScRange(1,1,0,1,99999,0));
+ osl_getSystemTime(&aTimeAfter);
+ diff = getTimeDiff(aTimeAfter, aTimeBefore);
+ if (diff >= 1.0)
+ {
+ std::ostringstream os;
+ os << "Removal of a large array of formula cells took " << diff << " seconds. It should be instant.";
+ CPPUNIT_FAIL(os.str().c_str());
+ }
+ }
+
m_pDoc->DeleteTab(0);
}