diff options
author | Gülşah Köse <gulsah.kose@collabora.com> | 2025-02-13 18:51:13 +0300 |
---|---|---|
committer | Gülşah Köse <gulsah.kose@collabora.com> | 2025-04-08 19:28:36 +0200 |
commit | 8933bdc9db8110e980a24b1f7c3627b59a4a1ff1 (patch) | |
tree | 98cf1af8388af36e99005b50a97185a5c24a2dec | |
parent | 93bf5c795f2a4aa3f7e3e3ff102aa0ce7a44b44e (diff) |
cool#11216 Remove unnecessary control to invalidate cursor
bPostItActive control is introduced by b9cc6653606c829805c6c01b9613a3a25d81c20b
Then new annotation changes introduced by 69c546e1e7a697217f273baa7c1729ff823efd76
makes this control unnecessary so removed the test testWriterCommentInsertCursor
introduced in first commit.
To keep that control makes buggy finding text via "Find and Replace"
dialog in comments. It never moves the visible cursor if the text
matches only in comments
Now it fixed.
Signed-off-by: Gülşah Köse <gulsah.kose@collabora.com>
Change-Id: Ice60b4de2ae65c400b49153c3a0a4f3cccb7ad87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181634
Tested-by: Miklos Vajna <vmiklos@collabora.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183844
Tested-by: Jenkins
-rw-r--r-- | sw/qa/extras/tiledrendering/data/findandreplaceincomments.odt | bin | 0 -> 10479 bytes | |||
-rw-r--r-- | sw/qa/extras/tiledrendering/tiledrendering.cxx | 34 | ||||
-rw-r--r-- | sw/qa/inc/swtiledrenderingtest.hxx | 1 | ||||
-rw-r--r-- | sw/qa/unit/swtiledrenderingtest.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/crsr/viscrs.cxx | 11 |
5 files changed, 43 insertions, 10 deletions
diff --git a/sw/qa/extras/tiledrendering/data/findandreplaceincomments.odt b/sw/qa/extras/tiledrendering/data/findandreplaceincomments.odt Binary files differnew file mode 100644 index 000000000000..a34186b43eea --- /dev/null +++ b/sw/qa/extras/tiledrendering/data/findandreplaceincomments.odt diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 8b9387d2afb1..2ba5e6890b77 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -26,6 +26,7 @@ #include <test/helper/transferable.hxx> #include <comphelper/dispatchcommand.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/scopeguard.hxx> #include <svx/svdpage.hxx> #include <svx/svdview.hxx> #include <vcl/virdev.hxx> @@ -53,6 +54,7 @@ #include <sfx2/lokhelper.hxx> #include <comphelper/lok.hxx> #include <comphelper/string.hxx> +#include <unotools/searchopt.hxx> #include <drawdoc.hxx> #include <ndtxt.hxx> @@ -3956,6 +3958,38 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testTdf159626_blackPatternFill) CPPUNIT_ASSERT(nPureBlackPixels / 10 > nEdgePlusWhitePlusAntialiasPixels); } +CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testFindAndReplaceInComments) +{ + comphelper::LibreOfficeKit::setViewIdForVisCursorInvalidation(true); + SvtSearchOptions aSearchOpt; + aSearchOpt.SetNotes(true); + aSearchOpt.Commit(); + comphelper::ScopeGuard g([] { + comphelper::LibreOfficeKit::setViewIdForVisCursorInvalidation(false); + SvtSearchOptions aOpt; + aOpt.SetNotes(false); + aOpt.Commit(); + }); + + SwXTextDocument* pXTextDocument = createDoc("findandreplaceincomments.odt"); + CPPUNIT_ASSERT(pXTextDocument); + + SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell(); + Scheduler::ProcessEventsToIdle(); + setupLibreOfficeKitViewCallback(pWrtShell->GetSfxViewShell()); + + uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence({ + { "SearchItem.SearchString", uno::Any(OUString("test")) }, + })); + comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); + Scheduler::ProcessEventsToIdle(); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected greater than: 2000 (2108) + // - Actual : 1418 + CPPUNIT_ASSERT_GREATER(static_cast<tools::Long>(2000), m_aCursorRectangle.getY()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/inc/swtiledrenderingtest.hxx b/sw/qa/inc/swtiledrenderingtest.hxx index 5150db235052..6419a90fd206 100644 --- a/sw/qa/inc/swtiledrenderingtest.hxx +++ b/sw/qa/inc/swtiledrenderingtest.hxx @@ -45,6 +45,7 @@ protected: int m_nRedlineTableEntryModified; int m_nTrackedChangeIndex; bool m_bFullInvalidateSeen; + tools::Rectangle m_aCursorRectangle; OString m_sHyperlinkText; OString m_sHyperlinkLink; OString m_aFormFieldButton; diff --git a/sw/qa/unit/swtiledrenderingtest.cxx b/sw/qa/unit/swtiledrenderingtest.cxx index 8aa80f1c68a3..3ea1a08352b4 100644 --- a/sw/qa/unit/swtiledrenderingtest.cxx +++ b/sw/qa/unit/swtiledrenderingtest.cxx @@ -190,6 +190,13 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload) boost::property_tree::ptree& aChild = aTree.get_child("hyperlink"); m_sHyperlinkText = OString(aChild.get("text", "")); m_sHyperlinkLink = OString(aChild.get("link", "")); + + OString aRectangle(aTree.get_child("rectangle").get_value<std::string>()); + uno::Sequence<OUString> aSeq + = comphelper::string::convertCommaSeparated(OUString::fromUtf8(aRectangle)); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), aSeq.getLength()); + m_aCursorRectangle = tools::Rectangle(Point(aSeq[0].toInt32(), aSeq[1].toInt32()), + Size(aSeq[2].toInt32(), aSeq[3].toInt32())); } } break; diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index ad11b3a8294d..e492544a4805 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -208,18 +208,9 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * pViewShell) bool bIsCursorPosChanged = m_aTextCursor.GetPos() != aRect.Pos(); m_aTextCursor.SetSize( aRect.SSize() ); - m_aTextCursor.SetPos( aRect.Pos() ); - bool bPostItActive = false; - SwView* pView = dynamic_cast<SwView*>(m_pCursorShell->GetSfxViewShell()); - if (pView) - { - if (SwPostItMgr* pPostItMgr = pView->GetPostItMgr()) - bPostItActive = pPostItMgr->GetActiveSidebarWin() != nullptr; - } - - if (comphelper::LibreOfficeKit::isActive() && !bPostItActive) + if (comphelper::LibreOfficeKit::isActive()) { // notify about page number change (if that happened) sal_uInt16 nPage, nVirtPage; |