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

Method testOrigin02

tests/import_export/Project/ProjectImportTest.cpp:169–196  ·  view source on GitHub ↗

* import one single folder child */

Source from the content-addressed store, hash-verified

167 * import one single folder child
168 */
169void ProjectImportTest::testOrigin02() {
170 // import one single object
171 OriginProjectParser parser;
172 parser.setProjectFileName(QFINDTESTDATA(QLatin1String("data/origin8_test_tree_import.opj")));
173 Project project;
174 QStringList selectedPathes = {QLatin1String("test_tree_import/Folder1/Book1"),
175 QLatin1String("test_tree_import/Folder1"),
176 QLatin1String("test_tree_import")};
177 parser.importTo(&project, selectedPathes);
178
179 // check the project tree for the imported project
180
181 // first child of the root folder, folder "Folder1" -> import into a Folder
182 auto* aspect = project.child<AbstractAspect>(0);
183 QCOMPARE(aspect != nullptr, true);
184 if (aspect != nullptr)
185 QCOMPARE(aspect->name(), QLatin1String("Folder1"));
186 QCOMPARE(dynamic_cast<Folder*>(aspect) != nullptr, true);
187 if (aspect != nullptr)
188 QCOMPARE(aspect->childCount<AbstractAspect>(), 1);
189
190 // first child of "Folder", workbook "Book" with one sheet -> import into a Spreadsheet
191 aspect = project.child<AbstractAspect>(0)->child<AbstractAspect>(0);
192 QCOMPARE(aspect != nullptr, true);
193 if (aspect != nullptr)
194 QCOMPARE(aspect->name(), QLatin1String("Book1"));
195 QCOMPARE(dynamic_cast<Spreadsheet*>(aspect) != nullptr, true);
196}
197
198/*
199 * 1. import one single folder child

Callers

nothing calls this directly

Calls 3

setProjectFileNameMethod · 0.45
importToMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected