[Libreoffice-commits] core.git: configmgr/source sc/qa sd/qa

Fakabbir Amin fakabbir at gmail.com
Mon Feb 20 08:57:28 UTC 2017


 configmgr/source/components.cxx              |    4 ++--
 sc/qa/unit/tiledrendering/tiledrendering.cxx |    7 +++----
 sd/qa/unit/tiledrendering/tiledrendering.cxx |   11 ++++++-----
 3 files changed, 11 insertions(+), 11 deletions(-)

New commits:
commit 12fc1d5399a688a80eec2565a4b552377e428ab7
Author: Fakabbir Amin <fakabbir at gmail.com>
Date:   Fri Feb 17 19:48:40 2017 +0530

    tdf#84323: Make osl::Condition::wait more readable
    
    Improved readability of calls to osl::Condition::wait.
    
    Change-Id: I69fb9815561013f1eb9fd4a649e32902e09473c6
    Reviewed-on: https://gerrit.libreoffice.org/34399
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx
index 7fdb43a..3978305 100644
--- a/configmgr/source/components.cxx
+++ b/configmgr/source/components.cxx
@@ -21,6 +21,7 @@
 
 #include <algorithm>
 #include <cassert>
+#include <chrono>
 #include <cstddef>
 #include <list>
 #include <set>
@@ -178,8 +179,7 @@ Components::WriteThread::WriteThread(
 }
 
 void Components::WriteThread::execute() {
-    TimeValue t = { 1, 0 }; // 1 sec
-    delay_.wait(&t); // must not throw; result_error is harmless and ignored
+    delay_.wait(std::chrono::seconds(1)); // must not throw; result_error is harmless and ignored
     osl::MutexGuard g(*lock_); // must not throw
     try {
         try {
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 025139d..a4c355b 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -32,6 +32,7 @@
 #include <sfx2/lokhelper.hxx>
 #include <svx/svdpage.hxx>
 
+#include <chrono>
 #include <tabvwsh.hxx>
 #include <docsh.hxx>
 #include <document.hxx>
@@ -352,15 +353,13 @@ void ScTiledRenderingTest::testDocumentSize()
     // Set cursor column
     pViewShell->SetCursor(100, 0);
     // 2 seconds
-    TimeValue aTime = { 2 , 0 };
-    osl::Condition::Result aResult = m_aDocSizeCondition.wait(aTime);
+    osl::Condition::Result aResult = m_aDocSizeCondition.wait(std::chrono::seconds(2));
     CPPUNIT_ASSERT_EQUAL(aResult, osl::Condition::result_ok);
 
     // Set cursor row
     pViewShell->SetCursor(0, 100);
     // 2 seconds
-    aTime = { 2 , 0 };
-    aResult = m_aDocSizeCondition.wait(aTime);
+    aResult = m_aDocSizeCondition.wait(std::chrono::seconds(2));
     CPPUNIT_ASSERT_EQUAL(aResult, osl::Condition::result_ok);
 
     comphelper::LibreOfficeKit::setActive(false);
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index cbb8703..2013bfe 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -45,6 +45,8 @@
 #include <sfx2/request.hxx>
 #include <svx/svxids.hrc>
 
+#include <chrono>
+
 using namespace css;
 
 static const char* const DATA_DIRECTORY = "/sd/qa/unit/tiledrendering/data/";
@@ -668,8 +670,7 @@ void SdTiledRenderingTest::testInsertDeletePage()
     for (unsigned it = 1; it <= 10; it++)
         comphelper::dispatchCommand(".uno:InsertPage", aArgs);
 
-    TimeValue aTimeValue = { 2 , 0 }; // 2 seconds max
-    osl::Condition::Result aResult = m_aDocumentSizeCondition.wait(aTimeValue);
+    osl::Condition::Result aResult = m_aDocumentSizeCondition.wait(std::chrono::seconds(2));
     CPPUNIT_ASSERT_EQUAL(aResult, osl::Condition::result_ok);
 
     // Verify inserted slides
@@ -686,7 +687,7 @@ void SdTiledRenderingTest::testInsertDeletePage()
     for (unsigned it = 1; it <= 10; it++)
         comphelper::dispatchCommand(".uno:DeletePage", aArgs);
 
-    aResult = m_aDocumentSizeCondition.wait(aTimeValue);
+    aResult = m_aDocumentSizeCondition.wait(std::chrono::seconds(2));
     CPPUNIT_ASSERT_EQUAL(aResult, osl::Condition::result_ok);
 
     // Verify deleted slides
@@ -702,7 +703,7 @@ void SdTiledRenderingTest::testInsertDeletePage()
     for (unsigned it = 1; it <= 10; it++)
         comphelper::dispatchCommand(".uno:Undo", aArgs);
 
-    aResult = m_aDocumentSizeCondition.wait(aTimeValue);
+    aResult = m_aDocumentSizeCondition.wait(std::chrono::seconds(2));
     CPPUNIT_ASSERT_EQUAL(aResult, osl::Condition::result_ok);
 
     // Verify inserted slides
@@ -718,7 +719,7 @@ void SdTiledRenderingTest::testInsertDeletePage()
     for (unsigned it = 1; it <= 10; it++)
         comphelper::dispatchCommand(".uno:Redo", aArgs);
 
-    aResult = m_aDocumentSizeCondition.wait(aTimeValue);
+    aResult = m_aDocumentSizeCondition.wait(std::chrono::seconds(2));
     CPPUNIT_ASSERT_EQUAL(aResult, osl::Condition::result_ok);
 
     // Verify deleted slides


More information about the Libreoffice-commits mailing list