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
fedb28e8
Kaydet (Commit)
fedb28e8
authored
Mar 18, 2013
tarafından
Michael Meeks
Kaydeden (comit)
Kohei Yoshida
Mar 19, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
add initial formula group unit tests.
Change-Id: Id4dd3cc0d3d8a4db641e316d2eda44a5b94105c7
üst
aed58c04
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
7 deletions
+69
-7
ucalc.cxx
sc/qa/unit/ucalc.cxx
+58
-0
cell2.cxx
sc/source/core/data/cell2.cxx
+11
-3
column3.cxx
sc/source/core/data/column3.cxx
+0
-4
No files found.
sc/qa/unit/ucalc.cxx
Dosyayı görüntüle @
fedb28e8
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include <osl/file.hxx>
#include <osl/file.hxx>
#include "scdll.hxx"
#include "scdll.hxx"
#include "cell.hxx"
#include "document.hxx"
#include "document.hxx"
#include "stringutil.hxx"
#include "stringutil.hxx"
#include "scmatrix.hxx"
#include "scmatrix.hxx"
...
@@ -266,6 +267,11 @@ public:
...
@@ -266,6 +267,11 @@ public:
void
testAnchoredRotatedShape
();
void
testAnchoredRotatedShape
();
void
testCellTextWidth
();
void
testCellTextWidth
();
/**
* Test formula & formula grouping
*/
void
testFormulaGrouping
();
CPPUNIT_TEST_SUITE
(
Test
);
CPPUNIT_TEST_SUITE
(
Test
);
CPPUNIT_TEST
(
testCollator
);
CPPUNIT_TEST
(
testCollator
);
CPPUNIT_TEST
(
testRangeList
);
CPPUNIT_TEST
(
testRangeList
);
...
@@ -328,6 +334,7 @@ public:
...
@@ -328,6 +334,7 @@ public:
CPPUNIT_TEST
(
testDeleteCol
);
CPPUNIT_TEST
(
testDeleteCol
);
CPPUNIT_TEST
(
testAnchoredRotatedShape
);
CPPUNIT_TEST
(
testAnchoredRotatedShape
);
CPPUNIT_TEST
(
testCellTextWidth
);
CPPUNIT_TEST
(
testCellTextWidth
);
CPPUNIT_TEST
(
testFormulaGrouping
);
CPPUNIT_TEST_SUITE_END
();
CPPUNIT_TEST_SUITE_END
();
private
:
private
:
...
@@ -6174,6 +6181,57 @@ void Test::testCellTextWidth()
...
@@ -6174,6 +6181,57 @@ void Test::testCellTextWidth()
m_pDoc
->
DeleteTab
(
0
);
m_pDoc
->
DeleteTab
(
0
);
}
}
void
Test
::
testFormulaGrouping
()
{
static
const
struct
{
const
char
*
pFormula
[
3
];
const
bool
bGroup
[
3
];
}
aGroupTests
[]
=
{
{
{
"=B1"
,
"=C1"
,
""
},
// single increments
{
true
,
true
,
false
}
},
{
{
"=B1"
,
"=D1"
,
"=F1"
},
// tripple increments
{
true
,
true
,
true
}
},
{
{
"=B1"
,
""
,
"=C1"
},
// a gap
{
false
,
false
,
false
}
},
{
{
"=B1"
,
"=C1+3"
,
"=C1+D1"
},
// confusion: FIXME: =C1+7
{
false
,
false
,
false
}
},
};
m_pDoc
->
InsertTab
(
0
,
"sheet"
);
for
(
size_t
i
=
0
;
i
<
SAL_N_ELEMENTS
(
aGroupTests
);
i
++
)
{
for
(
size_t
j
=
0
;
j
<
SAL_N_ELEMENTS
(
aGroupTests
[
0
].
pFormula
);
j
++
)
{
OUString
aFormula
=
OUString
::
createFromAscii
(
aGroupTests
[
i
].
pFormula
[
j
]);
m_pDoc
->
SetString
(
0
,
(
SCROW
)
j
,
0
,
aFormula
);
}
m_pDoc
->
RebuildFormulaGroups
();
for
(
size_t
j
=
0
;
j
<
SAL_N_ELEMENTS
(
aGroupTests
[
0
].
pFormula
);
j
++
)
{
ScBaseCell
*
pCell
=
NULL
;
m_pDoc
->
GetCell
(
0
,
(
SCROW
)
j
,
0
,
pCell
);
if
(
!
pCell
)
{
CPPUNIT_ASSERT_MESSAGE
(
"invalid empty cell"
,
!
aGroupTests
[
i
].
bGroup
[
j
]);
continue
;
}
CPPUNIT_ASSERT_MESSAGE
(
"Cell expected, but not there."
,
pCell
!=
NULL
);
CPPUNIT_ASSERT_MESSAGE
(
"Cell wrong type."
,
pCell
->
GetCellType
()
==
CELLTYPE_FORMULA
);
ScFormulaCell
*
pCur
=
static_cast
<
ScFormulaCell
*>
(
pCell
);
if
(
!!
pCur
->
GetCellGroup
().
get
()
^
aGroupTests
[
i
].
bGroup
[
j
]
)
{
printf
(
"expected group test %d at row %d to be %d but is %d
\n
"
,
i
,
j
,
!!
pCur
->
GetCellGroup
().
get
(),
aGroupTests
[
i
].
bGroup
[
j
]);
CPPUNIT_ASSERT_MESSAGE
(
"Failed"
,
false
);
}
}
}
}
CPPUNIT_TEST_SUITE_REGISTRATION
(
Test
);
CPPUNIT_TEST_SUITE_REGISTRATION
(
Test
);
}
}
...
...
sc/source/core/data/cell2.cxx
Dosyayı görüntüle @
fedb28e8
...
@@ -1752,11 +1752,15 @@ ScSimilarFormulaDelta *ScFormulaCell::BuildDeltaTo( ScFormulaCell *pOtherCell )
...
@@ -1752,11 +1752,15 @@ ScSimilarFormulaDelta *ScFormulaCell::BuildDeltaTo( ScFormulaCell *pOtherCell )
fprintf
(
stderr
,
"Incompatible type, op-code or param counts
\n
"
);
fprintf
(
stderr
,
"Incompatible type, op-code or param counts
\n
"
);
return
NULL
;
return
NULL
;
}
}
if
(
pThis
[
i
]
->
GetType
()
==
formula
::
svMatrix
||
switch
(
pThis
[
i
]
->
GetType
()
)
pOther
[
i
]
->
GetType
()
==
formula
::
svMatrix
)
{
{
fprintf
(
stderr
,
"Ignoring matrix formulae for now
\n
"
);
case
formula
:
:
svMatrix
:
case
formula
:
:
svExternalSingleRef
:
case
formula
:
:
svExternalDoubleRef
:
fprintf
(
stderr
,
"Ignoring matrix and external references for now
\n
"
);
return
NULL
;
return
NULL
;
default
:
break
;
}
}
}
}
...
@@ -1765,6 +1769,10 @@ ScSimilarFormulaDelta *ScFormulaCell::BuildDeltaTo( ScFormulaCell *pOtherCell )
...
@@ -1765,6 +1769,10 @@ ScSimilarFormulaDelta *ScFormulaCell::BuildDeltaTo( ScFormulaCell *pOtherCell )
for
(
sal_uInt16
i
=
0
;
i
<
pThisLen
;
i
++
)
for
(
sal_uInt16
i
=
0
;
i
<
pThisLen
;
i
++
)
{
{
if
(
pThis
[
i
]
->
GetType
()
!=
formula
::
svSingleRef
&&
pThis
[
i
]
->
GetType
()
!=
formula
::
svDoubleRef
)
continue
;
ScToken
*
pThisTok
=
static_cast
<
ScToken
*
>
(
pThis
[
i
]
);
ScToken
*
pThisTok
=
static_cast
<
ScToken
*
>
(
pThis
[
i
]
);
ScToken
*
pOtherTok
=
static_cast
<
ScToken
*
>
(
pOther
[
i
]
);
ScToken
*
pOtherTok
=
static_cast
<
ScToken
*
>
(
pOther
[
i
]
);
...
...
sc/source/core/data/column3.cxx
Dosyayı görüntüle @
fedb28e8
...
@@ -2036,7 +2036,6 @@ void ScColumn::RebuildFormulaGroups()
...
@@ -2036,7 +2036,6 @@ void ScColumn::RebuildFormulaGroups()
ScFormulaCell
*
pCur
=
static_cast
<
ScFormulaCell
*>
(
rCur
.
pCell
);
ScFormulaCell
*
pCur
=
static_cast
<
ScFormulaCell
*>
(
rCur
.
pCell
);
ScFormulaCell
*
pPrev
=
static_cast
<
ScFormulaCell
*>
(
rPrev
.
pCell
);
ScFormulaCell
*
pPrev
=
static_cast
<
ScFormulaCell
*>
(
rPrev
.
pCell
);
#ifdef BUILD_FORMULA_GROUPS
fprintf
(
stderr
,
"column has contiguous formulae
\n
"
);
fprintf
(
stderr
,
"column has contiguous formulae
\n
"
);
ScSimilarFormulaDelta
*
pDelta
=
pPrev
->
BuildDeltaTo
(
pCur
);
ScSimilarFormulaDelta
*
pDelta
=
pPrev
->
BuildDeltaTo
(
pCur
);
...
@@ -2081,9 +2080,6 @@ void ScColumn::RebuildFormulaGroups()
...
@@ -2081,9 +2080,6 @@ void ScColumn::RebuildFormulaGroups()
pCur
->
ReleaseDelta
(
pDelta
);
pCur
->
ReleaseDelta
(
pDelta
);
}
}
#else
(
void
)
pCur
;
(
void
)
pPrev
;
#endif
}
}
bDirtyGroups
=
false
;
bDirtyGroups
=
false
;
...
...
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