Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit b23d8d3b authored by Laurent Montel's avatar Laurent Montel 😁

Backport fix unittest

parent 16bac91e
......@@ -82,15 +82,18 @@ void RoundtripTest::testVCardRoundtrip_data()
QTest::addColumn<QString>( "output2_1File" );
QTest::addColumn<QString>( "output3_0File" );
QTest::addColumn<QString>( "output4_0File" );
Q_FOREACH ( const QString &inputFile, mInputFiles ) {
const QString outFile = mOutFilePattern.arg( inputFile );
QTest::newRow( QFile::encodeName( inputFile ) )
<< inputFile
<< ( mOutput2_1Dir.exists( outFile ) ? outFile : QString() )
<< ( mOutput3_0Dir.exists( outFile ) ? outFile : QString() )
<< ( mOutput4_0Dir.exists( outFile ) ? outFile : QString() );
QString outFile21Pattern = QLatin1String("%1.2_1ref");
QString outFile4Pattern = QLatin1String("v4_0.%1.ref");
QString outFilePattern = QLatin1String("%1.ref");
Q_FOREACH (const QString &inputFile, mInputFiles) {
const QString outFile = outFilePattern.arg(inputFile);
const QString outFileV2_1 = outFile21Pattern.arg(inputFile);
const QString outFileV4 = outFile4Pattern.arg(inputFile);
QTest::newRow(QFile::encodeName(inputFile).constData())
<< inputFile
<< (mOutput2_1Dir.exists(outFileV2_1) ? outFileV2_1 : QString())
<< (mOutput3_0Dir.exists(outFile) ? outFile : QString())
<< (mOutput4_0Dir.exists(outFileV4) ? outFileV4 : QString());
}
}
......@@ -169,6 +172,34 @@ void RoundtripTest::testVCardRoundtrip()
}
}
}
#if 0
if (!output4_0File.isEmpty()) {
const QByteArray outputData = converter.createVCards(list, VCardConverter::v4_0);
QFile outputFile(QFileInfo(mOutput4_0Dir, output4_0File).absoluteFilePath());
QVERIFY(outputFile.open(QIODevice::ReadOnly));
const QByteArray outputRefData = outputFile.readAll();
//QCOMPARE( outputData.size(), outputRefData.size() );
const QList<QByteArray> outputLines = outputData.split('\n');
const QList<QByteArray> outputRefLines = outputRefData.split('\n');
//QCOMPARE(outputLines.count(), outputRefLines.count());
for (int i = 0; i < outputLines.count(); ++i) {
const QByteArray actual = outputLines[i];
const QByteArray expect = outputRefLines[i];
if (actual != expect) {
qCritical() << "Mismatch in v4.0 output line" << (i + 1);
qCritical() << "\nActual:" << actual << "\nExpect:" << expect;
QCOMPARE(actual.count(), expect.count());
QCOMPARE(actual, expect);
}
}
}
#endif
}
QTEST_KDEMAIN( RoundtripTest, NoGUI )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment