| 1257 | } |
| 1258 | |
| 1259 | void AxisTest3::autoScaleLog102() { |
| 1260 | QLocale::setDefault(QLocale::C); // use . as decimal separator |
| 1261 | Project project; |
| 1262 | auto* ws = new Worksheet(QStringLiteral("worksheet")); |
| 1263 | QVERIFY(ws != nullptr); |
| 1264 | project.addChild(ws); |
| 1265 | |
| 1266 | auto* p = new CartesianPlot(QStringLiteral("plot")); |
| 1267 | p->setType(CartesianPlot::Type::TwoAxes); // Otherwise no axes are created |
| 1268 | QVERIFY(p != nullptr); |
| 1269 | ws->addChild(p); |
| 1270 | |
| 1271 | auto axes = p->children<Axis>(); |
| 1272 | QCOMPARE(axes.count(), 2); |
| 1273 | QCOMPARE(axes.at(0)->name(), QStringLiteral("x")); |
| 1274 | QCOMPARE(axes.at(1)->name(), QStringLiteral("y")); |
| 1275 | auto* xAxis = static_cast<Axis*>(axes.at(0)); |
| 1276 | xAxis->setMajorTicksNumber(4); |
| 1277 | QCOMPARE(xAxis->scale(), RangeT::Scale::Linear); |
| 1278 | QCOMPARE(xAxis->rangeScale(), true); |
| 1279 | xAxis->setLabelsAutoPrecision(false); |
| 1280 | xAxis->setLabelsPrecision(2); |
| 1281 | |
| 1282 | auto range = p->range(Dimension::X, 0); |
| 1283 | range.setStart(0); |
| 1284 | range.setEnd(1); |
| 1285 | p->setRange(Dimension::X, 0, range); |
| 1286 | p->setNiceExtend(false); |
| 1287 | p->enableAutoScale(Dimension::X, 0, false, true); |
| 1288 | p->setRangeScale(Dimension::X, 0, RangeT::Scale::Log10); // use different method |
| 1289 | |
| 1290 | QCOMPARE(xAxis->range(), p->range(Dimension::X, 0)); |
| 1291 | QCOMPARE(xAxis->scale(), RangeT::Scale::Log10); |
| 1292 | |
| 1293 | VALUES_EQUAL(xAxis->range().start(), 0.01); |
| 1294 | QCOMPARE(xAxis->range().end(), 1.0); |
| 1295 | |
| 1296 | QStringList expectedStrings{ |
| 1297 | QStringLiteral("0.01"), |
| 1298 | QStringLiteral("0.05"), |
| 1299 | QStringLiteral("0.22"), |
| 1300 | QStringLiteral("1.00"), |
| 1301 | }; |
| 1302 | COMPARE_STRING_VECTORS(xAxis->tickLabelStrings(), expectedStrings); |
| 1303 | } |
| 1304 | |
| 1305 | void AxisTest3::autoScaleLog102Vertical() { |
| 1306 | QLocale::setDefault(QLocale::C); // use . as decimal separator |
nothing calls this directly
no test coverage detected