summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2018-08-30 15:22:27 +0200
committerKatarina Behrens <Katarina.Behrens@cib.de>2018-08-31 14:14:07 +0200
commit8eca83829b21bf17f6a83b87df38862eab490b30 (patch)
treebbcd63e455ec5de969c9a2055de2ea19fcafc518 /sc
parente56eb9cb7ee80215c05d06f25349d7ab7ad06640 (diff)
tdf#112454 Add tests for ScDocument::ContainsNotesInRange
Change-Id: Ic8867c69ae537f785a5928849e247174e92ac437 Reviewed-on: https://gerrit.libreoffice.org/59816 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/ucalc.cxx22
-rw-r--r--sc/qa/unit/ucalc.hxx2
2 files changed, 24 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 193522887b8b..cd8a87eca658 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -5540,6 +5540,28 @@ void Test::testNoteCopyPaste()
m_pDoc->DeleteTab(0);
}
+// tdf#112454
+void Test::testNoteContainsNotesInRange() {
+ m_pDoc->InsertTab(0, "PostIts");
+
+ // We need a drawing layer in order to create caption objects.
+ m_pDoc->InitDrawLayer(&getDocShell());
+
+ ScAddress aAddr(2, 2, 0); // cell C3
+
+ CPPUNIT_ASSERT_MESSAGE("Claiming there's notes in a document that doesn't have any.",
+ !m_pDoc->ContainsNotesInRange((ScRange(ScAddress(0, 0, 0), aAddr))));
+
+ m_pDoc->GetOrCreateNote(aAddr);
+
+ CPPUNIT_ASSERT_MESSAGE("Claiming there's notes in range that doesn't have any.",
+ !m_pDoc->ContainsNotesInRange(ScRange(ScAddress(0, 0, 0), ScAddress(0, 1, 0))));
+ CPPUNIT_ASSERT_MESSAGE("Note not detected that lies on border of range.",
+ m_pDoc->ContainsNotesInRange((ScRange(ScAddress(0, 0, 0), aAddr))));
+ CPPUNIT_ASSERT_MESSAGE("Note not detected that lies in inner area of range.",
+ m_pDoc->ContainsNotesInRange((ScRange(ScAddress(0, 0, 0), ScAddress(3, 3, 0)))));
+}
+
void Test::testAreasWithNotes()
{
ScDocument& rDoc = getDocShell().GetDocument();
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 25cfe3f6b48d..40f1d8be1953 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -477,6 +477,7 @@ public:
void testNoteDeleteCol();
void testNoteLifeCycle();
void testNoteCopyPaste();
+ void testNoteContainsNotesInRange();
void testAreasWithNotes();
void testAnchoredRotatedShape();
void testCellTextWidth();
@@ -792,6 +793,7 @@ public:
CPPUNIT_TEST(testNoteDeleteCol);
CPPUNIT_TEST(testNoteLifeCycle);
CPPUNIT_TEST(testNoteCopyPaste);
+ CPPUNIT_TEST(testNoteContainsNotesInRange);
CPPUNIT_TEST(testAreasWithNotes);
CPPUNIT_TEST(testAnchoredRotatedShape);
CPPUNIT_TEST(testCellTextWidth);