[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - sal/qa sw/source

Herbert Dürr hdu at apache.org
Wed Jun 4 05:08:01 PDT 2014


 sal/qa/osl/condition/osl_Condition.cxx |   22 +++++++++++-----------
 sw/source/core/inc/pagefrm.hxx         |    2 +-
 sw/source/core/layout/paintfrm.cxx     |   11 +++++------
 3 files changed, 17 insertions(+), 18 deletions(-)

New commits:
commit 283007f8da755af1a9a4a66cc7089aaed3ec8d18
Author: Herbert Dürr <hdu at apache.org>
Date:   Wed Jun 4 11:21:52 2014 +0000

    #i125003# fix google-test for osl_condition in the sal module
    
    the test didn't initialize the nanosecond part of the condition timeout and so
    the absolute timeout calculated from the second and nanosecond values could
    become invalid depending on the pseudo-random value of the nanosecond member.
    This resulted in spurious gtest failures (first seen on Ubuntu).

diff --git a/sal/qa/osl/condition/osl_Condition.cxx b/sal/qa/osl/condition/osl_Condition.cxx
index 2feee84..7231d05 100644
--- a/sal/qa/osl/condition/osl_Condition.cxx
+++ b/sal/qa/osl/condition/osl_Condition.cxx
@@ -216,8 +216,7 @@ namespace osl_Condition
         Result wait(const TimeValue *pTimeout = 0)
     */
     TEST(Sal_Test_Condition, wait_001) {
-        TimeValue tv1;
-        tv1.Seconds = 1;
+        TimeValue tv1 = {1,0};
 
         ::osl::Condition cond1;
         ::osl::Condition cond2;
@@ -232,14 +231,13 @@ namespace osl_Condition
         fprintf(stderr,"%d %d %d\n",r1,r2,r3);
 
         // #test comment#: test three types of wait.
-        ASSERT_TRUE( (cond1.wait(&tv1) == ::osl::Condition::result_ok) &&
-                     (cond2.wait() == ::osl::Condition::result_ok) &&
-                     (cond3.wait(&tv1) == ::osl::Condition::result_timeout) );
+        ASSERT_TRUE( cond1.wait(&tv1) == ::osl::Condition::result_ok );
+        ASSERT_TRUE( cond2.wait() == ::osl::Condition::result_ok );
+        ASSERT_TRUE( cond3.wait(&tv1) == ::osl::Condition::result_timeout );
     }
 
     TEST(Sal_Test_Condition, wait_002) {
-        TimeValue tv1;
-        tv1.Seconds = 1;
+        TimeValue tv1 = {1,0};
 
         ::osl::Condition aCond;
         ::osl::Condition::Result wRes, wRes1;
@@ -253,9 +251,10 @@ namespace osl_Condition
         sal_Bool bRes1 = aCond.check( );
 
         // #test comment#: wait a condition after set/reset.
-        ASSERT_TRUE( !bRes && bRes1 &&
-                     ( ::osl::Condition::result_timeout == wRes ) &&
-                     ( ::osl::Condition::result_ok == wRes1 ) );
+        ASSERT_TRUE( !bRes );
+        ASSERT_TRUE( bRes1 );
+        ASSERT_TRUE( ::osl::Condition::result_timeout == wRes );
+        ASSERT_TRUE( ::osl::Condition::result_ok == wRes1 );
     }
 
 
@@ -288,7 +287,8 @@ namespace osl_Condition
         sal_Bool bRes1 = aCond.check( );
 
         // #test comment#: use threads to set/reset Condition and check it in main routine.
-        ASSERT_TRUE( bRes && !bRes1 );
+        ASSERT_TRUE( bRes );
+        ASSERT_TRUE( !bRes1 );
     }
 
 } // namespace osl_Condition
commit a8a2653568d31a2fb76aeb3183e128e3304452bd
Author: Armin Le Grand <alg at apache.org>
Date:   Wed Jun 4 11:12:30 2014 +0000

    Corrected GetDrawBackgrdColor to return a value, not a reference, removed unused var

diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index 2876704..3b00e71 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -317,7 +317,7 @@ public:
 
         @return reference to an instance of class Color
     */
-    const Color& GetDrawBackgrdColor() const;
+    const Color GetDrawBackgrdColor() const;
 
     /** paint margin area of a page
 
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 081ad1a..ca5e6ae 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -308,8 +308,7 @@ void SwCalcPixStatics( OutputDevice *pOut )
 //Zum Sichern der statics, damit das Paint (quasi) reentrant wird.
 class SwSavePaintStatics
 {
-    sal_Bool            bSFlyMetafile,
-                        bSPageOnly;
+    sal_Bool            bSFlyMetafile; // not used: bSPageOnly;
     ViewShell          *pSGlobalShell;
     OutputDevice       *pSFlyMetafileOut;
     SwFlyFrm           *pSRetoucheFly,
@@ -3011,7 +3010,7 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const
                 /// OD 29.08.2002 #102450#
                 /// determine background color of page for <PaintLayer> method
                 /// calls, paint <hell> or <heaven>
-                const Color aPageBackgrdColor = pPage->GetDrawBackgrdColor();
+                const Color aPageBackgrdColor(pPage->GetDrawBackgrdColor());
 
                 pPage->PaintBaBo( aPaintRect, pPage, sal_True );
 
@@ -6489,7 +6488,7 @@ void SwLayoutFrm::RefreshExtraData( const SwRect &rRect ) const
 
     @return Color
 */
-const Color& SwPageFrm::GetDrawBackgrdColor() const
+const Color SwPageFrm::GetDrawBackgrdColor() const
 {
     const SvxBrushItem* pBrushItem;
     const Color* pDummyColor;
@@ -6605,7 +6604,7 @@ void SwFrm::Retouche( const SwPageFrm * pPage, const SwRect &rRect ) const
             SwRect aRetouchePart( rRetouche );
             if ( aRetouchePart.HasArea() )
             {
-                const Color aPageBackgrdColor = pPage->GetDrawBackgrdColor();
+                const Color aPageBackgrdColor(pPage->GetDrawBackgrdColor());
                 const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess();
                 // --> OD #i76669#
                 SwViewObjectContactRedirector aSwRedirector( *pSh );
@@ -6881,7 +6880,7 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap )
 
         // OD 09.12.2002 #103045# - determine page, fly frame is on
         const SwPageFrm* pFlyPage = pFly->FindPageFrm();
-        const Color aPageBackgrdColor = pFlyPage->GetDrawBackgrdColor();
+        const Color aPageBackgrdColor(pFlyPage->GetDrawBackgrdColor());
         const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess();
         // --> OD #i76669#
         SwViewObjectContactRedirector aSwRedirector( *pSh );


More information about the Libreoffice-commits mailing list