! * read a project file containing one plot area/layer with one single coordinate system with 4 axes and one curve. */
| 796 | * read a project file containing one plot area/layer with one single coordinate system with 4 axes and one curve. |
| 797 | */ |
| 798 | void ProjectImportTest::testOriginSingleLayerTwoAxes() { |
| 799 | // import the opj file into LabPlot's project object |
| 800 | OriginProjectParser parser; |
| 801 | parser.setProjectFileName(QFINDTESTDATA(QLatin1String("data/single_layer_two_axes.opj"))); |
| 802 | parser.setGraphLayerAsPlotArea(true); // read every layer as a new plot area |
| 803 | Project project; |
| 804 | parser.importTo(&project, QStringList()); |
| 805 | |
| 806 | const auto& plots = project.children<CartesianPlot>(AbstractAspect::ChildIndexFlag::Recursive); |
| 807 | QCOMPARE(plots.count(), 1); |
| 808 | |
| 809 | // check the plot area |
| 810 | const auto* plot1 = plots.first(); |
| 811 | QVERIFY(plot1 != nullptr); |
| 812 | |
| 813 | // ranges and axes - there should be one single coordinate system and 4 axes on the plot area |
| 814 | QCOMPARE(plot1->rangeCount(Dimension::X), 1); |
| 815 | QCOMPARE(plot1->rangeCount(Dimension::Y), 1); |
| 816 | QCOMPARE(plot1->coordinateSystemCount(), 1); |
| 817 | |
| 818 | const auto& rangeX1 = plot1->range(Dimension::X, 0); |
| 819 | QCOMPARE(rangeX1.start(), 1.5); |
| 820 | QCOMPARE(rangeX1.end(), 8.5); |
| 821 | QCOMPARE(rangeX1.scale(), RangeT::Scale::Linear); |
| 822 | QCOMPARE(rangeX1.format(), RangeT::Format::Numeric); |
| 823 | |
| 824 | const auto& rangeY1 = plot1->range(Dimension::Y, 0); |
| 825 | QCOMPARE(rangeY1.start(), 3.5); |
| 826 | QCOMPARE(rangeY1.end(), 8.5); |
| 827 | QCOMPARE(rangeY1.scale(), RangeT::Scale::Linear); |
| 828 | QCOMPARE(rangeY1.format(), RangeT::Format::Numeric); |
| 829 | |
| 830 | // axes |
| 831 | const auto& axes = plot1->children<Axis>(); |
| 832 | QCOMPARE(axes.count(), 4); |
| 833 | |
| 834 | // curve |
| 835 | const auto& curves1 = plot1->children<XYCurve>(); |
| 836 | QCOMPARE(curves1.count(), 1); |
| 837 | QCOMPARE(curves1.constFirst()->coordinateSystemIndex(), 0); |
| 838 | } |
| 839 | |
| 840 | /*! |
| 841 | * read a project file containing one plot area/layer with one single coordinate system with 4 axes and one curve. |
nothing calls this directly
no test coverage detected