sc/qa/unit/data/dif/universal-content.dif | 86 ++++++++++++++++++++++++++++++ sc/qa/unit/filters-test.cxx | 15 ++++- sc/qa/unit/helper/qahelper.hxx | 3 + 3 files changed, 103 insertions(+), 1 deletion(-)
New commits: commit 72e0e01c4b2adf9583c83cc6c7e2f4850a8b4704 Author: Markus Mohrhard <[email protected]> Date: Mon May 27 20:36:13 2013 +0200 add initial test case for DIF import Change-Id: I52634a8d31f580ac5565d615c872a575c6dc81c0 diff --git a/sc/qa/unit/data/dif/universal-content.dif b/sc/qa/unit/data/dif/universal-content.dif new file mode 100644 index 0000000..981c6e9 --- /dev/null +++ b/sc/qa/unit/data/dif/universal-content.dif @@ -0,0 +1,86 @@ +TABLE +0,1 +"Sheet1" +VECTORS +0,8 +"" +TUPLES +0,4 +"" +DATA +0,0 +"" +-1,0 +BOT +0,1 +V +1,0 +"String1" +0,6 +V +1,0 +"" +1,0 +"" +1,0 +"" +1,0 +"" +1,0 +"" +-1,0 +BOT +0,2 +V +1,0 +"String2" +0,5 +V +1,0 +"" +1,0 +"" +1,0 +"" +1,0 +"" +1,0 +"" +-1,0 +BOT +1,0 +"" +1,0 +"" +0,-1 +V +1,0 +"" +1,0 +"" +1,0 +"" +1,0 +"" +1,0 +"" +-1,0 +BOT +1,0 +"" +1,0 +"" +0,11 +V +1,0 +"" +1,0 +"" +1,0 +"" +1,0 +"" +1,0 +"" +-1,0 +EOD diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index 8f245c2..a024437 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -64,6 +64,7 @@ public: void testContentXLS(); void testContentXLSX(); void testContentLotus123(); + void testContentDIF(); #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); @@ -81,6 +82,7 @@ public: CPPUNIT_TEST(testContentXLS); CPPUNIT_TEST(testContentXLSX); CPPUNIT_TEST(testContentLotus123); + CPPUNIT_TEST(testContentDIF); CPPUNIT_TEST(testLegacyCellAnchoredRotatedShape); #if TEST_BUG_FILES @@ -246,6 +248,7 @@ void testContentImpl(ScDocument* pDoc, sal_Int32 nFormat ) //same code for ods, CPPUNIT_ASSERT_MESSAGE("string not imported correctly", aString == OUString("String2")); //check basic formula import + // in case of DIF it just contains values pDoc->GetValue(2,0,0,fValue); CPPUNIT_ASSERT_MESSAGE("=2*3", fValue == 6); pDoc->GetValue(2,1,0,fValue); @@ -256,7 +259,7 @@ void testContentImpl(ScDocument* pDoc, sal_Int32 nFormat ) //same code for ods, CPPUNIT_ASSERT_MESSAGE("=C1+C2", fValue == 11); //check merged cells import - if(nFormat != LOTUS123) + if(nFormat != LOTUS123 && nFormat != DIF) { SCCOL nCol = 4; SCROW nRow = 1; @@ -315,6 +318,16 @@ void ScFiltersTest::testContentLotus123() testContentImpl(pDoc, LOTUS123); xDocSh->DoClose(); } + +void ScFiltersTest::testContentDIF() +{ + ScDocShellRef xDocSh = loadDoc("universal-content.", DIF); + + ScDocument* pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(pDoc); + +} + void impl_testLegacyCellAnchoredRotatedShape( ScDocument* pDoc, Rectangle& aRect, ScDrawObjData& aAnchor, long TOLERANCE = 30 /* 30 hmm */ ) { ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index 4a18265..a0168c4 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -33,6 +33,7 @@ #define LOTUS123_FORMAT_TYPE 268435649 #define CSV_FORMAT_TYPE (SFX_FILTER_IMPORT | SFX_FILTER_EXPORT | SFX_FILTER_ALIEN | SFX_FILTER_USESOPTIONS) #define HTML_FORMAT_TYPE (SFX_FILTER_IMPORT | SFX_FILTER_EXPORT | SFX_FILTER_ALIEN | SFX_FILTER_USESOPTIONS) +#define DIF_FORMAT_TYPE 195 #define ODS 0 #define XLS 1 @@ -40,6 +41,7 @@ #define CSV 3 #define HTML 4 #define LOTUS123 5 +#define DIF 6 bool testEqualsWithTolerance( long nVal1, long nVal2, long nTol ) { @@ -78,6 +80,7 @@ FileFormat aFileFormats[] = { { "csv" , "Text - txt - csv (StarCalc)", "generic_Text", CSV_FORMAT_TYPE }, { "html" , "calc_HTML_WebQuery", "generic_HTML", HTML_FORMAT_TYPE }, { "123" , "Lotus", "calc_Lotus", LOTUS123_FORMAT_TYPE }, + { "dif", "DIF", "calc_DIF", DIF_FORMAT_TYPE }, }; // Why is this here and not in osl, and using the already existing file _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
