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
e4a886f6
Kaydet (Commit)
e4a886f6
authored
Nis 29, 2014
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#77647: Write test for this.
Change-Id: I25b04c4790fcdae1e85b5d7b9cb85792226af757
üst
b6086aa6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
1 deletion
+44
-1
ucalc.hxx
sc/qa/unit/ucalc.hxx
+2
-0
ucalc_formula.cxx
sc/qa/unit/ucalc_formula.cxx
+42
-1
No files found.
sc/qa/unit/ucalc.hxx
Dosyayı görüntüle @
e4a886f6
...
...
@@ -118,6 +118,7 @@ public:
void
testFormulaRefUpdate
();
void
testFormulaRefUpdateRange
();
void
testFormulaRefUpdateSheets
();
void
testFormulaRefUpdateInsertRows
();
void
testFormulaRefUpdateMove
();
void
testFormulaRefUpdateMoveUndo
();
void
testFormulaRefUpdateNamedExpression
();
...
...
@@ -370,6 +371,7 @@ public:
CPPUNIT_TEST
(
testFormulaRefUpdate
);
CPPUNIT_TEST
(
testFormulaRefUpdateRange
);
CPPUNIT_TEST
(
testFormulaRefUpdateSheets
);
CPPUNIT_TEST
(
testFormulaRefUpdateInsertRows
);
CPPUNIT_TEST
(
testFormulaRefUpdateMove
);
CPPUNIT_TEST
(
testFormulaRefUpdateMoveUndo
);
CPPUNIT_TEST
(
testFormulaRefUpdateNamedExpression
);
...
...
sc/qa/unit/ucalc_formula.cxx
Dosyayı görüntüle @
e4a886f6
...
...
@@ -1477,6 +1477,43 @@ void Test::testFormulaRefUpdateSheets()
m_pDoc
->
DeleteTab
(
0
);
}
void
Test
::
testFormulaRefUpdateInsertRows
()
{
ScModule
*
pMod
=
SC_MOD
();
ScInputOptions
aOpt
=
pMod
->
GetInputOptions
();
aOpt
.
SetExpandRefs
(
false
);
pMod
->
SetInputOptions
(
aOpt
);
sc
::
AutoCalcSwitch
aACSwitch
(
*
m_pDoc
,
true
);
// turn auto calc on.
m_pDoc
->
InsertTab
(
0
,
"Formula"
);
// Insert raw values in B2:B4.
m_pDoc
->
SetValue
(
ScAddress
(
1
,
1
,
0
),
1.0
);
m_pDoc
->
SetValue
(
ScAddress
(
1
,
2
,
0
),
2.0
);
m_pDoc
->
SetValue
(
ScAddress
(
1
,
3
,
0
),
3.0
);
// Insert a formula in B5 to sum up B2:B4.
m_pDoc
->
SetString
(
ScAddress
(
1
,
4
,
0
),
"=SUM(B2:B4)"
);
CPPUNIT_ASSERT_EQUAL
(
6.0
,
m_pDoc
->
GetValue
(
ScAddress
(
1
,
4
,
0
)));
// Insert rows over rows 1:2.
ScMarkData
aMark
;
aMark
.
SelectOneTable
(
0
);
ScDocFunc
&
rFunc
=
getDocShell
().
GetDocFunc
();
rFunc
.
InsertCells
(
ScRange
(
0
,
0
,
0
,
MAXCOL
,
1
,
0
),
&
aMark
,
INS_INSROWS
,
false
,
true
,
false
);
// The raw data should have shifted to B4:B6.
CPPUNIT_ASSERT_EQUAL
(
1.0
,
m_pDoc
->
GetValue
(
ScAddress
(
1
,
3
,
0
)));
CPPUNIT_ASSERT_EQUAL
(
2.0
,
m_pDoc
->
GetValue
(
ScAddress
(
1
,
4
,
0
)));
CPPUNIT_ASSERT_EQUAL
(
3.0
,
m_pDoc
->
GetValue
(
ScAddress
(
1
,
5
,
0
)));
if
(
!
checkFormula
(
*
m_pDoc
,
ScAddress
(
1
,
6
,
0
),
"SUM(B4:B6)"
))
CPPUNIT_FAIL
(
"Wrong formula!"
);
m_pDoc
->
DeleteTab
(
0
);
}
void
Test
::
testFormulaRefUpdateMove
()
{
m_pDoc
->
InsertTab
(
0
,
"Sheet1"
);
...
...
@@ -1900,10 +1937,14 @@ void Test::testFormulaRefUpdateNamedExpressionMove()
void
Test
::
testFormulaRefUpdateNamedExpressionExpandRef
()
{
ScModule
*
pMod
=
SC_MOD
();
ScInputOptions
aOpt
=
pMod
->
GetInputOptions
();
aOpt
.
SetExpandRefs
(
true
);
// turn on automatic range expansion.
pMod
->
SetInputOptions
(
aOpt
);
sc
::
AutoCalcSwitch
aACSwitch
(
*
m_pDoc
,
true
);
// turn auto calc on.
m_pDoc
->
InsertTab
(
0
,
"Test"
);
m_pDoc
->
SetExpandRefs
(
true
);
// turn on automatic range expansion.
bool
bInserted
=
m_pDoc
->
InsertNewRangeName
(
"MyRange"
,
ScAddress
(
0
,
0
,
0
),
"$A$1:$A$3"
);
CPPUNIT_ASSERT
(
bInserted
);
...
...
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