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
a0b9200e
Kaydet (Commit)
a0b9200e
authored
Tem 28, 2014
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#79578: Write test for this first.
Change-Id: I46ccf0954f9397779244132488d93f3162cf04d6
üst
ab409bf7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
0 deletions
+70
-0
ucalc.hxx
sc/qa/unit/ucalc.hxx
+2
-0
ucalc_sharedformula.cxx
sc/qa/unit/ucalc_sharedformula.cxx
+68
-0
No files found.
sc/qa/unit/ucalc.hxx
Dosyayı görüntüle @
a0b9200e
...
@@ -299,6 +299,7 @@ public:
...
@@ -299,6 +299,7 @@ public:
void
testSharedFormulaInsertColumn
();
void
testSharedFormulaInsertColumn
();
void
testSharedFormulaMoveBlock
();
void
testSharedFormulaMoveBlock
();
void
testSharedFormulaUpdateOnNamedRangeChange
();
void
testSharedFormulaUpdateOnNamedRangeChange
();
void
testSharedFormulaUpdateOnDBChange
();
void
testFormulaPosition
();
void
testFormulaPosition
();
void
testMixData
();
void
testMixData
();
...
@@ -503,6 +504,7 @@ public:
...
@@ -503,6 +504,7 @@ public:
CPPUNIT_TEST
(
testSharedFormulasCopyPaste
);
CPPUNIT_TEST
(
testSharedFormulasCopyPaste
);
CPPUNIT_TEST
(
testSharedFormulaInsertColumn
);
CPPUNIT_TEST
(
testSharedFormulaInsertColumn
);
CPPUNIT_TEST
(
testSharedFormulaUpdateOnNamedRangeChange
);
CPPUNIT_TEST
(
testSharedFormulaUpdateOnNamedRangeChange
);
CPPUNIT_TEST
(
testSharedFormulaUpdateOnDBChange
);
CPPUNIT_TEST
(
testFormulaPosition
);
CPPUNIT_TEST
(
testFormulaPosition
);
CPPUNIT_TEST
(
testMixData
);
CPPUNIT_TEST
(
testMixData
);
CPPUNIT_TEST
(
testJumpToPrecedentsDependents
);
CPPUNIT_TEST
(
testJumpToPrecedentsDependents
);
...
...
sc/qa/unit/ucalc_sharedformula.cxx
Dosyayı görüntüle @
a0b9200e
...
@@ -16,9 +16,11 @@
...
@@ -16,9 +16,11 @@
#include "undoblk.hxx"
#include "undoblk.hxx"
#include "scopetools.hxx"
#include "scopetools.hxx"
#include <docfunc.hxx>
#include <docfunc.hxx>
#include <dbdocfun.hxx>
#include <tokenarray.hxx>
#include <tokenarray.hxx>
#include <tokenstringcontext.hxx>
#include <tokenstringcontext.hxx>
#include <globalnames.hxx>
#include <globalnames.hxx>
#include <dbdata.hxx>
#include <svl/sharedstring.hxx>
#include <svl/sharedstring.hxx>
...
@@ -1307,4 +1309,70 @@ void Test::testSharedFormulaUpdateOnNamedRangeChange()
...
@@ -1307,4 +1309,70 @@ void Test::testSharedFormulaUpdateOnNamedRangeChange()
m_pDoc
->
DeleteTab
(
0
);
m_pDoc
->
DeleteTab
(
0
);
}
}
void
Test
::
testSharedFormulaUpdateOnDBChange
()
{
sc
::
AutoCalcSwitch
aACSwitch
(
*
m_pDoc
,
true
);
// turn on auto calc.
m_pDoc
->
InsertTab
(
0
,
"RangeTest"
);
// Put 1, 2, 3, 4 in A1:A4.
for
(
SCROW
i
=
0
;
i
<=
3
;
++
i
)
m_pDoc
->
SetValue
(
ScAddress
(
0
,
i
,
0
),
(
i
+
1
));
ScDBCollection
*
pDBs
=
m_pDoc
->
GetDBCollection
();
CPPUNIT_ASSERT_MESSAGE
(
"Failed to fetch DB collection object."
,
pDBs
);
// Define database range 'MyRange' for A1:A2.
ScDBData
*
pData
=
new
ScDBData
(
"MyRange"
,
0
,
0
,
0
,
0
,
1
);
bool
bInserted
=
pDBs
->
getNamedDBs
().
insert
(
pData
);
CPPUNIT_ASSERT_MESSAGE
(
"Failed to insert a new database range."
,
bInserted
);
// Insert in C2:C4 a group of formula cells that reference MyRange.
for
(
SCROW
i
=
1
;
i
<=
3
;
++
i
)
m_pDoc
->
SetString
(
ScAddress
(
2
,
i
,
0
),
"=SUM(MyRange)"
);
// Make sure C2:C4 is a formula group.
const
ScFormulaCell
*
pFC
=
m_pDoc
->
GetFormulaCell
(
ScAddress
(
2
,
1
,
0
));
CPPUNIT_ASSERT
(
pFC
);
CPPUNIT_ASSERT
(
pFC
->
IsSharedTop
());
CPPUNIT_ASSERT_EQUAL
(
static_cast
<
SCROW
>
(
3
),
pFC
->
GetSharedLength
());
// Check the initial formula results.
CPPUNIT_ASSERT_EQUAL
(
3.0
,
m_pDoc
->
GetValue
(
ScAddress
(
2
,
1
,
0
)));
CPPUNIT_ASSERT_EQUAL
(
3.0
,
m_pDoc
->
GetValue
(
ScAddress
(
2
,
2
,
0
)));
CPPUNIT_ASSERT_EQUAL
(
3.0
,
m_pDoc
->
GetValue
(
ScAddress
(
2
,
3
,
0
)));
ScDBDocFunc
aFunc
(
getDocShell
());
// Change the range referenced by MyRange to A1:A4.
ScDBCollection
aNewDBs
(
m_pDoc
);
bInserted
=
aNewDBs
.
getNamedDBs
().
insert
(
new
ScDBData
(
"MyRange"
,
0
,
0
,
0
,
0
,
3
));
CPPUNIT_ASSERT_MESSAGE
(
"Failed to insert a new database range."
,
bInserted
);
std
::
vector
<
ScRange
>
aDeleted
;
aFunc
.
ModifyAllDBData
(
aNewDBs
,
aDeleted
);
// Check the updated formula results.
CPPUNIT_ASSERT_EQUAL
(
10.0
,
m_pDoc
->
GetValue
(
ScAddress
(
2
,
1
,
0
)));
CPPUNIT_ASSERT_EQUAL
(
10.0
,
m_pDoc
->
GetValue
(
ScAddress
(
2
,
2
,
0
)));
CPPUNIT_ASSERT_EQUAL
(
10.0
,
m_pDoc
->
GetValue
(
ScAddress
(
2
,
3
,
0
)));
SfxUndoManager
*
pUndoMgr
=
m_pDoc
->
GetUndoManager
();
CPPUNIT_ASSERT
(
pUndoMgr
);
// Undo and check the results.
pUndoMgr
->
Undo
();
CPPUNIT_ASSERT_EQUAL
(
3.0
,
m_pDoc
->
GetValue
(
ScAddress
(
2
,
1
,
0
)));
CPPUNIT_ASSERT_EQUAL
(
3.0
,
m_pDoc
->
GetValue
(
ScAddress
(
2
,
2
,
0
)));
CPPUNIT_ASSERT_EQUAL
(
3.0
,
m_pDoc
->
GetValue
(
ScAddress
(
2
,
3
,
0
)));
// Redo and check the results.
pUndoMgr
->
Redo
();
CPPUNIT_ASSERT_EQUAL
(
10.0
,
m_pDoc
->
GetValue
(
ScAddress
(
2
,
1
,
0
)));
CPPUNIT_ASSERT_EQUAL
(
10.0
,
m_pDoc
->
GetValue
(
ScAddress
(
2
,
2
,
0
)));
CPPUNIT_ASSERT_EQUAL
(
10.0
,
m_pDoc
->
GetValue
(
ScAddress
(
2
,
3
,
0
)));
m_pDoc
->
DeleteTab
(
0
);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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