diff options
author | Frantisek Vacek <fvacek@blackberry.com> | 2014-02-05 08:49:29 +0100 |
---|---|---|
committer | Fanda Vacek <fvacek@blackberry.com> | 2014-02-05 11:39:48 +0100 |
commit | b254313c686d07057acba243198100e49159e6e5 (patch) | |
tree | 4b34e9e0897f944fd3b60a4e80c1a1ecda2981d6 /src/plugins/qnx/qnxplugin.cpp | |
parent | e24b5c17d6ea598e27dbb8e0e2a1d6ac88b3501d (diff) | |
download | qt-creator-b254313c686d07057acba243198100e49159e6e5.tar.gz |
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>
Diffstat (limited to 'src/plugins/qnx/qnxplugin.cpp')
-rw-r--r-- | src/plugins/qnx/qnxplugin.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/plugins/qnx/qnxplugin.cpp b/src/plugins/qnx/qnxplugin.cpp index 465086da8f..6fcf1b0bc6 100644 --- a/src/plugins/qnx/qnxplugin.cpp +++ b/src/plugins/qnx/qnxplugin.cpp @@ -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) |