/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
aDataRange = insertRangeData(m_pDoc, aPos, aData);
CPPUNIT_ASSERT_EQUAL_MESSAGE("failed to insert range data at correct position", aPos, aDataRange.aStart);
}
// Title should stay at the top, numbers should be sorted numerically, // numbers always come before strings, and empty cells always occur at the // end.
CPPUNIT_ASSERT_EQUAL(u"Title"_ustr, m_pDoc->GetString(aPos));
aPos.IncRow();
CPPUNIT_ASSERT_EQUAL(u"1"_ustr, m_pDoc->GetString(aPos));
aPos.IncRow();
CPPUNIT_ASSERT_EQUAL(u"9"_ustr, m_pDoc->GetString(aPos));
aPos.IncRow();
CPPUNIT_ASSERT_EQUAL(u"12"_ustr, m_pDoc->GetString(aPos));
aPos.IncRow();
CPPUNIT_ASSERT_EQUAL(u"123"_ustr, m_pDoc->GetString(aPos));
aPos.IncRow();
CPPUNIT_ASSERT_EQUAL(u"b"_ustr, m_pDoc->GetString(aPos));
aPos.IncRow();
CPPUNIT_ASSERT_EQUAL(CELLTYPE_NONE, m_pDoc->GetCellType(aPos));
// Insert raw data into A1:D4.
ScRange aDataRange = insertRangeData(m_pDoc, ScAddress(0,0,0), aData);
CPPUNIT_ASSERT_EQUAL(u"A1:D4"_ustr, aDataRange.Format(*m_pDoc, ScRefFlags::VALID));
// Check the formula values.
CPPUNIT_ASSERT_EQUAL(u"Yes-No"_ustr, m_pDoc->GetString(ScAddress(3,1,0)));
CPPUNIT_ASSERT_EQUAL(u"No-No"_ustr, m_pDoc->GetString(ScAddress(3,2,0)));
CPPUNIT_ASSERT_EQUAL(u"Yes-Yes"_ustr, m_pDoc->GetString(ScAddress(3,3,0)));
// regression test of fdo#53814, sorting doesn't work as expected // if cells in the sort are referenced by formulas
CPPUNIT_TEST_FIXTURE(TestSort, testSortWithFormulaRefs)
{
SortRefUpdateSetter aUpdateSet;
// Insert data to sort in A2:A5 on the 1st sheet. for (SCROW i = 1; i <= 4; ++i)
m_pDoc->SetString( 0, i, 0, OUString::createFromAscii(aTextData[i-1]) );
// Insert formulas in A1:A6 on the 2nd sheet. for (size_t i = 0; i < std::size(aFormulaData); ++i)
m_pDoc->SetString( 0, i, 1, OUString::createFromAscii(aFormulaData[i]) );
// Sort data in A2:A8 on the 1st sheet. No column header.
ScSortParam aSortData;
aSortData.nCol1 = 0;
aSortData.nCol2 = 0;
aSortData.nRow1 = 1;
aSortData.nRow2 = 7;
aSortData.maKeyState[0].bDoSort = true;
aSortData.maKeyState[0].nField = 0;
aSortData.maKeyState[0].aColorSortMode = ScColorSortMode::None;
for ( SCROW i = 0; i < SCROW(std::size( aEntries )); ++i )
{ double val = m_pDoc->GetValue( aEntries[i].nCol, aEntries[i].nRow, 0 );
CPPUNIT_ASSERT_MESSAGE("Mis-matching value after sort.",
rtl::math::approxEqual(val, aResults[i]));
}
const SfxPoolItem* pItem = nullptr; if (!pPat->GetItemSet().HasItem(ATTR_FONT_WEIGHT, &pItem))
{
cerr << "Pattern does not have a font weight item, but it should." << endl; returnfalse;
}
CPPUNIT_ASSERT(pItem);
if (static_cast<const SvxWeightItem*>(pItem)->GetEnumValue() != WEIGHT_BOLD)
{
cerr << "Font weight should be bold." << endl; returnfalse;
}
returntrue;
}
bool isItalic( const ScPatternAttr* pPat ) const
{ if (!pPat)
{
cerr << "Pattern is NULL!" << endl; returnfalse;
}
const SfxPoolItem* pItem = nullptr; if (!pPat->GetItemSet().HasItem(ATTR_FONT_POSTURE, &pItem))
{
cerr << "Pattern does not have a font posture item, but it should." << endl; returnfalse;
}
CPPUNIT_ASSERT(pItem);
if (static_cast<const SvxPostureItem*>(pItem)->GetEnumValue() != ITALIC_NORMAL)
{
cerr << "Italic should be applied.." << endl; returnfalse;
}
returntrue;
}
bool isNormal( const ScPatternAttr* pPat ) const
{ if (!pPat)
{
cerr << "Pattern is NULL!" << endl; returnfalse;
}
const SfxPoolItem* pItem = nullptr; if (pPat->GetItemSet().HasItem(ATTR_FONT_WEIGHT, &pItem))
{ // Check if the font weight is applied. if (static_cast<const SvxWeightItem*>(pItem)->GetEnumValue() == WEIGHT_BOLD)
{
cerr << "This cell is bold, but shouldn't." << endl; returnfalse;
}
}
if (pPat->GetItemSet().HasItem(ATTR_FONT_POSTURE, &pItem))
{ // Check if the italics is applied. if (static_cast<const SvxPostureItem*>(pItem)->GetEnumValue() == ITALIC_NORMAL)
{
cerr << "This cell is italic, but shouldn't." << endl; returnfalse;
}
}
returntrue;
}
} aCheck;
m_pDoc->InsertTab(0, u"Test"_ustr);
// Insert some values into A1:A4.
m_pDoc->SetString(ScAddress(0,0,0), u"Header"_ustr);
m_pDoc->SetString(ScAddress(0,1,0), u"Normal"_ustr);
m_pDoc->SetString(ScAddress(0,2,0), u"Bold"_ustr);
m_pDoc->SetString(ScAddress(0,3,0), u"Italic"_ustr);
// Make sure it's really in. bool bGood = aCheck.isBold(m_pDoc->GetPattern(ScAddress(0,2,0)));
CPPUNIT_ASSERT_MESSAGE("A3 is not bold but it should.", bGood);
}
// A2 should be bold now. bool bBold = aCheck.isBold(m_pDoc->GetPattern(ScAddress(0,1,0)));
CPPUNIT_ASSERT_MESSAGE("A2 should be bold after the sort.", bBold);
// and A3 should be italic. bool bItalic = aCheck.isItalic(m_pDoc->GetPattern(ScAddress(0,2,0)));
CPPUNIT_ASSERT_MESSAGE("A3 should be italic.", bItalic);
// A4 should have neither bold nor italic. bool bNormal = aCheck.isNormal(m_pDoc->GetPattern(ScAddress(0,3,0)));
CPPUNIT_ASSERT_MESSAGE("A4 should be neither bold nor italic.", bNormal);
sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.
FormulaGrammarSwitch aFGSwitch(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1);
m_pDoc->InsertTab(0, u"Sort"_ustr);
// Set values to sort in column A.
m_pDoc->SetString(ScAddress(0,0,0), u"Header"_ustr);
double aValues[] = { 4.0, 36.0, 14.0, 29.0, 98.0, 78.0, 0.0, 99.0, 1.0 };
size_t nCount = std::size(aValues); for (size_t i = 0; i < nCount; ++i)
m_pDoc->SetValue(ScAddress(0,i+1,0), aValues[i]);
// Set formulas to reference these values in column C.
m_pDoc->SetString(ScAddress(2,0,0), u"Formula"_ustr); for (size_t i = 0; i < nCount; ++i)
m_pDoc->SetString(ScAddress(2,1+i,0), u"=RC[-2]"_ustr);
// Check the values in column C. for (size_t i = 0; i < nCount; ++i)
{ double fCheck = aValues[i];
CPPUNIT_ASSERT_EQUAL(fCheck, m_pDoc->GetValue(ScAddress(2,i+1,0)));
}
// Check the sort result.
CPPUNIT_ASSERT_EQUAL(u"Header"_ustr, m_pDoc->GetString(ScAddress(0,0,0))); for (size_t i = 0; i < nCount; ++i)
{ double fCheck = aSorted[i];
CPPUNIT_ASSERT_EQUAL(fCheck, m_pDoc->GetValue(ScAddress(0,i+1,0)));
}
// Sorting should not alter the values in column C.
m_pDoc->CalcAll(); // just in case... for (size_t i = 0; i < nCount; ++i)
{ double fCheck = aValues[i];
CPPUNIT_ASSERT_EQUAL(fCheck, m_pDoc->GetValue(ScAddress(2,i+1,0)));
}
// C2 should now point to A4.
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in C2!", u"=R[2]C[-2]"_ustr, m_pDoc->GetFormula(2,1,0));
// Undo the sort.
SfxUndoManager* pUndoMgr = m_pDoc->GetUndoManager();
pUndoMgr->Undo();
// Check the undo result.
CPPUNIT_ASSERT_EQUAL(u"Header"_ustr, m_pDoc->GetString(ScAddress(0,0,0))); for (size_t i = 0; i < nCount; ++i)
{ double fCheck = aValues[i];
CPPUNIT_ASSERT_EQUAL(fCheck, m_pDoc->GetValue(ScAddress(0,i+1,0)));
}
// Values in column C should still be unaltered.
m_pDoc->CalcAll(); // just in case... for (size_t i = 0; i < nCount; ++i)
{ double fCheck = aValues[i];
CPPUNIT_ASSERT_EQUAL(fCheck, m_pDoc->GetValue(ScAddress(2,i+1,0)));
}
// C2 should now point to A2.
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in C2!", u"=RC[-2]"_ustr, m_pDoc->GetFormula(2,1,0));
// Redo.
pUndoMgr->Redo();
CPPUNIT_ASSERT_EQUAL(u"Header"_ustr, m_pDoc->GetString(ScAddress(0,0,0))); for (size_t i = 0; i < nCount; ++i)
{ double fCheck = aSorted[i];
CPPUNIT_ASSERT_EQUAL(fCheck, m_pDoc->GetValue(ScAddress(0,i+1,0)));
}
// Sorting should not alter the values in column C.
m_pDoc->CalcAll(); // just in case... for (size_t i = 0; i < nCount; ++i)
{ double fCheck = aValues[i];
CPPUNIT_ASSERT_EQUAL(fCheck, m_pDoc->GetValue(ScAddress(2,i+1,0)));
}
// C2 should now point to A4.
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in C2!", u"=R[2]C[-2]"_ustr, m_pDoc->GetFormula(2,1,0));
// Undo again.
pUndoMgr->Undo();
// Formulas in column C should all be "RC[-2]" again. for (size_t i = 0; i < nCount; ++i)
m_pDoc->SetString(ScAddress(2,1+i,0), u"=RC[-2]"_ustr);
// Turn off reference update on sort.
SortTypeSetter::changeTo(false);
// Check the sort result again.
CPPUNIT_ASSERT_EQUAL(u"Header"_ustr, m_pDoc->GetString(ScAddress(0,0,0))); for (size_t i = 0; i < nCount; ++i)
{ double fCheck = aSorted[i];
CPPUNIT_ASSERT_EQUAL(fCheck, m_pDoc->GetValue(ScAddress(0,i+1,0)));
}
// Formulas in column C should all remain "RC[-2]". for (size_t i = 0; i < nCount; ++i)
m_pDoc->SetString(ScAddress(2,1+i,0), u"=RC[-2]"_ustr);
// The values in column C should now be the same as sorted values in column A.
m_pDoc->CalcAll(); // just in case... for (size_t i = 0; i < nCount; ++i)
{ double fCheck = aSorted[i];
CPPUNIT_ASSERT_EQUAL(fCheck, m_pDoc->GetValue(ScAddress(2,i+1,0))); // column C
}
for (SCROW i = 0; aData[i][0]; ++i)
{
m_pDoc->SetString(0, i, 0, OUString::createFromAscii(aData[i][0]));
m_pDoc->SetString(1, i, 0, OUString::createFromAscii(aData[i][1]));
}
// Check the values in B2:B5.
CPPUNIT_ASSERT_EQUAL(9.0, m_pDoc->GetValue(ScAddress(1,1,0)));
CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(1,2,0)));
CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(1,3,0)));
CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(1,4,0)));
// Check the sort result in column A.
CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(0,1,0)));
CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(0,2,0)));
CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(0,3,0)));
CPPUNIT_ASSERT_EQUAL(9.0, m_pDoc->GetValue(ScAddress(0,4,0)));
// and column B.
CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(1,1,0)));
CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(1,2,0)));
CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(1,3,0)));
CPPUNIT_ASSERT_EQUAL(9.0, m_pDoc->GetValue(ScAddress(1,4,0)));
// Formulas in column B should still point to their respective left neighbor cell. for (SCROW i = 1; i <= 4; ++i)
{
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", u"=RC[-1]"_ustr, m_pDoc->GetFormula(1,i,0));
}
// Undo and check the result in column B.
SfxUndoManager* pUndoMgr = m_pDoc->GetUndoManager();
pUndoMgr->Undo();
// Make sure the formula cells have been adjusted correctly.
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A4.", u"=A2+A3"_ustr, m_pDoc->GetFormula(0,3,0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A5.", u"=A2+10"_ustr, m_pDoc->GetFormula(0,4,0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A6.", u"=A3+10"_ustr, m_pDoc->GetFormula(0,5,0));
// Derived from fdo#79441 https://bugs.freedesktop.org/attachment.cgi?id=100144 // testRefInterne.ods
CPPUNIT_TEST_FIXTURE(TestSort, testSortRefUpdate4)
{ // This test has to work in both update reference modes.
{
SortRefNoUpdateSetter aUpdateSet;
testSortRefUpdate4_Impl();
}
{
SortRefUpdateSetter aUpdateSet;
testSortRefUpdate4_Impl();
}
}
void TestSort::testSortRefUpdate4_Impl()
{
sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.
m_pDoc->InsertTab(0, u"Sort"_ustr);
m_pDoc->InsertTab(1, u"Lesson1"_ustr);
m_pDoc->InsertTab(2, u"Lesson2"_ustr);
// Make sure the refupdate works also with volatile cells, see fdo#83067 /* FIXME: this test is not roll-over-midnight safe and will fail then! We may * want to have something different, but due to the nature of volatile * functions it's not that easy to come up with something reproducible staying * stable over sorts... ;-) Check for time and don't run test a few seconds
* before midnight, ermm... */
CPPUNIT_TEST_FIXTURE(TestSort, testSortRefUpdate5)
{
SortRefUpdateSetter aUpdateSet;
sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.
m_pDoc->InsertTab(0, u"Sort"_ustr);
// Check the sorted values.
m_pDoc->CalcAll(); for (SCROW nRow=0; nRow < static_cast<SCROW>(SAL_N_ELEMENTS(aValCheck)); ++nRow)
{
size_t i = static_cast<size_t>(m_pDoc->GetValue(ScAddress(2,nRow+1,0))); // order 1..4
CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(nRow+1), i);
CPPUNIT_ASSERT_EQUAL( aValCheck[i-1][2], m_pDoc->GetValue(ScAddress(1,nRow+1,0)));
}
// Make sure the formula cells have been adjusted correctly. constchar* aFormulaCheck[] = { // Volatile "=TODAY()-$A2", "=TODAY()-$A3", "=TODAY()-$A4", "=TODAY()-$A5",
}; for (SCROW nRow=0; nRow < static_cast<SCROW>(SAL_N_ELEMENTS(aFormulaCheck)); ++nRow)
{
CPPUNIT_ASSERT_EQUAL_MESSAGE(OString("Wrong formula in B" + OString::number(nRow+2) + ".").getStr(), OUString::createFromAscii(aFormulaCheck[nRow]), m_pDoc->GetFormula(1,nRow+1,0));
}
// Undo and check the result.
SfxUndoManager* pUndoMgr = m_pDoc->GetUndoManager();
pUndoMgr->Undo();
m_pDoc->CalcAll(); for (SCROW nRow=0; nRow < static_cast<SCROW>(SAL_N_ELEMENTS(aValCheck)); ++nRow)
{
CPPUNIT_ASSERT_EQUAL( aValCheck[nRow][0], m_pDoc->GetValue(ScAddress(1,nRow+1,0)));
CPPUNIT_ASSERT_EQUAL( aValCheck[nRow][1], m_pDoc->GetValue(ScAddress(2,nRow+1,0)));
}
// Redo and check the result.
pUndoMgr->Redo();
m_pDoc->CalcAll(); for (SCROW nRow=0; nRow < static_cast<SCROW>(SAL_N_ELEMENTS(aValCheck)); ++nRow)
{
size_t i = static_cast<size_t>(m_pDoc->GetValue(ScAddress(2,nRow+1,0))); // order 1..4
CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(nRow+1), i);
CPPUNIT_ASSERT_EQUAL( aValCheck[i-1][2], m_pDoc->GetValue(ScAddress(1,nRow+1,0)));
}
// Make sure that the formulas in C2:C4 are not adjusted.
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", u"=C1+B2"_ustr, m_pDoc->GetFormula(2,1,0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", u"=C2+B3"_ustr, m_pDoc->GetFormula(2,2,0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", u"=C3+B4"_ustr, m_pDoc->GetFormula(2,3,0));
// Undo and check.
SfxUndoManager* pUndoMgr = m_pDoc->GetUndoManager();
CPPUNIT_ASSERT(pUndoMgr);
bool bSuccess = checkOutput(m_pDoc, aDataRange, aOutputCheck, "After undo of header value change");
CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
}
m_pDoc->DeleteTab(0);
}
// fdo#86762 check that broadcasters are sorted correctly and empty cell is // broadcasted.
CPPUNIT_TEST_FIXTURE(TestSort, testSortBroadcaster)
{
SortRefNoUpdateSetter aUpdateSet;
sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.
m_pDoc->InsertTab(0, u"Sort"_ustr);
// Make sure that the formulas in D1:G2 are not adjusted.
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", u"=B1"_ustr, m_pDoc->GetFormula(3,0,0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", u"=B2"_ustr, m_pDoc->GetFormula(3,1,0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", u"=$B$1"_ustr, m_pDoc->GetFormula(4,0,0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", u"=$B$2"_ustr, m_pDoc->GetFormula(4,1,0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", u"=SUM(A1:B1)"_ustr, m_pDoc->GetFormula(5,0,0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", u"=SUM(A2:B2)"_ustr, m_pDoc->GetFormula(5,1,0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", u"=SUM($A$1:$B$1)"_ustr, m_pDoc->GetFormula(6,0,0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", u"=SUM($A$2:$B$2)"_ustr, m_pDoc->GetFormula(6,1,0));
// Enter new value and check that it is broadcasted. First in empty cell.
m_pDoc->SetString(1,1,0, u"16"_ustr); double nVal = m_pDoc->GetValue(3,1,0);
ASSERT_DOUBLES_EQUAL( 16.0, nVal);
nVal = m_pDoc->GetValue(4,1,0);
ASSERT_DOUBLES_EQUAL( 16.0, nVal);
nVal = m_pDoc->GetValue(5,1,0);
ASSERT_DOUBLES_EQUAL( 17.0, nVal);
nVal = m_pDoc->GetValue(6,1,0);
ASSERT_DOUBLES_EQUAL( 17.0, nVal);
// Enter new value and check that it is broadcasted. Now overwriting data.
m_pDoc->SetString(1,0,0, u"32"_ustr);
nVal = m_pDoc->GetValue(3,0,0);
ASSERT_DOUBLES_EQUAL( 32.0, nVal);
nVal = m_pDoc->GetValue(4,0,0);
ASSERT_DOUBLES_EQUAL( 32.0, nVal);
nVal = m_pDoc->GetValue(5,0,0);
ASSERT_DOUBLES_EQUAL( 34.0, nVal);
nVal = m_pDoc->GetValue(6,0,0);
ASSERT_DOUBLES_EQUAL( 34.0, nVal);
}
// Make sure that the formulas in A8:B11 are not adjusted.
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", u"=A6"_ustr, m_pDoc->GetFormula(0,7,0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", u"=B6"_ustr, m_pDoc->GetFormula(1,7,0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", u"=$A$6"_ustr, m_pDoc->GetFormula(0,8,0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", u"=$B$6"_ustr, m_pDoc->GetFormula(1,8,0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", u"=SUM(A5:A6)"_ustr, m_pDoc->GetFormula(0,9,0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", u"=SUM(B5:B6)"_ustr, m_pDoc->GetFormula(1,9,0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", u"=SUM($A$5:$A$6)"_ustr, m_pDoc->GetFormula(0,10,0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", u"=SUM($B$5:$B$6)"_ustr, m_pDoc->GetFormula(1,10,0));
// Enter new value and check that it is broadcasted. First in empty cell.
m_pDoc->SetString(1,5,0, u"16"_ustr); double nVal = m_pDoc->GetValue(1,7,0);
ASSERT_DOUBLES_EQUAL(16.0, nVal);
nVal = m_pDoc->GetValue(1,8,0);
ASSERT_DOUBLES_EQUAL(16.0, nVal);
nVal = m_pDoc->GetValue(1,9,0);
ASSERT_DOUBLES_EQUAL(17.0, nVal);
nVal = m_pDoc->GetValue(1,10,0);
ASSERT_DOUBLES_EQUAL(17.0, nVal);
// Enter new value and check that it is broadcasted. Now overwriting data.
m_pDoc->SetString(0,5,0, u"32"_ustr);
nVal = m_pDoc->GetValue(0,7,0);
ASSERT_DOUBLES_EQUAL(32.0, nVal);
nVal = m_pDoc->GetValue(0,8,0);
ASSERT_DOUBLES_EQUAL(32.0, nVal);
nVal = m_pDoc->GetValue(0,9,0);
ASSERT_DOUBLES_EQUAL(34.0, nVal);
nVal = m_pDoc->GetValue(0,10,0);
ASSERT_DOUBLES_EQUAL(34.0, nVal);
}
m_pDoc->DeleteTab(0);
}
// tdf#99417 check that formulas are tracked that *only* indirectly depend on // sorted data and no other broadcasting than BroadcastBroadcasters is // involved (for which this test can not be included in testSortBroadcaster()).
CPPUNIT_TEST_FIXTURE(TestSort, testSortBroadcastBroadcaster)
{
SortRefNoUpdateSetter aUpdateSet;
sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.
m_pDoc->InsertTab(0, u"Sort"_ustr);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.