| 737 | } |
| 738 | |
| 739 | void AxisTest3::customColumnNonMonotonicColumnValues() { |
| 740 | Project project; |
| 741 | auto* ws = new Worksheet(QStringLiteral("worksheet")); |
| 742 | QVERIFY(ws != nullptr); |
| 743 | project.addChild(ws); |
| 744 | ws->setPageRect(QRectF(0, 0, 300, 300)); |
| 745 | ws->setLayoutBottomMargin(0); |
| 746 | ws->setLayoutTopMargin(0); |
| 747 | ws->setLayoutRightMargin(0); |
| 748 | ws->setLayoutLeftMargin(0); |
| 749 | |
| 750 | Spreadsheet* spreadsheetData = new Spreadsheet(QStringLiteral("data"), false); |
| 751 | spreadsheetData->setColumnCount(2); |
| 752 | spreadsheetData->setRowCount(3); |
| 753 | project.addChild(spreadsheetData); |
| 754 | auto* xCol = spreadsheetData->column(0); |
| 755 | xCol->setColumnMode(AbstractColumn::ColumnMode::Double); |
| 756 | xCol->replaceValues(-1, QVector<double>({0., 1000.})); |
| 757 | auto* yCol = spreadsheetData->column(1); |
| 758 | yCol->replaceValues(-1, QVector<double>({0., 1000.})); |
| 759 | |
| 760 | Spreadsheet* spreadsheetLabels = new Spreadsheet(QStringLiteral("labels"), false); |
| 761 | spreadsheetLabels->setColumnCount(2); |
| 762 | spreadsheetLabels->setRowCount(3); |
| 763 | project.addChild(spreadsheetLabels); |
| 764 | auto* posCol = spreadsheetLabels->column(0); |
| 765 | posCol->setColumnMode(AbstractColumn::ColumnMode::Double); |
| 766 | QVector<double> posValues({ |
| 767 | 0., 5., 3., 800., 500., 300., 200., 1., 6., 2., 900., 787., 333., 128., 999., 650., 11., 14., 18., 20., 576., 238., 239., |
| 768 | }); |
| 769 | for (int i = 100; i < 200; i++) |
| 770 | posValues.push_back(i); // Add more posValues which are between 100 and 200 |
| 771 | |
| 772 | posCol->replaceValues(-1, posValues); |
| 773 | QVERIFY(posCol->rowCount() > Axis::maxNumberMajorTicksCustomColumn()); |
| 774 | |
| 775 | auto* p = new CartesianPlot(QStringLiteral("plot")); |
| 776 | p->setType(CartesianPlot::Type::TwoAxes); // Otherwise no axes are created |
| 777 | p->setNiceExtend(false); |
| 778 | QVERIFY(p != nullptr); |
| 779 | p->setBottomPadding(0); |
| 780 | p->setHorizontalPadding(0); |
| 781 | p->setRightPadding(0); |
| 782 | p->setVerticalPadding(0); |
| 783 | ws->addChild(p); |
| 784 | |
| 785 | auto* curve = new XYCurve(QStringLiteral("xy-curve")); |
| 786 | curve->setXColumn(xCol); |
| 787 | curve->setYColumn(yCol); |
| 788 | p->addChild(curve); |
| 789 | p->enableAutoScale(Dimension::X, 0, false); |
| 790 | auto r = p->range(Dimension::X, 0); |
| 791 | r.setStart(100.); |
| 792 | r.setEnd(200.); |
| 793 | p->setRange(Dimension::X, 0, r); |
| 794 | |
| 795 | auto axes = p->children<Axis>(); |
| 796 | QCOMPARE(axes.count(), 2); |
nothing calls this directly
no test coverage detected