[Libreoffice-commits] core.git: 3 commits - sc/qa sc/source
Tamás Zolnai
tamas.zolnai at collabora.com
Tue Oct 4 20:01:51 UTC 2016
sc/qa/unit/data/xlsx/pivot-table/shared-dategroup.xlsx |binary
sc/qa/unit/data/xlsx/pivot-table/shared-numgroup.xlsx |binary
sc/qa/unit/subsequent_filters-test.cxx | 78 ++++++++++++++++-
sc/source/core/data/dpobject.cxx | 3
4 files changed, 79 insertions(+), 2 deletions(-)
New commits:
commit 7e1fd9aa86ab8d5e86f35df8615f438a3383af98
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date: Thu Sep 29 05:24:22 2016 +0200
Pivot tables: Fix wrong group field number in cache
getCache should not append new group fields to the cache,
but use those which are stored in the dimension data.
Change-Id: I2011b0d3a22644a86c31500d74469b9c4c641649
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 63bafd2..0b17d4c 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -2104,9 +2104,7 @@ void ScFiltersTest::testPivotTableSharedGroupXLSX()
const ScDPCache* pCache = rSheetCaches.getExistingCache(ScRange(0,0,1,13,18,1));
CPPUNIT_ASSERT_MESSAGE("Pivot cache is expected for A1:N19 on the second sheet.", pCache);
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(14), pCache->GetFieldCount());
-
- // TODO : Look into this and find out why it fails.
- // CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pCache->GetGroupFieldCount());
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pCache->GetGroupFieldCount());
xDocSh->DoClose();
}
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 8e6411b..d9b07a4 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -2952,7 +2952,10 @@ const ScDPCache* ScDPCollection::SheetCaches::getCache(const ScRange& rRange, co
}
if (pDimData)
+ {
+ (itCache->second)->ClearGroupFields();
pDimData->WriteToCache(*itCache->second);
+ }
return itCache->second.get();
}
commit 93098854c2d2b814a21161bd88071918cb382e87
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date: Wed Oct 5 05:14:42 2016 +0200
Test XLSX import of number groups
Change-Id: I12a8f301607240684676c5b50bdad0eea0923f97
diff --git a/sc/qa/unit/data/xlsx/pivot-table/shared-numgroup.xlsx b/sc/qa/unit/data/xlsx/pivot-table/shared-numgroup.xlsx
new file mode 100644
index 0000000..36f36ef
Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivot-table/shared-numgroup.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 8c90ce2..63bafd2 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);
commit f1a97fab957629d617b0b0ad44de5beb3d343f5c
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date: Wed Oct 5 05:12:41 2016 +0200
Test XLSX import of date groups
Change-Id: I25cd7e946231a718ca1c0ed64fb5e32b2a81abe8
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 0000000..60cbd66
Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivot-table/shared-dategroup.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index f06e66e..8c90ce2 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);
More information about the Libreoffice-commits
mailing list