[Libreoffice-commits] core.git: postprocess/qa sw/qa

Miklos Vajna vmiklos at collabora.co.uk
Fri Jan 20 14:07:53 UTC 2017


 postprocess/qa/services.cxx               |    2 -
 sw/qa/extras/mailmerge/mailmerge.cxx      |    4 +-
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx |    2 -
 sw/qa/extras/uiwriter/uiwriter.cxx        |   46 +++++++++++++++---------------
 sw/qa/extras/ww8export/ww8export.cxx      |    6 +--
 5 files changed, 30 insertions(+), 30 deletions(-)

New commits:
commit e71ed748acd040b68d9a1910b75ea0550e0c2008
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Jan 20 11:39:37 2017 +0100

    sw: fix remaining loplugin:cppunitassertequals warnings
    
    Now only subsequentchecks are remaining, as far as I see.
    
    Change-Id: Id5e5a874f8de08c0fd3722aecdc02967ae5d421f
    Reviewed-on: https://gerrit.libreoffice.org/33346
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/postprocess/qa/services.cxx b/postprocess/qa/services.cxx
index 6e95c64..9616a4a 100644
--- a/postprocess/qa/services.cxx
+++ b/postprocess/qa/services.cxx
@@ -216,7 +216,7 @@ void Test::test() {
                             "multiple implementations named \"" + msg(name)
                             + "\"")
                          .getStr()),
-                        j == k->second.factory);
+                        bool(j == k->second.factory));
                 }
                 CPPUNIT_ASSERT_MESSAGE(
                     (OString(
diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx b/sw/qa/extras/mailmerge/mailmerge.cxx
index 675073c..ec5d66c 100644
--- a/sw/qa/extras/mailmerge/mailmerge.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge.cxx
@@ -223,7 +223,7 @@ public:
         }
         else
         {
-            CPPUNIT_ASSERT(res == true);
+            CPPUNIT_ASSERT_EQUAL(uno::makeAny(true), res);
             if( !bMMFilenameFromColumn && !bDontLoadResult )
                 loadMailMergeDocument( 0 );
         }
@@ -337,7 +337,7 @@ int MMTest::documentStartPageNumber( int document ) const
         if( IDocumentMarkAccess::GetType( **mark ) == IDocumentMarkAccess::MarkType::UNO_BOOKMARK )
             ++pos;
     }
-    CPPUNIT_ASSERT( pos == document );
+    CPPUNIT_ASSERT_EQUAL(document, pos);
     sal_uInt16 page, dummy;
     shell->Push();
     shell->GotoMark( mark->get());
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 8e6714e..ef5308c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -115,7 +115,7 @@ DECLARE_OOXMLEXPORT_TEST(testTscp, "tscp.docx")
         rdf::Statement aStatement = xStatements->nextElement().get<rdf::Statement>();
         aActualStatements[aStatement.Predicate->getNamespace() + aStatement.Predicate->getLocalName()] = aStatement.Object->getStringValue();
     }
-    CPPUNIT_ASSERT(aExpectedStatements == aActualStatements);
+    CPPUNIT_ASSERT(bool(aExpectedStatements == aActualStatements));
 
     // No RDF statement on the third paragraph.
     xParagraph.set(getParagraph(3), uno::UNO_QUERY);
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index e879cd2..fd44880 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -1151,13 +1151,13 @@ void SwUiWriterTest::testBookmarkUndo()
     CPPUNIT_ASSERT(ppBkmk != pMarkAccess->getAllMarksEnd());
 
     pMarkAccess->renameMark(ppBkmk->get(), "Mark_");
-    CPPUNIT_ASSERT(pMarkAccess->findMark("Mark") == pMarkAccess->getAllMarksEnd());
+    CPPUNIT_ASSERT(bool(pMarkAccess->findMark("Mark") == pMarkAccess->getAllMarksEnd()));
     CPPUNIT_ASSERT(pMarkAccess->findMark("Mark_") != pMarkAccess->getAllMarksEnd());
     rUndoManager.Undo();
     CPPUNIT_ASSERT(pMarkAccess->findMark("Mark") != pMarkAccess->getAllMarksEnd());
-    CPPUNIT_ASSERT(pMarkAccess->findMark("Mark_") == pMarkAccess->getAllMarksEnd());
+    CPPUNIT_ASSERT(bool(pMarkAccess->findMark("Mark_") == pMarkAccess->getAllMarksEnd()));
     rUndoManager.Redo();
-    CPPUNIT_ASSERT(pMarkAccess->findMark("Mark") == pMarkAccess->getAllMarksEnd());
+    CPPUNIT_ASSERT(bool(pMarkAccess->findMark("Mark") == pMarkAccess->getAllMarksEnd()));
     CPPUNIT_ASSERT(pMarkAccess->findMark("Mark_") != pMarkAccess->getAllMarksEnd());
 
     pMarkAccess->deleteMark( pMarkAccess->findMark("Mark_") );
@@ -1341,19 +1341,19 @@ void SwUiWriterTest::testTdf51741()
     pMarkAccess->renameMark(ppBkmk->get(), "Mark_");
     CPPUNIT_ASSERT(pWrtShell->IsModified());
     pWrtShell->ResetModified();
-    CPPUNIT_ASSERT(pMarkAccess->findMark("Mark") == pMarkAccess->getAllMarksEnd());
+    CPPUNIT_ASSERT(bool(pMarkAccess->findMark("Mark") == pMarkAccess->getAllMarksEnd()));
     CPPUNIT_ASSERT(pMarkAccess->findMark("Mark_") != pMarkAccess->getAllMarksEnd());
     //Modification 5
     rUndoManager.Undo();
     CPPUNIT_ASSERT(pWrtShell->IsModified());
     pWrtShell->ResetModified();
     CPPUNIT_ASSERT(pMarkAccess->findMark("Mark") != pMarkAccess->getAllMarksEnd());
-    CPPUNIT_ASSERT(pMarkAccess->findMark("Mark_") == pMarkAccess->getAllMarksEnd());
+    CPPUNIT_ASSERT(bool(pMarkAccess->findMark("Mark_") == pMarkAccess->getAllMarksEnd()));
     //Modification 6
     rUndoManager.Redo();
     CPPUNIT_ASSERT(pWrtShell->IsModified());
     pWrtShell->ResetModified();
-    CPPUNIT_ASSERT(pMarkAccess->findMark("Mark") == pMarkAccess->getAllMarksEnd());
+    CPPUNIT_ASSERT(bool(pMarkAccess->findMark("Mark") == pMarkAccess->getAllMarksEnd()));
     CPPUNIT_ASSERT(pMarkAccess->findMark("Mark_") != pMarkAccess->getAllMarksEnd());
     //Modification 7
     pMarkAccess->deleteMark( pMarkAccess->findMark("Mark_") );
@@ -1415,7 +1415,7 @@ void SwUiWriterTest::testDeleteTableRedlines()
     IDocumentRedlineAccess& rIDRA = pDoc->getIDocumentRedlineAccess();
     SwExtraRedlineTable& rExtras = rIDRA.GetExtraRedlineTable();
     rExtras.DeleteAllTableRedlines(pDoc, rTable, false, sal_uInt16(USHRT_MAX));
-    CPPUNIT_ASSERT(rExtras.GetSize() == 0);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(0), rExtras.GetSize());
 }
 
 void SwUiWriterTest::testXFlatParagraph()
@@ -1955,8 +1955,8 @@ void SwUiWriterTest::testTdf60967()
     pCursor->Move(fnMoveForward);
     SwPosition aPosMoveAfterDel(*(pCursor->GetPoint()));
     //checking the positions to verify that the paragraph is actually deleted
-    CPPUNIT_ASSERT(aPosInTable == aPosAfterDel);
-    CPPUNIT_ASSERT(aPosInTable == aPosMoveAfterDel);
+    CPPUNIT_ASSERT_EQUAL(aPosAfterDel, aPosInTable);
+    CPPUNIT_ASSERT_EQUAL(aPosMoveAfterDel, aPosInTable);
     //Undo the changes
     rUndoManager.Undo();
     {
@@ -1969,18 +1969,18 @@ void SwUiWriterTest::testTdf60967()
         SwPosition aPosMoveAfterUndo(*(pCursor->GetPoint()));
         //checking positions to verify that paragraph node is the last one and we are paragraph node only
         CPPUNIT_ASSERT(aPosAfterTable > aPosMoveAfterUndo);
-        CPPUNIT_ASSERT(aPosMoveAfterUndo == aPosAfterUndo);
+        CPPUNIT_ASSERT_EQUAL(aPosAfterUndo, aPosMoveAfterUndo);
     }
     //Redo the changes
     rUndoManager.Redo();
     //paragraph *text node* should not be there
     SwPosition aPosAfterRedo(*(pCursor->GetPoint()));
     //position should be exactly same as it was after deletion of *text node*
-    CPPUNIT_ASSERT(aPosMoveAfterDel == aPosAfterRedo);
+    CPPUNIT_ASSERT_EQUAL(aPosAfterRedo, aPosMoveAfterDel);
     //moving the cursor forward, but it should not actually move as there is no *text node* after the table due to this same position is expected after move as it was before move
     pCursor->Move(fnMoveForward);
     SwPosition aPosAfterUndoMove(*(pCursor->GetPoint()));
-    CPPUNIT_ASSERT(aPosAfterUndoMove == aPosAfterRedo);
+    CPPUNIT_ASSERT_EQUAL(aPosAfterRedo, aPosAfterUndoMove);
 }
 
 void SwUiWriterTest::testSearchWithTransliterate()
@@ -3177,13 +3177,13 @@ void SwUiWriterTest::testTextTableCellNames()
 {
     sal_Int32 nCol, nRow2;
     SwXTextTable::GetCellPosition( "z1", nCol, nRow2);
-    CPPUNIT_ASSERT(nCol == 51);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(51), nCol);
     SwXTextTable::GetCellPosition( "AA1", nCol, nRow2);
-    CPPUNIT_ASSERT(nCol == 52);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(52), nCol);
     SwXTextTable::GetCellPosition( "AB1", nCol, nRow2);
-    CPPUNIT_ASSERT(nCol == 53);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(53), nCol);
     SwXTextTable::GetCellPosition( "BB1", nCol, nRow2);
-    CPPUNIT_ASSERT(nCol == 105);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(105), nCol);
 }
 
 void SwUiWriterTest::testShapeAnchorUndo()
@@ -3208,7 +3208,7 @@ void SwUiWriterTest::testShapeAnchorUndo()
 
     rUndoManager.Undo();
 
-    CPPUNIT_ASSERT(aOrigLogicRect == pObject->GetLogicRect());
+    CPPUNIT_ASSERT_EQUAL(pObject->GetLogicRect(), aOrigLogicRect);
 }
 
 void lcl_dispatchCommand(const uno::Reference<lang::XComponent>& xComponent, const OUString& rCommand, const uno::Sequence<beans::PropertyValue>& rPropertyValues)
@@ -3883,7 +3883,7 @@ void SwUiWriterTest::testTableStyleUndo()
     // check if attributes are preserved
     pStyle = pDoc->GetTableStyles().FindAutoFormat("Test Style");
     CPPUNIT_ASSERT(pStyle);
-    CPPUNIT_ASSERT(pStyle->GetBoxFormat(0).GetBackground() == aBackground);
+    CPPUNIT_ASSERT(bool(pStyle->GetBoxFormat(0).GetBackground() == aBackground));
 
     pDoc->DelTableStyle("Test Style");
     CPPUNIT_ASSERT_EQUAL(sal_Int32(pDoc->GetTableStyles().size()), nStyleCount);
@@ -3892,7 +3892,7 @@ void SwUiWriterTest::testTableStyleUndo()
     pStyle = pDoc->GetTableStyles().FindAutoFormat("Test Style");
     // check if attributes are preserved
     CPPUNIT_ASSERT(pStyle);
-    CPPUNIT_ASSERT(pStyle->GetBoxFormat(0).GetBackground() == aBackground);
+    CPPUNIT_ASSERT(bool(pStyle->GetBoxFormat(0).GetBackground() == aBackground));
     rUndoManager.Redo();
     CPPUNIT_ASSERT_EQUAL(sal_Int32(pDoc->GetTableStyles().size()), nStyleCount);
 
@@ -3901,7 +3901,7 @@ void SwUiWriterTest::testTableStyleUndo()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(pDoc->GetTableStyles().size()), nStyleCount +1 );
     pStyle = pDoc->GetTableStyles().FindAutoFormat("Test Style");
     CPPUNIT_ASSERT(pStyle);
-    CPPUNIT_ASSERT(pStyle->GetBoxFormat(0).GetBackground() == aBackground);
+    CPPUNIT_ASSERT(bool(pStyle->GetBoxFormat(0).GetBackground() == aBackground));
 
     SwTableAutoFormat aNewStyle("Test Style2");
     SvxBrushItem aBackground2(Color(0x00FF00), RES_BACKGROUND);
@@ -3910,15 +3910,15 @@ void SwUiWriterTest::testTableStyleUndo()
     pDoc->ChgTableStyle("Test Style", aNewStyle);
     pStyle = pDoc->GetTableStyles().FindAutoFormat("Test Style");
     CPPUNIT_ASSERT(pStyle);
-    CPPUNIT_ASSERT(pStyle->GetBoxFormat(0).GetBackground() == aBackground2);
+    CPPUNIT_ASSERT(bool(pStyle->GetBoxFormat(0).GetBackground() == aBackground2));
     rUndoManager.Undo();
     pStyle = pDoc->GetTableStyles().FindAutoFormat("Test Style");
     CPPUNIT_ASSERT(pStyle);
-    CPPUNIT_ASSERT(pStyle->GetBoxFormat(0).GetBackground() == aBackground);
+    CPPUNIT_ASSERT(bool(pStyle->GetBoxFormat(0).GetBackground() == aBackground));
     rUndoManager.Redo();
     pStyle = pDoc->GetTableStyles().FindAutoFormat("Test Style");
     CPPUNIT_ASSERT(pStyle);
-    CPPUNIT_ASSERT(pStyle->GetBoxFormat(0).GetBackground() == aBackground2);
+    CPPUNIT_ASSERT(bool(pStyle->GetBoxFormat(0).GetBackground() == aBackground2));
 }
 
 void SwUiWriterTest::testRedlineParam()
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index f5fffee..dd3f6b3 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -579,7 +579,7 @@ DECLARE_WW8EXPORT_TEST(testfdo68963, "fdo68963.doc")
     CPPUNIT_ASSERT ( !parseDump("/root/page/body/tab/row[2]/cell[1]/txt/Special", "rText").isEmpty() );
     CPPUNIT_ASSERT_EQUAL( OUString("Topic 1"), parseDump("/root/page/body/tab/row[2]/cell[1]/txt/Special", "rText") );
     // all crossreference bookmarks should have a target.  Shouldn't be any "Reference source not found" in the xml
-    CPPUNIT_ASSERT ( -1 == parseDump("/root/page/body/txt[24]/Special[2]","rText").indexOf("Reference source not found"));
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1), parseDump("/root/page/body/txt[24]/Special[2]","rText").indexOf("Reference source not found"));
 }
 
 DECLARE_WW8EXPORT_TEST(testTdf99100, "tdf99100.doc")
@@ -703,7 +703,7 @@ DECLARE_WW8EXPORT_TEST(testTscp, "tscp.doc")
         rdf::Statement aStatement = xStatements->nextElement().get<rdf::Statement>();
         aActualStatements[aStatement.Predicate->getNamespace() + aStatement.Predicate->getLocalName()] = aStatement.Object->getStringValue();
     }
-    CPPUNIT_ASSERT(aExpectedStatements == aActualStatements);
+    CPPUNIT_ASSERT(bool(aExpectedStatements == aActualStatements));
 
     // No RDF statement on the third paragraph.
     xParagraph.set(getParagraph(3), uno::UNO_QUERY);
@@ -1174,7 +1174,7 @@ DECLARE_WW8EXPORT_TEST(testRES_MIRROR_GRAPH_BOTH, "tdf56321_flipImage_both.doc")
         SwNode* pNode = pDoc->GetNodes()[ n ];
         if (SwGrfNode *pGrfNode = pNode->GetGrfNode())
         {
-            CPPUNIT_ASSERT(pGrfNode->GetSwAttrSet().GetMirrorGrf().GetValue() == 3);
+            CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(3), pGrfNode->GetSwAttrSet().GetMirrorGrf().GetValue());
             break;
         }
     }


More information about the Libreoffice-commits mailing list