summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2020-11-20 12:27:31 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2020-11-20 15:08:00 +0100
commitbf5b90e035f2a3107833b3533eab027424093770 (patch)
tree398e7a2460412853b5f6b44c6b3bce0c7ba596bc /sc
parent07f0e515c055847689121249c29c6baaa35d35e4 (diff)
sc: Add unittest to check size of comments
Change-Id: I267f85a2d3394e4b97e294c25cd7a16e28bf8b7f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106223 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/filters-test.cxx36
1 files changed, 36 insertions, 0 deletions
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index 3c6e6c7d9bbb..a994297ff2c0 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -29,6 +29,7 @@
#include <scopetools.hxx>
#include <scmod.hxx>
+#include <svx/svdocapt.hxx>
#include <svx/svdpage.hxx>
using namespace ::com::sun::star;
@@ -71,6 +72,7 @@ public:
void testSharedFormulaRefUpdateXLSX();
void testSheetNamesXLSX();
void testTdf79998();
+ void testCommentSize();
void testLegacyCellAnchoredRotatedShape();
void testEnhancedProtectionXLS();
void testEnhancedProtectionXLSX();
@@ -98,6 +100,7 @@ public:
CPPUNIT_TEST(testSharedFormulaRefUpdateXLSX);
CPPUNIT_TEST(testSheetNamesXLSX);
CPPUNIT_TEST(testTdf79998);
+ CPPUNIT_TEST(testCommentSize);
CPPUNIT_TEST(testLegacyCellAnchoredRotatedShape);
CPPUNIT_TEST(testEnhancedProtectionXLS);
CPPUNIT_TEST(testEnhancedProtectionXLSX);
@@ -488,6 +491,39 @@ void ScFiltersTest::testTdf79998()
xDocSh->DoClose();
}
+void ScFiltersTest::testCommentSize()
+{
+ ScDocShellRef xDocSh = loadDoc("comment.", FORMAT_ODS);
+ ScDocument& rDoc = xDocSh->GetDocument();
+
+ ScAddress aPos(0,0,0);
+ ScPostIt *pNote = rDoc.GetNote(aPos);
+ CPPUNIT_ASSERT(pNote);
+
+ pNote->ShowCaption(aPos, true);
+ CPPUNIT_ASSERT(pNote->IsCaptionShown());
+
+ SdrCaptionObj* pCaption = pNote->GetCaption();
+ CPPUNIT_ASSERT(pCaption);
+
+ const tools::Rectangle& rOldRect = pCaption->GetLogicRect();
+ CPPUNIT_ASSERT_EQUAL(tools::Long(2899), rOldRect.getWidth());
+ CPPUNIT_ASSERT_EQUAL(tools::Long(939), rOldRect.getHeight());
+
+ pNote->SetText(aPos, "first\nsecond\nthird");
+
+ const tools::Rectangle& rNewRect = pCaption->GetLogicRect();
+ CPPUNIT_ASSERT_EQUAL(rOldRect.getWidth(), rNewRect.getWidth());
+ CPPUNIT_ASSERT_EQUAL(tools::Long(1605), rNewRect.getHeight());
+
+ rDoc.GetUndoManager()->Undo();
+
+ CPPUNIT_ASSERT_EQUAL(rOldRect.getWidth(), pCaption->GetLogicRect().getWidth());
+ CPPUNIT_ASSERT_EQUAL(rOldRect.getHeight(), pCaption->GetLogicRect().getHeight());
+
+ xDocSh->DoClose();
+}
+
static void impl_testLegacyCellAnchoredRotatedShape( ScDocument& rDoc, const tools::Rectangle& aRect, const ScDrawObjData& aAnchor, tools::Long TOLERANCE = 30 /* 30 hmm */ )
{
ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();