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
8c3b6b34
Kaydet (Commit)
8c3b6b34
authored
Ock 16, 2014
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#73655: Write unit test for this.
Change-Id: I0409e3c482d8a833672f41b1398333e5181847af
üst
982a03d4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
1 deletion
+84
-1
qahelper.cxx
sc/qa/unit/helper/qahelper.cxx
+1
-1
ucalc.hxx
sc/qa/unit/ucalc.hxx
+2
-0
ucalc_sharedformula.cxx
sc/qa/unit/ucalc_sharedformula.cxx
+81
-0
No files found.
sc/qa/unit/helper/qahelper.cxx
Dosyayı görüntüle @
8c3b6b34
...
@@ -420,7 +420,7 @@ bool checkFormula(ScDocument& rDoc, const ScAddress& rPos, const char* pExpected
...
@@ -420,7 +420,7 @@ bool checkFormula(ScDocument& rDoc, const ScAddress& rPos, const char* pExpected
return
false
;
return
false
;
}
}
OUString
aFormula
=
toString
(
rDoc
,
rPos
,
*
pCode
);
OUString
aFormula
=
toString
(
rDoc
,
rPos
,
*
pCode
,
rDoc
.
GetGrammar
()
);
if
(
aFormula
!=
OUString
::
createFromAscii
(
pExpected
))
if
(
aFormula
!=
OUString
::
createFromAscii
(
pExpected
))
{
{
cerr
<<
"Formula '"
<<
pExpected
<<
"' expected, but '"
<<
aFormula
<<
"' found"
<<
endl
;
cerr
<<
"Formula '"
<<
pExpected
<<
"' expected, but '"
<<
aFormula
<<
"' found"
<<
endl
;
...
...
sc/qa/unit/ucalc.hxx
Dosyayı görüntüle @
8c3b6b34
...
@@ -246,6 +246,7 @@ public:
...
@@ -246,6 +246,7 @@ public:
void
testSharedFormulasRefUpdate
();
void
testSharedFormulasRefUpdate
();
void
testSharedFormulasRefUpdateRange
();
void
testSharedFormulasRefUpdateRange
();
void
testSharedFormulasDeleteRows
();
void
testSharedFormulasDeleteRows
();
void
testSharedFormulasRefUpdateMoveSheets
();
void
testSharedFormulasCopyPaste
();
void
testSharedFormulasCopyPaste
();
void
testFormulaPosition
();
void
testFormulaPosition
();
...
@@ -396,6 +397,7 @@ public:
...
@@ -396,6 +397,7 @@ public:
CPPUNIT_TEST
(
testSharedFormulasRefUpdate
);
CPPUNIT_TEST
(
testSharedFormulasRefUpdate
);
CPPUNIT_TEST
(
testSharedFormulasRefUpdateRange
);
CPPUNIT_TEST
(
testSharedFormulasRefUpdateRange
);
CPPUNIT_TEST
(
testSharedFormulasDeleteRows
);
CPPUNIT_TEST
(
testSharedFormulasDeleteRows
);
CPPUNIT_TEST
(
testSharedFormulasRefUpdateMoveSheets
);
CPPUNIT_TEST
(
testSharedFormulasCopyPaste
);
CPPUNIT_TEST
(
testSharedFormulasCopyPaste
);
CPPUNIT_TEST
(
testFormulaPosition
);
CPPUNIT_TEST
(
testFormulaPosition
);
CPPUNIT_TEST
(
testJumpToPrecedentsDependents
);
CPPUNIT_TEST
(
testJumpToPrecedentsDependents
);
...
...
sc/qa/unit/ucalc_sharedformula.cxx
Dosyayı görüntüle @
8c3b6b34
...
@@ -515,7 +515,88 @@ void Test::testSharedFormulasDeleteRows()
...
@@ -515,7 +515,88 @@ void Test::testSharedFormulasDeleteRows()
CPPUNIT_ASSERT_MESSAGE
(
"1,6 must be a shared formula cell."
,
pFC
&&
pFC
->
IsShared
());
CPPUNIT_ASSERT_MESSAGE
(
"1,6 must be a shared formula cell."
,
pFC
&&
pFC
->
IsShared
());
CPPUNIT_ASSERT_EQUAL
(
static_cast
<
SCROW
>
(
6
),
pFC
->
GetSharedTopRow
());
CPPUNIT_ASSERT_EQUAL
(
static_cast
<
SCROW
>
(
6
),
pFC
->
GetSharedTopRow
());
CPPUNIT_ASSERT_EQUAL
(
static_cast
<
SCROW
>
(
8
),
pFC
->
GetSharedLength
());
CPPUNIT_ASSERT_EQUAL
(
static_cast
<
SCROW
>
(
8
),
pFC
->
GetSharedLength
());
}
void
Test
::
testSharedFormulasRefUpdateMoveSheets
()
{
m_pDoc
->
InsertTab
(
0
,
"Sheet1"
);
m_pDoc
->
InsertTab
(
1
,
"Sheet2"
);
m_pDoc
->
InsertTab
(
2
,
"Sheet3"
);
sc
::
AutoCalcSwitch
aACSwitch
(
*
m_pDoc
,
true
);
// make sure auto calc is on.
// Switch to R1C1 for ease of repeated formula insertions.
FormulaGrammarSwitch
aFGSwitch
(
m_pDoc
,
formula
::
FormulaGrammar
::
GRAM_ENGLISH_XL_R1C1
);
// Fill numbers in A1:A8 on Sheet2.
for
(
SCROW
i
=
0
;
i
<=
7
;
++
i
)
m_pDoc
->
SetValue
(
ScAddress
(
0
,
i
,
1
),
i
+
1
);
// Fill formula cells A1:A8 on Sheet1, to refer to the same cell address on Sheet2.
for
(
SCROW
i
=
0
;
i
<=
7
;
++
i
)
m_pDoc
->
SetString
(
ScAddress
(
0
,
i
,
0
),
"=Sheet2!RC"
);
// Check the results.
for
(
SCROW
i
=
0
;
i
<=
7
;
++
i
)
CPPUNIT_ASSERT_EQUAL
(
static_cast
<
double
>
(
i
+
1
),
m_pDoc
->
GetValue
(
ScAddress
(
0
,
i
,
0
)));
// Move Sheet3 to the leftmost position before Sheet1.
m_pDoc
->
MoveTab
(
2
,
0
);
// Check sheet names.
std
::
vector
<
OUString
>
aTabNames
=
m_pDoc
->
GetAllTableNames
();
CPPUNIT_ASSERT_MESSAGE
(
"There should be at least 3 sheets."
,
aTabNames
.
size
()
>=
3
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Sheet3"
),
aTabNames
[
0
]);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Sheet1"
),
aTabNames
[
1
]);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Sheet2"
),
aTabNames
[
2
]);
// Check the results again on Sheet1.
for
(
SCROW
i
=
0
;
i
<=
7
;
++
i
)
{
CPPUNIT_ASSERT_EQUAL
(
static_cast
<
double
>
(
i
+
1
),
m_pDoc
->
GetValue
(
ScAddress
(
0
,
i
,
1
)));
if
(
!
checkFormula
(
*
m_pDoc
,
ScAddress
(
0
,
i
,
1
),
"Sheet2!RC"
))
CPPUNIT_FAIL
(
"Wrong formula expression."
);
}
// Insert a new sheet at the left end.
m_pDoc
->
InsertTab
(
0
,
"Sheet4"
);
// Check sheet names.
aTabNames
=
m_pDoc
->
GetAllTableNames
();
CPPUNIT_ASSERT_MESSAGE
(
"There should be at least 4 sheets."
,
aTabNames
.
size
()
>=
4
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Sheet4"
),
aTabNames
[
0
]);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Sheet3"
),
aTabNames
[
1
]);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Sheet1"
),
aTabNames
[
2
]);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Sheet2"
),
aTabNames
[
3
]);
// Check the results again on Sheet1.
for
(
SCROW
i
=
0
;
i
<=
7
;
++
i
)
{
CPPUNIT_ASSERT_EQUAL
(
static_cast
<
double
>
(
i
+
1
),
m_pDoc
->
GetValue
(
ScAddress
(
0
,
i
,
2
)));
if
(
!
checkFormula
(
*
m_pDoc
,
ScAddress
(
0
,
i
,
2
),
"Sheet2!RC"
))
CPPUNIT_FAIL
(
"Wrong formula expression."
);
}
// Delete Sheet4.
m_pDoc
->
DeleteTab
(
0
);
// Check sheet names.
aTabNames
=
m_pDoc
->
GetAllTableNames
();
CPPUNIT_ASSERT_MESSAGE
(
"There should be at least 3 sheets."
,
aTabNames
.
size
()
>=
3
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Sheet3"
),
aTabNames
[
0
]);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Sheet1"
),
aTabNames
[
1
]);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Sheet2"
),
aTabNames
[
2
]);
// Check the results again on Sheet1.
for
(
SCROW
i
=
0
;
i
<=
7
;
++
i
)
{
CPPUNIT_ASSERT_EQUAL
(
static_cast
<
double
>
(
i
+
1
),
m_pDoc
->
GetValue
(
ScAddress
(
0
,
i
,
1
)));
if
(
!
checkFormula
(
*
m_pDoc
,
ScAddress
(
0
,
i
,
1
),
"Sheet2!RC"
))
CPPUNIT_FAIL
(
"Wrong formula expression."
);
}
m_pDoc
->
DeleteTab
(
2
);
m_pDoc
->
DeleteTab
(
1
);
m_pDoc
->
DeleteTab
(
0
);
m_pDoc
->
DeleteTab
(
0
);
}
}
...
...
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