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
ae5ac480
Kaydet (Commit)
ae5ac480
authored
Eki 26, 2014
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#85215: Write test for this.
Change-Id: Ibe959201541ce6ad84540eba93ac9235dca91f40
üst
10fc1383
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
110 additions
and
0 deletions
+110
-0
ucalc.hxx
sc/qa/unit/ucalc.hxx
+2
-0
ucalc_sort.cxx
sc/qa/unit/ucalc_sort.cxx
+108
-0
No files found.
sc/qa/unit/ucalc.hxx
Dosyayı görüntüle @
ae5ac480
...
@@ -364,6 +364,7 @@ public:
...
@@ -364,6 +364,7 @@ public:
void
testSortRefUpdate3
();
void
testSortRefUpdate3
();
void
testSortRefUpdate4
();
void
testSortRefUpdate4
();
void
testSortRefUpdate5
();
void
testSortRefUpdate5
();
void
testSortRefUpdate6
();
void
testSortOutOfPlaceResult
();
void
testSortOutOfPlaceResult
();
void
testSortPartialFormulaGroup
();
void
testSortPartialFormulaGroup
();
...
@@ -555,6 +556,7 @@ public:
...
@@ -555,6 +556,7 @@ public:
CPPUNIT_TEST
(
testSortRefUpdate3
);
CPPUNIT_TEST
(
testSortRefUpdate3
);
CPPUNIT_TEST
(
testSortRefUpdate4
);
CPPUNIT_TEST
(
testSortRefUpdate4
);
CPPUNIT_TEST
(
testSortRefUpdate5
);
CPPUNIT_TEST
(
testSortRefUpdate5
);
CPPUNIT_TEST
(
testSortRefUpdate6
);
CPPUNIT_TEST
(
testSortOutOfPlaceResult
);
CPPUNIT_TEST
(
testSortOutOfPlaceResult
);
CPPUNIT_TEST
(
testSortPartialFormulaGroup
);
CPPUNIT_TEST
(
testSortPartialFormulaGroup
);
CPPUNIT_TEST
(
testShiftCells
);
CPPUNIT_TEST
(
testShiftCells
);
...
...
sc/qa/unit/ucalc_sort.cxx
Dosyayı görüntüle @
ae5ac480
...
@@ -1329,6 +1329,114 @@ void Test::testSortRefUpdate5()
...
@@ -1329,6 +1329,114 @@ void Test::testSortRefUpdate5()
m_pDoc
->
DeleteTab
(
0
);
m_pDoc
->
DeleteTab
(
0
);
}
}
void
Test
::
testSortRefUpdate6
()
{
SortRefNoUpdateSetter
aUpdateSet
;
sc
::
AutoCalcSwitch
aACSwitch
(
*
m_pDoc
,
true
);
// turn auto calc on.
m_pDoc
->
InsertTab
(
0
,
"Sort"
);
const
char
*
aData
[][
3
]
=
{
{
"Order"
,
"Value"
,
"1"
},
{
"9"
,
"1"
,
"=C1+B2"
},
{
"1"
,
"2"
,
"=C2+B3"
},
{
"8"
,
"3"
,
"=C3+B4"
},
};
ScAddress
aPos
(
0
,
0
,
0
);
ScRange
aDataRange
=
insertRangeData
(
m_pDoc
,
aPos
,
aData
,
SAL_N_ELEMENTS
(
aData
));
CPPUNIT_ASSERT
(
aDataRange
.
aStart
==
aPos
);
{
// Expected output table content. 0 = empty cell
const
char
*
aOutputCheck
[][
3
]
=
{
{
"Order"
,
"Value"
,
"1"
},
{
"9"
,
"1"
,
"2"
},
{
"1"
,
"2"
,
"4"
},
{
"8"
,
"3"
,
"7"
},
};
bool
bSuccess
=
checkOutput
<
3
>
(
m_pDoc
,
aDataRange
,
aOutputCheck
,
"Initial value"
);
CPPUNIT_ASSERT_MESSAGE
(
"Table output check failed"
,
bSuccess
);
}
ScDBDocFunc
aFunc
(
getDocShell
());
// Sort A1:C4.
m_pDoc
->
SetAnonymousDBData
(
0
,
new
ScDBData
(
STR_DB_LOCAL_NONAME
,
0
,
0
,
0
,
2
,
3
));
// Sort A1:A6 by column A (with a row header).
ScSortParam
aSortData
;
aSortData
.
nCol1
=
0
;
aSortData
.
nCol2
=
2
;
aSortData
.
nRow1
=
0
;
aSortData
.
nRow2
=
3
;
aSortData
.
bHasHeader
=
true
;
aSortData
.
maKeyState
[
0
].
bDoSort
=
true
;
aSortData
.
maKeyState
[
0
].
nField
=
0
;
aSortData
.
maKeyState
[
0
].
bAscending
=
true
;
bool
bSorted
=
aFunc
.
Sort
(
0
,
aSortData
,
true
,
true
,
true
);
CPPUNIT_ASSERT
(
bSorted
);
{
// Expected output table content. 0 = empty cell
const
char
*
aOutputCheck
[][
3
]
=
{
{
"Order"
,
"Value"
,
"1"
},
{
"1"
,
"2"
,
"3"
},
{
"8"
,
"3"
,
"6"
},
{
"9"
,
"1"
,
"7"
},
};
bool
bSuccess
=
checkOutput
<
3
>
(
m_pDoc
,
aDataRange
,
aOutputCheck
,
"Sorted without reference update"
);
CPPUNIT_ASSERT_MESSAGE
(
"Table output check failed"
,
bSuccess
);
}
// Make sure that the formulas in C2:C4 are not adjusted.
if
(
!
checkFormula
(
*
m_pDoc
,
ScAddress
(
2
,
1
,
0
),
"C1+B2"
))
CPPUNIT_FAIL
(
"Wrong formula!"
);
if
(
!
checkFormula
(
*
m_pDoc
,
ScAddress
(
2
,
2
,
0
),
"C2+B3"
))
CPPUNIT_FAIL
(
"Wrong formula!"
);
if
(
!
checkFormula
(
*
m_pDoc
,
ScAddress
(
2
,
3
,
0
),
"C3+B4"
))
CPPUNIT_FAIL
(
"Wrong formula!"
);
// Undo and check.
SfxUndoManager
*
pUndoMgr
=
m_pDoc
->
GetUndoManager
();
CPPUNIT_ASSERT
(
pUndoMgr
);
pUndoMgr
->
Undo
();
{
// Expected output table content. 0 = empty cell
const
char
*
aOutputCheck
[][
3
]
=
{
{
"Order"
,
"Value"
,
"1"
},
{
"9"
,
"1"
,
"2"
},
{
"1"
,
"2"
,
"4"
},
{
"8"
,
"3"
,
"7"
},
};
bool
bSuccess
=
checkOutput
<
3
>
(
m_pDoc
,
aDataRange
,
aOutputCheck
,
"After undo"
);
CPPUNIT_ASSERT_MESSAGE
(
"Table output check failed"
,
bSuccess
);
}
// Redo and check.
pUndoMgr
->
Redo
();
{
// Expected output table content. 0 = empty cell
const
char
*
aOutputCheck
[][
3
]
=
{
{
"Order"
,
"Value"
,
"1"
},
{
"1"
,
"2"
,
"3"
},
{
"8"
,
"3"
,
"6"
},
{
"9"
,
"1"
,
"7"
},
};
bool
bSuccess
=
checkOutput
<
3
>
(
m_pDoc
,
aDataRange
,
aOutputCheck
,
"Sorted without reference update"
);
CPPUNIT_ASSERT_MESSAGE
(
"Table output check failed"
,
bSuccess
);
}
m_pDoc
->
DeleteTab
(
0
);
}
void
Test
::
testSortOutOfPlaceResult
()
void
Test
::
testSortOutOfPlaceResult
()
{
{
m_pDoc
->
InsertTab
(
0
,
"Sort"
);
m_pDoc
->
InsertTab
(
0
,
"Sort"
);
...
...
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