From 6b00d0576a310796590631d14c54d7d5ea6814ac Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 8 Feb 2021 07:48:59 +0100 Subject: Improve loplugin:cppunitassertequal for CPPUNIT_ASSERT(a && b) ...by re-enabling the code temporarily #if'ed-out in a528392e71bc70136021be4e3d83732fccbb885e "Fixed/improved loplugin:cppunitassertequals" (and which then triggers lots of other lopglugin:cppunitassertequal CPPUNIT_ASSERT -> CPPUNIT_ASSERT_EQUAL warnings). For two css::uno::Reference equality comparisons in cppu/qa/test_any.cxx, it was more straightforward to rewrite them with an explicit call to operator == (which silences loplugin:cppunitassertequal) than to adapt them to CPPUNIT_ASSERT_EQUAL's requirement for arguments of identical types. In sc/qa/unit/ucalc_pivottable.cxx, ScDPItemData needs toString, which has been implemented trivially for now, but might want to combine that with the DEBUG_PIVOT_TABLE-only ScDPItemData::Dump. Change-Id: Iae6d09cf69bd4e52fe4411bba9e50c48e696291c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110546 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- desktop/qa/desktop_lib/test_desktop_lib.cxx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'desktop') diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 7a52bee8c6fa..71ce50b5d301 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -1169,15 +1169,22 @@ namespace { // separator doesn't have any other attribs if ( aType.get().data() == "separator" ) { - CPPUNIT_ASSERT( !aText && !aCommand && !aSubmenu && !aEnabled && !aChecktype && !aChecked ); + CPPUNIT_ASSERT( !aText ); + CPPUNIT_ASSERT( !aCommand ); + CPPUNIT_ASSERT( !aSubmenu ); + CPPUNIT_ASSERT( !aEnabled ); + CPPUNIT_ASSERT( !aChecktype ); + CPPUNIT_ASSERT( !aChecked ); } else if ( aType.get().data() == "command" ) { - CPPUNIT_ASSERT( aCommand && aText ); + CPPUNIT_ASSERT( aCommand ); + CPPUNIT_ASSERT( aText ); } else if ( aType.get().data() == "menu") { - CPPUNIT_ASSERT( aSubmenu && aText ); + CPPUNIT_ASSERT( aSubmenu ); + CPPUNIT_ASSERT( aText ); verifyContextMenuStructure( aSubmenu.get() ); } @@ -1187,8 +1194,8 @@ namespace { aChecktype.get().data() == "checkmark" || aChecktype.get().data() == "auto" ); - CPPUNIT_ASSERT( aChecked && - ( aChecked.get().data() == "true" || aChecked.get().data() == "false" ) ); + CPPUNIT_ASSERT( aChecked ); + CPPUNIT_ASSERT( aChecked.get().data() == "true" || aChecked.get().data() == "false" ); } } -- cgit