[Libreoffice-commits] core.git: sc/qa starmath/qa

Miklos Vajna vmiklos at collabora.co.uk
Fri Nov 18 08:27:46 UTC 2016


 sc/qa/unit/bugfix-test.cxx            |    4 ++--
 starmath/qa/cppunit/test_starmath.cxx |   24 ++++++++++++------------
 2 files changed, 14 insertions(+), 14 deletions(-)

New commits:
commit 3ab9cebf45e725bbd3d7828dbcf974d3bef2c32c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Nov 18 08:12:33 2016 +0100

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

diff --git a/sc/qa/unit/bugfix-test.cxx b/sc/qa/unit/bugfix-test.cxx
index 692e2a8..5d21670 100644
--- a/sc/qa/unit/bugfix-test.cxx
+++ b/sc/qa/unit/bugfix-test.cxx
@@ -212,8 +212,8 @@ void ScFiltersTest::testTdf91979()
     Point aPos = aViewData.GetScrPos(MAXCOL - 1, 10000, SC_SPLIT_TOPLEFT, true);
     int nColWidth = ScViewData::ToPixel(pDoc->GetColWidth(0, 0), aViewData.GetPPTX());
     int nRowHeight = ScViewData::ToPixel(pDoc->GetRowHeight(0, 0), aViewData.GetPPTY());
-    CPPUNIT_ASSERT(aPos.getX() == (MAXCOL - 1) * nColWidth);
-    CPPUNIT_ASSERT(aPos.getY() == 10000 * nRowHeight);
+    CPPUNIT_ASSERT_EQUAL(static_cast<long>((MAXCOL - 1) * nColWidth), aPos.getX());
+    CPPUNIT_ASSERT_EQUAL(static_cast<long>(10000 * nRowHeight), aPos.getY());
 
     xComponent->dispose();
 }
diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx
index 91a14bd..05cddc5 100644
--- a/starmath/qa/cppunit/test_starmath.cxx
+++ b/starmath/qa/cppunit/test_starmath.cxx
@@ -114,7 +114,7 @@ void Test::editMarker()
         m_pEditWindow->SetText(sMarkedText);
         m_pEditWindow->Flush();
         OUString sFinalText = m_pEditWindow->GetText();
-        CPPUNIT_ASSERT_MESSAGE("Should be equal text", sFinalText == sMarkedText);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be equal text", sMarkedText, sFinalText);
     }
 
     {
@@ -135,7 +135,7 @@ void Test::editMarker()
 
         m_pEditWindow->Flush();
         OUString sFinalText = m_pEditWindow->GetText();
-        CPPUNIT_ASSERT_MESSAGE("Should be a under b under c", sFinalText == sTargetText);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be a under b under c", sTargetText, sFinalText);
     }
 
     {
@@ -178,7 +178,7 @@ void Test::editUndoRedo()
         rEditEngine.SetText(0, sStringOne);
         m_xDocShRef->UpdateText();
         OUString sFinalText = m_xDocShRef->GetText();
-        CPPUNIT_ASSERT_MESSAGE("Strings must match", sStringOne == sFinalText);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Strings must match", sFinalText, sStringOne);
     }
 
     OUString sStringTwo("a over b");
@@ -186,7 +186,7 @@ void Test::editUndoRedo()
         rEditEngine.SetText(0, sStringTwo);
         m_xDocShRef->UpdateText();
         OUString sFinalText = m_xDocShRef->GetText();
-        CPPUNIT_ASSERT_MESSAGE("Strings must match", sStringTwo == sFinalText);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Strings must match", sFinalText, sStringTwo);
     }
 
     SfxRequest aUndo(SID_UNDO, SfxCallMode::SYNCHRON, SmDocShell::GetPool());
@@ -195,7 +195,7 @@ void Test::editUndoRedo()
         m_xDocShRef->Execute(aUndo);
         m_xDocShRef->UpdateText();
         OUString sFinalText = m_xDocShRef->GetText();
-        CPPUNIT_ASSERT_MESSAGE("Strings much match", sStringOne == sFinalText);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Strings much match", sFinalText, sStringOne);
     }
 
     {
@@ -210,7 +210,7 @@ void Test::editUndoRedo()
         m_xDocShRef->Execute(aRedo);
         m_xDocShRef->UpdateText();
         OUString sFinalText = m_xDocShRef->GetText();
-        CPPUNIT_ASSERT_MESSAGE("Strings much match", sStringOne == sFinalText);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Strings much match", sFinalText, sStringOne);
     }
 
     {
@@ -245,7 +245,7 @@ void Test::viewZoom()
         rEditEngine.SetText(0, sStringOne);
         m_xDocShRef->UpdateText();
         OUString sFinalText = m_xDocShRef->GetText();
-        CPPUNIT_ASSERT_MESSAGE("Strings must match", sStringOne == sFinalText);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Strings must match", sFinalText, sStringOne);
     }
 
     SmGraphicWindow &rGraphicWindow = m_pViewShell->GetGraphicWindow();
@@ -263,7 +263,7 @@ void Test::viewZoom()
         SfxRequest aZoomOut(SID_ZOOMOUT, SfxCallMode::SYNCHRON, m_pViewShell->GetPool());
         m_pViewShell->Execute(aZoomOut);
         nFinalZoom = rGraphicWindow.GetZoom();
-        CPPUNIT_ASSERT_MESSAGE("Should be equal", nFinalZoom == nOrigZoom);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be equal", nOrigZoom, nFinalZoom);
     }
 
     sal_uInt16 nOptimalZoom=0;
@@ -281,7 +281,7 @@ void Test::viewZoom()
         SfxRequest aZoom(SID_ATTR_ZOOM, SfxCallMode::SYNCHRON, aSet);
         m_pViewShell->Execute(aZoom);
         nFinalZoom = rGraphicWindow.GetZoom();
-        CPPUNIT_ASSERT_MESSAGE("Should be optimal zoom", nFinalZoom == nOptimalZoom);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be optimal zoom", nOptimalZoom, nFinalZoom);
     }
 
 //To-Do: investigate GetPrinter logic of SvxZoomType::PAGEWIDTH/SvxZoomType::WHOLEPAGE to ensure
@@ -327,7 +327,7 @@ void Test::viewZoom()
         SfxRequest aZoom(SID_ATTR_ZOOM, SfxCallMode::SYNCHRON, aSet);
         m_pViewShell->Execute(aZoom);
         nFinalZoom = rGraphicWindow.GetZoom();
-        CPPUNIT_ASSERT_MESSAGE("Should be 50%", nFinalZoom == 50);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be 50%", static_cast<sal_uInt16>(50), nFinalZoom);
     }
 
     {
@@ -336,7 +336,7 @@ void Test::viewZoom()
         SfxRequest aZoom(SID_ATTR_ZOOM, SfxCallMode::SYNCHRON, aSet);
         m_pViewShell->Execute(aZoom);
         nFinalZoom = rGraphicWindow.GetZoom();
-        CPPUNIT_ASSERT_MESSAGE("Should be Clipped to 25%", nFinalZoom == 25);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be Clipped to 25%", static_cast<sal_uInt16>(25), nFinalZoom);
     }
 
     {
@@ -345,7 +345,7 @@ void Test::viewZoom()
         SfxRequest aZoom(SID_ATTR_ZOOM, SfxCallMode::SYNCHRON, aSet);
         m_pViewShell->Execute(aZoom);
         nFinalZoom = rGraphicWindow.GetZoom();
-        CPPUNIT_ASSERT_MESSAGE("Should be Clipped to 800%", nFinalZoom == 800);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be Clipped to 800%", static_cast<sal_uInt16>(800), nFinalZoom);
     }
 
 }


More information about the Libreoffice-commits mailing list