Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
2758492a
Kaydet (Commit)
2758492a
authored
Tem 06, 2012
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
New unit test for pivot table's handling of empty rows.
Change-Id: I1c922fd3d06aca49b98a933d82da478b22e74d4a
üst
f2b6d71c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
0 deletions
+89
-0
ucalc.cxx
sc/qa/unit/ucalc.cxx
+89
-0
No files found.
sc/qa/unit/ucalc.cxx
Dosyayı görüntüle @
2758492a
...
...
@@ -167,6 +167,7 @@ public:
void
testPivotTableNormalGrouping
();
void
testPivotTableNumberGrouping
();
void
testPivotTableDateGrouping
();
void
testPivotTableEmptyRows
();
void
testSheetCopy
();
void
testSheetMove
();
...
...
@@ -234,6 +235,7 @@ public:
CPPUNIT_TEST
(
testPivotTableNormalGrouping
);
CPPUNIT_TEST
(
testPivotTableNumberGrouping
);
CPPUNIT_TEST
(
testPivotTableDateGrouping
);
CPPUNIT_TEST
(
testPivotTableEmptyRows
);
CPPUNIT_TEST
(
testSheetCopy
);
CPPUNIT_TEST
(
testSheetMove
);
CPPUNIT_TEST
(
testExternalRef
);
...
...
@@ -2688,6 +2690,93 @@ void Test::testPivotTableDateGrouping()
m_pDoc
->
DeleteTab
(
0
);
}
void
Test
::
testPivotTableEmptyRows
()
{
m_pDoc
->
InsertTab
(
0
,
OUString
(
"Data"
));
m_pDoc
->
InsertTab
(
1
,
OUString
(
"Table"
));
// Raw data
const
char
*
aData
[][
2
]
=
{
{
"Name"
,
"Value"
},
{
"A"
,
"1"
},
{
"B"
,
"2"
},
{
"C"
,
"3"
},
{
"D"
,
"4"
},
};
// Dimension definition
DPFieldDef
aFields
[]
=
{
{
"Name"
,
sheet
::
DataPilotFieldOrientation_ROW
,
0
},
{
"Value"
,
sheet
::
DataPilotFieldOrientation_DATA
,
sheet
::
GeneralFunction_SUM
},
};
ScAddress
aPos
(
1
,
1
,
0
);
ScRange
aDataRange
=
insertRangeData
(
m_pDoc
,
aPos
,
aData
,
SAL_N_ELEMENTS
(
aData
));
CPPUNIT_ASSERT_MESSAGE
(
"failed to insert range data at correct position"
,
aDataRange
.
aStart
==
aPos
);
// Extend the range downward to include some trailing empty rows.
aDataRange
.
aEnd
.
IncRow
(
2
);
ScDPObject
*
pDPObj
=
createDPFromRange
(
m_pDoc
,
aDataRange
,
aFields
,
SAL_N_ELEMENTS
(
aFields
),
false
);
ScDPCollection
*
pDPs
=
m_pDoc
->
GetDPCollection
();
bool
bSuccess
=
pDPs
->
InsertNewTable
(
pDPObj
);
CPPUNIT_ASSERT_MESSAGE
(
"failed to insert a new pivot table object into document."
,
bSuccess
);
CPPUNIT_ASSERT_MESSAGE
(
"there should be only one data pilot table."
,
pDPs
->
GetCount
()
==
1
);
pDPObj
->
SetName
(
pDPs
->
CreateNewName
());
ScRange
aOutRange
=
refresh
(
pDPObj
);
{
// Expected output table content. 0 = empty cell
const
char
*
aOutputCheck
[][
2
]
=
{
{
"Name"
,
0
},
{
"A"
,
"1"
},
{
"B"
,
"2"
},
{
"C"
,
"3"
},
{
"D"
,
"4"
},
{
"(empty)"
,
0
},
{
"Total Result"
,
"10"
},
};
bSuccess
=
checkDPTableOutput
<
2
>
(
m_pDoc
,
aOutRange
,
aOutputCheck
,
"Include empty rows"
);
CPPUNIT_ASSERT_MESSAGE
(
"Table output check failed"
,
bSuccess
);
}
// 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
(
pDPObj
);
{
// Expected output table content. 0 = empty cell
const
char
*
aOutputCheck
[][
2
]
=
{
{
"Name"
,
0
},
{
"A"
,
"1"
},
{
"B"
,
"2"
},
{
"C"
,
"3"
},
{
"D"
,
"4"
},
{
"Total Result"
,
"10"
},
};
bSuccess
=
checkDPTableOutput
<
2
>
(
m_pDoc
,
aOutRange
,
aOutputCheck
,
"Ignore empty rows"
);
CPPUNIT_ASSERT_MESSAGE
(
"Table output check failed"
,
bSuccess
);
}
pDPs
->
FreeTable
(
pDPObj
);
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
"There should be no more tables."
,
pDPs
->
GetCount
(),
static_cast
<
size_t
>
(
0
));
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
"There shouldn't be any more cache stored."
,
pDPs
->
GetSheetCaches
().
size
(),
static_cast
<
size_t
>
(
0
));
m_pDoc
->
DeleteTab
(
1
);
m_pDoc
->
DeleteTab
(
0
);
}
void
Test
::
testSheetCopy
()
{
OUString
aTabName
(
"TestTab"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment