Test if setting curve points on the image result in correct values for logY mapping
| 671 | |
| 672 | // Test if setting curve points on the image result in correct values for logY mapping |
| 673 | void DatapickerTest::logarithmic10YMapping() { |
| 674 | Datapicker datapicker(QStringLiteral("Test")); |
| 675 | auto* image = datapicker.image(); |
| 676 | |
| 677 | // Set reference points |
| 678 | datapicker.addNewPoint(QPointF(3, 10), image); |
| 679 | datapicker.addNewPoint(QPointF(3, 0), image); |
| 680 | datapicker.addNewPoint(QPointF(13, 0), image); |
| 681 | |
| 682 | auto ap = image->axisPoints(); |
| 683 | ap.type = DatapickerImage::GraphType::Log10Y; |
| 684 | image->setAxisPoints(ap); |
| 685 | |
| 686 | DatapickerImageWidget w(nullptr); |
| 687 | w.setImages({image}); |
| 688 | w.ui.sbPositionX1->setValue(0); |
| 689 | w.ui.sbPositionY1->setValue(100); |
| 690 | w.ui.sbPositionZ1->setValue(0); |
| 691 | w.ui.sbPositionX2->setValue(0); |
| 692 | w.ui.sbPositionY2->setValue(0); |
| 693 | w.ui.sbPositionZ2->setValue(0); |
| 694 | w.ui.sbPositionX3->setValue(100); |
| 695 | w.ui.sbPositionY3->setValue(0); |
| 696 | w.ui.sbPositionZ3->setValue(0); |
| 697 | w.logicalPositionChanged(); |
| 698 | |
| 699 | auto* curve = new DatapickerCurve(i18n("Curve")); |
| 700 | curve->addDatasheet(image->axisPoints().type); |
| 701 | datapicker.addChild(curve); |
| 702 | |
| 703 | datapicker.addNewPoint(QPointF(5, 6), curve); // updates the curve data |
| 704 | VALUES_EQUAL(curve->posXColumn()->valueAt(0), 0.); // x start is zero, which is not valid therefore the result is 0 |
| 705 | VALUES_EQUAL(curve->posYColumn()->valueAt(0), 0.); // x start is zero, which is not valid therefore the result is 0 |
| 706 | |
| 707 | QCOMPARE(w.ui.sbPositionY2->setValue(1), true); |
| 708 | QCOMPARE(w.ui.sbPositionY3->setValue(1), true); |
| 709 | w.ui.sbPositionY3->valueChanged(1); // axisPointsChanged will call updatePoint() |
| 710 | QCOMPARE(image->axisPoints().type, DatapickerImage::GraphType::Log10Y); |
| 711 | |
| 712 | VALUES_EQUAL(curve->posXColumn()->valueAt(0), 20.); |
| 713 | // Value validated manually, not reverse calculated |
| 714 | VALUES_EQUAL(curve->posYColumn()->valueAt(0), 15.8489322662); |
| 715 | } |
| 716 | |
| 717 | // Test if setting curve points on the image result in correct values for logXY mapping |
| 718 | void DatapickerTest::logarithmic10XYMapping() { |
nothing calls this directly
no test coverage detected