summaryrefslogtreecommitdiff
path: root/sc/qa/unit/ucalc.cxx
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2021-05-07 16:32:52 +0530
committerDennis Francis <dennis.francis@collabora.com>2021-05-13 16:23:46 +0200
commitca2ec443893731093970914feb750b31ea13e47f (patch)
tree840c2980d6f7e73c0b68284008dc2dc3ad3c4ed4 /sc/qa/unit/ucalc.cxx
parentf8039c6d645acb015a6c4e45000bbfd1311bfea3 (diff)
tdf#142214: autocomplete: do not search across empty blocks
Change-Id: Ia5b0be1eed2bf645fa1e53d71abc7b2e67dfaa0a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115458 Tested-by: Jenkins Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
Diffstat (limited to 'sc/qa/unit/ucalc.cxx')
-rw-r--r--sc/qa/unit/ucalc.cxx19
1 files changed, 16 insertions, 3 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 72e25f2f5b91..32db14e20be2 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -613,14 +613,22 @@ void Test::testDataEntries()
m_pDoc->SetString(ScAddress(0,5,0), "Andy");
m_pDoc->SetString(ScAddress(0,6,0), "Bruce");
m_pDoc->SetString(ScAddress(0,7,0), "Charlie");
+ m_pDoc->SetValue(ScAddress(0,8,0), 100);
+ m_pDoc->SetValue(ScAddress(0,9,0), 200);
m_pDoc->SetString(ScAddress(0,10,0), "Andy");
+ m_pDoc->SetValue(ScAddress(0,11,0), 1000);
std::vector<ScTypedStrData> aEntries;
- m_pDoc->GetDataEntries(0, 0, 0, aEntries); // Try at the very top.
+ m_pDoc->GetDataEntries(0, 0, 0, aEntries); // Try at the top.
+ std::vector<ScTypedStrData>::const_iterator it = aEntries.begin();
+ CPPUNIT_ASSERT_MESSAGE("The entries should be empty.", bool(it == aEntries.end()));
+
+ aEntries.clear();
+ m_pDoc->GetDataEntries(0, 4, 0, aEntries); // Try at A5.
// Entries are supposed to be sorted in ascending order, and are all unique.
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aEntries.size());
- std::vector<ScTypedStrData>::const_iterator it = aEntries.begin();
+ it = aEntries.begin();
CPPUNIT_ASSERT_EQUAL(OUString("Andy"), it->GetString());
++it;
CPPUNIT_ASSERT_EQUAL(OUString("Bruce"), it->GetString());
@@ -630,7 +638,7 @@ void Test::testDataEntries()
CPPUNIT_ASSERT_MESSAGE("The entries should have ended here.", bool(it == aEntries.end()));
aEntries.clear();
- m_pDoc->GetDataEntries(0, MAXROW, 0, aEntries); // Try at the very bottom.
+ m_pDoc->GetDataEntries(0, 12, 0, aEntries); // Try at A13.
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aEntries.size());
// Make sure we get the same set of suggestions.
@@ -643,6 +651,11 @@ void Test::testDataEntries()
++it;
CPPUNIT_ASSERT_MESSAGE("The entries should have ended here.", bool(it == aEntries.end()));
+ aEntries.clear();
+ m_pDoc->GetDataEntries(0, MAXROW, 0, aEntries); // Try at the bottom.
+ it = aEntries.begin();
+ CPPUNIT_ASSERT_MESSAGE("The entries should be empty.", bool(it == aEntries.end()));
+
m_pDoc->DeleteTab(0);
}