From 10742e6eed87d33bf7619ce7819036b0545f0102 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Thu, 1 Nov 2012 11:12:40 -0400 Subject: Unit test for cache filtering, to secure the recent bug fix I did. Change-Id: Ie5068b45520b6c82af41062d97ec65d006b4b3ba --- sc/qa/unit/ucalc.cxx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'sc/qa/unit') diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 74c72051f988..b489cb752e8b 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -62,6 +62,7 @@ #include "dpsave.hxx" #include "dpdimsave.hxx" #include "dpcache.hxx" +#include "dpfilteredcache.hxx" #include "calcconfig.hxx" #include "interpre.hxx" @@ -82,6 +83,7 @@ #include #include +#include #include #define CALC_DEBUG_OUTPUT 0 @@ -2420,6 +2422,29 @@ void Test::testPivotTableCache() } } + // 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_MESSAGE("Wrong dimension.", nRows == 6 && aFilteredCache.getColSize() == 3); + + 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().c_str(), false); + } + } + } + + // TODO : Add test for filtered caches. + m_pDoc->DeleteTab(0); } -- cgit