| 838 | } |
| 839 | |
| 840 | void InfoElementTest::moveCurve() { |
| 841 | Project project; |
| 842 | auto* ws = new Worksheet(QStringLiteral("worksheet")); |
| 843 | QVERIFY(ws != nullptr); |
| 844 | project.addChild(ws); |
| 845 | |
| 846 | auto* p = new CartesianPlot(QStringLiteral("plot")); |
| 847 | QVERIFY(p != nullptr); |
| 848 | ws->addChild(p); |
| 849 | |
| 850 | auto* curve{new XYEquationCurve(QStringLiteral("f(x)"))}; |
| 851 | curve->setCoordinateSystemIndex(p->defaultCoordinateSystemIndex()); |
| 852 | p->addChild(curve); |
| 853 | |
| 854 | XYEquationCurve::EquationData data; |
| 855 | data.min = QStringLiteral("0"); |
| 856 | data.max = QStringLiteral("10"); |
| 857 | data.count = 11; |
| 858 | data.expression1 = QStringLiteral("x"); |
| 859 | curve->setEquationData(data); |
| 860 | curve->recalculate(); |
| 861 | |
| 862 | auto* curve2{new XYEquationCurve(QStringLiteral("f(x^2)"))}; |
| 863 | curve2->setCoordinateSystemIndex(p->defaultCoordinateSystemIndex()); |
| 864 | p->addChild(curve2); |
| 865 | |
| 866 | data.min = QStringLiteral("0"); |
| 867 | data.max = QStringLiteral("10"); |
| 868 | data.count = 11; |
| 869 | data.expression1 = QStringLiteral("x^2"); |
| 870 | curve2->setEquationData(data); |
| 871 | curve2->recalculate(); |
| 872 | |
| 873 | CHECK_RANGE(p, curve, Dimension::X, 0., 10.); |
| 874 | CHECK_RANGE(p, curve, Dimension::Y, 0., 100.); |
| 875 | |
| 876 | auto* ie = new InfoElement(QStringLiteral("InfoElement"), p, curve, 4.9); |
| 877 | QVERIFY(ie != nullptr); |
| 878 | p->addChild(ie); |
| 879 | |
| 880 | { |
| 881 | const auto points = ie->children<CustomPoint>(); |
| 882 | QCOMPARE(ie->markerPointsCount(), 1); |
| 883 | QCOMPARE(ie->markerPointAt(0).curve, curve); |
| 884 | QCOMPARE(points.count(), 1); |
| 885 | QCOMPARE(ie->markerPointAt(0).customPoint, points.at(0)); |
| 886 | QCOMPARE(points.at(0)->positionLogical(), QPointF(5, 5)); |
| 887 | } |
| 888 | QCOMPARE(ie->connectionLineCurveName(), curve->name()); |
| 889 | |
| 890 | ie->addCurve(curve2); |
| 891 | |
| 892 | QCOMPARE(ie->connectionLineCurveName(), curve->name()); // No change here |
| 893 | |
| 894 | { |
| 895 | const auto points = ie->children<CustomPoint>(); |
| 896 | QCOMPARE(points.count(), 2); |
| 897 |
nothing calls this directly
no test coverage detected