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
41afbdcc
Kaydet (Commit)
41afbdcc
authored
Eyl 03, 2014
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#83217: Write test for this.
Change-Id: I5af25079a24d4c18eed70a7f0abc42d84cfc2242
üst
31abf4ce
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
0 deletions
+58
-0
ucalc.hxx
sc/qa/unit/ucalc.hxx
+2
-0
ucalc_formula.cxx
sc/qa/unit/ucalc_formula.cxx
+56
-0
No files found.
sc/qa/unit/ucalc.hxx
Dosyayı görüntüle @
41afbdcc
...
@@ -131,6 +131,7 @@ public:
...
@@ -131,6 +131,7 @@ public:
void
testFormulaRefUpdateInsertColumns
();
void
testFormulaRefUpdateInsertColumns
();
void
testFormulaRefUpdateMove
();
void
testFormulaRefUpdateMove
();
void
testFormulaRefUpdateMoveUndo
();
void
testFormulaRefUpdateMoveUndo
();
void
testFormulaRefUpdateMoveToSheet
();
void
testFormulaRefUpdateDeleteContent
();
void
testFormulaRefUpdateDeleteContent
();
void
testFormulaRefUpdateNamedExpression
();
void
testFormulaRefUpdateNamedExpression
();
void
testFormulaRefUpdateNamedExpressionMove
();
void
testFormulaRefUpdateNamedExpressionMove
();
...
@@ -412,6 +413,7 @@ public:
...
@@ -412,6 +413,7 @@ public:
CPPUNIT_TEST
(
testFormulaRefUpdateInsertColumns
);
CPPUNIT_TEST
(
testFormulaRefUpdateInsertColumns
);
CPPUNIT_TEST
(
testFormulaRefUpdateMove
);
CPPUNIT_TEST
(
testFormulaRefUpdateMove
);
CPPUNIT_TEST
(
testFormulaRefUpdateMoveUndo
);
CPPUNIT_TEST
(
testFormulaRefUpdateMoveUndo
);
CPPUNIT_TEST
(
testFormulaRefUpdateMoveToSheet
);
CPPUNIT_TEST
(
testFormulaRefUpdateDeleteContent
);
CPPUNIT_TEST
(
testFormulaRefUpdateDeleteContent
);
CPPUNIT_TEST
(
testFormulaRefUpdateNamedExpression
);
CPPUNIT_TEST
(
testFormulaRefUpdateNamedExpression
);
CPPUNIT_TEST
(
testFormulaRefUpdateNamedExpressionMove
);
CPPUNIT_TEST
(
testFormulaRefUpdateNamedExpressionMove
);
...
...
sc/qa/unit/ucalc_formula.cxx
Dosyayı görüntüle @
41afbdcc
...
@@ -1849,6 +1849,62 @@ void Test::testFormulaRefUpdateMoveUndo()
...
@@ -1849,6 +1849,62 @@ void Test::testFormulaRefUpdateMoveUndo()
m_pDoc
->
DeleteTab
(
0
);
m_pDoc
->
DeleteTab
(
0
);
}
}
void
Test
::
testFormulaRefUpdateMoveToSheet
()
{
sc
::
AutoCalcSwitch
aACSwitch
(
*
m_pDoc
,
true
);
// turn auto calc on.
m_pDoc
->
InsertTab
(
0
,
"Sheet1"
);
m_pDoc
->
InsertTab
(
1
,
"Sheet2"
);
// Set values to A1:A2 on Sheet1, and B1:B2 to reference them.
m_pDoc
->
SetValue
(
ScAddress
(
0
,
0
,
0
),
11
);
m_pDoc
->
SetValue
(
ScAddress
(
0
,
1
,
0
),
12
);
m_pDoc
->
SetString
(
ScAddress
(
1
,
0
,
0
),
"=A1"
);
m_pDoc
->
SetString
(
ScAddress
(
1
,
1
,
0
),
"=A2"
);
if
(
!
checkFormula
(
*
m_pDoc
,
ScAddress
(
1
,
0
,
0
),
"A1"
))
CPPUNIT_FAIL
(
"Wrong formula"
);
if
(
!
checkFormula
(
*
m_pDoc
,
ScAddress
(
1
,
1
,
0
),
"A2"
))
CPPUNIT_FAIL
(
"Wrong formula"
);
CPPUNIT_ASSERT_EQUAL
(
11.0
,
m_pDoc
->
GetValue
(
ScAddress
(
1
,
0
,
0
)));
CPPUNIT_ASSERT_EQUAL
(
12.0
,
m_pDoc
->
GetValue
(
ScAddress
(
1
,
1
,
0
)));
// Move A1:A2 on Sheet1 to B3:B4 on Sheet2.
ScDocFunc
&
rFunc
=
getDocShell
().
GetDocFunc
();
bool
bMoved
=
rFunc
.
MoveBlock
(
ScRange
(
0
,
0
,
0
,
0
,
1
,
0
),
ScAddress
(
1
,
2
,
1
),
true
,
true
,
false
,
true
);
CPPUNIT_ASSERT
(
bMoved
);
if
(
!
checkFormula
(
*
m_pDoc
,
ScAddress
(
1
,
0
,
0
),
"Sheet2.B3"
))
CPPUNIT_FAIL
(
"Wrong formula"
);
if
(
!
checkFormula
(
*
m_pDoc
,
ScAddress
(
1
,
1
,
0
),
"Sheet2.B4"
))
CPPUNIT_FAIL
(
"Wrong formula"
);
// Undo and check again.
SfxUndoManager
*
pUndoMgr
=
m_pDoc
->
GetUndoManager
();
pUndoMgr
->
Undo
();
if
(
!
checkFormula
(
*
m_pDoc
,
ScAddress
(
1
,
0
,
0
),
"A1"
))
CPPUNIT_FAIL
(
"Wrong formula"
);
if
(
!
checkFormula
(
*
m_pDoc
,
ScAddress
(
1
,
1
,
0
),
"A2"
))
CPPUNIT_FAIL
(
"Wrong formula"
);
// Redo and check.
pUndoMgr
->
Redo
();
if
(
!
checkFormula
(
*
m_pDoc
,
ScAddress
(
1
,
0
,
0
),
"Sheet2.B3"
))
CPPUNIT_FAIL
(
"Wrong formula"
);
if
(
!
checkFormula
(
*
m_pDoc
,
ScAddress
(
1
,
1
,
0
),
"Sheet2.B4"
))
CPPUNIT_FAIL
(
"Wrong formula"
);
m_pDoc
->
DeleteTab
(
1
);
m_pDoc
->
DeleteTab
(
0
);
}
void
Test
::
testFormulaRefUpdateDeleteContent
()
void
Test
::
testFormulaRefUpdateDeleteContent
()
{
{
sc
::
AutoCalcSwitch
aACSwitch
(
*
m_pDoc
,
true
);
// turn auto calc on.
sc
::
AutoCalcSwitch
aACSwitch
(
*
m_pDoc
,
true
);
// turn auto calc on.
...
...
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