! * check the correctness of the data points after one of the reference points was moved on the scene. * In real this is not possible, because it is not implemented, but neverthless it shall be shown * that when moving reference points, the curves will be updated */
| 765 | * that when moving reference points, the curves will be updated |
| 766 | */ |
| 767 | void DatapickerTest::referenceMove() { |
| 768 | Datapicker datapicker(QStringLiteral("Test")); |
| 769 | datapicker.addNewPoint(QPointF(0, 1), datapicker.image()); |
| 770 | datapicker.addNewPoint(QPointF(0, 0), datapicker.image()); |
| 771 | datapicker.addNewPoint(QPointF(1, 0), datapicker.image()); |
| 772 | |
| 773 | auto ap = datapicker.image()->axisPoints(); |
| 774 | ap.type = DatapickerImage::GraphType::Linear; |
| 775 | datapicker.image()->setAxisPoints(ap); |
| 776 | |
| 777 | DatapickerImageWidget w(nullptr); |
| 778 | w.setImages({datapicker.image()}); |
| 779 | w.ui.sbPositionX1->setValue(0); |
| 780 | w.ui.sbPositionY1->setValue(10); |
| 781 | w.ui.sbPositionZ1->setValue(0); |
| 782 | w.ui.sbPositionX2->setValue(0); |
| 783 | w.ui.sbPositionY2->setValue(0); |
| 784 | w.ui.sbPositionZ2->setValue(0); |
| 785 | w.ui.sbPositionX3->setValue(10); |
| 786 | w.ui.sbPositionY3->setValue(0); |
| 787 | w.ui.sbPositionZ3->setValue(0); |
| 788 | w.logicalPositionChanged(); |
| 789 | |
| 790 | auto* curve = new DatapickerCurve(i18n("Curve")); |
| 791 | curve->addDatasheet(datapicker.image()->axisPoints().type); |
| 792 | datapicker.addChild(curve); |
| 793 | |
| 794 | datapicker.addNewPoint(QPointF(0.5, 0.6), curve); // updates the curve data |
| 795 | VALUES_EQUAL(curve->posXColumn()->valueAt(0), 5.); |
| 796 | VALUES_EQUAL(curve->posYColumn()->valueAt(0), 6.); |
| 797 | |
| 798 | // Points are stored in the image |
| 799 | auto points = datapicker.image()->children<DatapickerPoint>(AbstractAspect::ChildIndexFlag::IncludeHidden); |
| 800 | QCOMPARE(points.count(), 3); |
| 801 | |
| 802 | // set position after mouse was released |
| 803 | points[0]->setPosition(QPointF(0., 4)); |
| 804 | // points[1]->setPosition(QPointF(0.1, 0.)); |
| 805 | points[2]->setPosition(QPointF(2., 0.)); |
| 806 | |
| 807 | // Currently not supported |
| 808 | // VALUES_EQUAL(curve->posXColumn()->valueAt(0), 0.5 / 2 * 10); |
| 809 | // VALUES_EQUAL(curve->posYColumn()->valueAt(0), 0.6 / 4 * 10); |
| 810 | } |
| 811 | |
| 812 | void DatapickerTest::referenceMoveKeyPress() { |
| 813 | Datapicker datapicker(QStringLiteral("Test")); |
nothing calls this directly
no test coverage detected