diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-04-17 20:42:27 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-04-17 21:02:18 +0200 |
commit | 738ff483a5f5627aa482ec944c66f8ebcf201b39 (patch) | |
tree | c7fe9519a28a351f0180103f2d9cbc222cd378c8 /sc/qa/unit | |
parent | f892be678a036cd0fea665eda529e9cc906e0cfa (diff) |
add a simple test case for shared formula import
Thanks to Kohei for the test document
Please only change this file with Excel and check after changing it that
it still contains shared formulas in all places.
Diffstat (limited to 'sc/qa/unit')
-rw-r--r-- | sc/qa/unit/data/contentCSV/shared-formula.csv | 9 | ||||
-rw-r--r-- | sc/qa/unit/data/xlsx/shared-formula.xlsx | bin | 0 -> 8336 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 32 |
3 files changed, 41 insertions, 0 deletions
diff --git a/sc/qa/unit/data/contentCSV/shared-formula.csv b/sc/qa/unit/data/contentCSV/shared-formula.csv new file mode 100644 index 000000000000..07193989308c --- /dev/null +++ b/sc/qa/unit/data/contentCSV/shared-formula.csv @@ -0,0 +1,9 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 diff --git a/sc/qa/unit/data/xlsx/shared-formula.xlsx b/sc/qa/unit/data/xlsx/shared-formula.xlsx Binary files differnew file mode 100644 index 000000000000..d1b4f52fd47d --- /dev/null +++ b/sc/qa/unit/data/xlsx/shared-formula.xlsx diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index f7d5d2b76995..8476b85c1542 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -118,6 +118,9 @@ public: void testBugFixesXLSX(); void testBrokenQuotesCSV(); + //change this test file only in excel and not in calc + void testSharedFormulaXLSX(); + //misc tests unrelated to the import filters void testPasswordNew(); void testPasswordOld(); @@ -142,6 +145,8 @@ public: #if 0 CPPUNIT_TEST(testBrokenQuotesCSV); #endif + CPPUNIT_TEST(testSharedFormulaXLSX); + //disable testPassword on MacOSX due to problems with libsqlite3 //also crashes on DragonFly due to problems with nss/nspr headers #if !defined(MACOSX) && !defined(DRAGONFLY) && !defined(WNT) @@ -667,6 +672,33 @@ void ScFiltersTest::testBrokenQuotesCSV() xDocSh->DoClose(); } +void ScFiltersTest::testSharedFormulaXLSX() +{ + const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM("shared-formula.")); + 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 shared-formula.xlsx", xDocSh.Is()); + ScDocument* pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT_MESSAGE("No Document", pDoc); //remove with first test + + rtl::OUString aCSVPath; + createCSVPath( aFileNameBase, aCSVPath ); + testFile( aCSVPath, pDoc, 0 ); + + //test some additional properties + ScRangeName* pName = pDoc->GetRangeName(); + for (ScRangeName::iterator itr = pName->begin(); itr != pName->end(); ++itr) + { + CPPUNIT_ASSERT(itr->second->GetType() & RT_SHARED); + } +} + void ScFiltersTest::testPassword_Impl(const rtl::OUString& aFileNameBase) { rtl::OUString aFileExtension(aFileFormats[0].pName, strlen(aFileFormats[0].pName), RTL_TEXTENCODING_UTF8 ); |