summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/mark_test.cxx12
-rw-r--r--sc/qa/unit/ucalc.cxx14
-rw-r--r--sc/qa/unit/ucalc_formula.cxx18
-rw-r--r--sc/qa/unit/ucalc_sharedformula.cxx2
4 files changed, 24 insertions, 22 deletions
diff --git a/sc/qa/unit/mark_test.cxx b/sc/qa/unit/mark_test.cxx
index 6cd63a02de6b..8177d4444170 100644
--- a/sc/qa/unit/mark_test.cxx
+++ b/sc/qa/unit/mark_test.cxx
@@ -165,22 +165,22 @@ void Test::testSimpleMark( const ScRange& rRange, const ScRange& rSelectionCover
SCCOL nOutCol2 = rRange.aStart.Col() - 1;
CPPUNIT_ASSERT( aMark.IsCellMarked( nMidCol, nMidRow ) );
- if ( ValidCol( nOutCol1 ) && ValidRow( nOutRow1 ) )
+ if ( ValidCol( nOutCol1, MAXCOL ) && ValidRow( nOutRow1, MAXROW ) )
CPPUNIT_ASSERT( !aMark.IsCellMarked( nOutCol1, nOutRow1 ) );
- if ( ValidCol( nOutCol2 ) && ValidRow( nOutRow2 ) )
+ if ( ValidCol( nOutCol2, MAXCOL ) && ValidRow( nOutRow2, MAXROW ) )
CPPUNIT_ASSERT( !aMark.IsCellMarked( nOutCol2, nOutRow2 ) );
- if ( ValidRow( nOutRow1 ) )
+ if ( ValidRow( nOutRow1, MAXROW ) )
CPPUNIT_ASSERT( !aMark.IsCellMarked( nMidCol, nOutRow1 ) );
- if ( ValidCol( nOutCol1 ) )
+ if ( ValidCol( nOutCol1, MAXCOL ) )
CPPUNIT_ASSERT( !aMark.IsCellMarked( nOutCol1, nMidRow ) );
- if ( ValidRow( nOutRow2 ) )
+ if ( ValidRow( nOutRow2, MAXROW ) )
CPPUNIT_ASSERT( !aMark.IsCellMarked( nMidCol, nOutRow2 ) );
- if ( ValidCol( nOutCol2 ) )
+ if ( ValidCol( nOutCol2, MAXCOL ) )
CPPUNIT_ASSERT( !aMark.IsCellMarked( nOutCol2, nMidRow ) );
if ( rRange.aStart.Row() == 0 && rRange.aEnd.Row() == MAXROW )
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index e8c643f4d5ba..1b62cc1eecb4 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4600,7 +4600,7 @@ void Test::testFormulaPosition()
namespace {
-bool hasRange(const std::vector<ScTokenRef>& rRefTokens, const ScRange& rRange, const ScAddress& rPos)
+bool hasRange(const ScDocument* pDoc, const std::vector<ScTokenRef>& rRefTokens, const ScRange& rRange, const ScAddress& rPos)
{
for (const ScTokenRef& p : rRefTokens)
{
@@ -4615,7 +4615,7 @@ bool hasRange(const std::vector<ScTokenRef>& rRefTokens, const ScRange& rRange,
if (rRange.aStart != rRange.aEnd)
break;
- ScAddress aThis = aData.toAbs(rPos);
+ ScAddress aThis = aData.toAbs(pDoc, rPos);
if (aThis == rRange.aStart)
return true;
}
@@ -4623,7 +4623,7 @@ bool hasRange(const std::vector<ScTokenRef>& rRefTokens, const ScRange& rRange,
case formula::svDoubleRef:
{
ScComplexRefData aData = *p->GetDoubleRef();
- ScRange aThis = aData.toAbs(rPos);
+ ScRange aThis = aData.toAbs(pDoc, rPos);
if (aThis == rRange)
return true;
}
@@ -4656,9 +4656,9 @@ void Test::testJumpToPrecedentsDependents()
ScRangeList aRange(aC1);
rDocFunc.DetectiveCollectAllPreds(aRange, aRefTokens);
CPPUNIT_ASSERT_MESSAGE("A1:A2 should be a precedent of C1.",
- hasRange(aRefTokens, ScRange(0, 0, 0, 0, 1, 0), aC1));
+ hasRange(m_pDoc, aRefTokens, ScRange(0, 0, 0, 0, 1, 0), aC1));
CPPUNIT_ASSERT_MESSAGE("B3 should be a precedent of C1.",
- hasRange(aRefTokens, ScRange(1, 2, 0), aC1));
+ hasRange(m_pDoc, aRefTokens, ScRange(1, 2, 0), aC1));
}
{
@@ -4669,7 +4669,7 @@ void Test::testJumpToPrecedentsDependents()
CPPUNIT_ASSERT_EQUAL_MESSAGE("there should only be one reference token.",
static_cast<size_t>(1), aRefTokens.size());
CPPUNIT_ASSERT_MESSAGE("A1 should be a precedent of C1.",
- hasRange(aRefTokens, ScRange(0, 0, 0), aC2));
+ hasRange(m_pDoc, aRefTokens, ScRange(0, 0, 0), aC2));
}
{
@@ -4678,7 +4678,7 @@ void Test::testJumpToPrecedentsDependents()
ScRangeList aRange(aA1);
rDocFunc.DetectiveCollectAllSuccs(aRange, aRefTokens);
CPPUNIT_ASSERT_MESSAGE("C1:C2 should be the only dependent of A1.",
- aRefTokens.size() == 1 && hasRange(aRefTokens, ScRange(2, 0, 0, 2, 1, 0), aA1));
+ aRefTokens.size() == 1 && hasRange(m_pDoc, aRefTokens, ScRange(2, 0, 0, 2, 1, 0), aA1));
}
m_pDoc->DeleteTab(0);
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 5c93d3083111..6219a65d35c7 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -946,6 +946,8 @@ void Test::testFormulaTokenEquality()
void Test::testFormulaRefData()
{
+ std::unique_ptr<ScDocument> pDoc = std::make_unique<ScDocument>();
+
ScAddress aAddr(4,5,3), aPos(2,2,2);
ScSingleRefData aRef;
aRef.InitAddress(aAddr);
@@ -957,7 +959,7 @@ void Test::testFormulaRefData()
aRef.SetRowRel(true);
aRef.SetColRel(true);
aRef.SetTabRel(true);
- aRef.SetAddress(aAddr, aPos);
+ aRef.SetAddress(pDoc->GetSheetLimits(), aAddr, aPos);
CPPUNIT_ASSERT_EQUAL(SCCOL(2), aRef.Col());
CPPUNIT_ASSERT_EQUAL(SCROW(3), aRef.Row());
CPPUNIT_ASSERT_EQUAL(SCTAB(1), aRef.Tab());
@@ -969,15 +971,15 @@ void Test::testFormulaRefData()
aRef.InitAddress(ScAddress(6,5,0));
- aDoubleRef.Extend(aRef, ScAddress());
- ScRange aTest = aDoubleRef.toAbs(ScAddress());
+ aDoubleRef.Extend(pDoc->GetSheetLimits(), aRef, ScAddress());
+ ScRange aTest = aDoubleRef.toAbs(pDoc.get(), ScAddress());
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong start position of extended range.", ScAddress(2,2,0), aTest.aStart);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong end position of extended range.", ScAddress(6,5,0), aTest.aEnd);
ScComplexRefData aDoubleRef2;
- aDoubleRef2.InitRangeRel(ScRange(1,2,0,8,6,0), ScAddress(5,5,0));
- aDoubleRef.Extend(aDoubleRef2, ScAddress(5,5,0));
- aTest = aDoubleRef.toAbs(ScAddress(5,5,0));
+ aDoubleRef2.InitRangeRel(pDoc.get(), ScRange(1,2,0,8,6,0), ScAddress(5,5,0));
+ aDoubleRef.Extend(pDoc->GetSheetLimits(), aDoubleRef2, ScAddress(5,5,0));
+ aTest = aDoubleRef.toAbs(pDoc.get(), ScAddress(5,5,0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong start position of extended range.", ScAddress(1,2,0), aTest.aStart);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong end position of extended range.", ScAddress(8,6,0), aTest.aEnd);
@@ -1198,7 +1200,7 @@ void Test::testFormulaCompilerImplicitIntersection2Param()
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong type of token(third argument to SUMIF)", svDoubleRef, ppTokens[2]->GetType());
ScComplexRefData aSumRangeData = *ppTokens[2]->GetDoubleRef();
- ScRange aSumRange = aSumRangeData.toAbs(rCase.aCellAddress);
+ ScRange aSumRange = aSumRangeData.toAbs(m_pDoc, rCase.aCellAddress);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong sum-range in RPN array", rCase.aSumRange, aSumRange);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong IsRel type for start column address in sum-range", rCase.bStartColRel, aSumRangeData.Ref1.IsColRel());
@@ -1379,7 +1381,7 @@ void Test::testFormulaCompilerImplicitIntersection1ParamWithChange()
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong type of RPN token(argument to COS)", svSingleRef, ppRPNTokens[0]->GetType());
ScSingleRefData aArgAddrRPN = *ppRPNTokens[0]->GetSingleRef();
- ScAddress aArgAddrActual = aArgAddrRPN.toAbs(rCase.aCellAddress);
+ ScAddress aArgAddrActual = aArgAddrRPN.toAbs(m_pDoc, rCase.aCellAddress);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Computed implicit intersection singleref is wrong", rCase.aArgAddr, aArgAddrActual);
}
}
diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx
index 45e4994481ed..0c3f06d46602 100644
--- a/sc/qa/unit/ucalc_sharedformula.cxx
+++ b/sc/qa/unit/ucalc_sharedformula.cxx
@@ -1048,7 +1048,7 @@ void Test::testSharedFormulasDeleteColumns()
CPPUNIT_ASSERT_EQUAL(svSingleRef, pToken->GetType());
const ScSingleRefData* pSRef = pToken->GetSingleRef();
CPPUNIT_ASSERT(pSRef->IsColDeleted());
- CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(0), pSRef->toAbs(ScAddress(1,0,0)).Row());
+ CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(0), pSRef->toAbs(m_pDoc, ScAddress(1,0,0)).Row());
// The formula string should show #REF! in lieu of the column position (only for Calc A1 syntax).
sc::CompileFormulaContext aCFCxt(m_pDoc, FormulaGrammar::GRAM_ENGLISH);