summaryrefslogtreecommitdiff
path: root/sw/qa
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-20 14:38:55 +0200
commitd9dca1eef91faa710112ffd20a2b2d36b48a9287 (patch)
treee3436cc55d62457d99c4c2ac203a816abe4f6f65 /sw/qa
parentbb0e9dd57e7ca0f346ac1102139edaec4e6b3790 (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. Change-Id: Ic452256d4ab47e6779ec71fe6576eacb5b74fb43
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 5080f375070d..4e5f9ccc835e 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();