[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Sep 20 12:40:41 UTC 2016
sw/qa/extras/uiwriter/uiwriter.cxx | 31 +++++++++++++++++++++++++++++++
sw/source/core/doc/docredln.cxx | 1 -
2 files changed, 31 insertions(+), 1 deletion(-)
New commits:
commit d9dca1eef91faa710112ffd20a2b2d36b48a9287
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Sep 20 12:23:04 2016 +0200
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.
Change-Id: Ic452256d4ab47e6779ec71fe6576eacb5b74fb43
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 5080f37..4e5f9cc 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -205,6 +205,7 @@ public:
void testRedlineParam();
void testRedlineViewAuthor();
void testTdf78727();
+ void testRedlineTimestamp();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
@@ -311,6 +312,7 @@ public:
CPPUNIT_TEST(testRedlineParam);
CPPUNIT_TEST(testRedlineViewAuthor);
CPPUNIT_TEST(testTdf78727);
+ CPPUNIT_TEST(testRedlineTimestamp);
CPPUNIT_TEST_SUITE_END();
private:
@@ -3938,6 +3940,35 @@ void SwUiWriterTest::testTdf78727()
CPPUNIT_ASSERT(SwTextBoxHelper::getCount(pPage) > 1);
}
+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 2173fc8..b15883f 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -841,7 +841,6 @@ SwRedlineData::SwRedlineData( RedlineType_t eT, sal_uInt16 nAut )
aStamp( DateTime::SYSTEM ),
eType( eT ), nAuthor( nAut ), nSeqNo( 0 )
{
- aStamp.SetSec( 0 );
aStamp.SetNanoSec( 0 );
}
More information about the Libreoffice-commits
mailing list