[Libreoffice-commits] .: sc/qa

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Sep 17 21:54:41 PDT 2012


 sc/qa/unit/ucalc.cxx |   27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

New commits:
commit c673a1f1212060dd5c5b9017354ad54321bb9549
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue Sep 18 00:54:33 2012 -0400

    Test for setting current page back to '- all -' in pivot table.
    
    Change-Id: I2fc0ac9609855273e47c492c72066dede9ff6850

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 5a2043a..1bcd5a8 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1938,11 +1938,11 @@ void Test::testPivotTableFilters()
 
     // Set current page of 'Group2' to 'A'.
     ScDPSaveData aSaveData(*pDPObj->GetSaveData());
-    ScDPSaveDimension* pDim = aSaveData.GetDimensionByName(
+    ScDPSaveDimension* pPageDim = aSaveData.GetDimensionByName(
         OUString("Group2"));
-    CPPUNIT_ASSERT_MESSAGE("Dimension not found", pDim);
+    CPPUNIT_ASSERT_MESSAGE("Dimension not found", pPageDim);
     OUString aPage("A");
-    pDim->SetCurrentPage(&aPage);
+    pPageDim->SetCurrentPage(&aPage);
     pDPObj->SetSaveData(aSaveData);
     aOutRange = refresh(pDPObj);
     {
@@ -1992,6 +1992,27 @@ void Test::testPivotTableFilters()
     fTest = m_pDoc->GetValue(aFormulaAddr);
     CPPUNIT_ASSERT_MESSAGE("Incorrect formula value that references a cell in the pivot table output.", fTest == 20.0);
 
+    // Set the current page of 'Group2' back to '- all -'. The query filter
+    // should still be in effect.
+    pPageDim->SetCurrentPage(NULL); // Remove the page.
+    pDPObj->SetSaveData(aSaveData);
+    aOutRange = refresh(pDPObj);
+    {
+        // Expected output table content.  0 = empty cell
+        const char* aOutputCheck[][2] = {
+            { "Filter", 0 },
+            { "Group2", "- all -" },
+            { 0, 0 },
+            { "Data", 0 },
+            { "Sum - Val1", "4" },
+            { "Sum - Val2", "40" }
+        };
+
+        bSuccess = checkDPTableOutput<2>(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output (filtered by page)");
+        CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
+    }
+
+
     pDPs->FreeTable(pDPObj);
     CPPUNIT_ASSERT_MESSAGE("There shouldn't be any data pilot table stored with the document.",
                            pDPs->GetCount() == 0);


More information about the Libreoffice-commits mailing list