MCPcopy Create free account
hub / github.com/KDE/labplot / TestChangePlotRangeElement2

Method TestChangePlotRangeElement2

tests/backend/Retransform/RetransformTest.cpp:1366–1570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1364}
1365
1366void RetransformTest::TestChangePlotRangeElement2() {
1367 // Change the plotrange of one of the elements
1368
1369 RetransformCallCounter c;
1370 Project project;
1371
1372 auto* sheet = new Spreadsheet(QStringLiteral("Spreadsheet"), false);
1373 sheet->setColumnCount(4);
1374 sheet->setRowCount(100);
1375
1376 project.addChild(sheet);
1377
1378 auto* worksheet = new Worksheet(QStringLiteral("Worksheet"));
1379 project.addChild(worksheet);
1380
1381 auto* p = new CartesianPlot(QStringLiteral("Plot"));
1382 p->setType(CartesianPlot::Type::FourAxes); // Otherwise no axis are created
1383 worksheet->addChild(p);
1384 p->setNiceExtend(false);
1385
1386 auto* curve = new XYCurve(QStringLiteral("curve"));
1387 p->addChild(curve);
1388 {
1389 QVector<int> xData;
1390 QVector<double> yData;
1391 for (int i = 1; i < 101; i++) {
1392 xData.append(i);
1393 yData.append(i);
1394 }
1395 auto* xColumn = sheet->column(0);
1396 xColumn->setColumnMode(AbstractColumn::ColumnMode::Integer);
1397 xColumn->replaceInteger(0, xData);
1398 auto* yColumn = sheet->column(1);
1399 yColumn->setColumnMode(AbstractColumn::ColumnMode::Double);
1400 yColumn->replaceValues(0, yData);
1401 curve->setXColumn(xColumn);
1402 curve->setYColumn(yColumn);
1403 }
1404
1405 auto* curve2 = new XYCurve(QStringLiteral("curve2"));
1406 p->addChild(curve2);
1407 {
1408 QVector<int> xData;
1409 QVector<double> yData;
1410 for (int i = 1; i < 31; i++) { // different to the above
1411 xData.append(i);
1412 yData.append(i);
1413 }
1414 auto* xColumn = sheet->column(2);
1415 xColumn->setColumnMode(AbstractColumn::ColumnMode::Integer);
1416 xColumn->replaceInteger(0, xData);
1417 auto* yColumn = sheet->column(3);
1418 yColumn->setColumnMode(AbstractColumn::ColumnMode::Double);
1419 yColumn->replaceValues(0, yData);
1420 curve2->setXColumn(xColumn);
1421 curve2->setYColumn(yColumn);
1422 }
1423

Callers

nothing calls this directly

Calls 15

setNiceExtendMethod · 0.80
appendMethod · 0.80
setYColumnMethod · 0.80
rangeMethod · 0.80
lengthMethod · 0.80
addPlotRangeMethod · 0.80
resetRetransformCountMethod · 0.80
PlotRangeChangedMethod · 0.80
coordinateSystemIndexMethod · 0.80
dataRectMethod · 0.80
setColumnCountMethod · 0.45
setRowCountMethod · 0.45

Tested by

no test coverage detected