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

Method testRange05

tests/backend/BarPlot/BarPlotTest.cpp:167–203  ·  view source on GitHub ↗

! * \brief two datasets, stacked 100% */

Source from the content-addressed store, hash-verified

165 * \brief two datasets, stacked 100%
166 */
167void BarPlotTest::testRange05() {
168 Project project;
169 auto* ws = new Worksheet(QStringLiteral("worksheet"));
170 project.addChild(ws);
171
172 auto* p = new CartesianPlot(QStringLiteral("plot"));
173 ws->addChild(p);
174
175 auto* barPlot = new BarPlot(QStringLiteral("barplot"));
176 barPlot->setType(BarPlot::Type::Stacked_100_Percent);
177 p->addChild(barPlot);
178
179 // set the data
180 QVector<const AbstractColumn*> dataColumns;
181
182 auto* c1 = new Column(QStringLiteral("data1"));
183 c1->setValueAt(0, 3.);
184 c1->setValueAt(1, 6.);
185 c1->setValueAt(2, 9.);
186 c1->setValueAt(3, 12.);
187 dataColumns << c1;
188
189 auto* c2 = new Column(QStringLiteral("data2"));
190 c2->setValueAt(0, 2.);
191 c2->setValueAt(1, 5.);
192 c2->setValueAt(2, 8.);
193 c2->setValueAt(3, 11.);
194 dataColumns << c2;
195
196 barPlot->setDataColumns(dataColumns);
197
198 // check the min and max range values
199 QCOMPARE(barPlot->minimum(Dimension::X), 0.);
200 QCOMPARE(barPlot->maximum(Dimension::X), 4.);
201 QCOMPARE(barPlot->minimum(Dimension::Y), 0.);
202 QCOMPARE(barPlot->maximum(Dimension::Y), 100.);
203}
204
205/*!
206 * \brief lollipop plot wiht one dataset, horizontal

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