diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-02-08 07:48:59 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-02-08 09:15:01 +0100 |
commit | 6b00d0576a310796590631d14c54d7d5ea6814ac (patch) | |
tree | 2e11a4454592be39cfeaa68458cae964d8cdef5e /sd | |
parent | 17149f65f03a34e88bb4a10abcd20e6891f5d7ca (diff) |
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 <sbergman@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/import-tests-smartart.cxx | 16 | ||||
-rw-r--r-- | sd/qa/unit/misc-tests.cxx | 6 |
2 files changed, 12 insertions, 10 deletions
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index e4bf1d4d2c63..7a2056e2295d 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -217,8 +217,8 @@ void SdImportTestSmartArt::testBase() CPPUNIT_ASSERT(xShape4->getPosition().Y > xShape2->getPosition().Y); CPPUNIT_ASSERT(xShape0->getPosition().X < xShape1->getPosition().X); CPPUNIT_ASSERT(xShape2->getPosition().X < xShape3->getPosition().X); - CPPUNIT_ASSERT((xShape2->getPosition().X < xShape4->getPosition().X) - && (xShape3->getPosition().X > xShape4->getPosition().X)); + CPPUNIT_ASSERT((xShape2->getPosition().X < xShape4->getPosition().X)); + CPPUNIT_ASSERT((xShape3->getPosition().X > xShape4->getPosition().X)); xDocShRef->DoClose(); } @@ -487,8 +487,8 @@ void SdImportTestSmartArt::testChevron() uno::Reference<drawing::XShape> xShape1(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW); uno::Reference<drawing::XShape> xShape2(xShapeGroup->getByIndex(3), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xShape0->getPosition().X < xShape1->getPosition().X - && xShape1->getPosition().X < xShape2->getPosition().X); + CPPUNIT_ASSERT(xShape0->getPosition().X < xShape1->getPosition().X); + CPPUNIT_ASSERT(xShape1->getPosition().X < xShape2->getPosition().X); CPPUNIT_ASSERT_EQUAL(xShape0->getPosition().Y, xShape1->getPosition().Y); CPPUNIT_ASSERT_EQUAL(xShape1->getPosition().Y, xShape2->getPosition().Y); @@ -517,8 +517,8 @@ void SdImportTestSmartArt::testCycle() // xShapeConn is connector between shapes 0 and 2 // it should lay between them and be rotated 0 -> 2 CPPUNIT_ASSERT(xShape0->getPosition().X < xShapeConn->getPosition().X); - CPPUNIT_ASSERT(xShape0->getPosition().Y < xShapeConn->getPosition().Y - && xShapeConn->getPosition().Y < xShape2->getPosition().Y); + CPPUNIT_ASSERT(xShape0->getPosition().Y < xShapeConn->getPosition().Y); + CPPUNIT_ASSERT(xShapeConn->getPosition().Y < xShape2->getPosition().Y); uno::Reference<beans::XPropertySet> xPropSetConn(xShapeConn, uno::UNO_QUERY_THROW); CPPUNIT_ASSERT_EQUAL(sal_Int32(32400), xPropSetConn->getPropertyValue("RotateAngle").get<sal_Int32>()); @@ -636,8 +636,8 @@ void SdImportTestSmartArt::testBaseRtoL() CPPUNIT_ASSERT(xShape4->getPosition().Y > xShape2->getPosition().Y); CPPUNIT_ASSERT(xShape0->getPosition().X > xShape1->getPosition().X); CPPUNIT_ASSERT(xShape2->getPosition().X > xShape3->getPosition().X); - CPPUNIT_ASSERT((xShape2->getPosition().X > xShape4->getPosition().X) - && (xShape3->getPosition().X < xShape4->getPosition().X)); + CPPUNIT_ASSERT((xShape2->getPosition().X > xShape4->getPosition().X)); + CPPUNIT_ASSERT((xShape3->getPosition().X < xShape4->getPosition().X)); xDocShRef->DoClose(); } diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx index fca399a360a8..8dc23c0295a3 100644 --- a/sd/qa/unit/misc-tests.cxx +++ b/sd/qa/unit/misc-tests.cxx @@ -865,12 +865,14 @@ void SdMiscTest::testTdf129898LayerDrawnInSlideshow() SdrLayerAdmin& rLayerAdmin = xDocShRef->GetDoc()->GetLayerAdmin(); SdrLayer* pLayer = rLayerAdmin.GetLayer(sName); CPPUNIT_ASSERT_MESSAGE("No layer DrawnInSlideshow", pLayer); - CPPUNIT_ASSERT(pLayer->IsVisibleODF() && pLayer->IsPrintableODF()); + CPPUNIT_ASSERT(pLayer->IsVisibleODF()); + CPPUNIT_ASSERT(pLayer->IsPrintableODF()); // Verify view sd::DrawViewShell* pViewShell = static_cast<sd::DrawViewShell*>(xDocShRef->GetViewShell()); SdrPageView* pPageView = pViewShell->GetView()->GetSdrPageView(); - CPPUNIT_ASSERT(pPageView->IsLayerVisible(sName) && pPageView->IsLayerPrintable(sName)); + CPPUNIT_ASSERT(pPageView->IsLayerVisible(sName)); + CPPUNIT_ASSERT(pPageView->IsLayerPrintable(sName)); xDocShRef->DoClose(); } |