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

Method testRange04

tests/backend/BarPlot/BarPlotTest.cpp:126–162  ·  view source on GitHub ↗

! * \brief two datasets, stacked, with a negative value */

Source from the content-addressed store, hash-verified

124 * \brief two datasets, stacked, with a negative value
125 */
126void BarPlotTest::testRange04() {
127 Project project;
128 auto* ws = new Worksheet(QStringLiteral("worksheet"));
129 project.addChild(ws);
130
131 auto* p = new CartesianPlot(QStringLiteral("plot"));
132 ws->addChild(p);
133
134 auto* barPlot = new BarPlot(QStringLiteral("barplot"));
135 barPlot->setType(BarPlot::Type::Stacked);
136 p->addChild(barPlot);
137
138 // set the data
139 QVector<const AbstractColumn*> dataColumns;
140
141 auto* c1 = new Column(QStringLiteral("data1"));
142 c1->setValueAt(0, 3.);
143 c1->setValueAt(1, 6.);
144 c1->setValueAt(2, 9.);
145 c1->setValueAt(3, 12.);
146 dataColumns << c1;
147
148 auto* c2 = new Column(QStringLiteral("data2"));
149 c2->setValueAt(0, 2.);
150 c2->setValueAt(1, 5.);
151 c2->setValueAt(2, 8.);
152 c2->setValueAt(3, -11.);
153 dataColumns << c2;
154
155 barPlot->setDataColumns(dataColumns);
156
157 // check the min and max range values
158 QCOMPARE(barPlot->minimum(Dimension::X), 0.0);
159 QCOMPARE(barPlot->maximum(Dimension::X), 4.0);
160 QCOMPARE(barPlot->minimum(Dimension::Y), -11.);
161 QCOMPARE(barPlot->maximum(Dimension::Y), 17.);
162}
163
164/*!
165 * \brief two datasets, stacked 100%

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