sc/qa/unit/ucalc.cxx | 22 ++++++++++++++++++++++ sc/qa/unit/ucalc.hxx | 2 ++ 2 files changed, 24 insertions(+)
New commits: commit 8eca83829b21bf17f6a83b87df38862eab490b30 Author: Michael Weghorn <[email protected]> AuthorDate: Thu Aug 30 15:22:27 2018 +0200 Commit: Katarina Behrens <[email protected]> CommitDate: Fri Aug 31 14:14:07 2018 +0200 tdf#112454 Add tests for ScDocument::ContainsNotesInRange Change-Id: Ic8867c69ae537f785a5928849e247174e92ac437 Reviewed-on: https://gerrit.libreoffice.org/59816 Tested-by: Jenkins Reviewed-by: Katarina Behrens <[email protected]> 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); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
