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
a364a87f
Kaydet (Commit)
a364a87f
authored
Kas 01, 2013
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add test for multiple operations. Part of it fails currently.
Change-Id: I90e3bbaae41fac51711b8502fbeb6ee2ebf19082
üst
13b69492
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
0 deletions
+56
-0
ucalc.hxx
sc/qa/unit/ucalc.hxx
+2
-0
ucalc_formula.cxx
sc/qa/unit/ucalc_formula.cxx
+54
-0
No files found.
sc/qa/unit/ucalc.hxx
Dosyayı görüntüle @
a364a87f
...
@@ -93,6 +93,7 @@ public:
...
@@ -93,6 +93,7 @@ public:
void
testFormulaRefUpdateSheets
();
void
testFormulaRefUpdateSheets
();
void
testFormulaRefUpdateMove
();
void
testFormulaRefUpdateMove
();
void
testFormulaRefUpdateNamedExpression
();
void
testFormulaRefUpdateNamedExpression
();
void
testMultipleOperations
();
void
testFuncCOLUMN
();
void
testFuncCOLUMN
();
void
testFuncROW
();
void
testFuncROW
();
void
testFuncSUM
();
void
testFuncSUM
();
...
@@ -300,6 +301,7 @@ public:
...
@@ -300,6 +301,7 @@ public:
CPPUNIT_TEST
(
testFormulaRefUpdateSheets
);
CPPUNIT_TEST
(
testFormulaRefUpdateSheets
);
CPPUNIT_TEST
(
testFormulaRefUpdateMove
);
CPPUNIT_TEST
(
testFormulaRefUpdateMove
);
CPPUNIT_TEST
(
testFormulaRefUpdateNamedExpression
);
CPPUNIT_TEST
(
testFormulaRefUpdateNamedExpression
);
CPPUNIT_TEST
(
testMultipleOperations
);
CPPUNIT_TEST
(
testFuncCOLUMN
);
CPPUNIT_TEST
(
testFuncCOLUMN
);
CPPUNIT_TEST
(
testFuncROW
);
CPPUNIT_TEST
(
testFuncROW
);
CPPUNIT_TEST
(
testFuncSUM
);
CPPUNIT_TEST
(
testFuncSUM
);
...
...
sc/qa/unit/ucalc_formula.cxx
Dosyayı görüntüle @
a364a87f
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include "scmod.hxx"
#include "scmod.hxx"
#include "docsh.hxx"
#include "docsh.hxx"
#include "docfunc.hxx"
#include "docfunc.hxx"
#include "paramisc.hxx"
#include "formula/vectortoken.hxx"
#include "formula/vectortoken.hxx"
...
@@ -1308,6 +1309,7 @@ void Test::testFormulaRefUpdateNamedExpression()
...
@@ -1308,6 +1309,7 @@ void Test::testFormulaRefUpdateNamedExpression()
m_pDoc
->
SetValue
(
ScAddress
(
3
,
9
,
1
),
10
);
m_pDoc
->
SetValue
(
ScAddress
(
3
,
9
,
1
),
10
);
CPPUNIT_ASSERT_EQUAL
(
33.0
,
m_pDoc
->
GetValue
(
ScAddress
(
2
,
7
,
1
)));
CPPUNIT_ASSERT_EQUAL
(
33.0
,
m_pDoc
->
GetValue
(
ScAddress
(
2
,
7
,
1
)));
// Delete the inserted sheet, which will shift the 'Formula' sheet to the left.
m_pDoc
->
DeleteTab
(
0
);
m_pDoc
->
DeleteTab
(
0
);
aName
=
OUString
();
aName
=
OUString
();
...
@@ -1341,6 +1343,58 @@ void Test::testFormulaRefUpdateNamedExpression()
...
@@ -1341,6 +1343,58 @@ void Test::testFormulaRefUpdateNamedExpression()
m_pDoc
->
DeleteTab
(
0
);
m_pDoc
->
DeleteTab
(
0
);
}
}
void
Test
::
testMultipleOperations
()
{
m_pDoc
->
InsertTab
(
0
,
"MultiOp"
);
sc
::
AutoCalcSwitch
aACSwitch
(
*
m_pDoc
,
true
);
// turn auto calc on.
// Insert the reference formula at top row.
m_pDoc
->
SetValue
(
ScAddress
(
0
,
0
,
0
),
1
);
m_pDoc
->
SetString
(
ScAddress
(
1
,
0
,
0
),
"=A1*10"
);
CPPUNIT_ASSERT_EQUAL
(
10.0
,
m_pDoc
->
GetValue
(
ScAddress
(
1
,
0
,
0
)));
// Insert variable inputs in A3:A5.
m_pDoc
->
SetValue
(
ScAddress
(
0
,
2
,
0
),
2
);
m_pDoc
->
SetValue
(
ScAddress
(
0
,
3
,
0
),
3
);
m_pDoc
->
SetValue
(
ScAddress
(
0
,
4
,
0
),
4
);
// Set multiple operations range.
ScTabOpParam
aParam
;
aParam
.
aRefFormulaCell
=
ScRefAddress
(
1
,
0
,
0
,
false
,
false
,
false
);
aParam
.
aRefFormulaEnd
=
aParam
.
aRefFormulaCell
;
aParam
.
aRefColCell
=
ScRefAddress
(
0
,
0
,
0
,
false
,
false
,
false
);
ScMarkData
aMark
;
aMark
.
SetMarkArea
(
ScRange
(
0
,
2
,
0
,
1
,
4
,
0
));
// Select A3:B5.
m_pDoc
->
InsertTableOp
(
aParam
,
0
,
2
,
1
,
4
,
aMark
);
CPPUNIT_ASSERT_EQUAL
(
20.0
,
m_pDoc
->
GetValue
(
1
,
2
,
0
));
CPPUNIT_ASSERT_EQUAL
(
30.0
,
m_pDoc
->
GetValue
(
1
,
3
,
0
));
CPPUNIT_ASSERT_EQUAL
(
40.0
,
m_pDoc
->
GetValue
(
1
,
4
,
0
));
// Clear A3:B5.
clearRange
(
m_pDoc
,
ScRange
(
0
,
2
,
0
,
1
,
4
,
0
));
// This time, use indirect reference formula cell.
m_pDoc
->
SetString
(
ScAddress
(
2
,
0
,
0
),
"=B1"
);
// C1 simply references B1.
CPPUNIT_ASSERT_EQUAL
(
10.0
,
m_pDoc
->
GetValue
(
ScAddress
(
2
,
0
,
0
)));
// Insert variable inputs in A3:A5.
m_pDoc
->
SetValue
(
ScAddress
(
0
,
2
,
0
),
3
);
m_pDoc
->
SetValue
(
ScAddress
(
0
,
3
,
0
),
4
);
m_pDoc
->
SetValue
(
ScAddress
(
0
,
4
,
0
),
5
);
// Set multiple operations range again, but this time, we'll use C1 as the reference formula.
aParam
.
aRefFormulaCell
.
Set
(
2
,
0
,
0
,
false
,
false
,
false
);
aParam
.
aRefFormulaEnd
=
aParam
.
aRefFormulaCell
;
m_pDoc
->
InsertTableOp
(
aParam
,
0
,
2
,
1
,
4
,
aMark
);
#if 0 // TODO: Make this pass.
CPPUNIT_ASSERT_EQUAL(30.0, m_pDoc->GetValue(1,2,0));
CPPUNIT_ASSERT_EQUAL(40.0, m_pDoc->GetValue(1,3,0));
CPPUNIT_ASSERT_EQUAL(50.0, m_pDoc->GetValue(1,4,0));
#endif
m_pDoc
->
DeleteTab
(
0
);
}
void
Test
::
testFuncCOLUMN
()
void
Test
::
testFuncCOLUMN
()
{
{
m_pDoc
->
InsertTab
(
0
,
"Formula"
);
m_pDoc
->
InsertTab
(
0
,
"Formula"
);
...
...
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