[education/labplot] tests/backend: more adjustments in the failing tests.
Alexander Semke <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 8ed2c72656652196d3c131a8ff8d5d55dae9128c by Alexander Semke.
Committed on 20/07/2026 at 21:17.
Pushed by sgerlach into branch 'master'.
more adjustments in the failing tests.
M +16 -0 tests/backend/InfoElement/InfoElementTest.cpp
M +13 -0 tests/backend/XYCurve/XYCurveTest.cpp
https://invent.kde.org/education/labplot/-/commit/8ed2c72656652196d3c131a8ff8d5d55dae9128c
diff --git a/tests/backend/InfoElement/InfoElementTest.cpp b/tests/backend/InfoElement/InfoElementTest.cpp
index 03558c6741..75005c2ea9 100644
--- a/tests/backend/InfoElement/InfoElementTest.cpp
+++ b/tests/backend/InfoElement/InfoElementTest.cpp
@@ -39,6 +39,7 @@ void InfoElementTest::addPlot() {
data.min = QStringLiteral("0");
data.max = QStringLiteral("10");
data.count = 11;
+ data.autoPointsCount = false;
data.expression1 = QStringLiteral("x");
curve->setEquationData(data);
curve->recalculate();
@@ -50,6 +51,7 @@ void InfoElementTest::addPlot() {
data.min = QStringLiteral("0");
data.max = QStringLiteral("10");
data.count = 11;
+ data.autoPointsCount = false;
data.expression1 = QStringLiteral("x^2");
curve2->setEquationData(data);
curve2->recalculate();
@@ -104,6 +106,7 @@ void InfoElementTest::removeCurve() {
data.min = QStringLiteral("0");
data.max = QStringLiteral("10");
data.count = 11;
+ data.autoPointsCount = false;
data.expression1 = QStringLiteral("x");
curve->setEquationData(data);
curve->recalculate();
@@ -115,6 +118,7 @@ void InfoElementTest::removeCurve() {
data.min = QStringLiteral("0");
data.max = QStringLiteral("10");
data.count = 11;
+ data.autoPointsCount = false;
data.expression1 = QStringLiteral("x^2");
curve2->setEquationData(data);
curve2->recalculate();
@@ -433,6 +437,7 @@ void InfoElementTest::deleteCurveRenameAddedAutomatically() {
data.min = QStringLiteral("0");
data.max = QStringLiteral("10");
data.count = 11;
+ data.autoPointsCount = false;
data.expression1 = QStringLiteral("x");
curve->setEquationData(data);
curve->recalculate();
@@ -444,6 +449,7 @@ void InfoElementTest::deleteCurveRenameAddedAutomatically() {
data.min = QStringLiteral("0");
data.max = QStringLiteral("10");
data.count = 11;
+ data.autoPointsCount = false;
data.expression1 = QStringLiteral("x^2");
curve2->setEquationData(data);
curve2->recalculate();
@@ -561,6 +567,7 @@ void InfoElementTest::deleteCurveRenameAddedAutomaticallyCustomPointInvisible()
data.min = QStringLiteral("0");
data.max = QStringLiteral("10");
data.count = 11;
+ data.autoPointsCount = false;
data.expression1 = QStringLiteral("x");
curve->setEquationData(data);
curve->recalculate();
@@ -572,6 +579,7 @@ void InfoElementTest::deleteCurveRenameAddedAutomaticallyCustomPointInvisible()
data.min = QStringLiteral("0");
data.max = QStringLiteral("10");
data.count = 11;
+ data.autoPointsCount = false;
data.expression1 = QStringLiteral("x^2");
curve2->setEquationData(data);
curve2->recalculate();
@@ -789,6 +797,7 @@ void InfoElementTest::moveDuringMissingCurve() {
data.min = QStringLiteral("0");
data.max = QStringLiteral("10");
data.count = 11;
+ data.autoPointsCount = false;
data.expression1 = QStringLiteral("x");
curve->setEquationData(data);
curve->recalculate();
@@ -799,6 +808,7 @@ void InfoElementTest::moveDuringMissingCurve() {
data.min = QStringLiteral("0");
data.max = QStringLiteral("10");
data.count = 11;
+ data.autoPointsCount = false;
data.expression1 = QStringLiteral("x^2");
curve3->setEquationData(data);
curve3->recalculate();
@@ -854,6 +864,7 @@ void InfoElementTest::moveCurve() {
data.min = QStringLiteral("0");
data.max = QStringLiteral("10");
data.count = 11;
+ data.autoPointsCount = false;
data.expression1 = QStringLiteral("x");
curve->setEquationData(data);
curve->recalculate();
@@ -865,6 +876,7 @@ void InfoElementTest::moveCurve() {
data.min = QStringLiteral("0");
data.max = QStringLiteral("10");
data.count = 11;
+ data.autoPointsCount = false;
data.expression1 = QStringLiteral("x^2");
curve2->setEquationData(data);
curve2->recalculate();
@@ -941,6 +953,7 @@ void InfoElementTest::saveLoad() {
data.min = QStringLiteral("0");
data.max = QStringLiteral("10");
data.count = 11;
+ data.autoPointsCount = false;
data.expression1 = QStringLiteral("x");
curve->setEquationData(data);
curve->recalculate();
@@ -952,6 +965,7 @@ void InfoElementTest::saveLoad() {
data.min = QStringLiteral("0");
data.max = QStringLiteral("10");
data.count = 11;
+ data.autoPointsCount = false;
data.expression1 = QStringLiteral("x^2");
curve2->setEquationData(data);
curve2->recalculate();
@@ -1035,6 +1049,7 @@ void InfoElementTest::saveLoadInvisiblePoint() {
data.min = QStringLiteral("0");
data.max = QStringLiteral("10");
data.count = 11;
+ data.autoPointsCount = false;
data.expression1 = QStringLiteral("x");
curve->setEquationData(data);
curve->recalculate();
@@ -1046,6 +1061,7 @@ void InfoElementTest::saveLoadInvisiblePoint() {
data.min = QStringLiteral("0");
data.max = QStringLiteral("10");
data.count = 11;
+ data.autoPointsCount = false;
data.expression1 = QStringLiteral("x^2");
curve2->setEquationData(data);
curve2->recalculate();
diff --git a/tests/backend/XYCurve/XYCurveTest.cpp b/tests/backend/XYCurve/XYCurveTest.cpp
index d22fc7a206..c3acf7f9a4 100644
--- a/tests/backend/XYCurve/XYCurveTest.cpp
+++ b/tests/backend/XYCurve/XYCurveTest.cpp
@@ -19,6 +19,7 @@
#include "backend/worksheet/plots/cartesian/CartesianCoordinateSystem.h"
#include "backend/worksheet/plots/cartesian/CartesianPlot.h"
#include "backend/worksheet/plots/cartesian/Symbol.h"
+#include "backend/worksheet/plots/cartesian/XYEquationCurve.h"
#include "backend/worksheet/plots/cartesian/XYCurve.h"
#include "backend/worksheet/plots/cartesian/XYCurvePrivate.h"
@@ -2005,6 +2006,17 @@ void XYCurveTest::updateLinesWithGapSegments3() {
*/
void XYCurveTest::updateLinesLog10() {
LOAD_PROJECT
+
+ // Disable automatic point calculation for this test to get predictable point count
+ // The test expects exactly 10 points from the equation evaluation
+ auto* equationCurve = dynamic_cast<XYEquationCurve*>(linear);
+ if (equationCurve) {
+ auto edata = equationCurve->equationData();
+ edata.autoPointsCount = false;
+ edata.count = 10;
+ equationCurve->setEquationData(edata);
+ }
+
bool updateLinesCalled = false;
connect(linear, &XYCurve::linesUpdated, [linearPrivate, &updateLinesCalled](const XYCurve* /*curve*/, const QVector<QLineF>& /*lines*/) {
updateLinesCalled = true;
@@ -2019,6 +2031,7 @@ void XYCurveTest::updateLinesLog10() {
QLineF(QPointF(7.8, 7.8), QPointF(8.9, 8.9)),
QLineF(QPointF(8.9, 8.9), QPointF(10, 10)),
};
+ QCOMPARE(linearPrivate->m_logicalPoints.size(), refLines.size() + 1); // last row is invalid so it will be omitted
auto test_lines = linearPrivate->m_lines;
QCOMPARE(refLines.size(), test_lines.size());
for (int i = 0; i < test_lines.size(); i++)