[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - sc/qa
Dennis Francis (via logerrit)
logerrit at kemper.freedesktop.org
Mon Apr 12 15:32:55 UTC 2021
sc/qa/unit/tiledrendering/tiledrendering.cxx | 57 +++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
New commits:
commit ac0b759b4e5f94c975529d367c715ca8b0e41090
Author: Dennis Francis <dennis.francis at collabora.com>
AuthorDate: Tue Jan 19 19:39:39 2021 +0530
Commit: Dennis Francis <dennis.francis at collabora.com>
CommitDate: Mon Apr 12 17:32:21 2021 +0200
unit test for row-height invalidations on pasting
... into a cell whose line-break attribute is set.
Change-Id: I82d021a262d6af48d5eaef5fefa0fe9098758a86
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109661
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
(cherry picked from commit f50e11c55e05506bba2c1a895f13d1a90ac54505)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113973
Tested-by: Dennis Francis <dennis.francis at collabora.com>
Reviewed-by: Dennis Francis <dennis.francis at collabora.com>
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index ed6370e1dbe5..cf45a033cd3f 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -44,6 +44,7 @@
#include <chrono>
#include <cstddef>
+#include <scitems.hxx>
#include <tabvwsh.hxx>
#include <docsh.hxx>
#include <document.hxx>
@@ -113,6 +114,7 @@ public:
void testDeleteCellMultilineContent();
void testSpellOnlineParameter();
void testSpellOnlineRenderParameter();
+ void testPasteIntoWrapTextCell();
CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
CPPUNIT_TEST(testRowColumnHeaders);
@@ -159,6 +161,7 @@ public:
CPPUNIT_TEST(testDeleteCellMultilineContent);
CPPUNIT_TEST(testSpellOnlineParameter);
CPPUNIT_TEST(testSpellOnlineRenderParameter);
+ CPPUNIT_TEST(testPasteIntoWrapTextCell);
CPPUNIT_TEST_SUITE_END();
private:
@@ -472,6 +475,7 @@ public:
OString m_sCellFormula;
boost::property_tree::ptree m_aCommentCallbackResult;
OString m_sInvalidateHeader;
+ OString m_sInvalidateSheetGeometry;
ViewCallback(bool bDeleteListenerOnDestruct=true)
: m_bOwnCursorInvalidated(false),
@@ -581,6 +585,11 @@ public:
{
m_sInvalidateHeader = pPayload;
}
+ break;
+ case LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY:
+ {
+ m_sInvalidateSheetGeometry = pPayload;
+ }
}
}
};
@@ -2324,6 +2333,54 @@ void ScTiledRenderingTest::testDeleteCellMultilineContent()
SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
}
+void ScTiledRenderingTest::testPasteIntoWrapTextCell()
+{
+ comphelper::LibreOfficeKit::setActive();
+ comphelper::LibreOfficeKit::setCompatFlag(
+ comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs);
+
+ ScModelObj* pModelObj = createDoc("empty.ods");
+ CPPUNIT_ASSERT(pModelObj);
+ ScDocument* pDoc = pModelObj->GetDocument();
+
+ // Set Wrap text in A3
+ pDoc->ApplyAttr(0, 2, 0, SfxBoolItem(ATTR_LINEBREAK, true));
+ const SfxBoolItem* pItem = static_cast<const SfxBoolItem*>(pDoc->GetAttr(0, 2, 0, ATTR_LINEBREAK));
+ CPPUNIT_ASSERT(pItem->GetValue());
+
+ ScViewData* pViewData = ScDocShell::GetViewData();
+ CPPUNIT_ASSERT(pViewData);
+
+ ViewCallback aView;
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView);
+ CPPUNIT_ASSERT(!lcl_hasEditView(*pViewData));
+
+ ScTabViewShell* pView = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
+ CPPUNIT_ASSERT(pView);
+
+ // Go to A2 and paste.
+ pView->SetCursor(0, 1);
+ Scheduler::ProcessEventsToIdle();
+ aView.m_sInvalidateSheetGeometry = "";
+ pView->GetViewFrame()->GetBindings().Execute(SID_PASTE);
+ Scheduler::ProcessEventsToIdle();
+
+ // No SG invalidations
+ CPPUNIT_ASSERT_EQUAL(OString(""), aView.m_sInvalidateSheetGeometry);
+
+ // Go to A3 and paste.
+ pView->SetCursor(0, 2);
+ Scheduler::ProcessEventsToIdle();
+ aView.m_sInvalidateSheetGeometry = "";
+ pView->GetViewFrame()->GetBindings().Execute(SID_PASTE);
+ Scheduler::ProcessEventsToIdle();
+
+ // SG invalidations for rows
+ CPPUNIT_ASSERT_EQUAL(OString("rows"), aView.m_sInvalidateSheetGeometry);
+
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+}
+
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);
More information about the Libreoffice-commits
mailing list