| 2262 | } |
| 2263 | |
| 2264 | void RetransformTest::removeReaddyColum() { |
| 2265 | Project project; |
| 2266 | auto* ws = new Worksheet(QStringLiteral("worksheet")); |
| 2267 | QVERIFY(ws != nullptr); |
| 2268 | project.addChild(ws); |
| 2269 | |
| 2270 | auto* sheet = new Spreadsheet(QStringLiteral("Spreadsheet"), false); |
| 2271 | sheet->setColumnCount(2); |
| 2272 | sheet->setRowCount(11); |
| 2273 | project.addChild(sheet); |
| 2274 | |
| 2275 | auto* p = new CartesianPlot(QStringLiteral("plot")); |
| 2276 | QVERIFY(p != nullptr); |
| 2277 | ws->addChild(p); |
| 2278 | |
| 2279 | auto* curve{new XYEquationCurve(QStringLiteral("f(x)"))}; |
| 2280 | curve->setCoordinateSystemIndex(p->defaultCoordinateSystemIndex()); |
| 2281 | p->addChild(curve); |
| 2282 | |
| 2283 | XYEquationCurve::EquationData data; |
| 2284 | data.min = QStringLiteral("0"); |
| 2285 | data.max = QStringLiteral("10"); |
| 2286 | data.count = 11; |
| 2287 | data.expression1 = QStringLiteral("x"); |
| 2288 | curve->setEquationData(data); |
| 2289 | curve->recalculate(); |
| 2290 | |
| 2291 | auto* curve2 = new XYCurve(QStringLiteral("curve2")); |
| 2292 | p->addChild(curve2); |
| 2293 | |
| 2294 | auto* xColumn = sheet->column(0); |
| 2295 | auto* yColumn = sheet->column(1); |
| 2296 | { |
| 2297 | QVector<int> xData; |
| 2298 | QVector<double> yData; |
| 2299 | for (int i = 1; i < 11; i++) { // different to the above |
| 2300 | xData.append(i); |
| 2301 | yData.append(pow(i, 2)); |
| 2302 | } |
| 2303 | |
| 2304 | xColumn->setColumnMode(AbstractColumn::ColumnMode::Integer); |
| 2305 | xColumn->replaceInteger(0, xData); |
| 2306 | yColumn->setColumnMode(AbstractColumn::ColumnMode::Double); |
| 2307 | yColumn->replaceValues(0, yData); |
| 2308 | curve2->setXColumn(xColumn); |
| 2309 | curve2->setYColumn(yColumn); |
| 2310 | } |
| 2311 | |
| 2312 | CHECK_RANGE(p, curve, Dimension::X, 0., 10.); |
| 2313 | CHECK_RANGE(p, curve, Dimension::Y, 0., 100.); |
| 2314 | |
| 2315 | sheet->removeChild(yColumn); |
| 2316 | |
| 2317 | // Curve 2 got invalid |
| 2318 | CHECK_RANGE(p, curve, Dimension::X, 0., 10.); |
| 2319 | CHECK_RANGE(p, curve, Dimension::Y, 0., 10.); |
| 2320 | |
| 2321 | const auto oldNameYColumn = yColumn->name(); |
nothing calls this directly
no test coverage detected