QNX: Use BarDescriptorDocument API to prepare bar-descriptor for deployment

Patch is refactoring create package step to use new BarDescriptorDocument
class when bar-descriptor.xml is prepared for deployment.

BarDescriptorDocument API is extended to allow this.

Change-Id: If00fba3310c5acf1cc8feefe0cf919aa2a05637e
Reviewed-by: Tobias Nätterlund <tobias.naetterlund@kdab.com>
Reviewed-by: Mehdi Fekari <mfekari@blackberry.com>
Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
This commit is contained in:
Frantisek Vacek
2014-02-05 08:49:29 +01:00
committed by Fanda Vacek
parent e24b5c17d6
commit b254313c68
5 changed files with 242 additions and 45 deletions

View File

@@ -331,6 +331,67 @@ void QNXPlugin::testBarDescriptorDocumentSetValue()
QCOMPARE(doc.value(tag), value);
}
void QNXPlugin::testBarDescriptorDocumentSetBannerComment_data()
{
QTest::addColumn<QString>("comment");
QTest::addColumn<QString>("baseXml");
QTest::addColumn<QString>("xml");
QString procInstr = QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>");
QString comment = QString::fromLatin1("This file is autogenerated, any change will be ...");
QString xmlComment = QString::fromLatin1("<!--%1-->").arg(comment);
QString oldXmlComment = QString::fromLatin1("<!-- Some old banner comment -->");
QString docRoot = QString::fromLatin1("<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\"/>");
QChar lf = QChar::fromLatin1('\n');
QTest::newRow("new-comment")
<< comment
<< QString(procInstr + lf + docRoot + lf)
<< QString(procInstr + lf + xmlComment + lf + docRoot + lf);
QTest::newRow("new-comment-noproc")
<< comment
<< QString(docRoot + lf)
<< QString(xmlComment + lf + docRoot + lf);
QTest::newRow("replace-comment")
<< comment
<< QString(procInstr + lf + oldXmlComment + lf + docRoot + lf)
<< QString(procInstr + lf + xmlComment + lf + docRoot + lf);
QTest::newRow("replace-comment-noproc")
<< comment
<< QString(oldXmlComment + lf + docRoot + lf)
<< QString(xmlComment + lf + docRoot + lf);
QTest::newRow("remove-comment")
<< QString()
<< QString(procInstr + lf + oldXmlComment + lf + docRoot + lf)
<< QString(procInstr + lf + docRoot + lf);
QTest::newRow("remove-comment-noproc")
<< QString()
<< QString(oldXmlComment + lf + docRoot + lf)
<< QString(docRoot + lf);
}
void QNXPlugin::testBarDescriptorDocumentSetBannerComment()
{
QFETCH(QString, comment);
QFETCH(QString, baseXml);
QFETCH(QString, xml);
BarDescriptorDocument doc;
doc.loadContent(baseXml, false);
QCOMPARE(doc.xmlSource(), baseXml);
doc.setBannerComment(comment);
QCOMPARE(doc.xmlSource(), xml);
QCOMPARE(doc.isModified(), true);
QCOMPARE(doc.bannerComment(), comment);
}
#endif
Q_EXPORT_PLUGIN2(QNX, QNXPlugin)