! * \brief RetransformTest::TestPadding * Check that during a padding change retransform and retransform scale is called */
| 514 | * Check that during a padding change retransform and retransform scale is called |
| 515 | */ |
| 516 | void RetransformTest::TestPadding() { |
| 517 | RetransformCallCounter c; |
| 518 | Project project; |
| 519 | |
| 520 | project.load(QFINDTESTDATA(QLatin1String("data/p1.lml"))); |
| 521 | auto children = project.children(AspectType::AbstractAspect, AbstractAspect::ChildIndexFlag::Recursive); |
| 522 | |
| 523 | // Spreadsheet "Spreadsheet" |
| 524 | // Column "x" |
| 525 | // Column "sin" |
| 526 | // Column "cos" |
| 527 | // Column "tan" |
| 528 | // Worksheet "Worksheet" |
| 529 | // CartesianPlot "xy-plot" |
| 530 | // Axis "x" |
| 531 | // Axis "y" |
| 532 | // XYCurve "sin" |
| 533 | // XYCurve "cos" |
| 534 | // XYCurve "tan" |
| 535 | // Axis "y-axis" |
| 536 | // Legend "legend" |
| 537 | // TextLabel "plotText" |
| 538 | // Image "plotImage" |
| 539 | // TextLabel "Text Label" |
| 540 | // Image "Image" |
| 541 | // --- Second plot |
| 542 | // CartesianPlot "plot2" |
| 543 | // Axis "x" |
| 544 | // Axis "y" |
| 545 | // XYCurve "xy-curve" |
| 546 | QCOMPARE(children.length(), 22); |
| 547 | for (const auto& child : children) |
| 548 | connect(child, &AbstractAspect::retransformCalledSignal, &c, &RetransformCallCounter::aspectRetransformed); |
| 549 | |
| 550 | for (const auto& plot : project.children(AspectType::CartesianPlot, AbstractAspect::ChildIndexFlag::Recursive)) |
| 551 | connect(static_cast<CartesianPlot*>(plot), &CartesianPlot::scaleRetransformed, &c, &RetransformCallCounter::retransformScaleCalled); |
| 552 | |
| 553 | auto* worksheet = project.child<Worksheet>(0); |
| 554 | QVERIFY(worksheet); |
| 555 | |
| 556 | auto* view = static_cast<WorksheetView*>(worksheet->view()); |
| 557 | QVERIFY(view); |
| 558 | |
| 559 | auto* plot = worksheet->child<CartesianPlot>(0); |
| 560 | QVERIFY(plot); |
| 561 | QCOMPARE(plot->name(), QLatin1String("xy-plot")); |
| 562 | |
| 563 | // Check that every element is exactly called once |
| 564 | // TODO: set to 6. legend should not retransform |
| 565 | // plot it self does not change so retransform is not called on cartesianplotPrivate |
| 566 | QStringList list = {QStringLiteral("Project/Worksheet/xy-plot"), // datarect changed, so plot must also be retransformed |
| 567 | QStringLiteral("Project/Worksheet/xy-plot/x"), |
| 568 | QStringLiteral("Project/Worksheet/xy-plot/y"), |
| 569 | QStringLiteral("Project/Worksheet/xy-plot/sin"), |
| 570 | QStringLiteral("Project/Worksheet/xy-plot/cos"), |
| 571 | QStringLiteral("Project/Worksheet/xy-plot/tan"), |
| 572 | QStringLiteral("Project/Worksheet/xy-plot/y-axis"), |
| 573 | QStringLiteral("Project/Worksheet/xy-plot/legend"), |
nothing calls this directly
no test coverage detected