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
03075bfa
Kaydet (Commit)
03075bfa
authored
Eki 19, 2014
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#82047: Write test for this.
Change-Id: I0e5e54b517d3fb3cb28eb133b2cbe5bf5ca6b1d6
üst
2f821f3b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
0 deletions
+76
-0
ucalc.hxx
sc/qa/unit/ucalc.hxx
+2
-0
ucalc_formula.cxx
sc/qa/unit/ucalc_formula.cxx
+74
-0
No files found.
sc/qa/unit/ucalc.hxx
Dosyayı görüntüle @
03075bfa
...
@@ -136,6 +136,7 @@ public:
...
@@ -136,6 +136,7 @@ public:
void
testFormulaRefUpdateName
();
void
testFormulaRefUpdateName
();
void
testFormulaRefUpdateNameMove
();
void
testFormulaRefUpdateNameMove
();
void
testFormulaRefUpdateNameExpandRef
();
void
testFormulaRefUpdateNameExpandRef
();
void
testFormulaRefUpdateNameDeleteRow
();
void
testFormulaRefUpdateValidity
();
void
testFormulaRefUpdateValidity
();
void
testMultipleOperations
();
void
testMultipleOperations
();
void
testFuncCOLUMN
();
void
testFuncCOLUMN
();
...
@@ -428,6 +429,7 @@ public:
...
@@ -428,6 +429,7 @@ public:
CPPUNIT_TEST
(
testFormulaRefUpdateName
);
CPPUNIT_TEST
(
testFormulaRefUpdateName
);
CPPUNIT_TEST
(
testFormulaRefUpdateNameMove
);
CPPUNIT_TEST
(
testFormulaRefUpdateNameMove
);
CPPUNIT_TEST
(
testFormulaRefUpdateNameExpandRef
);
CPPUNIT_TEST
(
testFormulaRefUpdateNameExpandRef
);
CPPUNIT_TEST
(
testFormulaRefUpdateNameDeleteRow
);
CPPUNIT_TEST
(
testFormulaRefUpdateValidity
);
CPPUNIT_TEST
(
testFormulaRefUpdateValidity
);
CPPUNIT_TEST
(
testMultipleOperations
);
CPPUNIT_TEST
(
testMultipleOperations
);
CPPUNIT_TEST
(
testFuncCOLUMN
);
CPPUNIT_TEST
(
testFuncCOLUMN
);
...
...
sc/qa/unit/ucalc_formula.cxx
Dosyayı görüntüle @
03075bfa
...
@@ -2285,6 +2285,80 @@ void Test::testFormulaRefUpdateNameExpandRef()
...
@@ -2285,6 +2285,80 @@ void Test::testFormulaRefUpdateNameExpandRef()
m_pDoc
->
DeleteTab
(
0
);
m_pDoc
->
DeleteTab
(
0
);
}
}
void
Test
::
testFormulaRefUpdateNameDeleteRow
()
{
m_pDoc
->
InsertTab
(
0
,
"Test"
);
// Insert a new name 'MyRange' to reference B2:B4.
bool
bInserted
=
m_pDoc
->
InsertNewRangeName
(
"MyRange"
,
ScAddress
(
0
,
0
,
0
),
"$B$2:$B$4"
);
CPPUNIT_ASSERT
(
bInserted
);
const
ScRangeData
*
pName
=
m_pDoc
->
GetRangeName
()
->
findByUpperName
(
"MYRANGE"
);
CPPUNIT_ASSERT
(
pName
);
sc
::
TokenStringContext
aCxt
(
m_pDoc
,
formula
::
FormulaGrammar
::
GRAM_ENGLISH
);
const
ScTokenArray
*
pCode
=
pName
->
GetCode
();
OUString
aExpr
=
pCode
->
CreateString
(
aCxt
,
ScAddress
(
0
,
0
,
0
));
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"$B$2:$B$4"
),
aExpr
);
ScDocFunc
&
rFunc
=
getDocShell
().
GetDocFunc
();
// Delete row 3.
ScMarkData
aMark
;
aMark
.
SelectOneTable
(
0
);
rFunc
.
DeleteCells
(
ScRange
(
0
,
2
,
0
,
MAXCOL
,
2
,
0
),
&
aMark
,
DEL_CELLSUP
,
true
,
true
);
// The reference in the name should get updated to B2:B3.
aExpr
=
pCode
->
CreateString
(
aCxt
,
ScAddress
(
0
,
0
,
0
));
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"$B$2:$B$3"
),
aExpr
);
// Delete row 3 again.
rFunc
.
DeleteCells
(
ScRange
(
0
,
2
,
0
,
MAXCOL
,
2
,
0
),
&
aMark
,
DEL_CELLSUP
,
true
,
true
);
aExpr
=
pCode
->
CreateString
(
aCxt
,
ScAddress
(
0
,
0
,
0
));
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"$B$2:$B$2"
),
aExpr
);
// Undo and check.
SfxUndoManager
*
pUndoMgr
=
m_pDoc
->
GetUndoManager
();
CPPUNIT_ASSERT
(
pUndoMgr
);
pUndoMgr
->
Undo
();
pName
=
m_pDoc
->
GetRangeName
()
->
findByUpperName
(
"MYRANGE"
);
CPPUNIT_ASSERT
(
pName
);
pCode
=
pName
->
GetCode
();
aExpr
=
pCode
->
CreateString
(
aCxt
,
ScAddress
(
0
,
0
,
0
));
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"$B$2:$B$3"
),
aExpr
);
// Undo again and check.
pUndoMgr
->
Undo
();
pName
=
m_pDoc
->
GetRangeName
()
->
findByUpperName
(
"MYRANGE"
);
CPPUNIT_ASSERT
(
pName
);
pCode
=
pName
->
GetCode
();
aExpr
=
pCode
->
CreateString
(
aCxt
,
ScAddress
(
0
,
0
,
0
));
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"$B$2:$B$4"
),
aExpr
);
// Delete row 2-3.
rFunc
.
DeleteCells
(
ScRange
(
0
,
1
,
0
,
MAXCOL
,
2
,
0
),
&
aMark
,
DEL_CELLSUP
,
true
,
true
);
aExpr
=
pCode
->
CreateString
(
aCxt
,
ScAddress
(
0
,
0
,
0
));
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"$B$2:$B$2"
),
aExpr
);
// Undo and check.
pUndoMgr
->
Undo
();
pName
=
m_pDoc
->
GetRangeName
()
->
findByUpperName
(
"MYRANGE"
);
CPPUNIT_ASSERT
(
pName
);
pCode
=
pName
->
GetCode
();
aExpr
=
pCode
->
CreateString
(
aCxt
,
ScAddress
(
0
,
0
,
0
));
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"$B$2:$B$4"
),
aExpr
);
m_pDoc
->
DeleteTab
(
0
);
}
void
Test
::
testFormulaRefUpdateValidity
()
void
Test
::
testFormulaRefUpdateValidity
()
{
{
struct
{
struct
{
...
...
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