Kaydet (Commit) ebd70ae1 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

add test case for outline import from ODS

Change-Id: I60f92dd13282281d77571e41707d68ae55722d9b
üst d91b1238
......@@ -41,7 +41,7 @@ public:
ScOutlineEntry( SCCOLROW nNewStart, SCCOLROW nNewSize, bool bNewHidden = false );
ScOutlineEntry( const ScOutlineEntry& rEntry );
SCCOLROW GetStart() const;
SC_DLLPUBLIC SCCOLROW GetStart() const;
SCSIZE GetSize() const;
SC_DLLPUBLIC SCCOLROW GetEnd() const;
......@@ -53,7 +53,7 @@ public:
/**
* @return true if the control is visible, false otherwise.
*/
bool IsVisible() const;
SC_DLLPUBLIC bool IsVisible() const;
void Move( SCsCOLROW nDelta );
void SetSize( SCSIZE nNewSize );
......
......@@ -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" )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment