add test for ScCellRangeObj::setDataArray and getDataArray

This commit is contained in:
Markus Mohrhard 2012-02-17 01:59:32 +01:00
parent 4e1e72dc34
commit 7b91c6d1c0
2 changed files with 26 additions and 2 deletions

View File

@ -31,6 +31,7 @@
#include <test/sheet/cellproperties.hxx>
#include <test/util/xreplaceable.hxx>
#include <test/util/xsearchable.hxx>
#include <test/sheet/xcellrangedata.hxx>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
@ -38,10 +39,10 @@
namespace sc_apitest {
#define NUMBER_OF_TESTS 12
#define NUMBER_OF_TESTS 14
class ScCellRangeObj : public UnoApiTest, apitest::XCellRangesQuery, apitest::CellProperties,
apitest::XSearchable, apitest::XReplaceable
apitest::XSearchable, apitest::XReplaceable, apitest::XCellRangeData
{
public:
ScCellRangeObj();
@ -49,6 +50,7 @@ public:
virtual void setUp();
virtual void tearDown();
virtual uno::Reference< uno::XInterface > init();
virtual uno::Reference< uno::XInterface > getXCellRangeData();
CPPUNIT_TEST_SUITE(ScCellRangeObj);
CPPUNIT_TEST(testQueryColumnDifference);
@ -64,6 +66,8 @@ public:
CPPUNIT_TEST(testFindFirst);
CPPUNIT_TEST(testReplaceAll);
CPPUNIT_TEST(testCreateReplaceDescriptor);
CPPUNIT_TEST(testGetDataArray);
CPPUNIT_TEST(testSetDataArray);
CPPUNIT_TEST_SUITE_END();
private:
@ -101,6 +105,26 @@ uno::Reference< uno::XInterface > ScCellRangeObj::init()
return xReturn;
}
uno::Reference< uno::XInterface > ScCellRangeObj::getXCellRangeData()
{
rtl::OUString aFileURL;
const rtl::OUString aFileBase(RTL_CONSTASCII_USTRINGPARAM("xcellrangesquery.ods"));
createFileURL(aFileBase, aFileURL);
std::cout << rtl::OUStringToOString(aFileURL, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
if( !mxComponent.is())
mxComponent = loadFromDesktop(aFileURL);
uno::Reference< sheet::XSpreadsheetDocument> xDoc (mxComponent, UNO_QUERY_THROW);
uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(1), UNO_QUERY_THROW);
CPPUNIT_ASSERT_MESSAGE("Could not create interface of type XSpreadsheet", xSheet.is());
uno::Reference<table::XCellRange> xReturn(xSheet->getCellRangeByPosition(0,0,3,3), UNO_QUERY_THROW);
CPPUNIT_ASSERT_MESSAGE("Could not create object of type XCellRangesQuery", xReturn.is());
return xReturn;
}
void ScCellRangeObj::setUp()
{
nTest++;