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

Method TestChangePlotRangeElement3

tests/backend/Retransform/RetransformTest.cpp:1572–1778  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1570}
1571
1572void RetransformTest::TestChangePlotRangeElement3() {
1573 // Change the plotrange of one of the elements
1574 // This time curve1 changes csystem
1575 // --> yRange1 and yRange2 have to be transformed
1576
1577 RetransformCallCounter c;
1578 Project project;
1579
1580 auto* sheet = new Spreadsheet(QStringLiteral("Spreadsheet"), false);
1581 sheet->setColumnCount(4);
1582 sheet->setRowCount(100);
1583
1584 project.addChild(sheet);
1585
1586 auto* worksheet = new Worksheet(QStringLiteral("Worksheet"));
1587 project.addChild(worksheet);
1588
1589 auto* p = new CartesianPlot(QStringLiteral("Plot"));
1590 p->setType(CartesianPlot::Type::FourAxes); // Otherwise no axis are created
1591 worksheet->addChild(p);
1592 p->setNiceExtend(false);
1593
1594 auto* curve = new XYCurve(QStringLiteral("curve"));
1595 p->addChild(curve);
1596 {
1597 QVector<int> xData;
1598 QVector<double> yData;
1599 for (int i = 1; i < 101; i++) {
1600 xData.append(i);
1601 yData.append(i);
1602 }
1603 auto* xColumn = sheet->column(0);
1604 xColumn->setColumnMode(AbstractColumn::ColumnMode::Integer);
1605 xColumn->replaceInteger(0, xData);
1606 auto* yColumn = sheet->column(1);
1607 yColumn->setColumnMode(AbstractColumn::ColumnMode::Double);
1608 yColumn->replaceValues(0, yData);
1609 curve->setXColumn(xColumn);
1610 curve->setYColumn(yColumn);
1611 }
1612
1613 auto* curve2 = new XYCurve(QStringLiteral("curve2"));
1614 p->addChild(curve2);
1615 {
1616 QVector<int> xData;
1617 QVector<double> yData;
1618 for (int i = 1; i < 31; i++) { // different to the above
1619 xData.append(i);
1620 yData.append(i);
1621 }
1622 auto* xColumn = sheet->column(2);
1623 xColumn->setColumnMode(AbstractColumn::ColumnMode::Integer);
1624 xColumn->replaceInteger(0, xData);
1625 auto* yColumn = sheet->column(3);
1626 yColumn->setColumnMode(AbstractColumn::ColumnMode::Double);
1627 yColumn->replaceValues(0, yData);
1628 curve2->setXColumn(xColumn);
1629 curve2->setYColumn(yColumn);

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