diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2016-10-05 05:14:42 +0200 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2016-10-05 06:03:40 +0200 |
commit | 93098854c2d2b814a21161bd88071918cb382e87 (patch) | |
tree | b5bf721025efc9d976ce5436f12a894e9fffd3d6 | |
parent | f1a97fab957629d617b0b0ad44de5beb3d343f5c (diff) |
Test XLSX import of number groups
Change-Id: I12a8f301607240684676c5b50bdad0eea0923f97
-rw-r--r-- | sc/qa/unit/data/xlsx/pivot-table/shared-numgroup.xlsx | bin | 0 -> 17830 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 37 |
2 files changed, 37 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xlsx/pivot-table/shared-numgroup.xlsx b/sc/qa/unit/data/xlsx/pivot-table/shared-numgroup.xlsx Binary files differnew file mode 100644 index 000000000000..36f36efb4567 --- /dev/null +++ b/sc/qa/unit/data/xlsx/pivot-table/shared-numgroup.xlsx diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 8c90ce2bf029..63bafd2921f4 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -202,6 +202,7 @@ public: void testGetPivotDataXLS(); void testPivotTableSharedGroupXLSX(); void testPivotTableSharedDateGroupXLSX(); + void testPivotTableSharedNumGroupXLSX(); void testFormulaDependency(); @@ -310,6 +311,7 @@ public: CPPUNIT_TEST(testGetPivotDataXLS); CPPUNIT_TEST(testPivotTableSharedGroupXLSX); CPPUNIT_TEST(testPivotTableSharedDateGroupXLSX); + CPPUNIT_TEST(testPivotTableSharedNumGroupXLSX); CPPUNIT_TEST(testRowHeightODS); CPPUNIT_TEST(testFormulaDependency); CPPUNIT_TEST(testRichTextContentODS); @@ -2146,6 +2148,41 @@ void ScFiltersTest::testPivotTableSharedDateGroupXLSX() xDocSh->DoClose(); } +void ScFiltersTest::testPivotTableSharedNumGroupXLSX() +{ + ScDocShellRef xDocSh = loadDoc("pivot-table/shared-numgroup.", FORMAT_XLSX); + CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is()); + ScDocument& rDoc = xDocSh->GetDocument(); + + // Check whether right number groups are imported for both tables + // First table + CPPUNIT_ASSERT_EQUAL(OUString("32674-47673"), rDoc.GetString(ScAddress(0,4,1))); + CPPUNIT_ASSERT_EQUAL(OUString("47674-62673"), rDoc.GetString(ScAddress(0,5,1))); + CPPUNIT_ASSERT_EQUAL(OUString("62674-77673"), rDoc.GetString(ScAddress(0,6,1))); + CPPUNIT_ASSERT_EQUAL(OUString("77674-92673"), rDoc.GetString(ScAddress(0,7,1))); + CPPUNIT_ASSERT_EQUAL(OUString("92674-107673"), rDoc.GetString(ScAddress(0,8,1))); + + // Second table + CPPUNIT_ASSERT_EQUAL(OUString("32674-47673"), rDoc.GetString(ScAddress(5,4,1))); + CPPUNIT_ASSERT_EQUAL(OUString("47674-62673"), rDoc.GetString(ScAddress(5,5,1))); + CPPUNIT_ASSERT_EQUAL(OUString("62674-77673"), rDoc.GetString(ScAddress(5,6,1))); + CPPUNIT_ASSERT_EQUAL(OUString("77674-92673"), rDoc.GetString(ScAddress(5,7,1))); + CPPUNIT_ASSERT_EQUAL(OUString("92674-107673"), 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); |