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

Method rangeFormatYDataChanged

tests/cartesianplot/CartesianPlotTest.cpp:573–616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

571}
572
573void CartesianPlotTest::rangeFormatYDataChanged() {
574 Project project;
575
576 Spreadsheet* sheet = new Spreadsheet(QStringLiteral("Spreadsheet"), false);
577 project.addChild(sheet);
578
579 sheet->setColumnCount(2);
580 sheet->setRowCount(3);
581
582 sheet->column(0)->setColumnMode(AbstractColumn::ColumnMode::DateTime);
583 sheet->column(1)->setColumnMode(AbstractColumn::ColumnMode::Integer);
584
585 sheet->column(0)->setDateTimeAt(0, QDateTime::fromString(QStringLiteral("2022-02-03 12:23:00"), Qt::ISODate));
586 sheet->column(0)->setDateTimeAt(1, QDateTime::fromString(QStringLiteral("2022-02-04 12:23:00"), Qt::ISODate));
587 sheet->column(0)->setDateTimeAt(2, QDateTime::fromString(QStringLiteral("2022-02-05 12:23:00"), Qt::ISODate));
588
589 QCOMPARE(sheet->column(0)->dateTimeAt(0), QDateTime::fromString(QStringLiteral("2022-02-03 12:23:00"), Qt::ISODate));
590
591 sheet->column(1)->setValueAt(0, 0);
592 sheet->column(1)->setValueAt(1, 1);
593 sheet->column(1)->setValueAt(2, 2);
594
595 auto* worksheet = new Worksheet(QStringLiteral("Worksheet"));
596 project.addChild(worksheet);
597
598 auto* plot = new CartesianPlot(QStringLiteral("plot"));
599 worksheet->addChild(plot);
600 plot->setType(CartesianPlot::Type::TwoAxes); // Otherwise no axis are created
601
602 auto* curve = new XYCurve(QStringLiteral("curve"));
603 plot->addChild(curve);
604
605 curve->setXColumn(sheet->column(0));
606 curve->setYColumn(sheet->column(1));
607
608 QCOMPARE(plot->rangeFormat(Dimension::X, 0), RangeT::Format::DateTime);
609 QCOMPARE(plot->rangeFormat(Dimension::Y, 0), RangeT::Format::Numeric);
610
611 // simulate data change
612 plot->dataChanged(curve, Dimension::Y);
613
614 QCOMPARE(plot->rangeFormat(Dimension::X, 0), RangeT::Format::DateTime);
615 QCOMPARE(plot->rangeFormat(Dimension::Y, 0), RangeT::Format::Numeric);
616}
617
618void CartesianPlotTest::rangeFormatXDataChanged() {
619 Project project;

Callers

nothing calls this directly

Calls 13

setYColumnMethod · 0.80
rangeFormatMethod · 0.80
addChildMethod · 0.45
setColumnCountMethod · 0.45
setRowCountMethod · 0.45
setColumnModeMethod · 0.45
columnMethod · 0.45
setDateTimeAtMethod · 0.45
dateTimeAtMethod · 0.45
setValueAtMethod · 0.45
setTypeMethod · 0.45
setXColumnMethod · 0.45

Tested by

no test coverage detected