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 /sw | |
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 'sw')
-rw-r--r-- | sw/qa/core/Test-BigPtrArray.cxx | 18 | ||||
-rw-r--r-- | sw/qa/core/uwriter.cxx | 74 | ||||
-rw-r--r-- | sw/qa/extras/layout/layout2.cxx | 9 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 6 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 21 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport7.cxx | 3 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport3.cxx | 6 | ||||
-rw-r--r-- | sw/qa/extras/tiledrendering/tiledrendering.cxx | 9 | ||||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter2.cxx | 9 | ||||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export.cxx | 17 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf139301.py | 5 |
11 files changed, 114 insertions, 63 deletions
diff --git a/sw/qa/core/Test-BigPtrArray.cxx b/sw/qa/core/Test-BigPtrArray.cxx index ea70a74aaccb..24c09a493d26 100644 --- a/sw/qa/core/Test-BigPtrArray.cxx +++ b/sw/qa/core/Test-BigPtrArray.cxx @@ -142,10 +142,15 @@ public: bparr.Insert(new BigPtrEntryMock(NUM_ENTRIES), bparr.Count() / 2); - CPPUNIT_ASSERT_MESSAGE + CPPUNIT_ASSERT_EQUAL_MESSAGE + ( + "test_insert_entries_in_the_middle failed", + oldCount + 1, bparr.Count() + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE ( "test_insert_entries_in_the_middle failed", - (oldCount + 1 == bparr.Count() && static_cast<BigPtrEntryMock*>(bparr[bparr.Count() / 2])->getCount() == NUM_ENTRIES) + NUM_ENTRIES, static_cast<BigPtrEntryMock*>(bparr[bparr.Count() / 2])->getCount() ); CPPUNIT_ASSERT_MESSAGE @@ -204,10 +209,15 @@ public: sal_uLong oldCount = bparr.Count(); bparr.Insert(new BigPtrEntryMock(NUM_ENTRIES), bparr.Count()); - CPPUNIT_ASSERT_MESSAGE + CPPUNIT_ASSERT_EQUAL_MESSAGE + ( + "test_insert_at_end failed", + oldCount + 1, bparr.Count() + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE ( "test_insert_at_end failed", - (oldCount + 1 == bparr.Count() && static_cast<BigPtrEntryMock*>(bparr[bparr.Count()-1])->getCount() == NUM_ENTRIES) + NUM_ENTRIES, static_cast<BigPtrEntryMock*>(bparr[bparr.Count()-1])->getCount() ); CPPUNIT_ASSERT_MESSAGE diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index ee394002e115..5c872bb5ebf5 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -837,72 +837,72 @@ void SwDocTest::testSwScanner() m_pDoc->getIDocumentContentOperations().InsertString(aPaM, sTemplate.replace('X', ' ')); pTextNode = aPaM.GetNode().GetTextNode(); pTextNode->CountWords(aDocStat, 0, pTextNode->Len()); - CPPUNIT_ASSERT(aDocStat.nWord == 4 && - aDocStat.nCharExcludingSpaces == 12 && - aDocStat.nChar == 15); + CPPUNIT_ASSERT_EQUAL(sal_uLong(4), aDocStat.nWord); + CPPUNIT_ASSERT_EQUAL(sal_uLong(12), aDocStat.nCharExcludingSpaces); + CPPUNIT_ASSERT_EQUAL(sal_uLong(15), aDocStat.nChar); aDocStat.Reset(); m_pDoc->getIDocumentContentOperations().AppendTextNode(*aPaM.GetPoint()); m_pDoc->getIDocumentContentOperations().InsertString(aPaM, sTemplate.replaceAll("X", " = ")); pTextNode = aPaM.GetNode().GetTextNode(); pTextNode->CountWords(aDocStat, 0, pTextNode->Len()); - CPPUNIT_ASSERT(aDocStat.nWord == 5 && - aDocStat.nCharExcludingSpaces == 13 && - aDocStat.nChar == 17); + CPPUNIT_ASSERT_EQUAL(sal_uLong(5), aDocStat.nWord); + CPPUNIT_ASSERT_EQUAL(sal_uLong(13), aDocStat.nCharExcludingSpaces); + CPPUNIT_ASSERT_EQUAL(sal_uLong(17), aDocStat.nChar); aDocStat.Reset(); m_pDoc->getIDocumentContentOperations().AppendTextNode(*aPaM.GetPoint()); m_pDoc->getIDocumentContentOperations().InsertString(aPaM, sTemplate.replaceAll("X", " _ ")); pTextNode = aPaM.GetNode().GetTextNode(); pTextNode->CountWords(aDocStat, 0, pTextNode->Len()); - CPPUNIT_ASSERT(aDocStat.nWord == 5 && - aDocStat.nCharExcludingSpaces == 13 && - aDocStat.nChar == 17); + CPPUNIT_ASSERT_EQUAL(sal_uLong(5), aDocStat.nWord); + CPPUNIT_ASSERT_EQUAL(sal_uLong(13), aDocStat.nCharExcludingSpaces); + CPPUNIT_ASSERT_EQUAL(sal_uLong(17), aDocStat.nChar); aDocStat.Reset(); m_pDoc->getIDocumentContentOperations().AppendTextNode(*aPaM.GetPoint()); m_pDoc->getIDocumentContentOperations().InsertString(aPaM, sTemplate.replaceAll("X", " -- ")); pTextNode = aPaM.GetNode().GetTextNode(); pTextNode->CountWords(aDocStat, 0, pTextNode->Len()); - CPPUNIT_ASSERT(aDocStat.nWord == 5 && - aDocStat.nCharExcludingSpaces == 14 && - aDocStat.nChar == 18); + CPPUNIT_ASSERT_EQUAL(sal_uLong(5), aDocStat.nWord); + CPPUNIT_ASSERT_EQUAL(sal_uLong(14), aDocStat.nCharExcludingSpaces); + CPPUNIT_ASSERT_EQUAL(sal_uLong(18), aDocStat.nChar); aDocStat.Reset(); m_pDoc->getIDocumentContentOperations().AppendTextNode(*aPaM.GetPoint()); m_pDoc->getIDocumentContentOperations().InsertString(aPaM, sTemplate.replace('X', '_')); pTextNode = aPaM.GetNode().GetTextNode(); pTextNode->CountWords(aDocStat, 0, pTextNode->Len()); - CPPUNIT_ASSERT(aDocStat.nWord == 3 && - aDocStat.nCharExcludingSpaces == 13 && - aDocStat.nChar == 15); + CPPUNIT_ASSERT_EQUAL(sal_uLong(3), aDocStat.nWord); + CPPUNIT_ASSERT_EQUAL(sal_uLong(13), aDocStat.nCharExcludingSpaces); + CPPUNIT_ASSERT_EQUAL(sal_uLong(15), aDocStat.nChar); aDocStat.Reset(); m_pDoc->getIDocumentContentOperations().AppendTextNode(*aPaM.GetPoint()); m_pDoc->getIDocumentContentOperations().InsertString(aPaM, sTemplate.replace('X', '-')); pTextNode = aPaM.GetNode().GetTextNode(); pTextNode->CountWords(aDocStat, 0, pTextNode->Len()); - CPPUNIT_ASSERT(aDocStat.nWord == 3 && - aDocStat.nCharExcludingSpaces == 13 && - aDocStat.nChar == 15); + CPPUNIT_ASSERT_EQUAL(sal_uLong(3), aDocStat.nWord); + CPPUNIT_ASSERT_EQUAL(sal_uLong(13), aDocStat.nCharExcludingSpaces); + CPPUNIT_ASSERT_EQUAL(sal_uLong(15), aDocStat.nChar); aDocStat.Reset(); m_pDoc->getIDocumentContentOperations().AppendTextNode(*aPaM.GetPoint()); m_pDoc->getIDocumentContentOperations().InsertString(aPaM, sTemplate.replace('X', 0x2012)); pTextNode = aPaM.GetNode().GetTextNode(); pTextNode->CountWords(aDocStat, 0, pTextNode->Len()); - CPPUNIT_ASSERT(aDocStat.nWord == 3 && - aDocStat.nCharExcludingSpaces == 13 && - aDocStat.nChar == 15); + CPPUNIT_ASSERT_EQUAL(sal_uLong(3), aDocStat.nWord); + CPPUNIT_ASSERT_EQUAL(sal_uLong(13), aDocStat.nCharExcludingSpaces); + CPPUNIT_ASSERT_EQUAL(sal_uLong(15), aDocStat.nChar); aDocStat.Reset(); m_pDoc->getIDocumentContentOperations().AppendTextNode(*aPaM.GetPoint()); m_pDoc->getIDocumentContentOperations().InsertString(aPaM, sTemplate.replace('X', 0x2015)); pTextNode = aPaM.GetNode().GetTextNode(); pTextNode->CountWords(aDocStat, 0, pTextNode->Len()); - CPPUNIT_ASSERT(aDocStat.nWord == 3 && - aDocStat.nCharExcludingSpaces == 13 && - aDocStat.nChar == 15); + CPPUNIT_ASSERT_EQUAL(sal_uLong(3), aDocStat.nWord); + CPPUNIT_ASSERT_EQUAL(sal_uLong(13), aDocStat.nCharExcludingSpaces); + CPPUNIT_ASSERT_EQUAL(sal_uLong(15), aDocStat.nChar); aDocStat.Reset(); //But default configuration should, msword-alike treat emdash @@ -911,18 +911,18 @@ void SwDocTest::testSwScanner() m_pDoc->getIDocumentContentOperations().InsertString(aPaM, sTemplate.replace('X', 0x2013)); pTextNode = aPaM.GetNode().GetTextNode(); pTextNode->CountWords(aDocStat, 0, pTextNode->Len()); - CPPUNIT_ASSERT(aDocStat.nWord == 4 && - aDocStat.nCharExcludingSpaces == 13 && - aDocStat.nChar == 15); + CPPUNIT_ASSERT_EQUAL(sal_uLong(4), aDocStat.nWord); + CPPUNIT_ASSERT_EQUAL(sal_uLong(13), aDocStat.nCharExcludingSpaces); + CPPUNIT_ASSERT_EQUAL(sal_uLong(15), aDocStat.nChar); aDocStat.Reset(); m_pDoc->getIDocumentContentOperations().AppendTextNode(*aPaM.GetPoint()); m_pDoc->getIDocumentContentOperations().InsertString(aPaM, sTemplate.replace('X', 0x2014)); pTextNode = aPaM.GetNode().GetTextNode(); pTextNode->CountWords(aDocStat, 0, pTextNode->Len()); - CPPUNIT_ASSERT(aDocStat.nWord == 4 && - aDocStat.nCharExcludingSpaces == 13 && - aDocStat.nChar == 15); + CPPUNIT_ASSERT_EQUAL(sal_uLong(4), aDocStat.nWord); + CPPUNIT_ASSERT_EQUAL(sal_uLong(13), aDocStat.nCharExcludingSpaces); + CPPUNIT_ASSERT_EQUAL(sal_uLong(15), aDocStat.nChar); aDocStat.Reset(); static constexpr OUStringLiteral sChunk = u" \u2013 "; @@ -930,9 +930,9 @@ void SwDocTest::testSwScanner() m_pDoc->getIDocumentContentOperations().InsertString(aPaM, sTemplate.replaceAll("X", sChunk)); pTextNode = aPaM.GetNode().GetTextNode(); pTextNode->CountWords(aDocStat, 0, pTextNode->Len()); - CPPUNIT_ASSERT(aDocStat.nWord == 4 && - aDocStat.nCharExcludingSpaces == 13 && - aDocStat.nChar == 17); + CPPUNIT_ASSERT_EQUAL(sal_uLong(4), aDocStat.nWord); + CPPUNIT_ASSERT_EQUAL(sal_uLong(13), aDocStat.nCharExcludingSpaces); + CPPUNIT_ASSERT_EQUAL(sal_uLong(17), aDocStat.nChar); aDocStat.Reset(); } } @@ -1578,11 +1578,15 @@ void SwDocTest::testFormulas() // tdf#61228: Evaluating non-defined function should return an error SwCalc aCalc(*m_pDoc); SwSbxValue val = aCalc.Calculate("foobar()"); - CPPUNIT_ASSERT(aCalc.IsCalcError() && val.IsVoidValue() && val.IsDouble()); + CPPUNIT_ASSERT(aCalc.IsCalcError()); + CPPUNIT_ASSERT(val.IsVoidValue()); + CPPUNIT_ASSERT(val.IsDouble()); CPPUNIT_ASSERT_EQUAL(DBL_MAX, val.GetDouble()); // Evaluating non-defined variable should return 0 without an error val = aCalc.Calculate("foobar"); - CPPUNIT_ASSERT(!aCalc.IsCalcError() && val.IsVoidValue() && val.IsLong()); + CPPUNIT_ASSERT(!aCalc.IsCalcError()); + CPPUNIT_ASSERT(val.IsVoidValue()); + CPPUNIT_ASSERT(val.IsLong()); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), val.GetLong()); } diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 7ed0094924a0..d3c3f247f01a 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -699,12 +699,14 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf126244) = getXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/font[5]", "orientation") .toInt32(); - CPPUNIT_ASSERT(nRotation >= 899 && nRotation <= 900); + CPPUNIT_ASSERT(nRotation >= 899); + CPPUNIT_ASSERT(nRotation <= 900); // Test the third level of vertical category axis labels orientation. The third level orientation should be vertical. nRotation = getXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/font[7]", "orientation") .toInt32(); - CPPUNIT_ASSERT(nRotation >= 899 && nRotation <= 900); + CPPUNIT_ASSERT(nRotation >= 899); + CPPUNIT_ASSERT(nRotation <= 900); } CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf127304) @@ -722,7 +724,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf127304) = getXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/font[1]", "orientation") .toInt32(); - CPPUNIT_ASSERT(nRotation >= 899 && nRotation <= 900); + CPPUNIT_ASSERT(nRotation >= 899); + CPPUNIT_ASSERT(nRotation <= 900); // Test the second level of horizontal category axis labels orientation. The second level orientation should be horizontal. assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/font[5]", "orientation", "0"); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index c191713a7be9..78c12d93a4ff 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -866,8 +866,10 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf125657, "tdf125657.docx") // Only decimal characters allowed, optionally prepended with '-'; no '.' CPPUNIT_ASSERT_MESSAGE(sAssertMsg.getStr(), sAttr[0] == '-' || (sAttr[0] >= '0' && sAttr[0] <= '9')); - for (sal_Int32 i = 1; i < sAttr.getLength(); ++i) - CPPUNIT_ASSERT_MESSAGE(sAssertMsg.getStr(), sAttr[i] >= '0' && sAttr[i] <= '9'); + for (sal_Int32 i = 1; i < sAttr.getLength(); ++i) { + CPPUNIT_ASSERT_MESSAGE(sAssertMsg.getStr(), sAttr[i] >= '0'); + CPPUNIT_ASSERT_MESSAGE(sAssertMsg.getStr(), sAttr[i] <= '9'); + } }; // check that we export all coordinates of srcRect as integers checkAttrIsInt("l"); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 5d973cc0551e..d115f6f5741e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -486,7 +486,12 @@ DECLARE_OOXMLEXPORT_TEST(testSmartart, "smartart.docx") CPPUNIT_ASSERT(aDrawingDom); // Reference not empty } } - CPPUNIT_ASSERT(bData && bLayout && bQStyle && bColor && bDrawing); // Grab Bag has all the expected elements + // Grab Bag has all the expected elements: + CPPUNIT_ASSERT(bData); + CPPUNIT_ASSERT(bLayout); + CPPUNIT_ASSERT(bQStyle); + CPPUNIT_ASSERT(bColor); + CPPUNIT_ASSERT(bDrawing); uno::Reference<beans::XPropertySet> xPropertySet(xGroup->getByIndex(0), uno::UNO_QUERY); OUString nValue; @@ -773,13 +778,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf41542_imagePadding, "tdf41542_imagePadding.odt") CPPUNIT_ASSERT_EQUAL(1, getPages()); // borderlessImage - image WITHOUT BORDERS : simulate padding with -crop text::GraphicCrop crop = getProperty<text::GraphicCrop>(getShape(2), "GraphicCrop"); - CPPUNIT_ASSERT( crop.Left != 0 && crop.Right != 0 ); - CPPUNIT_ASSERT( crop.Left == crop.Top && crop.Right == crop.Bottom && crop.Left == crop.Right); + CPPUNIT_ASSERT( crop.Left != 0 ); + CPPUNIT_ASSERT( crop.Right != 0 ); + CPPUNIT_ASSERT_EQUAL( crop.Left, crop.Top); + CPPUNIT_ASSERT_EQUAL( crop.Right, crop.Bottom); + CPPUNIT_ASSERT_EQUAL( crop.Left, crop.Right); // borderedImage - image WITH BORDERS : simulate padding with -crop crop = getProperty<text::GraphicCrop>(getShape(3), "GraphicCrop"); - CPPUNIT_ASSERT( crop.Left != 0 && crop.Right != 0 ); - CPPUNIT_ASSERT( crop.Left == crop.Top && crop.Right == crop.Bottom && crop.Left == crop.Right); + CPPUNIT_ASSERT( crop.Left != 0 ); + CPPUNIT_ASSERT( crop.Right != 0 ); + CPPUNIT_ASSERT_EQUAL( crop.Left, crop.Top); + CPPUNIT_ASSERT_EQUAL( crop.Right, crop.Bottom); + CPPUNIT_ASSERT_EQUAL( crop.Left, crop.Right); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFootnoteParagraphTag, "testFootnote.docx") diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index e9d8ebd64fd7..54540c265977 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -1069,7 +1069,8 @@ DECLARE_OOXMLEXPORT_TEST(testTDF87348, "tdf87348_linkedTextboxes.docx") //that means 9 NEXT links and 9 PREV links. //however, the current implementation adds leftover shapes, so can't go on exact numbers // (unknown number of flys, unknown order of leftovers) - CPPUNIT_ASSERT ( (followCount >= 6) && (precedeCount >= 6) ); + CPPUNIT_ASSERT ( (followCount >= 6) ); + CPPUNIT_ASSERT ( (precedeCount >= 6) ); } #endif diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx index 696e6add4c3b..3aed69335c44 100644 --- a/sw/qa/extras/rtfexport/rtfexport3.cxx +++ b/sw/qa/extras/rtfexport/rtfexport3.cxx @@ -157,10 +157,12 @@ DECLARE_RTFEXPORT_TEST(testTdf115180, "tdf115180.docx") CPPUNIT_ASSERT_EQUAL_MESSAGE("Row width", sal_Int32(9360), rowWidth); sal_Int32 cell1Width = parseDump("/root/page/body/tab/row/cell[1]/infos/bounds", "width").toInt32(); - CPPUNIT_ASSERT_MESSAGE("First cell width", cell1Width >= 9140 && cell1Width <= 9142); + CPPUNIT_ASSERT_MESSAGE("First cell width", cell1Width >= 9140); + CPPUNIT_ASSERT_MESSAGE("First cell width", cell1Width <= 9142); sal_Int32 cell2Width = parseDump("/root/page/body/tab/row/cell[2]/infos/bounds", "width").toInt32(); - CPPUNIT_ASSERT_MESSAGE("Second cell width", cell2Width >= 218 && cell2Width <= 220); + CPPUNIT_ASSERT_MESSAGE("Second cell width", cell2Width >= 218); + CPPUNIT_ASSERT_MESSAGE("Second cell width", cell2Width <= 220); } DECLARE_ODFEXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.rtf") diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index d7d60e5dec69..5477e3e24a36 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -1090,8 +1090,10 @@ void SwTiledRenderingTest::testShapeViewCursors() // Make sure that aView1 gets a view-only cursor notification, while // aView2 gets a real cursor notification. CPPUNIT_ASSERT_EQUAL(aView1.m_aOwnCursor, aLastOwnCursor1); - CPPUNIT_ASSERT(aView1.m_bViewCursorInvalidated && aLastViewCursor1 != aView1.m_aViewCursor); - CPPUNIT_ASSERT(aView2.m_bOwnCursorInvalidated && aLastOwnCursor2 != aView2.m_aOwnCursor); + CPPUNIT_ASSERT(aView1.m_bViewCursorInvalidated); + CPPUNIT_ASSERT(aLastViewCursor1 != aView1.m_aViewCursor); + CPPUNIT_ASSERT(aView2.m_bOwnCursorInvalidated); + CPPUNIT_ASSERT(aLastOwnCursor2 != aView2.m_aOwnCursor); CPPUNIT_ASSERT_EQUAL(aLastViewCursor2, aView2.m_aViewCursor); } @@ -1940,7 +1942,8 @@ void SwTiledRenderingTest::testAllTrackedChanges() int nView1 = SfxLokHelper::getView(); int nView2 = SfxLokHelper::createView(); SwView* pView2 = dynamic_cast<SwView*>(SfxViewShell::Current()); - CPPUNIT_ASSERT(pView2 && pView1 != pView2); + CPPUNIT_ASSERT(pView2); + CPPUNIT_ASSERT(pView1 != pView2); SwWrtShell* pWrtShell2 = pView2->GetWrtShellPtr(); // Insert text and reject all { diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 7d24e652d694..f426d0fd1eb5 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -1929,7 +1929,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122942) SdrObject* pObject2 = rFormats2[1]->FindSdrObject(); CPPUNIT_ASSERT(pObject2); const tools::Rectangle& rOutRect2 = pObject2->GetLastBoundRect(); - CPPUNIT_ASSERT(rOutRect2.Top() > rOutRect1.Top() && rOutRect2.Top() < rOutRect1.Bottom()); + CPPUNIT_ASSERT(rOutRect2.Top() > rOutRect1.Top()); + CPPUNIT_ASSERT(rOutRect2.Top() < rOutRect1.Bottom()); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf132160) @@ -2682,9 +2683,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testDocxAttributeTableExport) // test the new values sal_Int32 nValue = getProperty<sal_Int32>(xShape, "VertOrientPosition"); - CPPUNIT_ASSERT(sal_Int32(7999) <= nValue && nValue <= sal_Int32(8001)); + CPPUNIT_ASSERT(sal_Int32(7999) <= nValue); + CPPUNIT_ASSERT(nValue <= sal_Int32(8001)); nValue = getProperty<sal_Int32>(xShape, "HoriOrientPosition"); - CPPUNIT_ASSERT(sal_Int32(4999) <= nValue && nValue <= sal_Int32(5001)); + CPPUNIT_ASSERT(sal_Int32(4999) <= nValue); + CPPUNIT_ASSERT(nValue <= sal_Int32(5001)); CPPUNIT_ASSERT_EQUAL(sal_Int16(8), getProperty<sal_Int16>(xShape, "VertOrientRelation")); CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xShape, "HoriOrientRelation")); diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index 333b26b5230e..be85611d18e3 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -1027,13 +1027,19 @@ DECLARE_WW8EXPORT_TEST(testTdf41542_imagePadding, "tdf41542_imagePadding.odt") CPPUNIT_ASSERT_EQUAL(1, getPages()); // borderlessImage - image WITHOUT BORDERS : simulate padding with -crop text::GraphicCrop crop = getProperty<text::GraphicCrop>(getShape(2), "GraphicCrop"); - CPPUNIT_ASSERT( crop.Left != 0 && crop.Right != 0 ); - CPPUNIT_ASSERT( crop.Left == crop.Top && crop.Right == crop.Bottom && crop.Left == crop.Right ); + CPPUNIT_ASSERT( crop.Left != 0 ); + CPPUNIT_ASSERT( crop.Right != 0 ); + CPPUNIT_ASSERT_EQUAL( crop.Left, crop.Top ); + CPPUNIT_ASSERT_EQUAL( crop.Right, crop.Bottom ); + CPPUNIT_ASSERT_EQUAL( crop.Left, crop.Right ); // borderedImage - image WITH BORDERS : simulate padding with -crop crop = getProperty<text::GraphicCrop>(getShape(3), "GraphicCrop"); - CPPUNIT_ASSERT( crop.Left != 0 && crop.Right != 0 ); - CPPUNIT_ASSERT( crop.Left == crop.Top && crop.Right == crop.Bottom && crop.Left == crop.Right ); + CPPUNIT_ASSERT( crop.Left != 0 ); + CPPUNIT_ASSERT( crop.Right != 0 ); + CPPUNIT_ASSERT_EQUAL( crop.Left, crop.Top ); + CPPUNIT_ASSERT_EQUAL( crop.Right, crop.Bottom ); + CPPUNIT_ASSERT_EQUAL( crop.Left, crop.Right ); } DECLARE_WW8EXPORT_TEST(testFdo77454, "fdo77454.doc") @@ -1528,7 +1534,8 @@ DECLARE_WW8EXPORT_TEST(testTdf94386, "tdf94386.odt") awt::Size lSize; xNextPropertySet->getPropertyValue("Size") >>= lSize; - CPPUNIT_ASSERT((fSize.Width != lSize.Width) && (fSize.Height != lSize.Height)); + CPPUNIT_ASSERT((fSize.Width != lSize.Width)); + CPPUNIT_ASSERT((fSize.Height != lSize.Height)); } DECLARE_WW8EXPORT_TEST(testTdf99474, "tdf99474.odt") diff --git a/sw/qa/uitest/writer_tests7/tdf139301.py b/sw/qa/uitest/writer_tests7/tdf139301.py index 6064528bf166..caca09fa9281 100644 --- a/sw/qa/uitest/writer_tests7/tdf139301.py +++ b/sw/qa/uitest/writer_tests7/tdf139301.py @@ -6,6 +6,7 @@ # from uitest.framework import UITestCase from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +import time class tdf139301(UITestCase): @@ -22,12 +23,16 @@ class tdf139301(UITestCase): # wait for available line style setting self.ui_test.wait_until_child_is_available(xWriterEdit, 'metricfield') + time.sleep(1) # line setting dialog window self.ui_test.execute_dialog_through_command(".uno:FormatLine") + time.sleep(1) xFormatLineDlg = self.xUITest.getTopFocusWindow() + time.sleep(1) # get line style combo box xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") + time.sleep(1) # preset line style style = get_state_as_dict(xLineStyle)['SelectEntryText'] |