summaryrefslogtreecommitdiff
path: root/chart2/qa/extras/charttest.hxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-06-07 13:03:58 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2018-06-08 01:29:32 +0200
commit5708534b942c1d0ce384f6a8473da6bb569410e7 (patch)
tree2ec4fe87624541c15bf89c8b839e8f8dba8a89f4 /chart2/qa/extras/charttest.hxx
parent1e55a47e89a9d9d6cf9cb3993484022aaf2c097b (diff)
look for unnecessary calls to Reference::is() after an UNO_QUERY_THROW
Since the previous call would throw if there was nothing to be assigned to the value. Idea from tml. Used the following script to find places: git grep -A3 -n UNO_QUERY_THROW | grep -B3 -F 'is()' Change-Id: I36ba7b00bcd014bdf16c0455ab91056f82194969 Reviewed-on: https://gerrit.libreoffice.org/55417 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tor Lillqvist <tml@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'chart2/qa/extras/charttest.hxx')
-rw-r--r--chart2/qa/extras/charttest.hxx28
1 files changed, 0 insertions, 28 deletions
diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx
index 438565222db4..202475e7e4ca 100644
--- a/chart2/qa/extras/charttest.hxx
+++ b/chart2/qa/extras/charttest.hxx
@@ -184,26 +184,20 @@ Reference< lang::XComponent > getChartCompFromSheet( sal_Int32 nSheet, uno::Refe
// let us assume that we only have one chart per sheet
uno::Reference< sheet::XSpreadsheetDocument > xDoc(xComponent, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xDoc.is());
uno::Reference< container::XIndexAccess > xIA(xDoc->getSheets(), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xIA.is());
uno::Reference< table::XTableChartsSupplier > xChartSupplier( xIA->getByIndex(nSheet), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartSupplier.is());
uno::Reference< table::XTableCharts > xCharts = xChartSupplier->getCharts();
CPPUNIT_ASSERT(xCharts.is());
uno::Reference< container::XIndexAccess > xIACharts(xCharts, UNO_QUERY_THROW);
uno::Reference< table::XTableChart > xChart( xIACharts->getByIndex(0), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChart.is());
uno::Reference< document::XEmbeddedObjectSupplier > xEmbObjectSupplier(xChart, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xEmbObjectSupplier.is());
uno::Reference< lang::XComponent > xChartComp( xEmbObjectSupplier->getEmbeddedObject(), UNO_QUERY_THROW );
- CPPUNIT_ASSERT(xChartComp.is());
return xChartComp;
@@ -212,20 +206,16 @@ Reference< lang::XComponent > getChartCompFromSheet( sal_Int32 nSheet, uno::Refe
Reference< chart2::XChartDocument > getChartDocFromSheet( sal_Int32 nSheet, uno::Reference< lang::XComponent > const & xComponent )
{
uno::Reference< chart2::XChartDocument > xChartDoc ( getChartCompFromSheet(nSheet, xComponent), UNO_QUERY_THROW );
- CPPUNIT_ASSERT(xChartDoc.is());
return xChartDoc;
}
uno::Reference<table::XTablePivotCharts> getTablePivotChartsFromSheet(sal_Int32 nSheet, uno::Reference<lang::XComponent> const & xComponent)
{
uno::Reference<sheet::XSpreadsheetDocument> xDoc(xComponent, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xDoc.is());
uno::Reference<container::XIndexAccess> xIA(xDoc->getSheets(), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xIA.is());
uno::Reference<table::XTablePivotChartsSupplier> xChartSupplier(xIA->getByIndex(nSheet), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartSupplier.is());
uno::Reference<table::XTablePivotCharts> xTablePivotCharts = xChartSupplier->getPivotCharts();
CPPUNIT_ASSERT(xTablePivotCharts.is());
@@ -239,13 +229,10 @@ Reference<lang::XComponent> getPivotChartCompFromSheet(sal_Int32 nSheet, uno::Re
uno::Reference<container::XIndexAccess> xIACharts(xTablePivotCharts, UNO_QUERY_THROW);
uno::Reference<table::XTablePivotChart> xTablePivotChart(xIACharts->getByIndex(0), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xTablePivotChart.is());
uno::Reference<document::XEmbeddedObjectSupplier> xEmbObjectSupplier(xTablePivotChart, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xEmbObjectSupplier.is());
uno::Reference<lang::XComponent> xChartComp(xEmbObjectSupplier->getEmbeddedObject(), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartComp.is());
return xChartComp;
}
@@ -253,7 +240,6 @@ Reference<lang::XComponent> getPivotChartCompFromSheet(sal_Int32 nSheet, uno::Re
Reference<chart2::XChartDocument> getPivotChartDocFromSheet(sal_Int32 nSheet, uno::Reference<lang::XComponent> const & xComponent)
{
uno::Reference<chart2::XChartDocument> xChartDoc(getPivotChartCompFromSheet(nSheet, xComponent), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartDoc.is());
return xChartDoc;
}
@@ -261,16 +247,12 @@ Reference<chart2::XChartDocument> getPivotChartDocFromSheet(uno::Reference<table
{
uno::Reference<container::XIndexAccess> xIACharts(xTablePivotCharts, UNO_QUERY_THROW);
uno::Reference<table::XTablePivotChart> xTablePivotChart(xIACharts->getByIndex(nIndex), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xTablePivotChart.is());
uno::Reference<document::XEmbeddedObjectSupplier> xEmbObjectSupplier(xTablePivotChart, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xEmbObjectSupplier.is());
uno::Reference<lang::XComponent> xChartComp(xEmbObjectSupplier->getEmbeddedObject(), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartComp.is());
uno::Reference<chart2::XChartDocument> xChartDoc(xChartComp, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartDoc.is());
return xChartDoc;
}
@@ -283,13 +265,11 @@ Reference< chart2::XChartType > getChartTypeFromDoc( Reference< chart2::XChartDo
CPPUNIT_ASSERT( xDiagram.is() );
Reference< chart2::XCoordinateSystemContainer > xCooSysContainer( xDiagram, UNO_QUERY_THROW );
- CPPUNIT_ASSERT( xCooSysContainer.is() );
Sequence< Reference< chart2::XCoordinateSystem > > xCooSysSequence( xCooSysContainer->getCoordinateSystems());
CPPUNIT_ASSERT( xCooSysSequence.getLength() > nCooSys );
Reference< chart2::XChartTypeContainer > xChartTypeContainer( xCooSysSequence[nCooSys], UNO_QUERY_THROW );
- CPPUNIT_ASSERT( xChartTypeContainer.is() );
Sequence< Reference< chart2::XChartType > > xChartTypeSequence( xChartTypeContainer->getChartTypes() );
CPPUNIT_ASSERT( xChartTypeSequence.getLength() > nChartType );
@@ -304,7 +284,6 @@ Reference<chart2::XAxis> getAxisFromDoc(
CPPUNIT_ASSERT(xDiagram.is());
Reference<chart2::XCoordinateSystemContainer> xCooSysContainer(xDiagram, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xCooSysContainer.is());
Sequence<Reference<chart2::XCoordinateSystem> > xCooSysSequence = xCooSysContainer->getCoordinateSystems();
CPPUNIT_ASSERT(xCooSysSequence.getLength() > nCooSys);
@@ -323,7 +302,6 @@ sal_Int32 getNumberOfDataSeries(uno::Reference<chart2::XChartDocument> const & x
{
Reference<chart2::XChartType> xChartType = getChartTypeFromDoc(xChartDoc, nChartType, nCooSys);
Reference<chart2::XDataSeriesContainer> xDataSeriesContainer(xChartType, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xDataSeriesContainer.is());
uno::Sequence<uno::Reference<chart2::XDataSeries>> xSeriesSequence(xDataSeriesContainer->getDataSeries());
return xSeriesSequence.getLength();
@@ -335,7 +313,6 @@ Reference< chart2::XDataSeries > getDataSeriesFromDoc(uno::Reference<chart2::XCh
{
Reference< chart2::XChartType > xChartType = getChartTypeFromDoc( xChartDoc, nChartType, nCooSys );
Reference< chart2::XDataSeriesContainer > xDataSeriesContainer( xChartType, UNO_QUERY_THROW );
- CPPUNIT_ASSERT ( xDataSeriesContainer.is() );
Sequence< Reference< chart2::XDataSeries > > xSeriesSequence( xDataSeriesContainer->getDataSeries() );
CPPUNIT_ASSERT( xSeriesSequence.getLength() > nDataSeries );
@@ -407,7 +384,6 @@ uno::Sequence < OUString > getWriterChartColumnDescriptions( Reference< lang::XC
CPPUNIT_ASSERT( xChartDoc->getDataProvider().is() );
uno::Reference<beans::XPropertySet> xProp(xChartDoc->getDataProvider(), uno::UNO_QUERY );
uno::Reference< chart2::XAnyDescriptionAccess > xAnyDescriptionAccess ( xChartDoc->getDataProvider(), uno::UNO_QUERY_THROW );
- CPPUNIT_ASSERT( xAnyDescriptionAccess.is() );
uno::Sequence< OUString > seriesList = xAnyDescriptionAccess->getColumnDescriptions();
return seriesList;
}
@@ -503,7 +479,6 @@ uno::Reference< chart::XChartDocument > ChartTest::getChartDocFromImpress( const
uno::Reference< drawing::XDrawPagesSupplier > xDoc(mxComponent, uno::UNO_QUERY_THROW );
uno::Reference< drawing::XDrawPage > xPage(
xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
- CPPUNIT_ASSERT(xPage.is());
uno::Reference< beans::XPropertySet > xShapeProps(
xPage->getByIndex(0), uno::UNO_QUERY );
CPPUNIT_ASSERT(xShapeProps.is());
@@ -526,8 +501,6 @@ uno::Reference<chart::XChartDocument> ChartTest::getChartDocFromDrawImpress(
uno::Reference<drawing::XDrawPage> xPage(
xPages->getDrawPages()->getByIndex(nPage), uno::UNO_QUERY_THROW);
- if (!xPage.is())
- return xEmpty;
uno::Reference<beans::XPropertySet> xShapeProps(xPage->getByIndex(nShape), uno::UNO_QUERY);
if (!xShapeProps.is())
@@ -566,7 +539,6 @@ uno::Sequence < OUString > ChartTest::getImpressChartColumnDescriptions( const O
{
uno::Reference< chart::XChartDocument > xChartDoc = getChartDocFromImpress( pDir, pName );
uno::Reference< chart::XChartDataArray > xChartData ( xChartDoc->getData(), uno::UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartData.is());
uno::Sequence < OUString > seriesList = xChartData->getColumnDescriptions();
return seriesList;
}