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

Method testCopyPasteUtf8

tests/spreadsheet/SpreadsheetTest.cpp:433–455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

431}
432
433void SpreadsheetTest::testCopyPasteUtf8() {
434 Spreadsheet sheet(QStringLiteral("test"), false);
435 sheet.setColumnCount(2);
436 sheet.setRowCount(100);
437
438 const QString str = QString::fromUtf8("тест1 1\nтест2 2");
439
440 QApplication::clipboard()->setText(str);
441
442 SpreadsheetView view(&sheet, false);
443 view.pasteIntoSelection();
444
445 // data types
446 QCOMPARE(sheet.column(0)->columnMode(), AbstractColumn::ColumnMode::Text);
447 QCOMPARE(sheet.column(1)->columnMode(), AbstractColumn::ColumnMode::Integer);
448
449 // values
450 QCOMPARE(sheet.column(0)->textAt(0), QString::fromUtf8("тест1"));
451 QCOMPARE(sheet.column(1)->integerAt(0), 1);
452
453 QCOMPARE(sheet.column(0)->textAt(1), QString::fromUtf8("тест2"));
454 QCOMPARE(sheet.column(1)->integerAt(1), 2);
455}
456/*!
457 insert the data at the edge of the spreadsheet and paste the data.
458 the spreadsheet has to be extended accordingly

Callers

nothing calls this directly

Calls 8

setColumnCountMethod · 0.45
setRowCountMethod · 0.45
setTextMethod · 0.45
pasteIntoSelectionMethod · 0.45
columnModeMethod · 0.45
columnMethod · 0.45
textAtMethod · 0.45
integerAtMethod · 0.45

Tested by

no test coverage detected