summaryrefslogtreecommitdiff
path: root/chart2/qa/extras/chart2import.cxx
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-04-23 07:11:57 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-04-24 12:17:48 +0200
commita172ed9837d1c52eebd9336e5262f459920e525b (patch)
treea9ce15244ffbe1ac6783f3e5a9e695e811e0b9dc /chart2/qa/extras/chart2import.cxx
parent4b520d2ee8732d24d882ac965078f54e5ae5d418 (diff)
extract common chart test parts into own header
Change-Id: Id41b9c3cd241de9bc5fa1da885bc9a206bca093d
Diffstat (limited to 'chart2/qa/extras/chart2import.cxx')
-rw-r--r--chart2/qa/extras/chart2import.cxx131
1 files changed, 2 insertions, 129 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index b498c695ff96..decd18ed2b1a 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -7,45 +7,18 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include <test/bootstrapfixture.hxx>
-#include <unotest/macros_test.hxx>
+#include "charttest.hxx"
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/frame/Desktop.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
-#include <com/sun/star/container/XIndexAccess.hpp>
-#include <com/sun/star/table/XTableChartsSupplier.hpp>
-#include <com/sun/star/table/XTableCharts.hpp>
-#include <com/sun/star/table/XTableChart.hpp>
-#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/chart2/XDiagram.hpp>
-#include <com/sun/star/chart2/XDataSeries.hpp>
-#include <com/sun/star/chart2/XChartTypeContainer.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
-#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
#include <com/sun/star/chart2/CurveStyle.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
-#include <com/sun/star/chart/XChartDocument.hpp>
-
-#include <comphelper/processfactory.hxx>
-
-using namespace com::sun::star;
-using namespace com::sun::star::uno;
-class Chart2ImportTest : public test::BootstrapFixture, public unotest::MacrosTest
+class Chart2ImportTest : public ChartTest
{
public:
void Fdo60083();
void testSteppedLines();
void testErrorBarRange();
- virtual void setUp();
- virtual void tearDown();
-
CPPUNIT_TEST_SUITE(Chart2ImportTest);
CPPUNIT_TEST(Fdo60083);
CPPUNIT_TEST(testSteppedLines);
@@ -53,15 +26,7 @@ public:
CPPUNIT_TEST_SUITE_END();
private:
- void load( const char* pDir, const char* pName );
-
- Reference< chart2::XChartDocument > getChartDocFromSheet( sal_Int32 nSheet, uno::Reference< lang::XComponent > xComponent );
- Reference< chart2::XDataSeries > getDataSeriesFromDoc( Reference< chart2::XChartDocument > xChartDoc,
- sal_Int32 nDataSeries, sal_Int32 nChartType = 0, sal_Int32 nCooSys = 0 );
- Reference< chart2::XChartType > getChartTypeFromDoc( Reference< chart2::XChartDocument > xChartDoc,
- sal_Int32 nChartType, sal_Int32 nCooSys = 0 );
- Reference< lang::XComponent > mxComponent;
};
// error bar import
@@ -186,98 +151,6 @@ void Chart2ImportTest::testSteppedLines()
}
}
-Reference< chart2::XChartDocument > Chart2ImportTest::getChartDocFromSheet( sal_Int32 nSheet, uno::Reference< lang::XComponent > xComponent )
-{
- // 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());
-
- uno::Reference< chart2::XChartDocument > xChartDoc ( xChartComp, UNO_QUERY_THROW );
-
- CPPUNIT_ASSERT(xChartDoc.is());
- return xChartDoc;
-}
-
-Reference< chart2::XChartType > Chart2ImportTest::getChartTypeFromDoc( Reference< chart2::XChartDocument > xChartDoc,
- sal_Int32 nChartType, sal_Int32 nCooSys )
-{
- CPPUNIT_ASSERT( xChartDoc.is() );
-
- Reference <chart2::XDiagram > xDiagram = xChartDoc->getFirstDiagram();
- 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 );
-
- return xChartTypeSequence[nChartType];
-}
-
-Reference< chart2::XDataSeries > Chart2ImportTest::getDataSeriesFromDoc( uno::Reference< chart2::XChartDocument > xChartDoc,
- sal_Int32 nDataSeries, sal_Int32 nChartType, sal_Int32 nCooSys )
-{
- Reference< chart2::XChartType > xChartType = getChartTypeFromDoc( xChartDoc, nChartType, nCooSys );
- Reference< chart2::XDataSeriesContainer > xDataSequenceContainer( xChartType, UNO_QUERY_THROW );
- CPPUNIT_ASSERT ( xDataSequenceContainer.is() );
-
- Sequence< Reference< chart2::XDataSeries > > xSeriesSequence( xDataSequenceContainer->getDataSeries() );
- CPPUNIT_ASSERT( xSeriesSequence.getLength() > nDataSeries );
-
- Reference< chart2::XDataSeries > xSeries = xSeriesSequence[nDataSeries];
-
- return xSeries;
-}
-
-void Chart2ImportTest::load( const char* pDir, const char* pName )
-{
- mxComponent = loadFromDesktop(getURLFromSrc(pDir) + OUString::createFromAscii(pName), "com.sun.star.sheet.SpreadsheetDocument");
- CPPUNIT_ASSERT(mxComponent.is());
-}
-
-void Chart2ImportTest::setUp()
-{
- test::BootstrapFixture::setUp();
-
- mxDesktop.set( com::sun::star::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) ) );
-}
-
-void Chart2ImportTest::tearDown()
-{
- if(mxComponent.is())
- mxComponent->dispose();
-
- test::BootstrapFixture::tearDown();
-
-}
-
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();