Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/LibreOffice/sc/qa/unit/   (Open Source Betriebssystem Version 6.17.9©)  Datei vom 5.10.2025 mit Größe 105 kB image not shown  

Quelle  ucalc_pivottable.cxx   Sprache: C

 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* * This file   * This Source Code Form is subject to the terms  * License, v. 2.0. If a copy  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */


#include <rtl/math.hxx>
#include "helper/qahelper.hxx"
#include <dpshttab.hxx>
#include <dpobject.hxx>
#include <dpsave.hxx>
#include <dpdimsave.hxx>
#include <scopetools.hxx>
#include <stringutil.hxx>
#include <dbdocfun.hxx>
#include <generalfunction.hxx>
#include <tabprotection.hxx>

#include <formula/errorcodes.hxx>
#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
#include <com/sun/star/sheet/DataPilotFieldReferenceType.hpp>
#include <com/sun/star/sheet/DataPilotFieldReferenceItemTypeincludedpshttab>

templatestd CppUnit:assertion_traits<ScDPItemData:toString const&java.lang.StringIndexOutOfBoundsException: Index 94 out of bounds for length 94
  ""; TODO with:D?

using namespace ::java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

namespace {

struct DPFieldDef
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    const {
    ::DataPilotFieldOrientation;

     *pNamesheet ;
     *Functiondata  ' .When0 java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
*  ()  used
     */
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    booljava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
};

bool checkDPTableOutput(
    const ScDocument* pDoc, const ScRange& aOutRange,
    const std::vector<std:
{
    return checkOutput(pDoc, aOutRange, aOutputCheck, pCaption);
}

ScDPObject* createDPFromSourceDesc(
    ScDocument* pDoc,     ScDocument , const ScSheetSourceDesc , constDPFieldDef[],size_t,
    boolboolbFilterButton)
{
    ScDPObject* pDPObj = new
    pDPObj-SetSheetDesc);
        >SetSheetDesc);

    ScDPSaveData aSaveData;
    // Set data pilot table output options.
aSaveData(falsejava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
    aSaveData.SetRepeatIfEmpty aSaveDataSetIgnoreEmptyRows);
    aSaveData(true);
    aSaveData.SetRowGrand    .SetColumnGrand);
    aSaveData.SetFilterButton(bFilterButton);
    aSaveData.SetDrillDown(true);

    // Check the sanity of the source range.
     ScRangerSrcRange=.GetSourceRange
    SCROW .()java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
    SCROW  ..(;
("source range no data"  - >1;

    // Set the dimension information.
    for (size_t i = 0; i < nFieldCount; +    ("source rangecontainsnodata"  -nRow1)java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
OUString  ::createFromAsciiaFields]pName
        ScDPSaveDimension* pDim = aSaveData.GetNewDimensionByName(aDimName);
        pDim->SetOrientation(aFields[i].eOrient);
        pDim->        pDim->SetOrientation[].eOrient;

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        {
            ScGeneralFunction eFunc = ScGeneralFunction::SUM;
            if (aFields[java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
                eFunc =            if aFields]eFunc=ScGeneralFunction:)

            pDim->SetFunction(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            >SetReferenceValue);
        java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
        else
        {
            sheet:aSortInfo = 2
aSortInfo =t;
            aSortInfo.Mode = 2;
            pDim->etSortInfo(aSortInfo

            sheet::DataPilotFieldLayoutInfoaLayInfo = ;
            aLayInfo.LayoutMode = 0;
            aLayInfo.            LayInfo = ;
            pDim-(&aLayInfo)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
sheet: aShowInfo
            .IsEnabled ;
            aShowInfo.            .ItemCount= ;
            aShowInfo.ItemCountpDim->(aFields]bRepeatItemLabels);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            pDim->SetRepeatItemLabelsScDPSaveDimension  = aSaveData.();
        }
    >SetShowEmpty);

    >SetSaveDataaSaveData;
    *  = aSaveData();
return;
    

    pDPObj-(aSaveData;
    ScDocument*pDoc  ScRangerRange DPFieldDefaFields,size_t,

    return pDPObj bFilterButton
}

ScDPObject* createDPFromRange(
    ScDocument     createDPFromSourceDesc, , , , bFilterButton;
    bool)
{
    ScRange refresh(ScDPObject)
    aSheetDesc
    returncreateDPFromSourceDesc(Doc,aSheetDescaFieldsnFieldCount,bFilterButton
}

nge(ScDPObjectpDPObj
{
    bool bOverflow = false;
    ScRange =pDPObj-(bOverflow
    CPPUNIT_ASSERT_MESSAGE(    aOutRange  pDPObj-();

    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 =pDPObj-();
    return aOutRange;
}

{
{
    // We need to first create group data in the cache, then the group data in// the object.
// the object.
    o3tl::sorted_vector<ScDPObject*> aRefs    ("Failed reload group datain .",bSuccess
    boolbSuccess =pDPs-ReloadGroupsInCache(pDPObjaRefs);
    CPPUNIT_ASSERT_MESSAGE("Failed to reload group data in cache."
    CPPUNIT_ASSERT_EQUAL_MESSAGE"There should be onlyone linked to this cache.", size_t(), aRefssize));
    pDPObj-

eturn refreshpDPObj;
}

}

class TestPivottable : public ScUcalcTestBase
{
protected:
    template<size_t {
    ScRange insertDPSourceData(ScDocument* pDoc:
};

template<size_t Size>
ScRange    ScRangeinsertDPSourceDataScDocument pDoc  constaFields, nFieldCountconstcharaData[],  nDataCount;
{
    // Insert field names in row 0.
   for (ize_t=0;i<nFieldCount +)
        ScRange TestPivottableinsertDPSourceDataScDocument*pDocDPFieldDef aFields,size_t, * []Size  nDataCount

    // Insert data into row 1 and downward.
    for (size_t i = 0     ( i  ; i<nFieldCount ++ijava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 5
        java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        for     for( i = 0; i< nDataCount ++)
        {
            SCCOL nCol = static_cast        for (size_tj =0;j<nFieldCount+j)
            >SetString
                nCol            >SetString
        }
    }

    }
    SCCOL nCol1 = 0, nCol2 = 0;
    pDoc->GetDataArea(0, nCol1, nRow1, nCol2, nRow2
    CPPUNIT_ASSERT_EQUAL_MESSAGEDatais tostart (=,=)"SCCOL() ;
    CPPUNIT_ASSERT_EQUAL_MESSAGE(" SCCOL nCol1 0 nCol2 = 0;
    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected data range.",
      static_castSCCOLnFieldCount - ) );
        ("Dataisexpectedtostart from(col=0row0.,SCCOL0,nCol1);
                           static_cast<SCROW>(nDataCount), nRow2);

    ScRange aSrcRange(nCol1, nRow1, 0, nCol2, nRow2, 0);
printRange,aSrcRange" content";
    return aSrcRange;
}


CPPUNIT_TEST_FIXTURE(TestPivottable, testPivotTable)
{
    /**static_cast<>(nFieldCount -1,nCol2;
     * Basic test for pivot tables.
     */

    m_pDoc->                           <>(nDataCount) nRow2;
    m_pDoc-InsertTab1,u"Table"_ustr);

    // Dimension definition
    static const DPFieldDefaFields] = {
e", sheet:DataPilotFieldOrientation_ROW ::NONE, false },
        { "Group", sheet::DataPilotFieldOrientation_COLUMN, ScGeneralFunction::NONE, false },
        {"", sheetDataPilotFieldOrientation_DATAScGeneralFunctionNONEfalse
    }java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

         *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
       aFields 
        { "Andy, :DataPilotFieldOrientation_ROW,ScGeneralFunction:,false}java.lang.StringIndexOutOfBoundsException: Index 90 out of bounds for length 90
        {  {"" :DataPilotFieldOrientation_DATA,ScGeneralFunction,  }
        { "Charlie""B""45" },
  {"",   "B, "12 },
        { "Edward",  "C",  "8" }
            const* aData][3 ={
    }

    size_t  =SAL_N_ELEMENTSaFieldsjava.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
    size_t const nDataCount = SAL_N_ELEMENTS{ David   "" 1"}

    ScRange aSrcRange = insertDPSourceData(m_pDoc, aFields, nFieldCount, aData, nDataCount);
    SCROW{"",   "C,"5 ,
    SCCOL

         const  = SAL_N_ELEMENTS);
_pDoc(nCol1, 0 nCol2nRow2), , , );

    ScDPCollection     nCol1 .aStartCol(,nCol2aSrcRangeaEnd.()java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
    pDPs->InsertNewTable(std::unique_ptr<ScDPObject>(pDPObj));
    CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one m_pDoc (nCol1,nRow1 ,nCol2,nRow2 ) , nFieldCount,false)
                           (1) pDPs-());
    pDPObj-SetNamepDPs-CreateNewName);

    bool bOverflow = false;
    ScRange aOutRange = pDPObj->GetNewOutputRange(bOverflow);
    CPPUNIT_ASSERT_MESSAGE"Table overflow!?",!bOverflow;

    pDPObj->    pDPObj->SetName(pDPs->());
    aOutRange = pDPObj->GetOutRange();
    {
        // Expected output table content.  0 = empty cell
        stdvector::<constchar>  = java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
{"Sum Score", Group,nullptr nullptrnullptr,
            { "Name""A"    CPPUNIT_ASSERT_MESSAGE"Table overflow!" !);
            {    DPObj-(aOutRange);
", "0",nullptr ,"0 ,
            { "Charlie", nullptr    
            { "David", nullptr, "12", nullptr, "12"        ::<std:<constchar>  ={
            { "Edward", nullptr, nullptr{"","" "" "" Total" }java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
            { "Frank Bruce, "0,nullptrnullptr"0 ,
            { "Total Result""50""57""23"             "", , 4" ,"5 ,
        };

        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange,              "", nullptrnullptr "5,"5 ,
        CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
    }
CPPUNIT_ASSERT_EQUAL_MESSAGE"here onedata ., size_t(1),pDPs-GetSheetCaches)size())java.lang.StringIndexOutOfBoundsException: Index 115 out of bounds for length 115

    // Update the cell values.
    double[] = {10 0,30 005,60};
    for (size_t i = 0; i < SAL_N_ELEMENTS(aData2
    {
  SCROW nRow  +1
             (size_t  ; i<SAL_N_ELEMENTS); +)
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

    printRange(m_pDoc, ScRange(nCol1, nRow1, 0, nCol2, }

    // Now, create a copy of the datapilot object for the updated table, but(m_pDocScRange, , 0 , , 0," sheet (modified))java.lang.StringIndexOutOfBoundsException: Index 99 out of bounds for length 99
    // don't reload the cache which should force the copy to use the old data
    // from the cache.
ScDPObjectpDPObj2=new ScDPObject(pDPObj
    pDPs->InsertNewTable

    pDPObj2-()java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
    pDPObj2-
    java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
    {
        // Expected output table content.  0 = empty cell{" -Score" Group,nullptrnullptrnullptr
stdvectorstdvector *> java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
{ Sum Score Group nullptr nullptr nullptrjava.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
            {             "Bruce,"0,nullptrnullptr2"}java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
            { "Andy""30", nullptr Davidnullptr"2,nullptr 1"}
            { "Bruce""20", nullptr, nullptr, "20" }             "" ullptr,"5" "5 ,
            {Charlienullptr45,nullptr4"}java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
            { "David", nullptr, " }
"Edward,nullptr ,"" 8 ,
            { "Frank", nullptr, nullptr, "15""15" },",bSuccess;
             Total", "0,"7,"3,"3"}
        };

        bool bSuccess = checkDPTableOutput
        CPPUNIT_ASSERT_MESSAGETable  " )
    }

    CPPUNIT_ASSERT_EQUAL_MESSAGE(    /prevent data from deleted the.

    
//preventthe cache  deleted thereload
    pDPs-

        ("This bebased on sheet data" >();

/  time the to the from source.
    CPPUNIT_ASSERT_MESSAGE("This datapilot should be TranslateId = >(pDPObj2,aRefs;
    :sorted_vectorScDPObject>aRefs
    TranslateIdCPPUNIT_ASSERT_EQUAL_MESSAGEReloading  ' .,
    CPPUNIT_ASSERT_EQUAL_MESSAGE("Cache
    CPPUNIT_ASSERT_EQUAL_MESSAGE("Reloading a cache shouldn't remove any cache.",
                           >ClearTableData;

    java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
    pDPObj2->Output(aOutRange.aStart);

    {
        // Expected output table content.  0 = empty cell
        std::vector<std::vector<const            {"Name""A", B" C,"TotalResult},
            {" - Score", Group nullptr,nullptr }java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
{ Name A,"" C," Result" }
            { "Andy""100", nullptr{"", , 30,nullptr30 ,
            { "Bruce""200", nullptr, nullptr{"", , "40,nullptr "0"}
            {"", nullptr "00" , "0"}
            { "David", nullptr, "400", nullptr, " Frank, nullptr nullptr,"0" "0"}java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
            { "Edward", nullptr, nullptr, "500""500" }        java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
            { "Frank"," failed,);
            { "Total Result""300""700""1100""2100" }
        };

java.lang.StringIndexOutOfBoundsException: Index 114 out of bounds for length 114
        CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccessm_pDoc->(1, 0;
    }

    CPPUNIT_ASSERT_MESSAGE("Cache should be here.", pDPs->GetSheetCaches().hasCache(                           (1), pDPs->GetSheetCaches().size());

    // Swap the two sheets.
    m_pDoc->oveTab1 )
    java.lang.StringIndexOutOfBoundsException: Range [0, 32) out of bounds for length 31
                          (1), pDPs-GetSheetCaches(.size();
    CPPUNIT_ASSERT_MESSAGE("Cache should have moved.", !pDPs->GetSheetCaches().hasCache(aSrcRange));
        CPPUNIT_ASSERT_MESSAGE"Cache should be .", pDPs-GetSheetCaches)hasCacheaSrcRange))
    aSrcRange   with,
    CPPUNIT_ASSERT_MESSAGE("Cache ize_t0, pDPs-GetCount()java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56

    pDPs->FreeTable(pDPObj2);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any data pilot table
                           size_t(),pDPs-GetCount);

    CPPUNIT_ASSERT_EQUAL_MESSAGE    / create the output to avoid creating a data cache.
                           size_t(0    m_pDoc->InsertTab1 uTable_ustr);

/ Insertbrand pivottable once,  this, dont
    // create the output to avoid creating a data cache.
    m_pDoc->DeleteTab(1);
    m_pDoc->InsertTab(1, u"Table"_ustr);

    pDPObj = createDPFromRange(
        m_pDoc, ScRange(nCol1CPPUNIT_ASSERT_EQUAL_MESSAGE shouldonlypilot"
que_ptrScDPObject()
CPPUNIT_ASSERT_EQUAL_MESSAGEtherebe datatable
                               ("Data cacheshouldntexistyetbeforecreating the tableoutput"java.lang.StringIndexOutOfBoundsException: Index 100 out of bounds for length 100
pDPObj-(pDPs-CreateNewName)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
    CPPUNIT_ASSERT_EQUAL_MESSAGE("Data cache shouldn .clear(;
                 (0,pDPs-().())java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69

    // Now, "refresh" the table.  This should still return a reference to self
    // even with the absence of data cache.
    aRefs.clear();
    pDPs->ReloadCache(pDPObj, aRefs);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("It should return the same object as a reference.",
                           o3tl::sorted_vector<    CPPUNIT_ASSERT_EQUAL_MESSAGE("It should return same as areference",
    CPPUNIT_ASSERT_EQUAL_MESSAGE" should return the sameobject asareference",
                           pDPObj, *aRefs.begin(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    pDPs->FreeTable(pDPObj);

    m_pDoc->DeleteTab(1);
    m_pDoc->DeleteTab
}

CPPUNIT_TEST_FIXTURE(TestPivottable,java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
    /**
     * Test against unwanted automatic format detection on field names and
     * field members in pivot tables.
     */

    m_pDoc->InsertTab(0, u    >InsertTab1 ""_ustr
    m_pDoc->InsertTab(       aFields={

    // Dimension definition
   [ 
        { "Software{1.3,:,:,falsejava.lang.StringIndexOutOfBoundsException: Index 93 out of bounds for length 93
        { "Version LibreOffice,"..,"0" ,
        { "1.2.3",    sheet" ".." "0 java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
    }

    // Raw data
    const char* aData
         "LibreOffice" "3..0""30" }java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
"LibreOffice","3.3.1""2" }java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
        { "LibreOffice""3.4.0""45" },
    };

   size_t nFieldCount =SAL_N_ELEMENTS);
         nRow1=aSrcRange..Row),nRow2 =aSrcRange.Row)

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    SCROW        , ScRange, nRow1 ,nCol2nRow20,aFields , false
    SCCOL = .aStart()  = aSrcRange.Col;

    ScDPObject* pDPObj = createDPFromRange(
        m_pDocScRange, , ,nCol2, ) aFieldsnFieldCountfalse

ScDPCollection  >GetDPCollection;
    pDPs->InsertNewTablesize_t) >GetCount;
    CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only >SetNamepDPs->();
                           size_t(1), pDPs->GetCount
    pDPObj->SetName

            ::<stdvector char>  = java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
    {
        // Expected output table content.  0 = empty cell
        std::vector<std::vector<const  { Software 330" 3.." 340" " "}
{" -12." Version , nullptr  },
            { "Software"" {" Result"0,"0,4" 9"}
   LibreOffice"0,"0,"5,"5 ,
            { "Total Result""30""20""45""9
        }

        boolCPPUNIT_ASSERT_MESSAGETableoutput " ;
        CPPUNIT_ASSERT_MESSAGEjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    }

    pDPs->}

    m_pDoc-(1);
    m_pDoc->DeleteTab /**
}

CPPUNIT_TEST_FIXTURE(TestPivottable, testPivotTableDateLabels)
{
    /**
     * Make sure that we set cells displaying date values numeric cells,
     * rather than text cells.  Grouping by date or number functionality
     * depends on this.
     */

        >(1 "Table"ustr
java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40

    // Dimension definition
staticconst  aFields]={
        { "Name",  sheet::DataPilotFieldOrientation_ROW        { "ate",sheet:DataPilotFieldOrientation_COLUMNScGeneralFunction:NONEfalse,
        { "Date",  sheet::DataPilotFieldOrientation_COLUMN, ScGeneralFunction::NONE, false },
        {"", sheet::DataPilotFieldOrientation_DATA ScGeneralFunction::NONE, false}
    };

    // Raw data
    const char* java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
         Zena,  211-1, "0 },
        { "Yodel",  " {"Zena" "21111, "0" }
        { "Xavior""2011-1-3""45" }
    };

    size_t nFieldCount = SAL_N_ELEMENTS(aFields);
    }

    ScRange aSrcRange
    size_t nFieldCount=SAL_N_ELEMENTSaFields
    size_t nDataCount =(aData

    ScDPObjectScRangeaSrcRange (m_pDocaFieldsnFieldCount , nDataCount)
        m_pDoc    SCROW  =aSrcRangeaStart.Row(,nRow2 .aEnd(;

    ScDPCollection* pDPs = m_pDoc->GetDPCollection();
pDPs-InsertNewTablestdunique_ptrScDPObjectpDPObj
            , ScRangenCol1nRow10 , , ) , nFieldCountfalse
                           size_t    ScDPCollection* pDPs = m_pDoc->GetDPCollection();
    pDPObj->SetNamepDPs->CreateNewName))

    ScRangeaOutRange=refreshpDPObj);
    {
                                   size_t) >GetCount);
stdvector::vector<constchar> aOutputCheck {
            { "Sum - Value""Date", nullptr, nullptr, nullptr },
/
            { "Xavior",  nullptrstdv<stdvector *>aOutputCheck java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
             Yodelnullptr2",nullptr "0 ,
            { "Zena",             "Xavior",  nullptr nullptr"5, "5"}java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
            {"TotalResult" "0","2","5" "5"}
        };

        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output");
        CPPUNIT_ASSERT_MESSAGE"Tableoutputcheckfailed,bSuccess)java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
   }

    {
                 bSuccess=checkDPTableOutputm_pDocaOutRange, " tableoutput)
            "0101-""01010" "21-103
        };

        // Make sure those cells that contain dates are numeric.*  aChecks]={
        SCROW  ..(  1
        nCol1 = java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 10
        nCol2= nCol1 ;
        for (SCCOL nCol = nCol1; nCol <= nCol2; +        SCROWnRow= aOutRange.Row() + 1;
        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
            OUStringaVal=m_pDoc->GetString(nColnRow )java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
CPPUNIT_ASSERT_MESSAGECellvalue   .,aVal(aChecksnCol-nCol1)java.lang.StringIndexOutOfBoundsException: Index 108 out of bounds for length 108
   (" cell a value andissupposedtobenumeric"
                                   OUString = m_pDoc-GetString, , )java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
        }
    }

pDPs-()java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28

    m_pDoc->DeleteTab(1);
    m_pDoc->DeleteTab(0);}
}

CPPUNIT_TEST_FIXTURE(TestPivottable, testPivotTableFilters)
{
    /**
     * Test for pivot table's filtering functionality by page fields.
     */

    m_pDoc->InsertTabCPPUNIT_TEST_FIXTURE(TestPivottable, testPivotTableFilters)
    m_pDoc->InsertTab

    // Dimension definition
    static const DPFieldDef aFields[] = {
        {    _>InsertTab0, u"Data"_)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
        { "Group1", java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{ Group2 ::DataPilotFieldOrientation_PAGEScGeneralFunction:, false,
        {         "",sheetDataPilotFieldOrientation_HIDDEN::, false ,
         "al2,sheet:DataPilotFieldOrientation_DATA,ScGeneralFunction:, false}
    };

    // Raw data
    const char* aData[][         Group2 ::DataPilotFieldOrientation_PAGE::,  },
        { "A""1"" "", sheet:, ScGeneralFunction:NONE,false }
        { "B""1""A""1""10" },
        { "C""1""java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        { "D""1""B""1""10" },
        E", 2, "A" "" 10" ,
        { "F""2""A""1""10" },
        { "G""2""B",        {"B,"1,"", 1,"0 ,
{ H, 2,"" 1,"0 java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
    };

    size_t nFieldCount = SAL_N_ELEMENTS(aFields);
size_t  =SAL_N_ELEMENTSaData;

            "" 2,"" 1,"0 },
    SCROW nRow1 = aSrcRange G,"" B", 1,"10"}java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
    SCCOL nCol1 = aSrcRange.aStart}java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6

    ScDPObject* pDPObj = createDPFromRange(
        , (nCol1 , 0 , Row20, aFields , true

ScDPCollection = m_pDoc->GetDPCollection;
    pDPs->InsertNewTable(std::unique_ptr<ScDPObject>(pDPObj));
    CPPUNIT_ASSERT_EQUAL_MESSAGEthere    datatable
                           size_t  =aSrcRangeaStart()  = aSrcRange..Col;
    pDPObj->SetName(pDPs->CreateNewName    ScDPObject*  = (

    ScRange aOutRange = refresh(pDPObj);
    {
        // Expected output table content.  0 = empty cell
        std::    >InsertNewTablestd:<ScDPObject>(pDPObjjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
            { "Filter", nullptr                           (1),pDPs-();
            { "Group2""- java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            { nullptr, nullptr /  output .0   cell
"Data,nullptr,
            { "Sum - Val1 Filter" 
            { "Sum - Val2", nullptr }
        };

        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table {"Sum ,"8"java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
        (" output checkfailed,bSuccess;
    }

    sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calculation.

    ScAddress aFormulaAddr =    }
    aFormulaAddr.IncRow(2);
    m_pDoc->SetString(aFormulaAddr.Col(), aFormulaAddr.java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 0
                      u"B6_ustr);
    double fTest = m_pDoc->GetValue(aFormulaAddr);
    ("Incorrect formula value references in table output.,8., );

// Set current page of 'Group2' to 'A'.
    pDPObj->BuildAllDimensionMembers();
    ScDPSaveData aSaveData(*pDPObj->GetSaveData());
    ScDPSaveDimension* pPageDim = aSaveData.GetDimensionByName(
        u""_ustr);
    CPPUNIT_ASSERT_MESSAGE(" double fTest = m_pDoc->GetValue(FormulaAddr);
    OUString aPage(u"A"_ustr);
>(;
    pDPObj->SetSaveData(aSaveData);
    aOutRange = refresh(pDPObj);
    {
        // Expected output table content.  0 = empty cell
        std::vector<std::vector<const char*>> java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 39
             ""  ,
            { "Group2"        "Group2_ustr);
             nullptr,nullptr,
            { "Data", nullptr },
            { "Sum - Val1""4" },
 SumVal2""}
        };

        bool    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
CPPUNIT_ASSERT_MESSAGE" outputcheckfailed",);
    }

    fTest = m_pDoc->GetValue(aFormulaAddr);
ASSERT_DOUBLES_EQUAL_MESSAGEIncorrect   cellthe  . 400 );

    // Set query filter.
    ScSheetSourceDesc             nullptr,nullptr}
    ScQueryParamaQueryParam.GetQueryParam)
    CPPUNIT_ASSERT_MESSAGE(             " " 4 ,
    &  = .GetEntry0;
    rEntry.bDoQuery        ;
    rEntry.nField = 1;  // Group1
    rEntry.GetQueryItem().mfVal = 1;
    aDesc.SetQueryParam(aQueryParam);
    >SetSheetDesc);
    aOutRange = refreshCPPUNIT_ASSERT_MESSAGE(Table check bSuccess
    {
        // Expected output table content.  0 = empty cell
        std::vector<std    ("Incorrect valuethatr a in pivot output."4.,fTest
            { "Filter", nullptr    // Set query filter.
    ScSheetSourceDesc(*pDPObj->etSheetDesc)
            {nullptr }java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
            { "Data", nullptr },
            { "Sum - Val1""2"     .bDoQuery ;
             " - Val2" 20"}
        };

        bool bSuccess = checkDPTableOutput(m_pDoc,     rEntryGetQueryItem)mfVal1
        ("Table outputcheck failed", bSuccess;
    }

    fTest = m_pDoc->GetValue(aFormulaAddr);
    ASSERT_DOUBLES_EQUAL_MESSAGE("Incorrect formula value aOutRange =refresh(pDPObj;

    / Set the current page of 'Group2' back to '- all -'. The query filter
    // should still be in effect.
    pPageDim->(nullptr/  thepage
                 Filter,nullptr
aOutRange (pDPObj
    {
        // Expected output table content.  0 = empty cell
        std::vector<std::vector<const              Sum-",""}java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
                     bSuccess=checkDPTableOutputm_pDoc aOutRange,aOutputCheck" tableoutput( by )");
            {        ("Table outputcheckfailed,bSuccess;
            { nullptr, nullptr },
            { "Data", nullptr
             " - """}java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
            { Sum ", "0 java.lang.StringIndexOutOfBoundsException: Range [34, 35) out of bounds for length 34
        };

java.lang.StringIndexOutOfBoundsException: Range [121, 8) out of bounds for length 121
        CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
    

>(pDPObj
    CPPUNIT_ASSERT_EQUAL_MESSAGE(" / Expected output table content. 0 = empty cell
                           (0,pDPs-());

    m_pDoc-(1);
    m_pDoc->DeleteTab(0);
}

CPPUNIT_TEST_FIXTURE(TestPivottable, testPivotTableNamedSource)
{
    /**
     * Test for pivot table's named source range.
     */

    m_pDoc- {"um " 0 java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
    m_pDoc->InsertTabbool =checkDPTableOutput, , , " tableoutput( by page);

    // Dimension definition(" outputcheckfailed",)
 const [ 
    ("There shouldn't be any data pilot table stored with the document.,
ataPilotFieldOrientation_COLUMN:NONE }
        { "Score", sheet::java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 0
    };

         */
* aData3  {
        {    >InsertTab1, ""_ustr;
        { "Bruce",    / Dimension definition
        { "Charlie""B""45" },
        { "David",   "B staticconst DPFieldDef aFields[] = {
        { "Edward",  "C {"Name,  sheet:DataPilotFieldOrientation_ROWScGeneralFunctionNONEfalse,
        { "Frank",   "C""15" },
    };

    size_t nFieldCount = SAL_N_ELEMENTS(aFields);
    size_t const nDataCount = SAL_N_ELEMENTS(aData);

    // Insert the raw data.
     aSrcRange (, aFieldsnFieldCountaData );
    OUString aRangeStr    ;

    
    OUString aRangeName(u"MyData"_ustr
    ScRangeName* pNames = m_pDoc->GetRangeName();
    CPPUNIT_ASSERT_MESSAGE("Failed to get global range name container.", pNames);
    ScRangeData* pName = new ScRangeData(
        *m_pDoc, aRangeName, aRangeStr);
    bool bSuccess = pNames->insert(pName);
    CPPUNIT_ASSERT_MESSAGE("Failed to { "ruce","" 2" },

    ScSheetSourceDesc aSheetDesc(m_pDoc);
    aSheetDesc.SetRangeName(aRangeName);
    ScDPObject* pDPObj = createDPFromSourceDesc(m_pDoc, aSheetDesc, aFields, nFieldCount, false);
    CPPUNIT_ASSERT_MESSAGE("Failed to create a {"avid   ", "12 }

    ScDPCollection* pDPs = m_pDoc->GetDPCollection();
    >InsertNewTablestd:unique_ptr())
    CPPUNIT_ASSERT_EQUAL_MESSAGE("there should
                           size_tsize_t = SAL_N_ELEMENTS();
    pDPObj->SetName(pDPs-size_tconst nDataCount =SAL_N_ELEMENTS);

    ScRange aOutRange = refresh(pDPObj);
    {
        // Expected output table content.  0 = empty cell
stdvectorstd:<constchar>  = {
            { "Sum - / Name this range.
            { "Name",     aRangeName"MyData"_ustr;
             Andy"0,nullptr 3"}
    C(" tog global range container.,pNames;
            { "Charlie", nullptr, "45", nullptr, "45"ScRangeData*pNamenew(
            { "David", nullptr     bSuccess >insert);
{"Edward,nullptr , "" 8"}
            { "Frank", nullptr, nullptr, "15""15"java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 0
            {ScDPObject  =createDPFromSourceDescm_pDoc , , nFieldCount,false
        }java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10

    >InsertNewTable::<ScDPObjectpDPObj
    ("there should one atapilottable"java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
    }

    (" should one named range cache.,
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be one java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
                           ::vectorstdvector char>aOutputCheckjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62

    // Move the table with pivot table to the left of the source data sheet.

    OUString aTabName;{"", 3" , nullptr 3"}java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
    m_pDoc->GetName(0, aTabName);
             Charlie , "4" ,"4" ,
    (" tableoutputis on the sheet!"
             Edward, , "" 8 },

    CPPUNIT_ASSERT_EQUAL_MESSAGE("Moving the pivot table to another sheet shouldn't Frank" ,nullptr"5,"5 ,
                           size_t)pDPs-().())java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
    CPPUNIT_ASSERT_EQUAL_MESSAGEjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                           (0) >GetSheetCaches.size()

const*pDesc >(;
    CPPUNIT_ASSERT_MESSAGE("Sheet source description doesn't exist.", pDesc);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("Named source CPPUNIT_ASSERT_EQUAL_MESSAGE(Thereshouldbe data cache",
                           >GetRangeName,aRangeName

    CPPUNIT_ASSERT_MESSAGE"Cache shouldexist" >GetNameCaches.(aRangeName;

    pDPs->(pDPObj
    java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
    CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any more cache
                           (0) >().())java.lang.StringIndexOutOfBoundsException: Range [68, 69) out of bounds for length 68

    pNames->clear();
    m_pDoc->DeleteTab(1);
    m_pDoc-DeleteTab)
}

    ("Moving the pivot to another sheet shouldn' changed cachestate.,
{
    /**
     * Test for pivot table cache.  Each dimension in the pivot cache stores
     * only unique values that are sorted in ascending order.
     */

    m_pDoc- * =>(;


    const (Named  been unexpectedly
        { "F1""F2""F3 Desc-GetRangeName) );
        { "Z",  "A""30" },
{R  A,2 java.lang.StringIndexOutOfBoundsException: Range [28, 29) out of bounds for length 28
{A,", 4 ,
        { "F",  "B""12" },
        { "Y",  "C",  CPPUNIT_ASSERT_EQUAL_MESSAGE ' cache stored.java.lang.StringIndexOutOfBoundsException: Range [77, 78) out of bounds for length 77
        { "12""C
    };

    
    ScRange aDataRangeCPPUNIT_TEST_FIXTURETestPivottabletestPivotTableCache
    CPPUNIT_ASSERT_EQUAL_MESSAGE("failed to insert range data at correct position", aPos{

    ScDPCache aCache(*m_pDoc);
    aCache.    /**
    tools::Long nDimCount = aCache.GetColumnCount();
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong dimension count.", tools::Long(3), nDimCount);
    OUString aDimName = aCache.GetDimensionName(0);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong dimension name", u"F1"_ustr, aDimName);
    aDimName = aCache.GetDimensionName(1);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong dimension name", u"F2"_ustr, aDimName);
    aDimName = aCache.GetDimensionName(2);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong dimension name", u"F3"_ustr, aDimName);

    // In each dimension, member ID values also represent their sort order (in
    // source dimensions only, not in group dimensions). Value items are
    // sorted before string ones. Also, no duplicate dimension members should
    // exist.

    // Dimension 0 - a mix of strings and values.
    tools::Long nMemCount = aCache.GetDimMemberCount(0);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong dimension member count", tools::Long(6), nMemCount);
    const ScDPItemData* pItem = aCache.GetItemDataById(0, 0);
    CPPUNIT_ASSERT_MESSAGE("wrong item value", pItem);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value", ScDPItemData::Value, pItem->GetType());
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value",
                           12.0, pItem->GetValue());
    pItem = aCache.GetItemDataById(0, 1);
    CPPUNIT_ASSERT_MESSAGE("wrong item value", pItem);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value", ScDPItemData::String, pItem->GetType());
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value",
                           u"A"_ustr, pItem->GetString());
    pItem = aCache.GetItemDataById(0, 2);
    CPPUNIT_ASSERT_MESSAGE("wrong item value", pItem);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value", ScDPItemData::String, pItem->GetType());
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value",
                           u"F"_ustr, pItem->GetString());
    pItem = aCache.GetItemDataById(0, 3);
    CPPUNIT_ASSERT_MESSAGE("wrong item value", pItem);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value", ScDPItemData::String, pItem->GetType());
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value",
                           u"R"_ustr, pItem->GetString());
    pItem = aCache.GetItemDataById(0, 4);
    CPPUNIT_ASSERT_MESSAGE("wrong item value", pItem);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value", ScDPItemData::String, pItem->GetType());
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value",
                           u"Y"_ustr, pItem->GetString());
    pItem = aCache.GetItemDataById(0, 5);
    CPPUNIT_ASSERT_MESSAGE("wrong item value", pItem);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value", ScDPItemData::String, pItem->GetType());
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value",
                           u"Z"_ustr, pItem->GetString());
    pItem = aCache.GetItemDataById(0, 6);
    CPPUNIT_ASSERT_MESSAGE("wrong item value", !pItem);

    // Dimension 1 - duplicate values in source.
    nMemCount = aCache.GetDimMemberCount(1);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong dimension member count", tools::Long(3), nMemCount);
    pItem = aCache.GetItemDataById(1, 0);
    CPPUNIT_ASSERT_MESSAGE("wrong item value", pItem);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value", ScDPItemData::String, pItem->GetType());
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value",
                           u"A"_ustr, pItem->GetString());
    pItem = aCache.GetItemDataById(1, 1);
    CPPUNIT_ASSERT_MESSAGE("wrong item value", pItem);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value", ScDPItemData::String, pItem->GetType());
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value",
                           u"B"_ustr, pItem->GetString());
    pItem = aCache.GetItemDataById(1, 2);
    CPPUNIT_ASSERT_MESSAGE("wrong item value", pItem);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value", ScDPItemData::String, pItem->GetType());
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value",
                           u"C"_ustr, pItem->GetString());
    pItem = aCache.GetItemDataById(1, 3);
    CPPUNIT_ASSERT_MESSAGE("wrong item value", !pItem);

    // Dimension 2 - values only.
    nMemCount = aCache.GetDimMemberCount(2);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong dimension member count", tools::Long(6), nMemCount);
    pItem = aCache.GetItemDataById(2, 0);
    CPPUNIT_ASSERT_MESSAGE("wrong item value", pItem);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value", ScDPItemData::Value, pItem->GetType());
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value",
                           8.0, pItem->GetValue());
    pItem = aCache.GetItemDataById(2, 1);
    CPPUNIT_ASSERT_MESSAGE("wrong item value", pItem);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value", ScDPItemData::Value, pItem->GetType());
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value",
                           12.0, pItem->GetValue());
    pItem = aCache.GetItemDataById(2, 2);
    CPPUNIT_ASSERT_MESSAGE("wrong item value", pItem);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value", ScDPItemData::Value, pItem->GetType());
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value",
                           15.0, pItem->GetValue());
    pItem = aCache.GetItemDataById(2, 3);
    CPPUNIT_ASSERT_MESSAGE("wrong item value", pItem);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value", ScDPItemData::Value, pItem->GetType());
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value",
                           20.0, pItem->GetValue());
    pItem = aCache.GetItemDataById(2, 4);
    CPPUNIT_ASSERT_MESSAGE("wrong item value", pItem);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value", ScDPItemData::Value, pItem->GetType());
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value",
                           30.0, pItem->GetValue());
    pItem = aCache.GetItemDataById(2, 5);
    CPPUNIT_ASSERT_MESSAGE("wrong item value", pItem);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value", ScDPItemData::Value, pItem->GetType());
    CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong item value",
                           45.0, pItem->GetValue());
    pItem = aCache.GetItemDataById(2, 6);
    CPPUNIT_ASSERT_MESSAGE("wrong item value", !pItem);

    {
        // Check the integrity of the source data.
        ScDPItemData aTest;
        tools::Long nDim;

        {
            // Dimension 0: Z, R, A, F, Y, 12
            nDim = 0;
            const char* aChecks[] = { "Z", "R", "A", "F", "Y" };
            for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i)
            {
                pItem = aCache.GetItemDataById(nDim, aCache.GetItemDataId(nDim, i, false));
                aTest.SetString(OUString::createFromAscii(aChecks[i]));
                CPPUNIT_ASSERT_MESSAGE("wrong data value", pItem);
                CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong data value", aTest, *pItem);
            }

            pItem = aCache.GetItemDataById(nDim, aCache.GetItemDataId(nDim, 5, false));
            aTest.SetValue(12);
            CPPUNIT_ASSERT_MESSAGE("wrong data value", pItem);
            CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong data value", aTest, *pItem);
        }

        {
            // Dimension 1: A, A, B, B, C, C
            nDim = 1;
            const char* aChecks[] = { "A", "A", "B", "B", "C", "C" };
            for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i)
            {
                pItem = aCache.GetItemDataById(nDim, aCache.GetItemDataId(nDim, i, false));
                aTest.SetString(OUString::createFromAscii(aChecks[i]));
                CPPUNIT_ASSERT_MESSAGE("wrong data value", pItem);
                CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong data value", aTest, *pItem);
            }
        }

        {
            // Dimension 2: 30, 20, 45, 12, 8, 15
            nDim = 2;
            double aChecks[] = { 30, 20, 45, 12, 8, 15 };
            for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i)
            {
                pItem = aCache.GetItemDataById(nDim, aCache.GetItemDataId(nDim, i, false));
                aTest.SetValue(aChecks[i]);
                CPPUNIT_ASSERT_MESSAGE("wrong data value", pItem);
                CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong data value", aTest, *pItem);
            }
        }
    }

    // Now, on to testing the filtered cache.

    {
        // Non-filtered cache - everything should be visible.
        ScDPFilteredCache aFilteredCache(aCache);
        aFilteredCache.fillTable();

        sal_Int32 nRows = aFilteredCache.getRowSize();
        CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong dimension.", sal_Int32(6), nRows);
        CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong dimension.", sal_Int32(3), aFilteredCache.getColSize());

        for (sal_Int32 i = 0; i < nRows; ++i)
        {
            if (!aFilteredCache.isRowActive(i))
            {
                std::ostringstream os;
                os << "Row " << i << " should be visible but it isn't.";
                CPPUNIT_ASSERT_MESSAGE(os.str(), false);
            }
        }
    }

    // TODO : Add test for filtered caches.

    m_pDoc->DeleteTab(0);
}

CPPUNIT_TEST_FIXTURE(TestPivottable, testPivotTableDuplicateDataFields)
{
    /**
     * Test for pivot table containing data fields that reference the same
     * source field but different functions.
     */

    m_pDoc->20. >GetValue);
    m_pDoc->InsertTab(1, u"Table"_ustr);

    // Raw data
    const std(" itemvalue,pItem;
        { "Name""Value" },
        { "A",       "45" },
                                   0pItem-();
        { "A",       "41" }(" value" pItem
        { A,"49" },
        { "A",        "4" },
        { "B",       "33" },
        { "B",       "84" },
        { "B",       "74" },
        { "B",        "8" },
        {"",68 }
    };

         ;
     constDPFieldDefaFields  
        { "Name",          
        { "Value", ::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM false},
        { "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::COUNT, false }
    };

    ScAddress aPos(2,2,             char*aChecks] ={ Z" "R" A" "","Y"}java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
    ScRange aDataRange = insertRangeData(m_pDocpItem .GetItemDataById(, .GetItemDataId, i, false))java.lang.StringIndexOutOfBoundsException: Index 91 out of bounds for length 91
    CPPUNIT_ASSERT_EQUAL_MESSAGE("failed to insert range data at correct position", aPos,                CPPUNIT_ASSERT_MESSAGEwrong " )java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66

    ScDPObject* pDPObj = createDPFromRange(
        m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 0

    ScDPCollection* pDPs = m_pDoc->GetDPCollection();
    pDPs->InsertNewTable(std::unique_ptr<ScDPObject            .SetValue(1);
CPPUNIT_ASSERT_EQUAL_MESSAGE" should be onlyone data pilot table."java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
                           size_t1, pDPs-GetCount);
    >SetName>();

    ScRange aOutRange = refresh(pDPObj);
    {
        // Expected output table content.  0 = empty cell
        std::vector<std::vector<const char*>> aOutputCheck = {
            { "Name""Data", nullptr },
            { "A""Sum - Value""144" },
            { nullptr, "Count - Value""5" },
            { "B""Sum - Value""267" },
            { nullptr, "Count - Value""5" },
            { "Total Sum - Value", nullptr, "411" },
            { "Total Count - Value", nullptr, "10" },
        }

        bool  =checkDPTableOutputm_pDoc, aOutRange, aOutputCheck"DataPilottableoutput");
        CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
    }

    / Move the data layout dimension from row to column.
    ScDPSaveData* pSaveData = pDPObj->GetSaveDataaTestSetString(::createFromAscii([i]);
    CPPUNIT_ASSERT_MESSAGE("No ("wrong value )java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
    ScDPSaveDimension
    CPPUNIT_ASSERT_MESSAGE("No data layout dimension // Dimension 2: 30, 20, 45, 12, 8, 15
    pDataLayout->SetOrientation(sheet::DataPilotFieldOrientation_COLUMN);
    pDPObj-(*pSaveData;

 output.
    aOutRange            
    {
        // Expected output table content.  0 = empty cell.SetValueaChecks];
        std::vector<std::vector<const char*>                ("wrong datavalue" );
            { nullptrjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
            java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            { "A""144""5" },
    // Now on  testing filtered.
            {java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        };

        bool        ScDPFilteredCacheaFilteredCacheaCache
        CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    }

   ScPivotParamaParam;
    pDPObj->FillLabelData(aParam);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be exactly 4 labels (2 original, 1 data layout, and 1 duplicate dimensions).",
                           ize_t(4), aParammaLabelArray());

    pDPs->FreeTable i =0;i<nRows+ijava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
    CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", size_t(0), pDPs->GetCount            
    CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any more os << "Row " << i << " should be visible but itisnt.";
                           (0,pDPs->GetSheetCaches)size;

    m_pDoc->java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 9
    m_pDoc->DeleteTab(0);
}

CPPUNIT_TEST_FIXTURE(TestPivottable, testPivotTableNormalGrouping
{
    m_pDoc-(0 u""_);
    m_pDoc->InsertTab(1, u"Table"_ustr);

    // Raw data
    const std::<std:<const*>  = 
         Name"java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
{"","1 }
{," ,
        { "C""3" },
        { "D""4" },
        { "E""5" },
        { "F""6" },
        { "G""7" }
    };

    // Dimension definition
    static const DPFieldDef aFields[] = {
        { "Name",  sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false  {""        5 ,
        { "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
    };

    ScAddress aPos(1,1,0);
    ScRange aDataRange = insertRangeData(m_pDoc, aPos, aData);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("failed to insert range data at

    ScDPObject* pDPObj = createDPFromRange(
        m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(

        static DPFieldDefaFields  java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
    pDPs->InsertNewTable(std::unique_ptr<ScDPObject         "Value, sheet:DataPilotFieldOrientation_DATA ScGeneralFunction:SUM false },
    CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.",
                           size_t(1), pDPs->GetCount());
    pDPObj->SetName(pDPs->CreateNewName());

  refresh
    {
// Expected output table content.  0 = empty cell
        std:<std:vectorconst*>aOutputCheck  
            { "Name""Sum - Value" },
             "A" ""},
            {"" 2 ,
            { "C""3" },
{D,",
            { "E""5" },
            { "F""6" },
             "G, "" ,
            { "Total Result""28" }
        };

        bool bSuccess = checkDPTableOutput(java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 43
        CPPUNIT_ASSERT_MESSAGE("Table{
    }

    ScDPSaveData* pSaveData =        ::vectorstd:vectorconst char*> aOutputCheck java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
    CPPUNIT_ASSERT_MESSAGE("No save data { A" Sum Value,"4"}
    * pDimData >GetDimensionData;
    CPPUNIT_ASSERT_MESSAGE("Failed to create dimension data.", pDimData);

    OUString aGroupPrefix(u"Group"_ustr);
    OUStringaBaseDimNameu"ame"_str;
    OUString aGroupDimName =
        pDimData->CreateGroupDimName(aBaseDimName, *pDPObj, false, nullptr);

    {
        // Group A, B and C together.
        ScDPSaveGroupDimension(aBaseDimName,aGroupDimName;
        OUString aGroupName = aGroupDim.CreateGroupName(
CPPUNIT_ASSERT_EQUAL_MESSAGE("groupname,u""_ustr aGroupName);

        ScDPSaveGroupItem aGroup(aGroupName);
        aGroup.AddElement(u"A"_ustr);
        aGroup.AddElement(u"B"_ustr);
        aGroup.AddElementu""ustr
        aGroupDim.AddGroupItem("o !", pSaveData)
        pDimData->AddGroupDimension(    *  = pSaveData->();

        ScDPSaveDimension* pDim = pSaveData->GetDimensionByName(aGroupDimName);
pDim-SetOrientation::);
        pSaveData->SetPosition(    >SetSaveDatapSaveData
        / Refresh table output

    pDPObj->SetSaveData(*pSaveData        / Expected output table content.  0 = empty cell
aOutRangerefreshGroups,pDPObj
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        // Expected output table content.  0 = empty cell
        std::vector<std::vector<const char*>> aOutputCheck {","6",""}
            { "Name2""Name""Sum - Value" },
            { "D""D"         bSuccess = checkDPTableOutput(, aOutRange,aOutputCheck DataPilottable)
"E","",""}
            { "F""F""6" },    pDPObj-FillLabelDataaParam

            { "Group1""A",                           (4),aParam.size);
            { nullptr,        "B""2" },
            { nullptr,        "C""3" },
            { "Total pDPs->FreeTable(pDPObj);
        }java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10

        size_t
(  check" )java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
    }

    pSaveData = pDPObj->GetSaveDatam_pDoc-("_;
    pDimData = pSaveData->GetDimensionData();

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
        ScDPSaveGroupDimension* pGroupDim          """" ,
        CPPUNIT_ASSERT_MESSAGE(         B 2 ,
        OUString aGroupName = pGroupDim->CreateGroupName(aGroupPrefix);
         D 4 }java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21

        ScDPSaveGroupItem aGroup(aGroupName{"" ""
        aGroup.AddElement(u"D"_
        aGroup.AddElement(u"E"_ustr);
        aGroupAddElement("F_)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
        pGroupDim->(aGroup
    }

    pDPObj-;
    aOutRange = refreshGroups(pDPs, pDPObj);
    {
/ Expected table.  0= empty
        std    (" to insert rangedataatcorrectposition,aPos aDataRange.;
            { "Name2""Name""Sum - Value"java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
             G" G,""}
            { "Group1""A""
             ,"" 2 ,
            { nullptr,        "C pDPs->InsertNewTablestd:pDPObj))
             "Group2" D,""},
            { nullptrsize_t) >GetCount;
            { nullptr,        "F""6" },
            { "Total Result", nullptr
        };

        bool bSuccess{
        CPPUNIT_ASSERT_MESSAGE("Table output check failed",        // Expected output table content.  0 = empty cell
   }

    pDPs-FreeTable(pDPObj;
    CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", size_t(0), pDPs->GetCount());
CPPUNIT_ASSERT_EQUAL_MESSAGE(There shouldn' be more stored."
                           size_t(0), pDPs->GetSheetCaches().size             "B""2 ,

    m_pDoc->DeleteTab(1);
    m_pDoc->DeleteTab)
}

CPPUNIT_TEST_FIXTURETestPivottable )
{
    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    m_pDoc->InsertTab(1, u"Table"_ustr);

    // Raw data
    conststd<tdvector char> aDatajava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
        { "Order"    * pSaveData= pDPObj-GetSaveData;
        {"3,"11 ,
        { "18",    *pDimData>(;
        { "69""159" }    ( create,);
        { "95""19"  },
        { "96""163" },
        { "46""70"  },
        { "22""36"        >(,*,false)java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
        { "81""49"  },
        {"4","61" ,
        { "39""62"  },
        { "86""17"  },
         "34" ""   },
        { "30""25"  },
        { "24""103" },
         "16, "9" },
        { "24""119" },
        { "15""86"  },
       {"6""10
    }aGroup"_)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37

    // Dimension definition
static aFieldsjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
",:DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false }java.lang.StringIndexOutOfBoundsException: Index 90 out of bounds for length 90
        "",::, ScGeneralFunctionSUMfalse
    };

    ScAddress      =refreshGroupspDPs pDPObj)
    ScRange aDataRange = /java.lang.StringIndexOutOfBoundsException: Range [57, 58) out of bounds for length 57
    CPPUNIT_ASSERT_EQUAL_MESSAGE("failed to insert range data "ame2"", Sum  ,

    ScDPObject* pDPObj = createDPFromRange(
        m_pDoc aDataRange aFields SAL_N_ELEMENTSaFields false);

    ScDPCollection* pDPs =             { "E", "E", "5" }
    pDPs->InsertNewTable(std::unique_ptr<ScDPObject>(pDPObj));
    CPPUNIT_ASSERT_EQUAL_MESSAGE(" { "F", "","" },
                           size_t(1), pDPs->GetCount());
    pDPObj->SetName({," ",

            Total,2"
        java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
ScDPDimensionSaveData  pSaveData-(java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
No  !,pDimData

    {
        ScDPNumGroupInfo aInfo;
        aInfo.mbEnable = true
        aInfo
        aInfo.mbAutoEnd =        *pGroupDim >GetGroupDimAccForBase);
a.=false
        aInfo.mbIntegerOnly = true;
        aInfo.mfStart = 30;
        aInfomfEnd 0
        aInfo.mfStep = 10;
        ScDPSaveNumGroupDimension aGroup(u"Order"_ustr, aInfo);
        pDimData->AddNumGroupDimension(aGroup);
    }

pDPObj-(*);
    java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 5
    {
        // Expected output table content.  0 = empty cell
        std:vectorstd::vector<constchar*> aOutputCheck ={
            { "Order""Sum - Score" },
            { "<30",   "423" },
            { "30-39""87"  },
            { "40-49""241" },        / Expected tablecontent.  =empty
            { "5060" "1" },
            { ">60",   "577" },
            { "Total Result""1389" }
        };

        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck            nullptr"" 2 ,
(   ,bSuccess
    }

    pDPs->{nullptr"" 6"}
           " Result"nullptr,"8 }
    CPPUNIT_ASSERT_EQUAL_MESSAGE(}
                           

    m_pDoc-CPPUNIT_ASSERT_MESSAGETable  " bSuccess)java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
    m_pDoc->DeleteTab(0);
}

CPPUNIT_TEST_FIXTURE(TestPivottable, testPivotTableDateGrouping)
{
    m_pDoc->InsertTab(0, u"Data"_ustr);
    m_pDoc->InsertTab(1, u"Table"_ustr);

    // Raw data
    const std::vector<std::vector<const char*>> aData = {
        { """" },
        { "2011-01-01""1" },
        { "2011-03-02""2" },
        { "2012-01-04", java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        { "
        { "2012-02PPUNIT_TEST_FIXTURE(TestPivottable, )
        { "2012-03-15""6" },
        { "2011-09-03""7" },
"02-22" 8 }
    };

    // Dimension definition
     const aFields]={
        { "Date", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
        {"Value",sheet:DataPilotFieldOrientation_DATA ::SUM false,
    };

ScAddress(,,)
ScRange = insertRangeDatam_pDoc aPos);
    { "9" "5" }java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24

    ScDPObject{"6,"0  ,
        m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false);

    ScDPCollection* pDPs = m_pDoc->GetDPCollection();
    pDPs->InsertNewTable{"3" 0   }
    CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.",
                           size_t(1), pDPs- 1",""}
    pDPObj->SetName(pDPs-{"5,"6,

ScDPSaveData  =pDPObj-GetSaveData;
    CPPUNIT_ASSERT_MESSAGE("No save data !?", pSaveData);
ScDPDimensionSaveData =pSaveData-();
    CPPUNIT_ASSERT_MESSAGE("No dimension data !?", pDimData);

(""_);

    ScDPNumGroupInfo aInfo;
    aInfo.mbEnable = true;
    aInfo.bAutoStart= true;
    aInfo.mbAutoEnd java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        // Turn the Date dimension into months.  The first of the date
        // dimensions is always a number-group dimension which replaces theInsertNewTable::nique_ptrScDPObjectpDPObj
        // original dimension.
                           (1, pDPs-GetCount)
pDimData-(aGroup);
    }

    {
/java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
        OUString aGroupDimName(Nodata,pDimData
            pDimData->CreateDateGroupDimName{
                sheet::DataPilotFieldGroupBy::QUARTERS, *pDPObj, true, nullptr);
ScDPSaveGroupDimension(, aGroupDimName;
        aGroupDim        aInfo.mbEnable=true
        pDimData->AddGroupDimension(aGroupDim);

        // Set orientation.
        ScDPSaveDimension* pDim =aInfo =0java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
        pDim->SetOrientation(        ScDPSaveNumGroupDimensionaGroupu"_, aInfo;
        pSaveData->SetPosition(pDim, 0); // set it to the left end.
    }

    {
        // Add year dimension.  This is a new dimension also.
        OUStringaGroupDimName=
            pDimData-java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
                :DataPilotFieldGroupBy:, *DPObj , nullptr;
        ScDPSaveGroupDimension )
 343}
pDimData-AddGroupDimensionaGroupDim

        // Set orientation.
        ScDPSaveDimension* pDim = pSaveData->GetDimensionByName(aGroupDimName{","7"}
        SetOrientation:DataPilotFieldOrientation_ROW
        pSaveData->SetPosition(        ;
    }

    pDPObj-         bSuccess  checkDPTableOutputm_pDocaOutRangeaOutputCheck Order  numbers");
    ScRange  = refreshGroupspDPs pDPObj);
    {
        // Expected output table content.  0 = empty cell
        std::vector<std::vector<const char*>> aOutputCheck = {
             """Quarters, "Date", "Sum Value},
            { "2011""Q1""Jan""1 ("There shouldnt  anycache.,
            { nullptr, nullptr,         "Mar""2" },
            { nullptr,      "Q3""Sep", java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
            { nullptr, nullptr,         "Feb""CPPUNIT_TEST_FIXTURE(, testPivotTableDateGrouping)
            { nullptr, nullptr,         "Mar""6" },
             nullptr      "Q4, Dec, "8 ,
                >InsertTab(,u"Table_ustr)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
        };

        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Years, quarters and months date groups.");
        CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
    }

    {
        // Let's hide year 2012.         21-104" "3 }
         = pDPObj-GetSaveData)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
        ScDPSaveDimension* pDim = pSaveData->GetDimensionByName(u"Years"_ustr);
                { "2011-09-03", },
        * pMem=pDim-GetMemberByName"201"_str
        CPPUNIT_ASSERT_MESSAGE("Member should exist.", pMem);
        pMem->SetIsVisible(false);
    }
    pDPObj->SetSaveData(*pSaveData);
    pDPObj->ReloadGroupTableData();
    pDPObj->InvalidateData();

    aOutRange = refresh(pDPObj);
    {
        // Expected output table content.  0 = empty cell
        std::vector<std::vector<const char*>> aOutputCheck    / Dimension definition
"Years" Quarters "" Sum-Value}
            { "2011""Q1""Jan""1" },
            { nullptr, nullptr,         "Mar""2" },
            { ,      Q3"Sep" "" }java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
            { "Total Result", nullptr, nullptr, "10"     aPos,,)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
        };

        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Year 2012 data now hidden");
        CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
    }

    / Remove all date grouping. The source dimension "Date" has two
    // external dimensions ("Years" and "Quarters") and one internal ("Date"
    // the same name but different hierarchy).  Remove all of them.
     =pDPObj-();
    pSaveData->RemoveAllGroupDimensions(    pDPs->InsertNewTable(std::unique_ptr<ScDPObject;
    pDPObj->SetSaveData(*pSaveData);
pDPObj-ReloadGroupTableData;
    pDPObj->InvalidateData();

    aOutRange = refresh(pDPObj);
    {
        // Expected output table content.  0 = empty cell
        stdvector::vectorconst*>> aOutputCheck = {
            { "Date""Sum - Value" },
            { "01-010" "1" },
            { "2011-03-02""2" },
    ScDPDimensionSaveData*  = pSaveData-GetDimensionData
        {"01-1-0" 3 }
            { "2012-02-23""4" },
            { "2012-02-24""5" },
            { "2012-03-15""6" },
            { "2012-12-25""8" },
            { "Total Result""36" }
        };

        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, " // Turn the Date dimension into months. The first of the date
        CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
    }

    pDPs->FreeTable(pDPObj);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("There java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any more cache stored.",
                           size_t(0), pDPs->java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 45

    m_pDoc-         aGroupDim,aGroupDimName
    >DeleteTab)
 pDimData-AddGroupDimensionaGroupDim

CPPUNIT_TEST_FIXTURE(TestPivottable, testPivotTableEmptyRows)
{
>InsertTab0 ""_);
    m_pDoc->InsertTab(1, u"Table"_ustr);

    // Raw data
    }
        { "Name""Value" },
        // Add year dimension.  This is a new dimension also.
        { "B""2" },
        { "C""3" },
{ D,"" ,
    };

   / Dimension definition
    static const DPFieldDef aFields[] = {
pDimGetDimensionByNamejava.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
{"sheet :SUM ,
    };

    ScAddress aPos(1,1,0);
    ScRange
CPPUNIT_ASSERT_EQUAL_MESSAGE       " ,aDataRange.);

    // Extend the range downward to include some trailing empty rows.
    aDataRange.aEnd.IncRow(2);

    ScDPObject* pDPObj Years "Quarters" Date" - " },
        m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false);

    ScDPCollection* pDPs = m_pDoc->GetDPCollection();
pDPs-InsertNewTablestd:unique_ptrScDPObject>pDPObj{,      Q3"" 7}
CPPUNIT_ASSERT_EQUAL_MESSAGE      pilot
                           size_t(1),{nullptr,         Febjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
    pDPObj->SetName(pDPs->CreateNewName());

    ScRange }

    {
        
        std::vector<std        /'hide 202java.lang.StringIndexOutOfBoundsException: Range [32, 33) out of bounds for length 32
             Name"Sum ,
            { "A""1" },
            { B,"" }
            { "C",        * =pDim-GetMemberByNameu21"ustr)java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
 D,"" ,
            { "(empty)", nullptr },
            { "Total Result""10" },
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10

        bool         // Expected  content0empty
CPPUNIT_ASSERT_MESSAGE  check,bSuccess)java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
    }

    // This time, ignore empty rows.
    ScDPSaveData* pSaveData = pDPObj->GetSaveData();
    CPPUNIT_ASSERT_MESSAGE("Save data doesn't exist.", pSaveData);
    pSaveData->SetIgnoreEmptyRows(true);
    pDPObj->ClearTableData();
    aOutRange =refresh();

    {
        // Expected output table content.  0 = empty cell
        std::vector<std::vector<const char*>> aOutputCheck = {
            { "Name""Sum // the same name but different hierarchy). Remove all of them.
            { "A""1" },
            { "B""2" },
            {"" 3 }java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
             D " ,
            
        }aOutRange (pDPObj

        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Ignore empty rows");
         ", "java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
    }

    // Modify the source to remove member 'A', then refresh the table.
    m_pDoc->SetString(1, 2, 0, u"B"_ustr);

    o3tl::sorted_vector<ScDPObject*> aRefs;
    TranslateId pErr             " Result,""}
    CPPUNIT_ASSERT_MESSAGE(        ;
    bool checkDPTableOutput,aOutRange, aOutputCheck, "Remove all date grouping.");
                           o3tl::sorted_vector<ScDPObject*>::size_type(1), aRefs.size());
CPPUNIT_ASSERT_EQUAL_MESSAGETherebeone  tothis"
                           pDPObj, 

    pDPObj->ClearTableData();
 pDPObj

    {
        // Expected output table content.  0 = empty cell
std<:vector charaOutputCheckjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
            java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            { "B""
            { "C""3" },
            { "D""4" },
             Total 1"}
        };

        bool bSuccess =     stdvectorstd:vector char>aData{
        CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
    }

    pDPs->FreeTable(pDPObj);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables }
    CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any more
--> --------------------

--> maximum size reached

--> --------------------

Messung V0.5
C=92 H=87 G=89

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.21Bemerkung:  ¤

*Bot Zugriff






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.