summaryrefslogtreecommitdiff
path: root/sc/qa/unit/ucalc.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2016-10-07 21:39:02 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2016-10-07 22:05:11 -0400
commitf37292941fef7375b8bc29783f54e0c64d670a24 (patch)
tree880813e002c5b336c4bb10c1e29b102bf423824c /sc/qa/unit/ucalc.cxx
parent61b76cd8ca6a4a98a2ffe6fb42c73eba561aa87f (diff)
Write test case for it.
Change-Id: I63f8b5d490686f838c0618d670bb21a957690866
Diffstat (limited to 'sc/qa/unit/ucalc.cxx')
-rw-r--r--sc/qa/unit/ucalc.cxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index f1d705ff401b..86e2ed6e7f85 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -465,6 +465,41 @@ void Test::testDocStatistics()
m_pDoc->DeleteTab(0); // This may fail in case there is only one sheet in the document.
}
+void Test::testRowForHeight()
+{
+ m_pDoc->InsertTab(0, "Sheet1");
+ m_pDoc->SetRowHeightRange( 0, 9, 0, 100);
+ m_pDoc->SetRowHeightRange(10, 19, 0, 200);
+ m_pDoc->SetRowHeightRange(20, 29, 0, 300);
+
+ // Hide some rows.
+ m_pDoc->SetRowHidden(3, 5, 0, true);
+ m_pDoc->SetRowHidden(8, 12, 0, true);
+
+ struct Check
+ {
+ sal_uLong nHeight;
+ SCROW nRow;
+ };
+
+ std::vector<Check> aChecks = {
+ { 1, 1 },
+ { 99, 1 },
+ { 120, 2 },
+ { 330, 7 },
+ { 420, 13 },
+ { 780, 15 },
+ { 1860, 20 },
+ { 4020, 28 },
+ };
+
+ for (const Check& rCheck : aChecks)
+ {
+ SCROW nRow = m_pDoc->GetRowForHeight(0, rCheck.nHeight);
+ CPPUNIT_ASSERT_EQUAL(rCheck.nRow, nRow);
+ }
+}
+
void Test::testDataEntries()
{
m_pDoc->InsertTab(0, "Test");