| 675 | } |
| 676 | |
| 677 | void ProjectImportTest::testOriginHistogram() { |
| 678 | OriginProjectParser parser; |
| 679 | parser.setProjectFileName(QFINDTESTDATA(QLatin1String("data/histogram.opj"))); |
| 680 | Project project; |
| 681 | parser.importTo(&project, QStringList()); |
| 682 | |
| 683 | // check the project tree for the imported project |
| 684 | auto* folder = dynamic_cast<Folder*>(project.child<AbstractAspect>(0)); |
| 685 | QVERIFY(folder != nullptr); |
| 686 | QCOMPARE(folder->name(), QLatin1String("Folder1")); |
| 687 | |
| 688 | // Book |
| 689 | auto* sheet = dynamic_cast<Spreadsheet*>(folder->child<AbstractAspect>(0)); |
| 690 | QVERIFY(sheet != nullptr); |
| 691 | QCOMPARE(sheet->name(), QLatin1String("Book1")); |
| 692 | QCOMPARE(sheet->columnCount(), 2); |
| 693 | QCOMPARE(sheet->rowCount(), 32); |
| 694 | |
| 695 | auto* col1 = dynamic_cast<Column*>(sheet->child<AbstractAspect>(0)); |
| 696 | QVERIFY(col1 != nullptr); |
| 697 | QCOMPARE(col1->name(), QLatin1String("A")); |
| 698 | |
| 699 | auto* col2 = dynamic_cast<Column*>(sheet->child<AbstractAspect>(1)); |
| 700 | QVERIFY(col2 != nullptr); |
| 701 | QCOMPARE(col2->name(), QLatin1String("B")); |
| 702 | |
| 703 | // Graph 1 |
| 704 | auto* worksheet = dynamic_cast<Worksheet*>(folder->child<AbstractAspect>(1)); |
| 705 | QVERIFY(worksheet != nullptr); |
| 706 | QCOMPARE(worksheet->name(), QLatin1String("Graph1")); |
| 707 | |
| 708 | auto* plot = dynamic_cast<CartesianPlot*>(worksheet->child<CartesianPlot>(0)); |
| 709 | QVERIFY(plot != nullptr); |
| 710 | QCOMPARE(plot->name(), i18n("Plot%1", QString::number(1))); |
| 711 | |
| 712 | auto* histogram = dynamic_cast<Histogram*>(plot->child<Histogram>(0)); |
| 713 | QVERIFY(histogram != nullptr); |
| 714 | QCOMPARE(histogram->name(), QStringLiteral("A")); |
| 715 | QCOMPARE(histogram->coordinateSystemIndex(), plot->defaultCoordinateSystemIndex()); |
| 716 | QCOMPARE(histogram->orientation(), Histogram::Orientation::Vertical); |
| 717 | // TODO: chek more properties of the histogram |
| 718 | |
| 719 | // Graph 2 |
| 720 | worksheet = dynamic_cast<Worksheet*>(folder->child<AbstractAspect>(2)); |
| 721 | QVERIFY(worksheet != nullptr); |
| 722 | QCOMPARE(worksheet->name(), QLatin1String("Graph2")); |
| 723 | |
| 724 | plot = dynamic_cast<CartesianPlot*>(worksheet->child<CartesianPlot>(0)); |
| 725 | QVERIFY(plot != nullptr); |
| 726 | QCOMPARE(plot->name(), i18n("Plot%1", QString::number(1))); |
| 727 | |
| 728 | histogram = dynamic_cast<Histogram*>(plot->child<Histogram>(0)); |
| 729 | QVERIFY(histogram != nullptr); |
| 730 | QCOMPARE(histogram->name(), QStringLiteral("A")); |
| 731 | QCOMPARE(histogram->coordinateSystemIndex(), plot->defaultCoordinateSystemIndex()); |
| 732 | QCOMPARE(histogram->orientation(), Histogram::Orientation::Horizontal); |
| 733 | // TODO: check more properties of the histogram |
| 734 | } |
nothing calls this directly
no test coverage detected