MCPcopy Create free account
hub / github.com/KDE/labplot / TestLoadProject

Method TestLoadProject

tests/backend/Retransform/RetransformTest.cpp:44–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42using Dimension = CartesianCoordinateSystem::Dimension;
43
44void RetransformTest::TestLoadProject() {
45 RetransformCallCounter c;
46 Project project;
47
48 // Does not work during load.
49 // connect(&project, &Project::aspectAdded, &c, &RetransformCallCounter::aspectAdded);
50
51 project.load(QFINDTESTDATA(QLatin1String("data/p1.lml")));
52
53 QHash<QString, int> h = {{QStringLiteral("Project/Worksheet/xy-plot"), 1},
54 {QStringLiteral("Project/Worksheet/xy-plot/x"), 1},
55 {QStringLiteral("Project/Worksheet/xy-plot/y"), 1},
56 {QStringLiteral("Project/Worksheet/xy-plot/sin"), 1},
57 {QStringLiteral("Project/Worksheet/xy-plot/cos"), 1},
58 {QStringLiteral("Project/Worksheet/xy-plot/tan"), 1},
59 {QStringLiteral("Project/Worksheet/xy-plot/y-axis"), 1},
60 {QStringLiteral("Project/Worksheet/xy-plot/legend"), 1},
61 {QStringLiteral("Project/Worksheet/xy-plot/plotImage"), 1},
62 {QStringLiteral("Project/Worksheet/xy-plot/plotText"), 1},
63 {QStringLiteral("Project/Worksheet/Text Label"), 1},
64 {QStringLiteral("Project/Worksheet/Image"), 1},
65 {QStringLiteral("Project/Worksheet/plot2"), 1},
66 {QStringLiteral("Project/Worksheet/plot2/x"), 1},
67 {QStringLiteral("Project/Worksheet/plot2/y"), 1},
68 {QStringLiteral("Project/Worksheet/plot2/xy-curve"), 1}};
69
70 auto children = project.children(AspectType::AbstractAspect, AbstractAspect::ChildIndexFlag::Recursive);
71 for (auto& child : children) {
72 int expectedCallCount = 0;
73 const QString& path = child->path();
74 if (h.contains(path))
75 expectedCallCount = h.value(path);
76 COMPARE(c.callCount(child), expectedCallCount, path);
77 }
78}
79
80// Problem in this project was that the second axis labels are not loaded. Zooming in/out once shows the correct range
81void RetransformTest::TestLoadProject2() {

Callers

nothing calls this directly

Calls 6

callCountMethod · 0.80
loadMethod · 0.45
childrenMethod · 0.45
pathMethod · 0.45
containsMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected