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

Method saveLoad

tests/import_export/ASCII/AsciiFilterTest.cpp:3685–3752  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3683}
3684
3685void AsciiFilterTest::saveLoad() {
3686 QString s;
3687 {
3688 AsciiFilter filter;
3689 auto p = filter.properties();
3690 p.automaticSeparatorDetection = false;
3691 p.baseYear = 1200;
3692 p.columnModesString = QStringLiteral("Int, Int, Double");
3693 p.columnNamesRaw = QStringLiteral("Column1, Column2, Column3");
3694 p.commentCharacter = QStringLiteral("ACommenCharacter");
3695 p.createIndex = true;
3696 p.createTimestamp = false;
3697 p.dateTimeFormat = QStringLiteral("ADateTimeFormat");
3698 p.startColumn = 5;
3699 p.endColumn = 6;
3700 p.startRow = 22;
3701 p.endRow = 28;
3702 p.headerEnabled = false;
3703 p.headerLine = 3829;
3704 p.intAsDouble = true;
3705 p.nanValue = 29304;
3706 p.removeQuotes = true;
3707 p.skipEmptyParts = true;
3708 filter.setProperties(p);
3709 QXmlStreamWriter writer(&s);
3710 filter.save(&writer);
3711 }
3712
3713 {
3714 XmlStreamReader reader(s);
3715 AsciiFilter filter;
3716 while (!reader.atEnd()) {
3717 reader.readNext();
3718 if (reader.isEndElement())
3719 break;
3720
3721 if (!reader.isStartElement())
3722 continue;
3723
3724 if (reader.name() == QLatin1String("asciiFilter")) {
3725 QVERIFY(filter.load(&reader));
3726 break;
3727 }
3728 }
3729 const auto& s = reader.warningStrings();
3730 QVERIFY(s.isEmpty());
3731
3732 const auto p = filter.properties();
3733 QCOMPARE(p.automaticSeparatorDetection, false);
3734 QCOMPARE(p.baseYear, 1200);
3735 QCOMPARE(p.columnModesString, QStringLiteral("Int,Int,Double"));
3736 QCOMPARE(p.columnNamesRaw, QStringLiteral("Column1, Column2, Column3"));
3737 QCOMPARE(p.commentCharacter, QStringLiteral("ACommenCharacter"));
3738 QCOMPARE(p.createIndex, true);
3739 QCOMPARE(p.createTimestamp, false);
3740 QCOMPARE(p.dateTimeFormat, QStringLiteral("ADateTimeFormat"));
3741 QCOMPARE(p.startColumn, 5);
3742 QCOMPARE(p.endColumn, 6);

Callers

nothing calls this directly

Calls 7

setPropertiesMethod · 0.80
atEndMethod · 0.80
propertiesMethod · 0.45
saveMethod · 0.45
nameMethod · 0.45
loadMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected