| 755 | } |
| 756 | |
| 757 | void RetransformTest::TestZoom() { |
| 758 | RetransformCallCounter c; |
| 759 | Project project; |
| 760 | |
| 761 | auto* sheet = new Spreadsheet(QStringLiteral("Spreadsheet"), false); |
| 762 | sheet->setColumnCount(2); |
| 763 | sheet->setRowCount(100); |
| 764 | |
| 765 | QVector<int> xData; |
| 766 | QVector<double> yData; |
| 767 | for (int i = 0; i < 100; i++) { |
| 768 | xData.append(i); |
| 769 | yData.append(i); |
| 770 | } |
| 771 | auto* xColumn = sheet->column(0); |
| 772 | xColumn->setColumnMode(AbstractColumn::ColumnMode::Integer); |
| 773 | xColumn->replaceInteger(0, xData); |
| 774 | auto* yColumn = sheet->column(1); |
| 775 | yColumn->setColumnMode(AbstractColumn::ColumnMode::Double); |
| 776 | yColumn->replaceValues(0, yData); |
| 777 | |
| 778 | project.addChild(sheet); |
| 779 | |
| 780 | auto* worksheet = new Worksheet(QStringLiteral("Worksheet - Spreadsheet")); |
| 781 | project.addChild(worksheet); |
| 782 | |
| 783 | auto* p = new CartesianPlot(QStringLiteral("Plot - Spreadsheet")); |
| 784 | p->setType(CartesianPlot::Type::FourAxes); // Otherwise no axis are created |
| 785 | worksheet->addChild(p); |
| 786 | |
| 787 | auto* curve = new XYCurve(QStringLiteral("curve")); |
| 788 | p->addChild(curve); |
| 789 | curve->setXColumn(xColumn); |
| 790 | curve->setYColumn(yColumn); |
| 791 | |
| 792 | auto children = project.children(AspectType::AbstractAspect, AbstractAspect::ChildIndexFlag::Recursive); |
| 793 | |
| 794 | // Spreadsheet "Spreadsheet" |
| 795 | // Column "1" |
| 796 | // Column "2" |
| 797 | // Worksheet "Worksheet-Spreadsheet" |
| 798 | // CartesianPlot "Plot-Spreadsheet" |
| 799 | // Axis "x" |
| 800 | // Axis "x2" |
| 801 | // Axis "y" |
| 802 | // Axis "y2" |
| 803 | // XYCurve "curve" |
| 804 | QCOMPARE(children.length(), 10); |
| 805 | for (const auto& child : children) |
| 806 | connect(child, &AbstractAspect::retransformCalledSignal, &c, &RetransformCallCounter::aspectRetransformed); |
| 807 | |
| 808 | auto plots = project.children(AspectType::CartesianPlot, AbstractAspect::ChildIndexFlag::Recursive); |
| 809 | QCOMPARE(plots.length(), 1); |
| 810 | auto* plot = static_cast<CartesianPlot*>(plots[0]); |
| 811 | connect(static_cast<CartesianPlot*>(plot), &CartesianPlot::scaleRetransformed, &c, &RetransformCallCounter::retransformScaleCalled); |
| 812 | |
| 813 | plot->zoomInX(); |
| 814 |
nothing calls this directly
no test coverage detected