summaryrefslogtreecommitdiff
path: root/sc/qa/unit
diff options
context:
space:
mode:
authorDaniel Bankston <daniel.dev.libreoffice@gmail.com>2012-04-28 21:57:22 -0500
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-04-29 16:29:09 +0200
commitf45de1bed2f116ba3846c6fc2b1eb52f757c25f0 (patch)
tree25184362b0379160ec0b976a6ade5f454b127ccd /sc/qa/unit
parent1ac100610860a17792713afe948fa961c5f7cbe4 (diff)
First attempt adding cell-value xlsx test
Change-Id: I5481759669d14b7e4c564f2909d1db9af3b4a2e6
Diffstat (limited to 'sc/qa/unit')
-rw-r--r--sc/qa/unit/data/contentCSV/cell-value.csv3
-rw-r--r--sc/qa/unit/data/xlsx/cell-value.xlsxbin0 -> 7697 bytes
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx24
3 files changed, 27 insertions, 0 deletions
diff --git a/sc/qa/unit/data/contentCSV/cell-value.csv b/sc/qa/unit/data/contentCSV/cell-value.csv
new file mode 100644
index 000000000000..30ac22262812
--- /dev/null
+++ b/sc/qa/unit/data/contentCSV/cell-value.csv
@@ -0,0 +1,3 @@
+-2012,-1,0,1,2012
+-3.14,-0.99,0.01,3.14,
+H,"Hello, Calc!",,"Calc is the spreadsheet program you've always needed. Newcomers find it intuitive and easy to learn. Professional data miners and number crunchers will appreciate the comprehensive range of advanced functions. Advanced DataPilot technology makes it easy to pull-in raw data from corporate databases, and then cross-tabulate, summarise, and convert it into meaningful information. Natural language formulas let you create formulas using words (for example: ""sales - costs""). The Intelligent Sum button inserts a sum function or a subtotal automatically, depending on the context. Wizards can guide you through choosing and using a comprehensive range of advanced spreadsheet functions. Or you can download templates from the LibreOffice template repository, for ready-made spreadsheet solutions. Styles and direct formatting makes it easy to apply flexible cell formatting options, including freely-rotating contents, templates, backgrounds, borders and much more. Become a spreadsheet expert, using templates with built-in functions, so that you can re-use a pre-prepared sheet and just focus on the immediate work. The Scenario Manager allows ""what if ..."" analysis at the touch of a button. For instance, you can compare profitability for high, medium and low sales forecasts. Calc's solver component lets you solve optimization problems in which the optimum value of a particular spreadsheet cell has to be calculated based on constraints provided in other cells. You can do collaborative work on spreadsheets, thanks to Calc's multiple-user support. You can share a spreadsheet, so that other users can easily add their data to it. The spreadsheet owner can then easily integrate the new data, in just a few clicks. This collaboration feature helps avoid editing conflicts. You can save your spreadsheets in OpenDocument format, the new international standard for documents. This XML-based format means that your files can be read even if the recipient is not a Calc user. Your spreadsheets will be accessible using any OpenDocument-compliant software. You can also open Microsoft Excel spreadsheets, and can also save your work in Excel format for sending to people still locked into Microsoft products. If you only need to make your data readable, but on a wide range of devices and platforms, you can export to Portable Document Format (.pdf). Calc can read .xlsx files created with Microsoft Office 2007 for Windows or Microsoft Office 2008 for Mac OS X.",
diff --git a/sc/qa/unit/data/xlsx/cell-value.xlsx b/sc/qa/unit/data/xlsx/cell-value.xlsx
new file mode 100644
index 000000000000..70c8d0d6a580
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/cell-value.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 87697cdc1fd8..8a10a22eb5cd 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -115,6 +115,7 @@ public:
//change this test file only in excel and not in calc
void testSharedFormulaXLSX();
+ void testCellValueXLSX();
//misc tests unrelated to the import filters
void testPasswordNew();
@@ -140,6 +141,7 @@ public:
CPPUNIT_TEST(testBrokenQuotesCSV);
#endif
CPPUNIT_TEST(testSharedFormulaXLSX);
+ CPPUNIT_TEST(testCellValueXLSX);
//disable testPassword on MacOSX due to problems with libsqlite3
//also crashes on DragonFly due to problems with nss/nspr headers
@@ -678,6 +680,28 @@ void ScFiltersTest::testSharedFormulaXLSX()
}
}
+void ScFiltersTest::testCellValueXLSX()
+{
+ const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM("cell-value."));
+ 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());
+ ScDocument* pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT_MESSAGE("No Document", pDoc); //remove with first test
+
+ rtl::OUString aCSVPath;
+ createCSVPath( aFileNameBase, aCSVPath );
+ testFile( aCSVPath, pDoc, 0 );
+
+ xDocSh->DoClose();
+}
+
void ScFiltersTest::testPassword_Impl(const rtl::OUString& aFileNameBase)
{
rtl::OUString aFileExtension(aFileFormats[0].pName, strlen(aFileFormats[0].pName), RTL_TEXTENCODING_UTF8 );