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
48631bde
Kaydet (Commit)
48631bde
authored
May 06, 2014
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#77647: Test for reference adjustment on column insertion.
Change-Id: Ic95ff3892efbfc003ae9976b4fba4129de11bbef
üst
166c282e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
16 deletions
+53
-16
ucalc.cxx
sc/qa/unit/ucalc.cxx
+9
-0
ucalc.hxx
sc/qa/unit/ucalc.hxx
+8
-0
ucalc_formula.cxx
sc/qa/unit/ucalc_formula.cxx
+36
-16
No files found.
sc/qa/unit/ucalc.cxx
Dosyayı görüntüle @
48631bde
...
@@ -62,6 +62,7 @@
...
@@ -62,6 +62,7 @@
#include <patattr.hxx>
#include <patattr.hxx>
#include <docpool.hxx>
#include <docpool.hxx>
#include <globalnames.hxx>
#include <globalnames.hxx>
#include <inputopt.hxx>
#include "formula/IFunctionDescription.hxx"
#include "formula/IFunctionDescription.hxx"
...
@@ -6139,6 +6140,14 @@ ScUndoPaste* Test::createUndoPaste(ScDocShell& rDocSh, const ScRange& rRange, Sc
...
@@ -6139,6 +6140,14 @@ ScUndoPaste* Test::createUndoPaste(ScDocShell& rDocSh, const ScRange& rRange, Sc
&
rDocSh
,
rRange
,
aMarkData
,
pUndoDoc
,
NULL
,
IDF_ALL
,
pRefUndoData
,
false
);
&
rDocSh
,
rRange
,
aMarkData
,
pUndoDoc
,
NULL
,
IDF_ALL
,
pRefUndoData
,
false
);
}
}
void
Test
::
setExpandRefs
(
bool
bExpand
)
{
ScModule
*
pMod
=
SC_MOD
();
ScInputOptions
aOpt
=
pMod
->
GetInputOptions
();
aOpt
.
SetExpandRefs
(
bExpand
);
pMod
->
SetInputOptions
(
aOpt
);
}
CPPUNIT_TEST_SUITE_REGISTRATION
(
Test
);
CPPUNIT_TEST_SUITE_REGISTRATION
(
Test
);
CPPUNIT_PLUGIN_IMPLEMENT
();
CPPUNIT_PLUGIN_IMPLEMENT
();
...
...
sc/qa/unit/ucalc.hxx
Dosyayı görüntüle @
48631bde
...
@@ -47,6 +47,12 @@ public:
...
@@ -47,6 +47,12 @@ public:
static
void
pasteFromClip
(
ScDocument
*
pDestDoc
,
const
ScRange
&
rDestRange
,
ScDocument
*
pClipDoc
);
static
void
pasteFromClip
(
ScDocument
*
pDestDoc
,
const
ScRange
&
rDestRange
,
ScDocument
*
pClipDoc
);
static
ScUndoPaste
*
createUndoPaste
(
ScDocShell
&
rDocSh
,
const
ScRange
&
rRange
,
ScDocument
*
pUndoDoc
);
static
ScUndoPaste
*
createUndoPaste
(
ScDocShell
&
rDocSh
,
const
ScRange
&
rRange
,
ScDocument
*
pUndoDoc
);
/**
* Enable or disable expand reference options which controls how
* references in formula are expanded when inserting rows or columns.
*/
static
void
setExpandRefs
(
bool
bExpand
);
template
<
size_t
_Size
>
template
<
size_t
_Size
>
static
ScRange
insertRangeData
(
ScDocument
*
pDoc
,
const
ScAddress
&
rPos
,
const
char
*
aData
[][
_Size
],
size_t
nRowCount
)
static
ScRange
insertRangeData
(
ScDocument
*
pDoc
,
const
ScAddress
&
rPos
,
const
char
*
aData
[][
_Size
],
size_t
nRowCount
)
{
{
...
@@ -119,6 +125,7 @@ public:
...
@@ -119,6 +125,7 @@ public:
void
testFormulaRefUpdateRange
();
void
testFormulaRefUpdateRange
();
void
testFormulaRefUpdateSheets
();
void
testFormulaRefUpdateSheets
();
void
testFormulaRefUpdateInsertRows
();
void
testFormulaRefUpdateInsertRows
();
void
testFormulaRefUpdateInsertColumns
();
void
testFormulaRefUpdateMove
();
void
testFormulaRefUpdateMove
();
void
testFormulaRefUpdateMoveUndo
();
void
testFormulaRefUpdateMoveUndo
();
void
testFormulaRefUpdateNamedExpression
();
void
testFormulaRefUpdateNamedExpression
();
...
@@ -375,6 +382,7 @@ public:
...
@@ -375,6 +382,7 @@ public:
CPPUNIT_TEST
(
testFormulaRefUpdateRange
);
CPPUNIT_TEST
(
testFormulaRefUpdateRange
);
CPPUNIT_TEST
(
testFormulaRefUpdateSheets
);
CPPUNIT_TEST
(
testFormulaRefUpdateSheets
);
CPPUNIT_TEST
(
testFormulaRefUpdateInsertRows
);
CPPUNIT_TEST
(
testFormulaRefUpdateInsertRows
);
CPPUNIT_TEST
(
testFormulaRefUpdateInsertColumns
);
CPPUNIT_TEST
(
testFormulaRefUpdateMove
);
CPPUNIT_TEST
(
testFormulaRefUpdateMove
);
CPPUNIT_TEST
(
testFormulaRefUpdateMoveUndo
);
CPPUNIT_TEST
(
testFormulaRefUpdateMoveUndo
);
CPPUNIT_TEST
(
testFormulaRefUpdateNamedExpression
);
CPPUNIT_TEST
(
testFormulaRefUpdateNamedExpression
);
...
...
sc/qa/unit/ucalc_formula.cxx
Dosyayı görüntüle @
48631bde
...
@@ -17,7 +17,6 @@
...
@@ -17,7 +17,6 @@
#include "scopetools.hxx"
#include "scopetools.hxx"
#include "formulacell.hxx"
#include "formulacell.hxx"
#include "formulagroup.hxx"
#include "formulagroup.hxx"
#include "inputopt.hxx"
#include "scmod.hxx"
#include "scmod.hxx"
#include "docsh.hxx"
#include "docsh.hxx"
#include "docfunc.hxx"
#include "docfunc.hxx"
...
@@ -1036,10 +1035,7 @@ void Test::testFormulaRefUpdateRange()
...
@@ -1036,10 +1035,7 @@ void Test::testFormulaRefUpdateRange()
sc
::
AutoCalcSwitch
aACSwitch
(
*
m_pDoc
,
true
);
// turn auto calc on.
sc
::
AutoCalcSwitch
aACSwitch
(
*
m_pDoc
,
true
);
// turn auto calc on.
ScModule
*
pMod
=
SC_MOD
();
setExpandRefs
(
false
);
ScInputOptions
aOpt
=
pMod
->
GetInputOptions
();
aOpt
.
SetExpandRefs
(
false
);
pMod
->
SetInputOptions
(
aOpt
);
// Set values to B2:C5.
// Set values to B2:C5.
m_pDoc
->
SetValue
(
ScAddress
(
1
,
1
,
0
),
1
);
m_pDoc
->
SetValue
(
ScAddress
(
1
,
1
,
0
),
1
);
...
@@ -1166,7 +1162,7 @@ void Test::testFormulaRefUpdateRange()
...
@@ -1166,7 +1162,7 @@ void Test::testFormulaRefUpdateRange()
clearRange
(
m_pDoc
,
ScRange
(
0
,
0
,
0
,
20
,
20
,
0
));
clearRange
(
m_pDoc
,
ScRange
(
0
,
0
,
0
,
20
,
20
,
0
));
// Disable expansion of range reference on insertion in adjacent areas.
// Disable expansion of range reference on insertion in adjacent areas.
m_pDoc
->
S
etExpandRefs
(
false
);
s
etExpandRefs
(
false
);
// Fill C2:D3 with values.
// Fill C2:D3 with values.
m_pDoc
->
SetValue
(
ScAddress
(
2
,
1
,
0
),
1
);
m_pDoc
->
SetValue
(
ScAddress
(
2
,
1
,
0
),
1
);
...
@@ -1251,8 +1247,7 @@ void Test::testFormulaRefUpdateRange()
...
@@ -1251,8 +1247,7 @@ void Test::testFormulaRefUpdateRange()
clearRange
(
m_pDoc
,
ScRange
(
0
,
0
,
0
,
20
,
20
,
0
));
clearRange
(
m_pDoc
,
ScRange
(
0
,
0
,
0
,
20
,
20
,
0
));
// Turn edge expansion on.
// Turn edge expansion on.
aOpt
.
SetExpandRefs
(
true
);
setExpandRefs
(
true
);
pMod
->
SetInputOptions
(
aOpt
);
// Fill C6:D7 with values.
// Fill C6:D7 with values.
m_pDoc
->
SetValue
(
ScAddress
(
2
,
5
,
0
),
1
);
m_pDoc
->
SetValue
(
ScAddress
(
2
,
5
,
0
),
1
);
...
@@ -1479,10 +1474,7 @@ void Test::testFormulaRefUpdateSheets()
...
@@ -1479,10 +1474,7 @@ void Test::testFormulaRefUpdateSheets()
void
Test
::
testFormulaRefUpdateInsertRows
()
void
Test
::
testFormulaRefUpdateInsertRows
()
{
{
ScModule
*
pMod
=
SC_MOD
();
setExpandRefs
(
false
);
ScInputOptions
aOpt
=
pMod
->
GetInputOptions
();
aOpt
.
SetExpandRefs
(
false
);
pMod
->
SetInputOptions
(
aOpt
);
sc
::
AutoCalcSwitch
aACSwitch
(
*
m_pDoc
,
true
);
// turn auto calc on.
sc
::
AutoCalcSwitch
aACSwitch
(
*
m_pDoc
,
true
);
// turn auto calc on.
m_pDoc
->
InsertTab
(
0
,
"Formula"
);
m_pDoc
->
InsertTab
(
0
,
"Formula"
);
...
@@ -1537,6 +1529,37 @@ void Test::testFormulaRefUpdateInsertRows()
...
@@ -1537,6 +1529,37 @@ void Test::testFormulaRefUpdateInsertRows()
m_pDoc
->
DeleteTab
(
0
);
m_pDoc
->
DeleteTab
(
0
);
}
}
void
Test
::
testFormulaRefUpdateInsertColumns
()
{
sc
::
AutoCalcSwitch
aACSwitch
(
*
m_pDoc
,
true
);
// turn auto calc on.
setExpandRefs
(
false
);
m_pDoc
->
InsertTab
(
0
,
"Formula"
);
// Set values in B1:B3.
m_pDoc
->
SetValue
(
ScAddress
(
1
,
0
,
0
),
1.0
);
m_pDoc
->
SetValue
(
ScAddress
(
1
,
1
,
0
),
2.0
);
m_pDoc
->
SetValue
(
ScAddress
(
1
,
2
,
0
),
3.0
);
// Reference them in B4.
m_pDoc
->
SetString
(
ScAddress
(
1
,
3
,
0
),
"=SUM(B1:B3)"
);
CPPUNIT_ASSERT_EQUAL
(
6.0
,
m_pDoc
->
GetValue
(
ScAddress
(
1
,
3
,
0
)));
// Inert columns over A:B.
ScMarkData
aMark
;
aMark
.
SelectOneTable
(
0
);
ScDocFunc
&
rFunc
=
getDocShell
().
GetDocFunc
();
rFunc
.
InsertCells
(
ScRange
(
0
,
0
,
0
,
1
,
MAXROW
,
0
),
&
aMark
,
INS_INSCOLS
,
false
,
true
,
false
);
// Now, the original column B has moved to column D.
if
(
!
checkFormula
(
*
m_pDoc
,
ScAddress
(
3
,
3
,
0
),
"SUM(D1:D3)"
))
CPPUNIT_FAIL
(
"Wrong formula in D4 after column insertion."
);
CPPUNIT_ASSERT_EQUAL
(
6.0
,
m_pDoc
->
GetValue
(
ScAddress
(
3
,
3
,
0
)));
m_pDoc
->
DeleteTab
(
0
);
}
void
Test
::
testFormulaRefUpdateMove
()
void
Test
::
testFormulaRefUpdateMove
()
{
{
m_pDoc
->
InsertTab
(
0
,
"Sheet1"
);
m_pDoc
->
InsertTab
(
0
,
"Sheet1"
);
...
@@ -1982,10 +2005,7 @@ void Test::testFormulaRefUpdateNamedExpressionMove()
...
@@ -1982,10 +2005,7 @@ void Test::testFormulaRefUpdateNamedExpressionMove()
void
Test
::
testFormulaRefUpdateNamedExpressionExpandRef
()
void
Test
::
testFormulaRefUpdateNamedExpressionExpandRef
()
{
{
ScModule
*
pMod
=
SC_MOD
();
setExpandRefs
(
true
);
ScInputOptions
aOpt
=
pMod
->
GetInputOptions
();
aOpt
.
SetExpandRefs
(
true
);
// turn on automatic range expansion.
pMod
->
SetInputOptions
(
aOpt
);
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