Test if setting curve points on the image result in correct values for lnY mapping
| 536 | |
| 537 | // Test if setting curve points on the image result in correct values for lnY mapping |
| 538 | void DatapickerTest::logarithmicNaturalYMapping() { |
| 539 | Datapicker datapicker(QStringLiteral("Test")); |
| 540 | auto* image = datapicker.image(); |
| 541 | |
| 542 | // Set reference points |
| 543 | datapicker.addNewPoint(QPointF(3, 10), image); |
| 544 | datapicker.addNewPoint(QPointF(3, 0), image); |
| 545 | datapicker.addNewPoint(QPointF(13, 0), image); |
| 546 | |
| 547 | auto ap = image->axisPoints(); |
| 548 | ap.type = DatapickerImage::GraphType::LnY; |
| 549 | image->setAxisPoints(ap); |
| 550 | |
| 551 | DatapickerImageWidget w(nullptr); |
| 552 | w.setImages({image}); |
| 553 | w.ui.sbPositionX1->setValue(0); |
| 554 | w.ui.sbPositionY1->setValue(100); |
| 555 | w.ui.sbPositionZ1->setValue(0); |
| 556 | w.ui.sbPositionX2->setValue(0); |
| 557 | w.ui.sbPositionY2->setValue(0); |
| 558 | w.ui.sbPositionZ2->setValue(0); |
| 559 | w.ui.sbPositionX3->setValue(100); |
| 560 | w.ui.sbPositionY3->setValue(0); |
| 561 | w.ui.sbPositionZ3->setValue(0); |
| 562 | w.logicalPositionChanged(); |
| 563 | |
| 564 | auto* curve = new DatapickerCurve(i18n("Curve")); |
| 565 | curve->addDatasheet(image->axisPoints().type); |
| 566 | datapicker.addChild(curve); |
| 567 | |
| 568 | datapicker.addNewPoint(QPointF(5, 6), curve); // updates the curve data |
| 569 | VALUES_EQUAL(curve->posXColumn()->valueAt(0), 0.); // x start is zero, which is not valid therefore the result is 0 |
| 570 | VALUES_EQUAL(curve->posYColumn()->valueAt(0), 0.); // x start is zero, which is not valid therefore the result is 0 |
| 571 | |
| 572 | QCOMPARE(w.ui.sbPositionY2->setValue(1), true); // axisPointsChanged will call updatePoint() |
| 573 | QCOMPARE(w.ui.sbPositionY3->setValue(1), true); // axisPointsChanged will call updatePoint() |
| 574 | w.ui.sbPositionY3->valueChanged(1); // axisPointsChanged will call updatePoint() |
| 575 | |
| 576 | VALUES_EQUAL(curve->posXColumn()->valueAt(0), 20.); |
| 577 | // Value validated manually, not reverse calculated |
| 578 | VALUES_EQUAL(curve->posYColumn()->valueAt(0), 15.8489322662); |
| 579 | } |
| 580 | |
| 581 | // Test if setting curve points on the image result in correct values for lnXY mapping |
| 582 | void DatapickerTest::logarithmicNaturalXYMapping() { |
nothing calls this directly
no test coverage detected