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

Method testRange03

tests/backend/BarPlot/BarPlotTest.cpp:85–121  ·  view source on GitHub ↗

! * \brief two datasets, stacked */

Source from the content-addressed store, hash-verified

83 * \brief two datasets, stacked
84 */
85void BarPlotTest::testRange03() {
86 Project project;
87 auto* ws = new Worksheet(QStringLiteral("worksheet"));
88 project.addChild(ws);
89
90 auto* p = new CartesianPlot(QStringLiteral("plot"));
91 ws->addChild(p);
92
93 auto* barPlot = new BarPlot(QStringLiteral("barplot"));
94 barPlot->setType(BarPlot::Type::Stacked);
95 p->addChild(barPlot);
96
97 // set the data
98 QVector<const AbstractColumn*> dataColumns;
99
100 auto* c1 = new Column(QStringLiteral("data1"));
101 c1->setValueAt(0, 3.);
102 c1->setValueAt(1, 6.);
103 c1->setValueAt(2, 9.);
104 c1->setValueAt(3, 12.);
105 dataColumns << c1;
106
107 auto* c2 = new Column(QStringLiteral("data2"));
108 c2->setValueAt(0, 2.);
109 c2->setValueAt(1, 5.);
110 c2->setValueAt(2, 8.);
111 c2->setValueAt(3, 11.);
112 dataColumns << c2;
113
114 barPlot->setDataColumns(dataColumns);
115
116 // check the min and max range values
117 QCOMPARE(barPlot->minimum(Dimension::X), 0.);
118 QCOMPARE(barPlot->maximum(Dimension::X), 4.);
119 QCOMPARE(barPlot->minimum(Dimension::Y), 0.);
120 QCOMPARE(barPlot->maximum(Dimension::Y), 23.);
121}
122
123/*!
124 * \brief two datasets, stacked, with a negative value

Callers

nothing calls this directly

Calls 6

addChildMethod · 0.45
setTypeMethod · 0.45
setValueAtMethod · 0.45
setDataColumnsMethod · 0.45
minimumMethod · 0.45
maximumMethod · 0.45

Tested by

no test coverage detected