! * \brief AxisTest3::customColumnNumericMaxValuesLimitedRange * The range is limited to 100-200 (max Range: 0-1000). But still 20 ticks shall be visible */
| 819 | * The range is limited to 100-200 (max Range: 0-1000). But still 20 ticks shall be visible |
| 820 | */ |
| 821 | void AxisTest3::customColumnNumericMaxValuesLimitedRange() { |
| 822 | constexpr int rowCountCustomColumn = 1000; |
| 823 | |
| 824 | Project project; |
| 825 | auto* ws = new Worksheet(QStringLiteral("worksheet")); |
| 826 | QVERIFY(ws != nullptr); |
| 827 | project.addChild(ws); |
| 828 | ws->setPageRect(QRectF(0, 0, 300, 300)); |
| 829 | ws->setLayoutBottomMargin(0); |
| 830 | ws->setLayoutTopMargin(0); |
| 831 | ws->setLayoutRightMargin(0); |
| 832 | ws->setLayoutLeftMargin(0); |
| 833 | |
| 834 | Spreadsheet* spreadsheetData = new Spreadsheet(QStringLiteral("data"), false); |
| 835 | spreadsheetData->setColumnCount(2); |
| 836 | spreadsheetData->setRowCount(3); |
| 837 | project.addChild(spreadsheetData); |
| 838 | auto* xCol = spreadsheetData->column(0); |
| 839 | xCol->setColumnMode(AbstractColumn::ColumnMode::Double); |
| 840 | xCol->replaceValues(-1, QVector<double>({0., 1000.})); |
| 841 | auto* yCol = spreadsheetData->column(1); |
| 842 | yCol->replaceValues(-1, QVector<double>({0., 1000.})); |
| 843 | |
| 844 | Spreadsheet* spreadsheetLabels = new Spreadsheet(QStringLiteral("labels"), false); |
| 845 | spreadsheetLabels->setColumnCount(2); |
| 846 | spreadsheetLabels->setRowCount(3); |
| 847 | project.addChild(spreadsheetLabels); |
| 848 | auto* posCol = spreadsheetLabels->column(0); |
| 849 | posCol->setColumnMode(AbstractColumn::ColumnMode::Integer); |
| 850 | QVector<int> posValues; |
| 851 | QVector<QString> customLabels; |
| 852 | for (int i = 0; i < rowCountCustomColumn; i++) { |
| 853 | posValues.push_back(i); |
| 854 | customLabels.push_back(QStringLiteral("Some text") + QString::number(i)); |
| 855 | } |
| 856 | posCol->replaceInteger(-1, posValues); |
| 857 | auto* labelsCol = spreadsheetLabels->column(1); |
| 858 | labelsCol->setColumnMode(AbstractColumn::ColumnMode::Text); |
| 859 | labelsCol->replaceTexts(-1, customLabels); |
| 860 | |
| 861 | auto* p = new CartesianPlot(QStringLiteral("plot")); |
| 862 | p->setType(CartesianPlot::Type::TwoAxes); // Otherwise no axes are created |
| 863 | p->setNiceExtend(false); |
| 864 | QVERIFY(p != nullptr); |
| 865 | p->setBottomPadding(0); |
| 866 | p->setHorizontalPadding(0); |
| 867 | p->setRightPadding(0); |
| 868 | p->setVerticalPadding(0); |
| 869 | ws->addChild(p); |
| 870 | |
| 871 | auto* curve = new XYCurve(QStringLiteral("xy-curve")); |
| 872 | curve->setXColumn(xCol); |
| 873 | curve->setYColumn(yCol); |
| 874 | p->addChild(curve); |
| 875 | p->enableAutoScale(Dimension::X, 0, false); |
| 876 | auto r = p->range(Dimension::X, 0); |
| 877 | r.setStart(100.); |
| 878 | r.setEnd(200.); |
nothing calls this directly
no test coverage detected