* 1. import a spreadsheet * 2. modify a cell in it * 3. import the same spreadsheet once more * 4. check that the changes were really over-written */
| 264 | * 4. check that the changes were really over-written |
| 265 | */ |
| 266 | void ProjectImportTest::testOrigin04() { |
| 267 | OriginProjectParser parser; |
| 268 | parser.setProjectFileName(QFINDTESTDATA(QLatin1String("data/origin8_test_tree_import.opj"))); |
| 269 | Project project; |
| 270 | |
| 271 | // import "Book1" |
| 272 | QStringList selectedPathes = {QLatin1String("test_tree_import/Folder1/Book1"), |
| 273 | QLatin1String("test_tree_import/Folder1"), |
| 274 | QLatin1String("test_tree_import")}; |
| 275 | parser.importTo(&project, selectedPathes); |
| 276 | |
| 277 | // first child of folder "Folder1", workbook "Book1" with one sheet -> import into a spreadsheet |
| 278 | auto* aspect = project.child<AbstractAspect>(0); |
| 279 | QCOMPARE(aspect != nullptr, true); |
| 280 | if (aspect != nullptr) |
| 281 | QCOMPARE(aspect->name(), QLatin1String("Folder1")); |
| 282 | aspect = project.child<AbstractAspect>(0)->child<AbstractAspect>(0); |
| 283 | QCOMPARE(aspect != nullptr, true); |
| 284 | if (aspect != nullptr) |
| 285 | QCOMPARE(aspect->name(), QLatin1String("Book1")); |
| 286 | auto* spreadsheet = dynamic_cast<Spreadsheet*>(aspect); |
| 287 | QCOMPARE(spreadsheet != nullptr, true); |
| 288 | |
| 289 | // the (0,0)-cell has the value 1.0 |
| 290 | if (spreadsheet != nullptr) { |
| 291 | QCOMPARE(spreadsheet->column(0)->valueAt(0), 1.0); |
| 292 | |
| 293 | // set the value to 5.0 |
| 294 | spreadsheet->column(0)->setValueAt(0, 5.0); |
| 295 | QCOMPARE(spreadsheet->column(0)->valueAt(0), 5.0); |
| 296 | } |
| 297 | |
| 298 | // re-import |
| 299 | parser.importTo(&project, selectedPathes); |
| 300 | |
| 301 | // check the folder structure and the value of the (0,0)-cell again |
| 302 | aspect = project.child<AbstractAspect>(0)->child<AbstractAspect>(0); |
| 303 | QCOMPARE(aspect != nullptr, true); |
| 304 | if (aspect != nullptr) |
| 305 | QCOMPARE(aspect->name(), QLatin1String("Book1")); |
| 306 | spreadsheet = dynamic_cast<Spreadsheet*>(aspect); |
| 307 | QCOMPARE(spreadsheet != nullptr, true); |
| 308 | if (spreadsheet != nullptr) |
| 309 | QCOMPARE(spreadsheet->column(0)->valueAt(0), 1.0); |
| 310 | } |
| 311 | |
| 312 | void ProjectImportTest::testOriginTextNumericColumns() { |
| 313 | OriginProjectParser parser; |
nothing calls this directly
no test coverage detected