Test if setting curve points on the image result in correct values for Linear mapping
| 452 | |
| 453 | // Test if setting curve points on the image result in correct values for Linear mapping |
| 454 | void DatapickerTest::linearMapping() { |
| 455 | Datapicker datapicker(QStringLiteral("Test")); |
| 456 | auto* image = datapicker.image(); |
| 457 | |
| 458 | // Set reference points |
| 459 | datapicker.addNewPoint(QPointF(0, 1), image); |
| 460 | datapicker.addNewPoint(QPointF(0, 0), image); |
| 461 | datapicker.addNewPoint(QPointF(1, 0), image); |
| 462 | |
| 463 | auto ap = image->axisPoints(); |
| 464 | ap.type = DatapickerImage::GraphType::Linear; |
| 465 | image->setAxisPoints(ap); |
| 466 | |
| 467 | DatapickerImageWidget w(nullptr); |
| 468 | w.setImages({image}); |
| 469 | w.ui.sbPositionX1->setValue(0); |
| 470 | w.ui.sbPositionY1->setValue(10); |
| 471 | w.ui.sbPositionZ1->setValue(0); |
| 472 | w.ui.sbPositionX2->setValue(0); |
| 473 | w.ui.sbPositionY2->setValue(0); |
| 474 | w.ui.sbPositionZ2->setValue(0); |
| 475 | w.ui.sbPositionX3->setValue(10); |
| 476 | w.ui.sbPositionY3->setValue(0); |
| 477 | w.ui.sbPositionZ3->setValue(0); |
| 478 | w.logicalPositionChanged(); |
| 479 | |
| 480 | auto* curve = new DatapickerCurve(i18n("Curve")); |
| 481 | curve->addDatasheet(image->axisPoints().type); |
| 482 | datapicker.addChild(curve); |
| 483 | |
| 484 | datapicker.addNewPoint(QPointF(0.5, 0.5), curve); // updates the curve data |
| 485 | VALUES_EQUAL(curve->posXColumn()->valueAt(0), 5.); |
| 486 | VALUES_EQUAL(curve->posYColumn()->valueAt(0), 5.); |
| 487 | |
| 488 | datapicker.addNewPoint(QPointF(0.7, 0.65), curve); // updates the curve data |
| 489 | VALUES_EQUAL(curve->posXColumn()->valueAt(1), 7.); |
| 490 | VALUES_EQUAL(curve->posYColumn()->valueAt(1), 6.5); |
| 491 | } |
| 492 | |
| 493 | // Test if setting curve points on the image result in correct values for lnX mapping |
| 494 | void DatapickerTest::logarithmicNaturalXMapping() { |
nothing calls this directly
no test coverage detected