summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-05-27 20:36:13 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-05-27 20:39:54 +0200
commit72e0e01c4b2adf9583c83cc6c7e2f4850a8b4704 (patch)
treecdff2784548562223de0cf0b2f6337e8ed504989 /sc
parent6b562710cb8051e921726899246b421b197d49f0 (diff)
add initial test case for DIF import
Change-Id: I52634a8d31f580ac5565d615c872a575c6dc81c0
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/data/dif/universal-content.dif86
-rw-r--r--sc/qa/unit/filters-test.cxx15
-rw-r--r--sc/qa/unit/helper/qahelper.hxx3
3 files changed, 103 insertions, 1 deletions
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 000000000000..981c6e903668
--- /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 8f245c2ccbc2..a0244374302d 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 4a182655dbcb..a0168c4245d1 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