summaryrefslogtreecommitdiff
path: root/sw/qa/extras
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-09-23 18:15:14 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-09-27 10:17:03 +0200
commit197d78c533307bd110e9b03fe94fb2f2d5240337 (patch)
tree2ca286f511d63890697206258c194ed9a439ec75 /sw/qa/extras
parenta63e28c0c56965a0120f250f5a39595c2f020356 (diff)
tdf#102384 sw: avoid moving cursors of other windows in SwTextNode::Update()
There is a list of exceptional SwIndex containers in that member function, like bookmarks, at-char anchored fly frames, etc. If we're growing (so basically in the safe case), don't touch the cursors of other windows, either. This helps to avoid the surprising "I didn't do anything and my cursor moved" behavior. (cherry picked from commit ecdec24c035513dbf2ee1814eb437e2a9d9a3d6c) Conflicts: sw/qa/extras/uiwriter/uiwriter.cxx sw/source/core/txtnode/ndtxt.cxx Change-Id: I9941fdcb6b7ad4b6e18a321cecc72fdf73d917fd
Diffstat (limited to 'sw/qa/extras')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index f68d292f0009..cb55d49ca919 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -88,6 +88,7 @@
#include <comphelper/propertysequence.hxx>
#include <sfx2/classificationhelper.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <sfx2/lokhelper.hxx>
static const char* DATA_DIRECTORY = "/sw/qa/extras/uiwriter/data/";
@@ -191,6 +192,7 @@ public:
void testRedlineParam();
void testRedlineViewAuthor();
void testRedlineTimestamp();
+ void testCursorWindows();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
@@ -287,6 +289,7 @@ public:
CPPUNIT_TEST(testRedlineParam);
CPPUNIT_TEST(testRedlineViewAuthor);
CPPUNIT_TEST(testRedlineTimestamp);
+ CPPUNIT_TEST(testCursorWindows);
CPPUNIT_TEST_SUITE_END();
private:
@@ -3397,6 +3400,27 @@ void SwUiWriterTest::testRedlineTimestamp()
CPPUNIT_ASSERT(nSec1 != 0 || nSec2 != 0);
}
+void SwUiWriterTest::testCursorWindows()
+{
+ // Create a new document with one window.
+ SwDoc* pDoc = createDoc();
+ SwDocShell* pDocShell = pDoc->GetDocShell();
+ SwWrtShell* pWrtShell1 = pDocShell->GetWrtShell();
+
+ // Create a second view and type something.
+ SfxLokHelper::createView();
+ SwWrtShell* pWrtShell2 = pDocShell->GetWrtShell();
+ OUString aText("foo");
+ pWrtShell2->Insert(aText);
+
+ // Assert that only the cursor of the actual window move, not other cursors.
+ SwShellCursor* pShellCursor1 = pWrtShell1->getShellCursor(false);
+ SwShellCursor* pShellCursor2 = pWrtShell2->getShellCursor(false);
+ // This was 3, not 0 -- cursor of the other window moved.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), pShellCursor1->Start()->nContent.GetIndex());
+ CPPUNIT_ASSERT_EQUAL(aText.getLength(), pShellCursor2->Start()->nContent.GetIndex());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();