summaryrefslogtreecommitdiffstats
path: root/chart2/qa
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-10-28 16:14:54 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-10-29 11:07:27 +0200
commit5b0ae3b59cd2cccfb72d991657366eb2a69bff49 (patch)
treecd7a4b55b70df6a09bc28d8b30d105bb0a54f405 /chart2/qa
parentPrepare for removal of non-const operator[] from Sequence in configmgr (diff)
downloadcore-5b0ae3b59cd2cccfb72d991657366eb2a69bff49.tar.gz
core-5b0ae3b59cd2cccfb72d991657366eb2a69bff49.zip
Prepare for removal of non-const operator[] from Sequence in chart2
Change-Id: I71e0b458c4dd2a85e36a485e3efa72b1077b0e54 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124346 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'chart2/qa')
-rw-r--r--chart2/qa/extras/PivotChartTest.cxx5
-rw-r--r--chart2/qa/extras/chart2_trendcalculators.cxx36
-rw-r--r--chart2/qa/extras/charttest.hxx3
3 files changed, 28 insertions, 16 deletions
diff --git a/chart2/qa/extras/PivotChartTest.cxx b/chart2/qa/extras/PivotChartTest.cxx
index 97dd41634332..ee024531e88b 100644
--- a/chart2/qa/extras/PivotChartTest.cxx
+++ b/chart2/qa/extras/PivotChartTest.cxx
@@ -844,13 +844,12 @@ void PivotChartTest::testPivotChartRowFieldInOutlineMode()
}
sheet::DataPilotFieldLayoutInfo aLayoutInfoValue;
- uno::Sequence<sheet::GeneralFunction> aGeneralFunctionSequence(1);
// Test case where we enable subtotals (auto) and set the outline subtotals at the bottom
// We don't expect any change in data as every extra subtotal row should be ignored
// Enable subtotals - set to auto
- aGeneralFunctionSequence[0] = sheet::GeneralFunction_AUTO;
+ uno::Sequence<sheet::GeneralFunction> aGeneralFunctionSequence{ sheet::GeneralFunction_AUTO };
lclModifySubtotals(xDataPilotDescriptor, u"Country", aGeneralFunctionSequence);
// Set Subtotals layout to bottom + add empty lines
aLayoutInfoValue.AddEmptyLines = true;
@@ -879,7 +878,7 @@ void PivotChartTest::testPivotChartRowFieldInOutlineMode()
// We don't expect any change in data as every extra subtotal row should be ignored
// Enable subtotals - set to auto
- aGeneralFunctionSequence[0] = sheet::GeneralFunction_AUTO;
+ aGeneralFunctionSequence.getArray()[0] = sheet::GeneralFunction_AUTO;
lclModifySubtotals(xDataPilotDescriptor, u"Country", aGeneralFunctionSequence);
// Set Subtotals layout to top + add empty lines
aLayoutInfoValue.AddEmptyLines = true;
diff --git a/chart2/qa/extras/chart2_trendcalculators.cxx b/chart2/qa/extras/chart2_trendcalculators.cxx
index 1eeea5d12e23..c13c1666725e 100644
--- a/chart2/qa/extras/chart2_trendcalculators.cxx
+++ b/chart2/qa/extras/chart2_trendcalculators.cxx
@@ -112,12 +112,14 @@ void Chart2TrendCalculators::testPotentialRegression1()
loadCalculatorFromSheet( SHEET_POTENTIAL1 );
m_xRegressionCurveCalculator->setRegressionProperties( 0, false, 0, 0, 0 );
Sequence< double > xValues( 7 );
+ auto pxValues = xValues.getArray();
Sequence< double > yValues( 7 );
+ auto pyValues = yValues.getArray();
for (int i=0; i<7; i++)
{
const double d = static_cast<double>(i);
- xValues[i] = d;
- yValues[i] = 2.0 * pow ( d, 3 );
+ pxValues[i] = d;
+ pyValues[i] = 2.0 * pow ( d, 3 );
}
checkCalculator( xValues, yValues, "f(x) = 2 x^3");
}
@@ -128,12 +130,14 @@ void Chart2TrendCalculators::testPotentialRegression2()
loadCalculatorFromSheet( SHEET_POTENTIAL2 );
m_xRegressionCurveCalculator->setRegressionProperties( 0, false, 0, 0, 0 );
Sequence< double > xValues( 7 );
+ auto pxValues = xValues.getArray();
Sequence< double > yValues( 7 );
+ auto pyValues = yValues.getArray();
for (int i=0; i<7; i++)
{
const double d = static_cast<double>(i);
- xValues[i] = d;
- yValues[i] = -2.0 * pow ( d, 3 );
+ pxValues[i] = d;
+ pyValues[i] = -2.0 * pow ( d, 3 );
}
checkCalculator( xValues, yValues, "f(x) = "+ OUStringChar(aMinusSign) +" 2 x^3");
}
@@ -144,12 +148,14 @@ void Chart2TrendCalculators::testLinearRegression1()
loadCalculatorFromSheet( SHEET_LINEAR1 );
m_xRegressionCurveCalculator->setRegressionProperties( 1, false, 0, 0, 0 );
Sequence< double > xValues( 7 );
+ auto pxValues = xValues.getArray();
Sequence< double > yValues( 7 );
+ auto pyValues = yValues.getArray();
for (int i=0; i<7; i++)
{
const double d = static_cast<double>(i);
- xValues[i] = d;
- yValues[i] = - 2.0 * d - 5.0 ;
+ pxValues[i] = d;
+ pyValues[i] = - 2.0 * d - 5.0 ;
}
checkCalculator( xValues, yValues, "f(x) = "+ OUStringChar(aMinusSign) +" 2 x "+ OUStringChar(aMinusSign) +" 5");
}
@@ -160,12 +166,14 @@ void Chart2TrendCalculators::testPolynomialRegression1()
loadCalculatorFromSheet( SHEET_POLYNOMIAL1 );
m_xRegressionCurveCalculator->setRegressionProperties( 2, false, 0, 0, 0 );
Sequence< double > xValues( 7 );
+ auto pxValues = xValues.getArray();
Sequence< double > yValues( 7 );
+ auto pyValues = yValues.getArray();
for (int i=0; i<7; i++)
{
const double d = static_cast<double>(i);
- xValues[i] = d;
- yValues[i] = - 2.0 * d * d + 4 * d - 5;
+ pxValues[i] = d;
+ pyValues[i] = - 2.0 * d * d + 4 * d - 5;
}
OUString sExpectedFormula( "f(x) = "+ OUStringChar(aMinusSign) +" 2 x" + OUStringChar( aSuperscriptFigures[2] ) + " + 4 x "+ OUStringChar(aMinusSign) +" 5" );
checkCalculator( xValues, yValues, sExpectedFormula );
@@ -176,12 +184,14 @@ void Chart2TrendCalculators::testExponentialRegression1()
loadCalculatorFromSheet( SHEET_EXPONENTIAL1 );
m_xRegressionCurveCalculator->setRegressionProperties( 0, false, 0, 0, 0 );
Sequence< double > xValues( 7 );
+ auto pxValues = xValues.getArray();
Sequence< double > yValues( 7 );
+ auto pyValues = yValues.getArray();
for (int i=0; i<7; i++)
{
const double d = static_cast<double>(i);
- xValues[i] = d;
- yValues[i] = 2.0 * exp ( 0.3 * d );
+ pxValues[i] = d;
+ pyValues[i] = 2.0 * exp ( 0.3 * d );
}
checkCalculator( xValues, yValues, "f(x) = 2 exp( 0.3 x )");
}
@@ -191,12 +201,14 @@ void Chart2TrendCalculators::testExponentialRegression2()
loadCalculatorFromSheet( SHEET_EXPONENTIAL2 );
m_xRegressionCurveCalculator->setRegressionProperties( 0, false, 0, 0, 0 );
Sequence< double > xValues( 7 );
+ auto pxValues = xValues.getArray();
Sequence< double > yValues( 7 );
+ auto pyValues = yValues.getArray();
for (int i=0; i<7; i++)
{
const double d = static_cast<double>(i);
- xValues[i] = d;
- yValues[i] = -2.0 * exp ( 0.3 * d );
+ pxValues[i] = d;
+ pyValues[i] = -2.0 * exp ( 0.3 * d );
}
checkCalculator( xValues, yValues, "f(x) = "+ OUStringChar(aMinusSign) + " 2 exp( 0.3 x )");
}
diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx
index 2aec79cfccb0..02ad9675d930 100644
--- a/chart2/qa/extras/charttest.hxx
+++ b/chart2/qa/extras/charttest.hxx
@@ -666,9 +666,10 @@ Sequence< OUString > ChartTest::getFormattedDateCategories( const Reference<char
Sequence<double> aDateSeq = getDateCategories(xChartDoc);
const sal_Int32 nNumCategories = aDateSeq.getLength();
Sequence<OUString> aFormattedDates(nNumCategories);
+ auto aFormattedDatesRange = asNonConstRange(aFormattedDates);
for (sal_Int32 nIdx = 0; nIdx < nNumCategories; ++nIdx)
- aFormattedDates[nIdx] = xNumFormatter->convertNumberToString(nNumFmt, aDateSeq[nIdx]);
+ aFormattedDatesRange[nIdx] = xNumFormatter->convertNumberToString(nNumFmt, aDateSeq[nIdx]);
return aFormattedDates;
}