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

Method rangeFormatNonDefaultRange

tests/cartesianplot/CartesianPlotTest.cpp:663–744  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

661}
662
663void CartesianPlotTest::rangeFormatNonDefaultRange() {
664 Project project;
665
666 Spreadsheet* sheet = new Spreadsheet(QStringLiteral("Spreadsheet"), false);
667 project.addChild(sheet);
668
669 sheet->setColumnCount(4);
670 sheet->setRowCount(3);
671
672 sheet->column(0)->setColumnMode(AbstractColumn::ColumnMode::Integer);
673 sheet->column(1)->setColumnMode(AbstractColumn::ColumnMode::Integer);
674 sheet->column(2)->setColumnMode(AbstractColumn::ColumnMode::DateTime);
675 sheet->column(3)->setColumnMode(AbstractColumn::ColumnMode::Integer);
676
677 sheet->column(0)->setValueAt(0, 0);
678 sheet->column(0)->setValueAt(1, 1);
679 sheet->column(0)->setValueAt(2, 2);
680
681 sheet->column(1)->setValueAt(0, 5);
682 sheet->column(1)->setValueAt(1, 6);
683 sheet->column(1)->setValueAt(2, 7);
684
685 sheet->column(2)->setDateTimeAt(0, QDateTime::fromString(QStringLiteral("2022-02-03 12:23:00"), Qt::ISODate));
686 sheet->column(2)->setDateTimeAt(1, QDateTime::fromString(QStringLiteral("2022-02-04 12:23:00"), Qt::ISODate));
687 sheet->column(2)->setDateTimeAt(2, QDateTime::fromString(QStringLiteral("2022-02-05 12:23:00"), Qt::ISODate));
688
689 QCOMPARE(sheet->column(2)->dateTimeAt(0), QDateTime::fromString(QStringLiteral("2022-02-03 12:23:00"), Qt::ISODate));
690
691 sheet->column(3)->setValueAt(0, 8);
692 sheet->column(3)->setValueAt(1, 10);
693 sheet->column(3)->setValueAt(2, 9);
694
695 auto* worksheet = new Worksheet(QStringLiteral("Worksheet"));
696 project.addChild(worksheet);
697
698 auto* plot = new CartesianPlot(QStringLiteral("plot"));
699 worksheet->addChild(plot);
700 plot->setType(CartesianPlot::Type::TwoAxes); // Otherwise no axis are created
701
702 // Create new cSystem
703 Range<double> xRange;
704 xRange.setFormat(RangeT::Format::Numeric);
705 Range<double> yRange;
706 yRange.setFormat(RangeT::Format::Numeric);
707 plot->addXRange(xRange);
708 plot->addYRange(yRange);
709 CartesianCoordinateSystem* cSystem = new CartesianCoordinateSystem(plot);
710 cSystem->setIndex(Dimension::X, 1);
711 cSystem->setIndex(Dimension::Y, 1);
712 plot->addCoordinateSystem(cSystem);
713
714 auto* curve2 = new XYCurve(QStringLiteral("curve2"));
715 plot->addChild(curve2);
716
717 curve2->setCoordinateSystemIndex(1);
718
719 QCOMPARE(plot->rangeFormat(Dimension::X, 0), RangeT::Format::Numeric);
720 QCOMPARE(plot->rangeFormat(Dimension::Y, 0), RangeT::Format::Numeric);

Callers

nothing calls this directly

Calls 15

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

Tested by

no test coverage detected