summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-06-27 22:23:58 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-07-01 10:29:17 -0400
commitbdd8986ebd82884402b15d5d1d7cf76de37a47c6 (patch)
tree68a3d7f246c0eabb82dd616aa91eef7d6de74950 /sc
parentcb1310356b358137210ea5445500bb2e96847fda (diff)
Test loading of xls and xlsx with shared formulas.
To make sure I won't break this. And I moved the xlsx version of the test from the slow check to the normal test, which gets run for the normal build target. Change-Id: Id65f79796b11c0ab039842f1c1c158e9af310757
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/data/xls/shared-formula.xlsbin0 -> 13824 bytes
-rw-r--r--sc/qa/unit/data/xlsx/shared-formula.xlsxbin8336 -> 8984 bytes
-rw-r--r--sc/qa/unit/filters-test.cxx36
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx37
4 files changed, 36 insertions, 37 deletions
diff --git a/sc/qa/unit/data/xls/shared-formula.xls b/sc/qa/unit/data/xls/shared-formula.xls
new file mode 100644
index 000000000000..a9be6b7f1ec6
--- /dev/null
+++ b/sc/qa/unit/data/xls/shared-formula.xls
Binary files differ
diff --git a/sc/qa/unit/data/xlsx/shared-formula.xlsx b/sc/qa/unit/data/xlsx/shared-formula.xlsx
index d1b4f52fd47d..64d05018b223 100644
--- a/sc/qa/unit/data/xlsx/shared-formula.xlsx
+++ b/sc/qa/unit/data/xlsx/shared-formula.xlsx
Binary files differ
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index f82f1eb5e68f..dfaecfd35e1d 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -65,6 +65,8 @@ public:
void testContentXLSX();
void testContentLotus123();
void testContentDIF();
+ void testSharedFormulaXLS();
+ void testSharedFormulaXLSX();
#if TEST_BUG_FILES
//goes recursively through all files in this dir and tries to open them
void testDir(osl::Directory& rDir, sal_Int32 nType);
@@ -83,6 +85,8 @@ public:
CPPUNIT_TEST(testContentXLSX);
CPPUNIT_TEST(testContentLotus123);
CPPUNIT_TEST(testContentDIF);
+ CPPUNIT_TEST(testSharedFormulaXLS);
+ CPPUNIT_TEST(testSharedFormulaXLSX);
CPPUNIT_TEST(testLegacyCellAnchoredRotatedShape);
#if TEST_BUG_FILES
@@ -325,7 +329,39 @@ void ScFiltersTest::testContentDIF()
ScDocument* pDoc = xDocSh->GetDocument();
CPPUNIT_ASSERT(pDoc);
+ xDocSh->DoClose();
+}
+
+void ScFiltersTest::testSharedFormulaXLS()
+{
+ ScDocShellRef xDocSh = loadDoc("shared-formula.", XLS);
+ ScDocument* pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ xDocSh->DoHardRecalc(true);
+ // Check the results of formula cells in the shared formula range.
+ for (SCROW i = 1; i <= 18; ++i)
+ {
+ double fVal = pDoc->GetValue(ScAddress(1,i,0));
+ double fCheck = i*10.0;
+ CPPUNIT_ASSERT_EQUAL(fCheck, fVal);
+ }
+ xDocSh->DoClose();
+}
+void ScFiltersTest::testSharedFormulaXLSX()
+{
+ ScDocShellRef xDocSh = loadDoc("shared-formula.", XLSX);
+ ScDocument* pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ xDocSh->DoHardRecalc(true);
+ // Check the results of formula cells in the shared formula range.
+ for (SCROW i = 1; i <= 18; ++i)
+ {
+ double fVal = pDoc->GetValue(ScAddress(1,i,0));
+ double fCheck = i*10.0;
+ CPPUNIT_ASSERT_EQUAL(fCheck, fVal);
+ }
+ xDocSh->DoClose();
}
void impl_testLegacyCellAnchoredRotatedShape( ScDocument* pDoc, Rectangle& aRect, ScDrawObjData& aAnchor, long TOLERANCE = 30 /* 30 hmm */ )
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index f53a4302d2d2..c8bbcf03bce5 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -114,7 +114,6 @@ public:
void testNewCondFormatXLSX();
//change this test file only in excel and not in calc
- void testSharedFormulaXLSX();
void testCellValueXLSX();
//misc tests unrelated to the import filters
@@ -168,7 +167,6 @@ public:
CPPUNIT_TEST(testRepeatedColumnsODS);
CPPUNIT_TEST(testDataValidityODS);
CPPUNIT_TEST(testBrokenQuotesCSV);
- CPPUNIT_TEST(testSharedFormulaXLSX);
CPPUNIT_TEST(testCellValueXLSX);
CPPUNIT_TEST(testControlImport);
CPPUNIT_TEST(testChartImportODS);
@@ -1190,41 +1188,6 @@ void ScFiltersTest::testBrokenQuotesCSV()
xDocSh->DoClose();
}
-void ScFiltersTest::testSharedFormulaXLSX()
-{
- const OUString aFileNameBase("shared-formula.");
- OUString aFileExtension(aFileFormats[XLSX].pName, strlen(aFileFormats[XLSX].pName), RTL_TEXTENCODING_UTF8 );
- OUString aFilterName(aFileFormats[XLSX].pFilterName, strlen(aFileFormats[XLSX].pFilterName), RTL_TEXTENCODING_UTF8) ;
- OUString aFileName;
- createFileURL(aFileNameBase, aFileExtension, aFileName);
- OUString aFilterType(aFileFormats[XLSX].pTypeName, strlen(aFileFormats[XLSX].pTypeName), RTL_TEXTENCODING_UTF8);
- std::cout << aFileFormats[XLSX].pName << " Test" << std::endl;
-
- unsigned int nFormatType = aFileFormats[XLSX].nFormatType;
- unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
- ScDocShellRef xDocSh = ScBootstrapFixture::load(aFileName, aFilterName, OUString(), aFilterType,
- nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
-
- xDocSh->DoHardRecalc(true);
-
- 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
-
- 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);
- }
-
- xDocSh->DoClose();
-}
-
void ScFiltersTest::testCellValueXLSX()
{
const OUString aFileNameBase("cell-value.");