summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2016-10-05 05:12:41 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2016-10-05 06:03:40 +0200
commitf1a97fab957629d617b0b0ad44de5beb3d343f5c (patch)
tree8fd4b83ad2380838f4fa73fe73e44af51fd3c0f3
parent47258c2c3d095ff1b9314d7a817baa567cf4907e (diff)
Test XLSX import of date groups
Change-Id: I25cd7e946231a718ca1c0ed64fb5e32b2a81abe8
-rw-r--r--sc/qa/unit/data/xlsx/pivot-table/shared-dategroup.xlsxbin0 -> 17540 bytes
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx39
2 files changed, 39 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xlsx/pivot-table/shared-dategroup.xlsx b/sc/qa/unit/data/xlsx/pivot-table/shared-dategroup.xlsx
new file mode 100644
index 000000000000..60cbd66d8dcd
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/pivot-table/shared-dategroup.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index f06e66e38489..8c90ce2bf029 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -201,6 +201,7 @@ public:
void testPivotTableSharedCacheGroupODS();
void testGetPivotDataXLS();
void testPivotTableSharedGroupXLSX();
+ void testPivotTableSharedDateGroupXLSX();
void testFormulaDependency();
@@ -308,6 +309,7 @@ public:
CPPUNIT_TEST(testPivotTableSharedCacheGroupODS);
CPPUNIT_TEST(testGetPivotDataXLS);
CPPUNIT_TEST(testPivotTableSharedGroupXLSX);
+ CPPUNIT_TEST(testPivotTableSharedDateGroupXLSX);
CPPUNIT_TEST(testRowHeightODS);
CPPUNIT_TEST(testFormulaDependency);
CPPUNIT_TEST(testRichTextContentODS);
@@ -2107,6 +2109,43 @@ void ScFiltersTest::testPivotTableSharedGroupXLSX()
xDocSh->DoClose();
}
+void ScFiltersTest::testPivotTableSharedDateGroupXLSX()
+{
+ ScDocShellRef xDocSh = loadDoc("pivot-table/shared-dategroup.", FORMAT_XLSX);
+ CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is());
+ ScDocument& rDoc = xDocSh->GetDocument();
+
+ // Check whether right date labels are imported for both tables
+ // First table
+ CPPUNIT_ASSERT_EQUAL(OUString("1965"), rDoc.GetString(ScAddress(0,4,1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("1989"), rDoc.GetString(ScAddress(0,5,1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("2000"), rDoc.GetString(ScAddress(0,6,1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("2004"), rDoc.GetString(ScAddress(0,7,1)));
+ // TODO: check why this fails with 2005
+ // CPPUNIT_ASSERT_EQUAL(OUString("2007"), rDoc.GetString(ScAddress(0,8,1)));
+
+ // Second table
+ CPPUNIT_ASSERT_EQUAL(OUString("1965"), rDoc.GetString(ScAddress(5,4,1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("1989"), rDoc.GetString(ScAddress(5,5,1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("2000"), rDoc.GetString(ScAddress(5,6,1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("2004"), rDoc.GetString(ScAddress(5,7,1)));
+ // TODO: check why this fails with 2005
+ // CPPUNIT_ASSERT_EQUAL(OUString("2007"), rDoc.GetString(ScAddress(5,8,1)));
+
+ // There should be exactly 2 pivot tables and 1 cache.
+ ScDPCollection* pDPs = rDoc.GetDPCollection();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), pDPs->GetCount());
+
+ ScDPCollection::SheetCaches& rSheetCaches = pDPs->GetSheetCaches();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rSheetCaches.size());
+
+ const ScDPCache* pCache = rSheetCaches.getExistingCache(ScRange(0,0,0,9,24,0));
+ CPPUNIT_ASSERT_MESSAGE("Pivot cache is expected for A1:J25 on the first sheet.", pCache);
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(10), pCache->GetFieldCount());
+
+ xDocSh->DoClose();
+}
+
void ScFiltersTest::testRowHeightODS()
{
ScDocShellRef xDocSh = loadDoc("row-height-import.", FORMAT_ODS);