[Libreoffice-commits] core.git: vcl/qa

Miklos Vajna vmiklos at collabora.co.uk
Thu Dec 22 14:37:42 UTC 2016


 vcl/qa/cppunit/font.cxx        |   20 ++++++++++----------
 vcl/qa/cppunit/fontcharmap.cxx |    6 +++---
 vcl/qa/cppunit/fontmetric.cxx  |   12 ++++++------
 vcl/qa/cppunit/lifecycle.cxx   |    6 +++---
 vcl/qa/cppunit/mapmode.cxx     |   18 +++++++++---------
 vcl/qa/cppunit/outdev.cxx      |    2 +-
 6 files changed, 32 insertions(+), 32 deletions(-)

New commits:
commit 35a067f1966b41125d298bd54f577f1a560aff08
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Dec 22 09:11:47 2016 +0100

    vcl: fix remaining loplugin:cppunitassertequals warnings
    
    Change-Id: Ic499ebbaeb25a08b01cd1317ab3055a374444a4f
    Reviewed-on: https://gerrit.libreoffice.org/32329
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx
index f31a6f4..049e211 100644
--- a/vcl/qa/cppunit/font.cxx
+++ b/vcl/qa/cppunit/font.cxx
@@ -130,32 +130,32 @@ void VclFontTest::testSymbolFlagAndCharSet()
     vcl::Font aFont;
 
     CPPUNIT_ASSERT_MESSAGE( "Should not be seen as a symbol font after default constructor called", !aFont.IsSymbolFont() );
-    CPPUNIT_ASSERT_MESSAGE( "Character set should be RTL_TEXTENCODING_DONTKNOW after default constructor called",
-                            aFont.GetCharSet() == RTL_TEXTENCODING_DONTKNOW );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Character set should be RTL_TEXTENCODING_DONTKNOW after default constructor called",
+                            RTL_TEXTENCODING_DONTKNOW, aFont.GetCharSet() );
 
     aFont.SetSymbolFlag(true);
 
     CPPUNIT_ASSERT_MESSAGE( "Test 1: Symbol font flag should be on", aFont.IsSymbolFont() );
-    CPPUNIT_ASSERT_MESSAGE( "Test 1: Character set should be RTL_TEXTENCODING_SYMBOL",
-                            aFont.GetCharSet() == RTL_TEXTENCODING_SYMBOL );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Test 1: Character set should be RTL_TEXTENCODING_SYMBOL",
+                            RTL_TEXTENCODING_SYMBOL, aFont.GetCharSet() );
 
     aFont.SetSymbolFlag(false);
 
     CPPUNIT_ASSERT_MESSAGE( "Test 2: Symbol font flag should be off", !aFont.IsSymbolFont() );
-    CPPUNIT_ASSERT_MESSAGE( "Test 2: Character set should be RTL_TEXTENCODING_DONTKNOW",
-                            aFont.GetCharSet() == RTL_TEXTENCODING_DONTKNOW );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Test 2: Character set should be RTL_TEXTENCODING_DONTKNOW",
+                            RTL_TEXTENCODING_DONTKNOW, aFont.GetCharSet() );
 
     aFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
 
     CPPUNIT_ASSERT_MESSAGE( "Test 3: Symbol font flag should be on", aFont.IsSymbolFont() );
-    CPPUNIT_ASSERT_MESSAGE( "Test 3: Character set should be RTL_TEXTENCODING_SYMBOL",
-                            aFont.GetCharSet() == RTL_TEXTENCODING_SYMBOL );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Test 3: Character set should be RTL_TEXTENCODING_SYMBOL",
+                            RTL_TEXTENCODING_SYMBOL, aFont.GetCharSet() );
 
     aFont.SetCharSet( RTL_TEXTENCODING_UNICODE );
 
     CPPUNIT_ASSERT_MESSAGE( "Test 4: Symbol font flag should be off", !aFont.IsSymbolFont() );
-    CPPUNIT_ASSERT_MESSAGE( "Test 4: Character set should be RTL_TEXTENCODING_UNICODE",
-                            aFont.GetCharSet() == RTL_TEXTENCODING_UNICODE );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Test 4: Character set should be RTL_TEXTENCODING_UNICODE",
+                            RTL_TEXTENCODING_UNICODE, aFont.GetCharSet() );
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(VclFontTest);
diff --git a/vcl/qa/cppunit/fontcharmap.cxx b/vcl/qa/cppunit/fontcharmap.cxx
index fce8bc4..f57b2e1 100644
--- a/vcl/qa/cppunit/fontcharmap.cxx
+++ b/vcl/qa/cppunit/fontcharmap.cxx
@@ -36,9 +36,9 @@ void VclFontCharMapTest::testDefaultFontCharMap()
     sal_uInt32 nStartSupBMPPlane = xfcmap->GetNextChar(0xD800);
     sal_uInt32 nEndBMPPlane = xfcmap->GetLastChar();
 
-    CPPUNIT_ASSERT( nStartBMPPlane == 0x0020 );
-    CPPUNIT_ASSERT( nStartSupBMPPlane == 0xE000 );
-    CPPUNIT_ASSERT( nEndBMPPlane == 0xFFF0-1 );
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(0x0020), nStartBMPPlane);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(0xE000), nStartSupBMPPlane);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(0xFFF0-1), nEndBMPPlane);
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(VclFontCharMapTest);
diff --git a/vcl/qa/cppunit/fontmetric.cxx b/vcl/qa/cppunit/fontmetric.cxx
index f28aa0d5..b8c1f42 100644
--- a/vcl/qa/cppunit/fontmetric.cxx
+++ b/vcl/qa/cppunit/fontmetric.cxx
@@ -107,32 +107,32 @@ void VclFontMetricTest::testEqualityOperator()
 
     aLhs.SetFullstopCenteredFlag(true);
     aRhs.SetFullstopCenteredFlag(true);
-    CPPUNIT_ASSERT_MESSAGE( "Fullstop centered flag set same, aLhs == aRhs failed", aLhs == aRhs );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Fullstop centered flag set same, aLhs == aRhs failed", aRhs, aLhs );
     CPPUNIT_ASSERT_MESSAGE( "Fullstop centered flag set same, aLhs != aRhs succeeded", !(aLhs != aRhs) );
 
     aLhs.SetExternalLeading(10);
     aRhs.SetExternalLeading(10);
-    CPPUNIT_ASSERT_MESSAGE( "External leading set same, aLHS == aRhs failed", aLhs == aRhs );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "External leading set same, aLHS == aRhs failed", aRhs, aLhs );
     CPPUNIT_ASSERT_MESSAGE( "External leading set same, aLHS != aRhs succeeded", !(aLhs != aRhs) );
 
     aLhs.SetInternalLeading(10);
     aRhs.SetInternalLeading(10);
-    CPPUNIT_ASSERT_MESSAGE( "Internal leading set same, aLHS == aRhs failed", aLhs == aRhs );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Internal leading set same, aLHS == aRhs failed", aRhs, aLhs );
     CPPUNIT_ASSERT_MESSAGE( "Internal leading set same, aLHS != aRhs succeeded", !(aLhs != aRhs) );
 
     aLhs.SetAscent( 100 );
     aRhs.SetAscent( 100 );
-    CPPUNIT_ASSERT_MESSAGE( "Ascent set same, aLHS == aRhs failed", aLhs == aRhs );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Ascent set same, aLHS == aRhs failed", aRhs, aLhs );
     CPPUNIT_ASSERT_MESSAGE( "Ascent set same, aLHS != aRhs succeeded", !(aLhs != aRhs) );
 
     aLhs.SetDescent( 100 );
     aRhs.SetDescent( 100 );
-    CPPUNIT_ASSERT_MESSAGE( "Descent set same, aLHS == aRhs failed", aLhs == aRhs );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Descent set same, aLHS == aRhs failed", aRhs, aLhs);
     CPPUNIT_ASSERT_MESSAGE( "Descent set same, aLHS != aRhs succeeded", !(aLhs != aRhs) );
 
     aLhs.SetSlant( 100 );
     aRhs.SetSlant( 100 );
-    CPPUNIT_ASSERT_MESSAGE( "Slant set same, aLHS == aRhs failed", aLhs == aRhs );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Slant set same, aLHS == aRhs failed", aRhs, aLhs);
     CPPUNIT_ASSERT_MESSAGE( "Slant set same, aLHS != aRhs succeeded", !(aLhs != aRhs) );
 }
 
diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx
index 8177cc8..0ec8b4c 100644
--- a/vcl/qa/cppunit/lifecycle.cxx
+++ b/vcl/qa/cppunit/lifecycle.cxx
@@ -85,9 +85,9 @@ void LifecycleTest::testMultiDispose()
     xWin->disposeOnce();
     xWin->disposeOnce();
     xWin->disposeOnce();
-    CPPUNIT_ASSERT(xWin->GetWindow(GetWindowType::Parent) == nullptr);
-    CPPUNIT_ASSERT(xWin->GetChild(0) == nullptr);
-    CPPUNIT_ASSERT(xWin->GetChildCount() == 0);
+    CPPUNIT_ASSERT(!xWin->GetWindow(GetWindowType::Parent));
+    CPPUNIT_ASSERT(!xWin->GetChild(0));
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(0), xWin->GetChildCount());
 }
 
 void LifecycleTest::testWidgets(vcl::Window *pParent)
diff --git a/vcl/qa/cppunit/mapmode.cxx b/vcl/qa/cppunit/mapmode.cxx
index 94e6d4b..afa259a 100644
--- a/vcl/qa/cppunit/mapmode.cxx
+++ b/vcl/qa/cppunit/mapmode.cxx
@@ -31,27 +31,27 @@ public:
 void VclMapModeTest::testMultiplier()
 {
     MapMode aMapMode;
-    CPPUNIT_ASSERT_MESSAGE( "Default map mode is MapUnit::MapPixel, multiplier should be 1", aMapMode.GetUnitMultiplier() == 1 );
+    CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Default map mode is MapUnit::MapPixel, multiplier should be 1", 1.0, aMapMode.GetUnitMultiplier(), 1E-12);
     aMapMode.SetMapUnit( MapUnit::MapSysFont );
-    CPPUNIT_ASSERT_MESSAGE( "Map mode is MapUnit::MapSysFont, multiplier should be 1", aMapMode.GetUnitMultiplier() == 1 );
+    CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::MapSysFont, multiplier should be 1", 1.0, aMapMode.GetUnitMultiplier(), 1E-12);
     aMapMode.SetMapUnit( MapUnit::MapAppFont );
-    CPPUNIT_ASSERT_MESSAGE( "Map mode is MapUnit::MapAppFont, multiplier should be 1", aMapMode.GetUnitMultiplier() == 1 );
+    CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::MapAppFont, multiplier should be 1", 1.0, aMapMode.GetUnitMultiplier(), 1E-12);
     aMapMode.SetMapUnit( MapUnit::Map100thMM );
-    CPPUNIT_ASSERT_MESSAGE( "Map mode is MapUnit::Map100thMM, multiplier should be 1", aMapMode.GetUnitMultiplier() == 1 );
+    CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::Map100thMM, multiplier should be 1", 1.0, aMapMode.GetUnitMultiplier(), 1E-12);
     aMapMode.SetMapUnit( MapUnit::Map10thMM );
-    CPPUNIT_ASSERT_MESSAGE( "Map mode is MapUnit::Map10thMM, multiplier should be 10", aMapMode.GetUnitMultiplier() == 10 );
+    CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::Map10thMM, multiplier should be 10", 10.0, aMapMode.GetUnitMultiplier(), 1E-12);
     aMapMode.SetMapUnit( MapUnit::MapMM );
-    CPPUNIT_ASSERT_MESSAGE( "Map mode is MapUnit::MapMM, multiplier should be 100", aMapMode.GetUnitMultiplier() == 100 );
+    CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::MapMM, multiplier should be 100", 100.0, aMapMode.GetUnitMultiplier(), 1E-12);
     aMapMode.SetMapUnit( MapUnit::MapCM );
-    CPPUNIT_ASSERT_MESSAGE( "Map mode is MapUnit::MapCM, multiplier should be 1000", aMapMode.GetUnitMultiplier() == 1000 );
+    CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::MapCM, multiplier should be 1000", 1000.0, aMapMode.GetUnitMultiplier(), 1E-12);
     aMapMode.SetMapUnit( MapUnit::Map1000thInch );
     CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::Map1000thInch, multiplier should be 2.54", 2.54, aMapMode.GetUnitMultiplier(), 1E-12 );
     aMapMode.SetMapUnit( MapUnit::Map100thInch );
     CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::Map100thInch, multiplier should be 2.54", 25.4, aMapMode.GetUnitMultiplier(), 1E-12 );
     aMapMode.SetMapUnit( MapUnit::Map10thInch );
-    CPPUNIT_ASSERT_MESSAGE( "Map mode is MapUnit::Map10thInch, multiplier should be 254", aMapMode.GetUnitMultiplier() == 254 );
+    CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::Map10thInch, multiplier should be 254", 254.0, aMapMode.GetUnitMultiplier(), 1E-12 );
     aMapMode.SetMapUnit( MapUnit::MapInch );
-    CPPUNIT_ASSERT_MESSAGE( "Map mode is MapUnit::MapInch, multiplier should be 2540", aMapMode.GetUnitMultiplier() == 2540 );
+    CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::MapInch, multiplier should be 2540", 2540.0, aMapMode.GetUnitMultiplier(), 1E-12 );
     aMapMode.SetMapUnit( MapUnit::MapTwip );
     CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::MapTwip, multiplier should be 1.76388889", 1.76388889, aMapMode.GetUnitMultiplier(), 1E-12 );
     aMapMode.SetMapUnit( MapUnit::MapPoint );
diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx
index 4a44770..f566f81 100644
--- a/vcl/qa/cppunit/outdev.cxx
+++ b/vcl/qa/cppunit/outdev.cxx
@@ -40,7 +40,7 @@ void VclOutdevTest::testVirtualDevice()
     pVDev->DrawPixel(Point(31,30),COL_RED);
 
     Size aSize = pVDev->GetOutputSizePixel();
-    CPPUNIT_ASSERT(aSize == Size(32,32));
+    CPPUNIT_ASSERT_EQUAL(Size(32,32), aSize);
 
     Bitmap aBmp = pVDev->GetBitmap(Point(),aSize);
 


More information about the Libreoffice-commits mailing list