| 734 | } |
| 735 | |
| 736 | void ProjectImportTest::testOriginBarPlot() { |
| 737 | OriginProjectParser parser; |
| 738 | parser.setProjectFileName(QFINDTESTDATA(QLatin1String("data/bar-column.opj"))); |
| 739 | Project project; |
| 740 | parser.importTo(&project, QStringList()); |
| 741 | |
| 742 | // check the project tree for the imported project |
| 743 | auto* folder = dynamic_cast<Folder*>(project.child<AbstractAspect>(0)); |
| 744 | QVERIFY(folder != nullptr); |
| 745 | QCOMPARE(folder->name(), QLatin1String("Folder1")); |
| 746 | |
| 747 | // Book |
| 748 | auto* sheet = dynamic_cast<Spreadsheet*>(folder->child<AbstractAspect>(0)); |
| 749 | QVERIFY(sheet != nullptr); |
| 750 | QCOMPARE(sheet->name(), QLatin1String("Book1")); |
| 751 | QCOMPARE(sheet->columnCount(), 2); |
| 752 | QCOMPARE(sheet->rowCount(), 32); |
| 753 | |
| 754 | auto* col1 = dynamic_cast<Column*>(sheet->child<AbstractAspect>(0)); |
| 755 | QVERIFY(col1 != nullptr); |
| 756 | QCOMPARE(col1->name(), QLatin1String("A")); |
| 757 | |
| 758 | auto* col2 = dynamic_cast<Column*>(sheet->child<AbstractAspect>(1)); |
| 759 | QVERIFY(col2 != nullptr); |
| 760 | QCOMPARE(col2->name(), QLatin1String("B")); |
| 761 | |
| 762 | // Graph 2 |
| 763 | auto* worksheet = dynamic_cast<Worksheet*>(folder->child<AbstractAspect>(1)); |
| 764 | QVERIFY(worksheet != nullptr); |
| 765 | QCOMPARE(worksheet->name(), QLatin1String("Graph2")); |
| 766 | |
| 767 | auto* plot = dynamic_cast<CartesianPlot*>(worksheet->child<CartesianPlot>(0)); |
| 768 | QVERIFY(plot != nullptr); |
| 769 | QCOMPARE(plot->name(), i18n("Plot%1", QString::number(1))); |
| 770 | |
| 771 | auto* barPlot = dynamic_cast<BarPlot*>(plot->child<BarPlot>(0)); |
| 772 | QVERIFY(barPlot != nullptr); |
| 773 | QCOMPARE(barPlot->name(), QStringLiteral("B")); |
| 774 | QCOMPARE(barPlot->coordinateSystemIndex(), plot->defaultCoordinateSystemIndex()); |
| 775 | QCOMPARE(barPlot->orientation(), BarPlot::Orientation::Horizontal); |
| 776 | // TODO: chek more properties of the barPlot |
| 777 | |
| 778 | // Graph 1 |
| 779 | worksheet = dynamic_cast<Worksheet*>(folder->child<AbstractAspect>(2)); |
| 780 | QVERIFY(worksheet != nullptr); |
| 781 | QCOMPARE(worksheet->name(), QLatin1String("Graph1")); |
| 782 | |
| 783 | plot = dynamic_cast<CartesianPlot*>(worksheet->child<CartesianPlot>(0)); |
| 784 | QVERIFY(plot != nullptr); |
| 785 | QCOMPARE(plot->name(), i18n("Plot%1", QString::number(1))); |
| 786 | |
| 787 | barPlot = dynamic_cast<BarPlot*>(plot->child<BarPlot>(0)); |
| 788 | QVERIFY(barPlot != nullptr); |
| 789 | QCOMPARE(barPlot->name(), QStringLiteral("B")); |
| 790 | QCOMPARE(barPlot->coordinateSystemIndex(), plot->defaultCoordinateSystemIndex()); |
| 791 | QCOMPARE(barPlot->orientation(), BarPlot::Orientation::Vertical); |
| 792 | // TODO: check more properties of the barPlot |
| 793 | } |
nothing calls this directly
no test coverage detected