Kaydet (Commit) d9dca1ee authored tarafından Miklos Vajna's avatar Miklos Vajna

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
üst bb0e9dd5
...@@ -205,6 +205,7 @@ public: ...@@ -205,6 +205,7 @@ public:
void testRedlineParam(); void testRedlineParam();
void testRedlineViewAuthor(); void testRedlineViewAuthor();
void testTdf78727(); void testTdf78727();
void testRedlineTimestamp();
CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward); CPPUNIT_TEST(testReplaceForward);
...@@ -311,6 +312,7 @@ public: ...@@ -311,6 +312,7 @@ public:
CPPUNIT_TEST(testRedlineParam); CPPUNIT_TEST(testRedlineParam);
CPPUNIT_TEST(testRedlineViewAuthor); CPPUNIT_TEST(testRedlineViewAuthor);
CPPUNIT_TEST(testTdf78727); CPPUNIT_TEST(testTdf78727);
CPPUNIT_TEST(testRedlineTimestamp);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
private: private:
...@@ -3938,6 +3940,35 @@ void SwUiWriterTest::testTdf78727() ...@@ -3938,6 +3940,35 @@ void SwUiWriterTest::testTdf78727()
CPPUNIT_ASSERT(SwTextBoxHelper::getCount(pPage) > 1); 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_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -841,7 +841,6 @@ SwRedlineData::SwRedlineData( RedlineType_t eT, sal_uInt16 nAut ) ...@@ -841,7 +841,6 @@ SwRedlineData::SwRedlineData( RedlineType_t eT, sal_uInt16 nAut )
aStamp( DateTime::SYSTEM ), aStamp( DateTime::SYSTEM ),
eType( eT ), nAuthor( nAut ), nSeqNo( 0 ) eType( eT ), nAuthor( nAut ), nSeqNo( 0 )
{ {
aStamp.SetSec( 0 );
aStamp.SetNanoSec( 0 ); aStamp.SetNanoSec( 0 );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment