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

Method testFullTableAppend

tests/import_export/SQL/ImportSqlDatabaseTest.cpp:65–91  ·  view source on GitHub ↗

! * read the full table import in the append mode */

Source from the content-addressed store, hash-verified

63 * read the full table import in the append mode
64 */
65void ImportSqlDatabaseTest::testFullTableAppend() {
66 // prepare the target spreadsheet
67 Spreadsheet spreadsheet(QStringLiteral("test"), false);
68 spreadsheet.setColumnCount(1);
69 spreadsheet.column(0)->setName(QStringLiteral("test"));
70 spreadsheet.column(0)->setColumnMode(AbstractColumn::ColumnMode::Double);
71
72 // import the first table "artists"
73 ImportSQLDatabaseWidget w;
74 w.loadSettings();
75 w.setCustomQuery(false);
76 w.read(&spreadsheet, AbstractFileFilter::ImportMode::Append);
77
78 // check the spreadsheet size and columns names and modes
79 QCOMPARE(spreadsheet.rowCount(), 347);
80 QCOMPARE(spreadsheet.columnCount(), 4);
81
82 QCOMPARE(spreadsheet.column(0)->name(), QLatin1String("test"));
83 QCOMPARE(spreadsheet.column(1)->name(), QLatin1String("AlbumId"));
84 QCOMPARE(spreadsheet.column(2)->name(), QLatin1String("Title"));
85 QCOMPARE(spreadsheet.column(3)->name(), QLatin1String("ArtistId"));
86
87 QCOMPARE(spreadsheet.column(0)->columnMode(), AbstractColumn::ColumnMode::Double);
88 QCOMPARE(spreadsheet.column(1)->columnMode(), AbstractColumn::ColumnMode::Integer);
89 QCOMPARE(spreadsheet.column(2)->columnMode(), AbstractColumn::ColumnMode::Text);
90 QCOMPARE(spreadsheet.column(3)->columnMode(), AbstractColumn::ColumnMode::Integer);
91}
92
93/*!
94 * read the full table import in the prepand mode

Callers

nothing calls this directly

Calls 11

setCustomQueryMethod · 0.80
setColumnCountMethod · 0.45
setNameMethod · 0.45
columnMethod · 0.45
setColumnModeMethod · 0.45
loadSettingsMethod · 0.45
readMethod · 0.45
rowCountMethod · 0.45
columnCountMethod · 0.45
nameMethod · 0.45
columnModeMethod · 0.45

Tested by

no test coverage detected