diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-05-02 13:39:20 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-02 13:37:13 +0200 |
commit | deffca13fd8a765ddc518cfcff464cb1b6f5c65a (patch) | |
tree | e1a34de7398b803bca75fc9dcd69985cc8b9fc18 /test | |
parent | e2abbc0062398ea67cb13cb5b0b7bfdce78e652c (diff) |
Use hasElements to check Sequence emptiness in [t-u]*
Similar to clang-tidy readability-container-size-empty
Change-Id: Idefe55e37f5c837c889548ffe7c5711400012a4d
Reviewed-on: https://gerrit.libreoffice.org/71667
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'test')
-rw-r--r-- | test/source/container/xnameaccess.cxx | 2 | ||||
-rw-r--r-- | test/source/lang/xserviceinfo.cxx | 2 | ||||
-rw-r--r-- | test/source/sheet/globalsheetsettings.cxx | 3 | ||||
-rw-r--r-- | test/source/sheet/xcellrangedata.cxx | 2 | ||||
-rw-r--r-- | test/source/sheet/xconsolidationdescriptor.cxx | 2 | ||||
-rw-r--r-- | test/source/sheet/xdatapilottable2.cxx | 2 | ||||
-rw-r--r-- | test/source/sheet/xfunctiondescriptions.cxx | 2 | ||||
-rw-r--r-- | test/source/sheet/xrecentfunctions.cxx | 2 | ||||
-rw-r--r-- | test/source/sheet/xscenarioenhanced.cxx | 2 | ||||
-rw-r--r-- | test/source/sheet/xsheetfilterableex.cxx | 2 | ||||
-rw-r--r-- | test/source/sheet/xsheetfilterdescriptor.cxx | 3 | ||||
-rw-r--r-- | test/source/sheet/xsheetfilterdescriptor2.cxx | 3 | ||||
-rw-r--r-- | test/source/sheet/xsheetfilterdescriptor3.cxx | 3 | ||||
-rw-r--r-- | test/source/sheet/xsheetpagebreak.cxx | 4 | ||||
-rw-r--r-- | test/source/sheet/xsubtotalfield.cxx | 2 |
15 files changed, 16 insertions, 20 deletions
diff --git a/test/source/container/xnameaccess.cxx b/test/source/container/xnameaccess.cxx index 34b5e95da668..13199b9764b1 100644 --- a/test/source/container/xnameaccess.cxx +++ b/test/source/container/xnameaccess.cxx @@ -38,7 +38,7 @@ void XNameAccess::testGetElementNames() uno::Reference<container::XNameAccess> xNA(init(), uno::UNO_QUERY_THROW); uno::Sequence<OUString> aNames = xNA->getElementNames(); - CPPUNIT_ASSERT(aNames.getLength()); + CPPUNIT_ASSERT(aNames.hasElements()); } void XNameAccess::testHasByName() diff --git a/test/source/lang/xserviceinfo.cxx b/test/source/lang/xserviceinfo.cxx index eeba62784b14..9db9e4b1cbe3 100644 --- a/test/source/lang/xserviceinfo.cxx +++ b/test/source/lang/xserviceinfo.cxx @@ -34,7 +34,7 @@ void XServiceInfo::testGetSupportedServiceNames() uno::Reference<lang::XServiceInfo> xSI(init(), uno::UNO_QUERY_THROW); uno::Sequence<OUString> aServiceNames = xSI->getSupportedServiceNames(); - CPPUNIT_ASSERT(aServiceNames.getLength()); + CPPUNIT_ASSERT(aServiceNames.hasElements()); } void XServiceInfo::testSupportsService() diff --git a/test/source/sheet/globalsheetsettings.cxx b/test/source/sheet/globalsheetsettings.cxx index d877e7c3ceab..0fd2e1aae21d 100644 --- a/test/source/sheet/globalsheetsettings.cxx +++ b/test/source/sheet/globalsheetsettings.cxx @@ -172,8 +172,7 @@ void GlobalSheetSettings::testGlobalSheetSettingsProperties() aNewValue <<= uno::Sequence<OUString>(); xGlobalSheetSettings->setPropertyValue(propName, aNewValue); CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aUserLists); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue UserLists", sal_Int32(0), - aUserLists.getLength()); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue UserLists", !aUserLists.hasElements()); propName = "LinkUpdateMode"; sal_Int16 aLinkUpdateMode = 42; diff --git a/test/source/sheet/xcellrangedata.cxx b/test/source/sheet/xcellrangedata.cxx index 223fd5f7b32d..cc8345ab26e9 100644 --- a/test/source/sheet/xcellrangedata.cxx +++ b/test/source/sheet/xcellrangedata.cxx @@ -69,7 +69,7 @@ void XCellRangeData::testGetDataArray() { uno::Reference< sheet::XCellRangeData > xCellRangeData( getXCellRangeData(), UNO_QUERY_THROW); uno::Sequence< uno::Sequence < Any > > aColRow = xCellRangeData->getDataArray(); - CPPUNIT_ASSERT(aColRow.getLength()); + CPPUNIT_ASSERT(aColRow.hasElements()); } void XCellRangeData::testGetDataArrayOnTableSheet() diff --git a/test/source/sheet/xconsolidationdescriptor.cxx b/test/source/sheet/xconsolidationdescriptor.cxx index 5b95d0acf321..5161c500d1c1 100644 --- a/test/source/sheet/xconsolidationdescriptor.cxx +++ b/test/source/sheet/xconsolidationdescriptor.cxx @@ -49,7 +49,7 @@ void XConsolidationDescriptor::testGetSources() UNO_QUERY_THROW); uno::Sequence<table::CellRangeAddress> aSources = xConsolidationDescriptor->getSources(); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get sources", sal_Int32(0), aSources.getLength()); + CPPUNIT_ASSERT_MESSAGE("Unable to get sources", !aSources.hasElements()); } void XConsolidationDescriptor::testSetSources() diff --git a/test/source/sheet/xdatapilottable2.cxx b/test/source/sheet/xdatapilottable2.cxx index dc23c1045cb4..221d722373b1 100644 --- a/test/source/sheet/xdatapilottable2.cxx +++ b/test/source/sheet/xdatapilottable2.cxx @@ -250,7 +250,7 @@ table::CellAddress getLastUsedCellAddress( uno::Reference< sheet::XSpreadsheet > void XDataPilotTable2::checkDrillDownSheetContent(uno::Reference< sheet::XSpreadsheet > const & xSheet, const uno::Sequence< uno::Sequence< Any > >& aData) { table::CellAddress aLastCell = getLastUsedCellAddress(xSheet, 0, 0); - CPPUNIT_ASSERT(aData.getLength() > 0); + CPPUNIT_ASSERT(aData.hasElements()); CPPUNIT_ASSERT(aLastCell.Row); CPPUNIT_ASSERT(aLastCell.Column); diff --git a/test/source/sheet/xfunctiondescriptions.cxx b/test/source/sheet/xfunctiondescriptions.cxx index fb3820590586..5c53b52971ac 100644 --- a/test/source/sheet/xfunctiondescriptions.cxx +++ b/test/source/sheet/xfunctiondescriptions.cxx @@ -55,7 +55,7 @@ void XFunctionDescriptions::testGetById() OUString aName2; uno::Sequence<beans::PropertyValue> aProps2 = xFD->getById(aId1); CPPUNIT_ASSERT_MESSAGE("Received empty FunctionDescriptions from getById()", - aProps2.getLength()); + aProps2.hasElements()); for (const auto& aProp : aProps2) { if (aProp.Name == "Id") diff --git a/test/source/sheet/xrecentfunctions.cxx b/test/source/sheet/xrecentfunctions.cxx index 1d88943d4e39..209c5e56e33d 100644 --- a/test/source/sheet/xrecentfunctions.cxx +++ b/test/source/sheet/xrecentfunctions.cxx @@ -46,7 +46,7 @@ void XRecentFunctions::testSetRecentFunctionIds() xRecentFunctions->setRecentFunctionIds(aIds); aIds = xRecentFunctions->getRecentFunctionIds(); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set Ids (empty list)", sal_Int32(0), aIds.getLength()); + CPPUNIT_ASSERT_MESSAGE("Unable to set Ids (empty list)", !aIds.hasElements()); // max. size list aIds.realloc(nMaxNumber); diff --git a/test/source/sheet/xscenarioenhanced.cxx b/test/source/sheet/xscenarioenhanced.cxx index 6f8b80cbe40c..e6c9568d142e 100644 --- a/test/source/sheet/xscenarioenhanced.cxx +++ b/test/source/sheet/xscenarioenhanced.cxx @@ -29,7 +29,7 @@ void XScenarioEnhanced::testGetRanges() uno::Reference<sheet::XScenarioEnhanced> xSE(getScenarioSpreadsheet(), UNO_QUERY_THROW); uno::Sequence<table::CellRangeAddress> aCellRangeAddr = xSE->getRanges(); - CPPUNIT_ASSERT_MESSAGE("No ranges found", aCellRangeAddr.getLength() != 0); + CPPUNIT_ASSERT_MESSAGE("No ranges found", aCellRangeAddr.hasElements()); CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong CellRangeAddres", table::CellRangeAddress(1, 0, 0, 10, 10), aCellRangeAddr[0]); diff --git a/test/source/sheet/xsheetfilterableex.cxx b/test/source/sheet/xsheetfilterableex.cxx index dee2a8a573d3..46759b224ae3 100644 --- a/test/source/sheet/xsheetfilterableex.cxx +++ b/test/source/sheet/xsheetfilterableex.cxx @@ -36,7 +36,7 @@ void XSheetFilterableEx::testCreateFilterDescriptorByObject() CPPUNIT_ASSERT_MESSAGE("no XSheetFilterDescriptor", xSFD.is()); uno::Sequence<sheet::TableFilterField> xTFF = xSFD->getFilterFields(); - CPPUNIT_ASSERT_MESSAGE("The gained XSheetFilterDescriptor is empty", xTFF.getLength() != 0); + CPPUNIT_ASSERT_MESSAGE("The gained XSheetFilterDescriptor is empty", xTFF.hasElements()); for (const auto& field : xTFF) { diff --git a/test/source/sheet/xsheetfilterdescriptor.cxx b/test/source/sheet/xsheetfilterdescriptor.cxx index 97214fb10dd2..71e601372c5e 100644 --- a/test/source/sheet/xsheetfilterdescriptor.cxx +++ b/test/source/sheet/xsheetfilterdescriptor.cxx @@ -27,8 +27,7 @@ void XSheetFilterDescriptor::testGetSetFilterFields() uno::Reference<sheet::XSheetFilterDescriptor> xSFD(init(), uno::UNO_QUERY_THROW); uno::Sequence<sheet::TableFilterField> aDefaultTFF = xSFD->getFilterFields(); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get TableFilterField", sal_Int32(0), - aDefaultTFF.getLength()); + CPPUNIT_ASSERT_MESSAGE("Unable to get TableFilterField", !aDefaultTFF.hasElements()); uno::Sequence<sheet::TableFilterField> aTFF; aTFF.realloc(1); diff --git a/test/source/sheet/xsheetfilterdescriptor2.cxx b/test/source/sheet/xsheetfilterdescriptor2.cxx index 0f501769272c..804d61e222ef 100644 --- a/test/source/sheet/xsheetfilterdescriptor2.cxx +++ b/test/source/sheet/xsheetfilterdescriptor2.cxx @@ -27,8 +27,7 @@ void XSheetFilterDescriptor2::testGetSetFilterFields2() uno::Reference<sheet::XSheetFilterDescriptor2> xSFD(init(), uno::UNO_QUERY_THROW); uno::Sequence<sheet::TableFilterField2> aDefaultTFF = xSFD->getFilterFields2(); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get TableFilterField", sal_Int32(0), - aDefaultTFF.getLength()); + CPPUNIT_ASSERT_MESSAGE("Unable to get TableFilterField", !aDefaultTFF.hasElements()); uno::Sequence<sheet::TableFilterField2> aTFF; aTFF.realloc(1); diff --git a/test/source/sheet/xsheetfilterdescriptor3.cxx b/test/source/sheet/xsheetfilterdescriptor3.cxx index 420135e10914..818ea2c1f32a 100644 --- a/test/source/sheet/xsheetfilterdescriptor3.cxx +++ b/test/source/sheet/xsheetfilterdescriptor3.cxx @@ -27,8 +27,7 @@ void XSheetFilterDescriptor3::testGetSetFilterFields3() uno::Reference<sheet::XSheetFilterDescriptor3> xSFD(init(), uno::UNO_QUERY_THROW); uno::Sequence<sheet::TableFilterField3> aDefaultTFF = xSFD->getFilterFields3(); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get TableFilterField", sal_Int32(0), - aDefaultTFF.getLength()); + CPPUNIT_ASSERT_MESSAGE("Unable to get TableFilterField", !aDefaultTFF.hasElements()); uno::Sequence<sheet::TableFilterField3> aTFF; aTFF.realloc(1); diff --git a/test/source/sheet/xsheetpagebreak.cxx b/test/source/sheet/xsheetpagebreak.cxx index 551271029f18..656a33a0cb0b 100644 --- a/test/source/sheet/xsheetpagebreak.cxx +++ b/test/source/sheet/xsheetpagebreak.cxx @@ -27,7 +27,7 @@ void XSheetPageBreak::testGetColumnPageBreaks() uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak(init(), UNO_QUERY_THROW); uno::Sequence< sheet::TablePageBreakData > xColPageBreak = xSheetPageBreak->getColumnPageBreaks(); - CPPUNIT_ASSERT_MESSAGE("Unable to get column page breaks", xColPageBreak.getLength() != 0); + CPPUNIT_ASSERT_MESSAGE("Unable to get column page breaks", xColPageBreak.hasElements()); } void XSheetPageBreak::testGetRowPageBreaks() @@ -35,7 +35,7 @@ void XSheetPageBreak::testGetRowPageBreaks() uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak(init(), UNO_QUERY_THROW); uno::Sequence< sheet::TablePageBreakData > xRowPageBreak = xSheetPageBreak->getRowPageBreaks(); - CPPUNIT_ASSERT_MESSAGE("Unable to get row page breaks", xRowPageBreak.getLength() != 0); + CPPUNIT_ASSERT_MESSAGE("Unable to get row page breaks", xRowPageBreak.hasElements()); } void XSheetPageBreak::testRemoveAllManualPageBreaks() diff --git a/test/source/sheet/xsubtotalfield.cxx b/test/source/sheet/xsubtotalfield.cxx index ff7871fe0237..41824a1d0f64 100644 --- a/test/source/sheet/xsubtotalfield.cxx +++ b/test/source/sheet/xsubtotalfield.cxx @@ -63,7 +63,7 @@ void XSubTotalField::testGetSetTotalColumns() uno::Reference< sheet::XSubTotalField > xSTF(init(), UNO_QUERY_THROW); uno::Sequence< sheet::SubTotalColumn > sDefaultCols = xSTF->getSubTotalColumns(); - CPPUNIT_ASSERT_MESSAGE("Unable to get SubTotalColumns", sDefaultCols.getLength() != 0); + CPPUNIT_ASSERT_MESSAGE("Unable to get SubTotalColumns", sDefaultCols.hasElements()); uno::Sequence< sheet::SubTotalColumn > sNewCols; sNewCols.realloc(1); |