| 537 | } |
| 538 | |
| 539 | void ProjectImportTest::testOrigin_2graphs() { |
| 540 | OriginProjectParser parser; |
| 541 | parser.setProjectFileName(QFINDTESTDATA(QLatin1String("data/2graphs.opj"))); |
| 542 | Project project; |
| 543 | parser.importTo(&project, QStringList()); |
| 544 | |
| 545 | // check the project tree for the imported project |
| 546 | // Book 2 |
| 547 | auto* s2 = dynamic_cast<Spreadsheet*>(project.child<AbstractAspect>(0)); |
| 548 | QVERIFY(s2 != nullptr); |
| 549 | QCOMPARE(s2->name(), QLatin1String("Book2")); |
| 550 | |
| 551 | QCOMPARE(s2->columnCount(), 2); |
| 552 | QCOMPARE(s2->rowCount(), 32); |
| 553 | |
| 554 | auto* c1 = dynamic_cast<Column*>(s2->child<AbstractAspect>(0)); |
| 555 | QVERIFY(c1 != nullptr); |
| 556 | QCOMPARE(c1->name(), QLatin1String("A")); |
| 557 | auto* c2 = dynamic_cast<Column*>(s2->child<AbstractAspect>(1)); |
| 558 | QVERIFY(c2 != nullptr); |
| 559 | QCOMPARE(c2->name(), QLatin1String("B")); |
| 560 | |
| 561 | // Graph 2 |
| 562 | auto* w2 = dynamic_cast<Worksheet*>(project.child<AbstractAspect>(1)); |
| 563 | QVERIFY(w2 != nullptr); |
| 564 | QCOMPARE(w2->name(), QLatin1String("Graph2")); |
| 565 | |
| 566 | auto* plot = dynamic_cast<CartesianPlot*>(w2->child<CartesianPlot>(0)); |
| 567 | QVERIFY(plot != nullptr); |
| 568 | |
| 569 | QCOMPARE(plot->name(), i18n("Plot%1", QString::number(1))); |
| 570 | |
| 571 | auto* xAxis = dynamic_cast<Axis*>(plot->child<Axis>(0)); |
| 572 | QVERIFY(xAxis != nullptr); |
| 573 | QCOMPARE(xAxis->name(), QStringLiteral("x")); |
| 574 | auto* yAxis = dynamic_cast<Axis*>(plot->child<Axis>(1)); |
| 575 | QVERIFY(yAxis != nullptr); |
| 576 | QCOMPARE(yAxis->name(), QStringLiteral("y")); |
| 577 | |
| 578 | auto* legend = dynamic_cast<CartesianPlotLegend*>(plot->child<CartesianPlotLegend>(0)); |
| 579 | QVERIFY(legend != nullptr); |
| 580 | QCOMPARE(legend->name(), i18n("legend")); |
| 581 | |
| 582 | auto* curve = dynamic_cast<XYCurve*>(plot->child<XYCurve>(0)); |
| 583 | QVERIFY(curve != nullptr); |
| 584 | QCOMPARE(curve->name(), QStringLiteral("B")); // TODO: Origin uses Comments as curve name: "Length" |
| 585 | QCOMPARE(curve->coordinateSystemIndex(), plot->defaultCoordinateSystemIndex()); |
| 586 | |
| 587 | CHECK_RANGE(plot, curve, Dimension::X, .5, 5.5); |
| 588 | CHECK_RANGE(plot, curve, Dimension::Y, .5, 5.5); |
| 589 | |
| 590 | QCOMPARE(curve->xColumnPath(), QLatin1String("2graphs/Book2/A")); |
| 591 | QCOMPARE(curve->yColumnPath(), QLatin1String("2graphs/Book2/B")); |
| 592 | QCOMPARE(curve->lineType(), XYCurve::LineType::Line); |
| 593 | QCOMPARE(curve->legendVisible(), true); |
| 594 | QCOMPARE(curve->lineType(), XYCurve::LineType::Line); |
| 595 | QCOMPARE(curve->lineSkipGaps(), false); |
| 596 | QCOMPARE(curve->line()->opacity(), 1); |
nothing calls this directly
no test coverage detected