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

Method testImportDoublePortion

tests/import_export/HDF5/HDF5FilterTest.cpp:65–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void HDF5FilterTest::testImportDoublePortion() {
66 Spreadsheet spreadsheet(QStringLiteral("test"), false);
67 HDF5Filter filter;
68
69 const QString& fileName = QFINDTESTDATA(QLatin1String("data/hdf5_test.h5"));
70 filter.setCurrentDataSetName(QLatin1String("/arrays/2D float array"));
71 // set start/end row/col
72 filter.setStartRow(2);
73 filter.setEndRow(3);
74 filter.setStartColumn(2);
75 filter.setEndColumn(3);
76 filter.readDataFromFile(fileName, &spreadsheet, AbstractFileFilter::ImportMode::Replace);
77
78 QCOMPARE(spreadsheet.columnCount(), 2);
79 QCOMPARE(spreadsheet.rowCount(), 2);
80 for (int i = 0; i < 2; i++) {
81 QCOMPARE(spreadsheet.column(i)->columnMode(), AbstractColumn::ColumnMode::Double);
82 QCOMPARE(spreadsheet.column(i)->name(), QLatin1String("2D float array_") + QString::number(i + 1));
83 }
84
85 QCOMPARE(spreadsheet.column(0)->plotDesignation(), AbstractColumn::PlotDesignation::X);
86 QCOMPARE(spreadsheet.column(1)->plotDesignation(), AbstractColumn::PlotDesignation::Y);
87
88 for (int i = 0; i < 2; i++)
89 for (int j = 0; j < 2; j++)
90 DEBUG(std::setprecision(15) << spreadsheet.column(j)->valueAt(i))
91
92 QCOMPARE(spreadsheet.column(0)->valueAt(0), 0.899999976158142);
93 QCOMPARE(spreadsheet.column(0)->valueAt(1), 1.70000004768372);
94 QCOMPARE(spreadsheet.column(1)->valueAt(0), 1.70000004768372);
95 QCOMPARE(spreadsheet.column(1)->valueAt(1), 3.5);
96}
97
98void HDF5FilterTest::testImportInt() {
99 Spreadsheet spreadsheet(QStringLiteral("test"), false);

Callers

nothing calls this directly

Calls 13

setCurrentDataSetNameMethod · 0.80
setStartRowMethod · 0.45
setEndRowMethod · 0.45
setStartColumnMethod · 0.45
setEndColumnMethod · 0.45
readDataFromFileMethod · 0.45
columnCountMethod · 0.45
rowCountMethod · 0.45
columnModeMethod · 0.45
columnMethod · 0.45
nameMethod · 0.45
plotDesignationMethod · 0.45

Tested by

no test coverage detected