diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-18 10:01:32 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-19 10:37:54 +0200 |
commit | fd590397606e944e9a2974a2c62759436a5a5b20 (patch) | |
tree | d2e692a576bb9a4e535fdcb0448965d6f8e6dd37 /sw/qa | |
parent | c57b7875b4f725187faf113da6d563a9ea43164c (diff) |
sw redlining: support per-view authors
In case there are multiple SwView instances and SetRedlineAuthor() is
called with a non-empty string on them, switching views will keep the
SwModule redline author string up to date as expected.
(cherry picked from commit cb9362faad9fe702031c5e657a31b1963ad4d374)
Conflicts:
sw/source/uibase/uno/unotxdoc.cxx
Change-Id: I363221049dbacd67d7c8f4ff3e778f8032a3bc43
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index b6838bd00366..edc8e6b17af0 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -189,6 +189,7 @@ public: void testTdf84695(); void testClassificationPaste(); void testRedlineParam(); + void testRedlineViewAuthor(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -283,6 +284,7 @@ public: CPPUNIT_TEST(testTdf84695); CPPUNIT_TEST(testClassificationPaste); CPPUNIT_TEST(testRedlineParam); + CPPUNIT_TEST(testRedlineViewAuthor); CPPUNIT_TEST_SUITE_END(); private: @@ -3294,6 +3296,34 @@ void SwUiWriterTest::testRedlineParam() CPPUNIT_ASSERT_EQUAL(OUString("aaamiddle"), pShellCursor->GetPoint()->nNode.GetNode().GetTextNode()->GetText()); } +void SwUiWriterTest::testRedlineViewAuthor() +{ + // Test that setting an author at an SwView level has effect. + + // Create a document with minimal content. + SwDoc* pDoc = createDoc(); + SwDocShell* pDocShell = pDoc->GetDocShell(); + SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); + pWrtShell->Insert("middle"); + SwView* pView = pDocShell->GetView(); + const OUString aAuthor("A U. Thor"); + pView->SetRedlineAuthor(aAuthor); + pDocShell->SetView(pView); + + // Turn on track changes, and add changes to the start of the document. + uno::Reference<beans::XPropertySet> xPropertySet(mxComponent, uno::UNO_QUERY); + xPropertySet->setPropertyValue("RecordChanges", uno::makeAny(true)); + pWrtShell->SttDoc(); + pWrtShell->Insert("aaa"); + + // Now assert that SwView::SetRedlineAuthor() had an effect. + const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rTable.size()); + SwRangeRedline* pRedline = rTable[0]; + // This was 'Unknown Author' instead of 'A U. Thor'. + CPPUNIT_ASSERT_EQUAL(aAuthor, pRedline->GetAuthorString()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); |