summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-09-20 12:23:04 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-09-21 08:08:10 +0200
commitb9b7d4ee4ded28f59997ce7f30488e049af917a1 (patch)
tree37d0e67fb92b16d74bc4a3189e28f1a1ab34efe3
parent006c01038db88afa045efa12d5b778830a285ef7 (diff)
tdf#102308 sw: improve redline timestamp precision
It's not clear why it was like this since the initial import, but at least not clearing seconds is already an improvement. (cherry picked from commit d9dca1eef91faa710112ffd20a2b2d36b48a9287) Conflicts: sw/qa/extras/uiwriter/uiwriter.cxx Change-Id: Ic452256d4ab47e6779ec71fe6576eacb5b74fb43
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx31
-rw-r--r--sw/source/core/doc/docredln.cxx1
2 files changed, 31 insertions, 1 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index d63b3fc833ff..ad97db70bb8e 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -190,6 +190,7 @@ public:
void testClassificationPaste();
void testRedlineParam();
void testRedlineViewAuthor();
+ void testRedlineTimestamp();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
@@ -285,6 +286,7 @@ public:
CPPUNIT_TEST(testClassificationPaste);
CPPUNIT_TEST(testRedlineParam);
CPPUNIT_TEST(testRedlineViewAuthor);
+ CPPUNIT_TEST(testRedlineTimestamp);
CPPUNIT_TEST_SUITE_END();
private:
@@ -3357,6 +3359,35 @@ void SwUiWriterTest::testRedlineViewAuthor()
CPPUNIT_ASSERT_EQUAL(aAuthor, xField->getPropertyValue("Author").get<OUString>());
}
+void SwUiWriterTest::testRedlineTimestamp()
+{
+ // Test that a redline timestamp's second is not always 0.
+
+ // Create a document with minimal content.
+ SwDoc* pDoc = createDoc();
+ SwDocShell* pDocShell = pDoc->GetDocShell();
+ SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
+ pWrtShell->Insert("middle");
+
+ // Turn on track changes, and add changes to the start and to the end of
+ // the document.
+ uno::Reference<beans::XPropertySet> xPropertySet(mxComponent, uno::UNO_QUERY);
+ xPropertySet->setPropertyValue("RecordChanges", uno::makeAny(true));
+ pWrtShell->SttDoc();
+ pWrtShell->Insert("aaa");
+ osl::Thread::wait(std::chrono::seconds(1));
+ pWrtShell->EndDoc();
+ pWrtShell->Insert("zzz");
+
+ // Now assert that at least one of the the seconds are not 0.
+ const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rTable.size());
+ sal_uInt16 nSec1 = rTable[0]->GetRedlineData().GetTimeStamp().GetSec();
+ sal_uInt16 nSec2 = rTable[0]->GetRedlineData().GetTimeStamp().GetSec();
+ // This failed, seconds was always 0.
+ CPPUNIT_ASSERT(nSec1 != 0 || nSec2 != 0);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 99cd56658160..afbb653c08d6 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -853,7 +853,6 @@ SwRedlineData::SwRedlineData( RedlineType_t eT, sal_uInt16 nAut )
aStamp( DateTime::SYSTEM ),
eType( eT ), nAuthor( nAut ), nSeqNo( 0 )
{
- aStamp.SetSec( 0 );
aStamp.SetNanoSec( 0 );
}