diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-06-03 23:31:34 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-06-03 23:39:59 +0200 |
commit | ebd70ae1d84eed5e5311fcc018a122be2e8719d4 (patch) | |
tree | ac3071a9141a62ae41b892273f94e3bccf984314 /sc/qa | |
parent | d91b12383ecdceb4c2be7a5da11d84ac2146fddb (diff) |
add test case for outline import from ODS
Change-Id: I60f92dd13282281d77571e41707d68ae55722d9b
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/data/ods/outline.ods | bin | 0 -> 7959 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 56 |
2 files changed, 56 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/outline.ods b/sc/qa/unit/data/ods/outline.ods Binary files differnew file mode 100644 index 000000000000..bca7d14711d4 --- /dev/null +++ b/sc/qa/unit/data/ods/outline.ods diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index e963bdde93e3..17bfc3271eed 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -40,6 +40,7 @@ #include "docfunc.hxx" #include "markdata.hxx" #include "colorscale.hxx" +#include "olinetab.hxx" #include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/drawing/XControlShape.hpp> @@ -137,6 +138,7 @@ public: void testOptimalHeightReset(); void testPrintRangeODS(); + void testOutlineODS(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBasicCellContentODS); @@ -201,6 +203,7 @@ public: CPPUNIT_TEST(testMiscRowHeights); CPPUNIT_TEST(testOptimalHeightReset); CPPUNIT_TEST(testPrintRangeODS); + CPPUNIT_TEST(testOutlineODS); CPPUNIT_TEST_SUITE_END(); private: @@ -1941,6 +1944,59 @@ void ScFiltersTest::testPrintRangeODS() CPPUNIT_ASSERT_EQUAL(ScRange(0,2,0,0,4,0), *pRange); } +void ScFiltersTest::testOutlineODS() +{ + ScDocShellRef xDocSh = loadDoc("outline.", ODS); + ScDocument* pDoc = xDocSh->GetDocument(); + + const ScOutlineTable* pTable = pDoc->GetOutlineTable(0); + CPPUNIT_ASSERT(pTable); + + const ScOutlineArray* pArr = pTable->GetRowArray(); + size_t nDepth = pArr->GetDepth(); + CPPUNIT_ASSERT_EQUAL(size_t(4), nDepth); + + for(size_t i = 0; i < nDepth; ++i) + { + CPPUNIT_ASSERT_EQUAL(size_t(1), pArr->GetCount(i)); + } + + struct OutlineData { + SCCOLROW nStart; + SCCOLROW nEnd; + bool bHidden; + bool bVisible; + + size_t nDepth; + size_t nIndex; + }; + + OutlineData aRow[] = + { + { 1, 29, false, true, 0, 0 }, + { 2, 26, false, true, 1, 0 }, + { 4, 23, false, true, 2, 0 }, + { 6, 20, true, true, 3, 0 } + }; + + for(size_t i = 0; i < SAL_N_ELEMENTS(aRow); ++i) + { + + const ScOutlineEntry* pEntry = pArr->GetEntry(aRow[i].nDepth, aRow[i].nIndex); + SCCOLROW nStart = pEntry->GetStart(); + CPPUNIT_ASSERT_EQUAL(aRow[i].nStart, nStart); + + SCCOLROW nEnd = pEntry->GetEnd(); + CPPUNIT_ASSERT_EQUAL(aRow[i].nEnd, nEnd); + + bool bHidden = pEntry->IsHidden(); + CPPUNIT_ASSERT_EQUAL(aRow[i].bHidden, bHidden); + + bool bVisible = pEntry->IsVisible(); + CPPUNIT_ASSERT_EQUAL(aRow[i].bVisible, bVisible); + } +} + ScFiltersTest::ScFiltersTest() : ScBootstrapFixture( "/sc/qa/unit/data" ) { |