diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-07-06 02:04:21 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-07-06 02:06:09 +0200 |
commit | dd209b77391903cb6f9f04c44e10a05f31076f4a (patch) | |
tree | 8523fcfb639d6c8de09414f51d9f2345f51aa1fa /sc/qa | |
parent | 7a31136c0da182c53275d36c0a3aa8946e295197 (diff) |
add a import test for control shapes
Change-Id: I2ac5e1bdd1c681c8ba58edded3ab1b57ac30c512
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/data/xlsx/singlecontrol.xlsx | bin | 0 -> 17915 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 33 |
2 files changed, 33 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xlsx/singlecontrol.xlsx b/sc/qa/unit/data/xlsx/singlecontrol.xlsx Binary files differnew file mode 100644 index 000000000000..513c05bd3c13 --- /dev/null +++ b/sc/qa/unit/data/xlsx/singlecontrol.xlsx diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 62a99709b90f..2fab37a4eabc 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -45,6 +45,12 @@ #include <dbdata.hxx> #include "validat.hxx" +#include <com/sun/star/drawing/XDrawPageSupplier.hpp> +#include <com/sun/star/drawing/XControlShape.hpp> +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/frame/XModel.hpp> + #define CALC_DEBUG_OUTPUT 0 #define TEST_BUG_FILES 0 @@ -127,6 +133,8 @@ public: void testPasswordNew(); void testPasswordOld(); + //test shape import + void testControlImport(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testRangeNameXLS); @@ -154,6 +162,7 @@ public: #endif CPPUNIT_TEST(testSharedFormulaXLSX); CPPUNIT_TEST(testCellValueXLSX); + CPPUNIT_TEST(testControlImport); //disable testPassword on MacOSX due to problems with libsqlite3 //also crashes on DragonFly due to problems with nss/nspr headers @@ -1060,6 +1069,30 @@ void ScFiltersTest::testPasswordOld() testPassword_Impl(aFileNameBase); } +void ScFiltersTest::testControlImport() +{ + const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM("singlecontrol.")); + rtl::OUString aFileExtension(aFileFormats[XLSX].pName, strlen(aFileFormats[XLSX].pName), RTL_TEXTENCODING_UTF8 ); + rtl::OUString aFilterName(aFileFormats[XLSX].pFilterName, strlen(aFileFormats[XLSX].pFilterName), RTL_TEXTENCODING_UTF8) ; + rtl::OUString aFileName; + createFileURL(aFileNameBase, aFileExtension, aFileName); + rtl::OUString aFilterType(aFileFormats[XLSX].pTypeName, strlen(aFileFormats[XLSX].pTypeName), RTL_TEXTENCODING_UTF8); + std::cout << aFileFormats[XLSX].pName << " Test" << std::endl; + ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[XLSX].nFormatType); + + CPPUNIT_ASSERT_MESSAGE("Failed to load cell-value.xlsx", xDocSh.Is()); + + uno::Reference< frame::XModel > xModel = xDocSh->GetModel(); + uno::Reference< sheet::XSpreadsheetDocument > xDoc(xModel, UNO_QUERY_THROW); + uno::Reference< container::XIndexAccess > xIA(xDoc->getSheets(), UNO_QUERY_THROW); + uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( xIA->getByIndex(0), UNO_QUERY_THROW); + uno::Reference< container::XIndexAccess > xIA_DrawPage(xDrawPageSupplier->getDrawPage(), UNO_QUERY_THROW); + uno::Reference< drawing::XControlShape > xControlShape(xIA_DrawPage->getByIndex(0), UNO_QUERY_THROW); + + CPPUNIT_ASSERT(xControlShape.is()); + xDocSh->DoClose(); +} + ScFiltersTest::ScFiltersTest() : m_aBaseString(RTL_CONSTASCII_USTRINGPARAM("/sc/qa/unit/data")) { |