From: Giuseppe D'Angelo Date: Sun, 26 Feb 2012 21:04:57 +0000 (+0000) Subject: Remove usage of QtXml from rcc, add test X-Git-Tag: qt-v5.0.0-alpha1~462 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=84984af0e11029716a5a601869964470dff2d0be;p=profile%2Fivi%2Fqtbase.git Remove usage of QtXml from rcc, add test Ported from QDom to QXmlStreamReader. This enables removal of QtXml classes from bootstrap. A new rcc test was added, copying the data from the QResourceFileEngine test. The new test runs rcc to create binary resources, dynamically loads them under various locales and checks that they do contain the expected files. Change-Id: I15d23dfda45de851a421156951ce2a60af4c1f7f Reviewed-by: Lars Knoll Reviewed-by: hjk --- diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index dfe2398..8a9afec 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -50,8 +50,7 @@ #include #include #include - -#include +#include QT_BEGIN_NAMESPACE @@ -356,6 +355,12 @@ RCCResourceLibrary::~RCCResourceLibrary() delete m_root; } +enum RCCXmlTag { + RccTag, + ResourceTag, + FileTag +}; + bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice, const QString &fname, QString currentPath, bool ignoreErrors) { @@ -364,98 +369,168 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice, if (!currentPath.isEmpty() && !currentPath.endsWith(slash)) currentPath += slash; - QDomDocument document; - { - QString errorMsg; - int errorLine = 0; - int errorColumn = 0; - if (!document.setContent(inputDevice, &errorMsg, &errorLine, &errorColumn)) { - if (ignoreErrors) - return true; - const QString msg = QString::fromUtf8("RCC Parse Error: '%1' Line: %2 Column: %3 [%4]\n").arg(fname).arg(errorLine).arg(errorColumn).arg(errorMsg); - m_errorDevice->write(msg.toUtf8()); - return false; - } - } - - QDomElement domRoot = document.firstChildElement(m_strings.TAG_RCC).toElement(); - if (!domRoot.isNull() && domRoot.tagName() == m_strings.TAG_RCC) { - for (QDomNode node = domRoot.firstChild(); !node.isNull(); node = node.nextSibling()) { - if (!node.isElement()) - continue; - - QDomElement child = node.toElement(); - if (!child.isNull() && child.tagName() == m_strings.TAG_RESOURCE) { - QLocale::Language language = QLocale::c().language(); - QLocale::Country country = QLocale::c().country(); - - if (child.hasAttribute(m_strings.ATTRIBUTE_LANG)) { - QString attribute = child.attribute(m_strings.ATTRIBUTE_LANG); - QLocale lang = QLocale(attribute); - language = lang.language(); - if (2 == attribute.length()) { - // Language only - country = QLocale::AnyCountry; - } else { - country = lang.country(); + QXmlStreamReader reader(inputDevice); + QStack tokens; + + QString prefix; + QLocale::Language language = QLocale::c().language(); + QLocale::Country country = QLocale::c().country(); + QString alias; + int compressLevel = m_compressLevel; + int compressThreshold = m_compressThreshold; + + while (!reader.atEnd()) { + QXmlStreamReader::TokenType t = reader.readNext(); + switch (t) { + case QXmlStreamReader::StartElement: + if (reader.name() == m_strings.TAG_RCC) { + if (!tokens.isEmpty()) + reader.raiseError(QLatin1String("expected tag")); + else + tokens.push(RccTag); + } else if (reader.name() == m_strings.TAG_RESOURCE) { + if (tokens.isEmpty() || tokens.top() != RccTag) { + reader.raiseError(QLatin1String("unexpected tag")); + } else { + tokens.push(ResourceTag); + + QXmlStreamAttributes attributes = reader.attributes(); + language = QLocale::c().language(); + country = QLocale::c().country(); + + if (attributes.hasAttribute(m_strings.ATTRIBUTE_LANG)) { + QString attribute = attributes.value(m_strings.ATTRIBUTE_LANG).toString(); + QLocale lang = QLocale(attribute); + language = lang.language(); + if (2 == attribute.length()) { + // Language only + country = QLocale::AnyCountry; + } else { + country = lang.country(); + } } + + prefix.clear(); + if (attributes.hasAttribute(m_strings.ATTRIBUTE_PREFIX)) + prefix = attributes.value(m_strings.ATTRIBUTE_PREFIX).toString(); + if (!prefix.startsWith(slash)) + prefix.prepend(slash); + if (!prefix.endsWith(slash)) + prefix += slash; + } + } else if (reader.name() == m_strings.TAG_FILE) { + if (tokens.isEmpty() || tokens.top() != ResourceTag) { + reader.raiseError(QLatin1String("unexpected tag")); + } else { + tokens.push(FileTag); + + QXmlStreamAttributes attributes = reader.attributes(); + alias.clear(); + if (attributes.hasAttribute(m_strings.ATTRIBUTE_ALIAS)) + alias = attributes.value(m_strings.ATTRIBUTE_ALIAS).toString(); + + compressLevel = m_compressLevel; + if (attributes.hasAttribute(m_strings.ATTRIBUTE_COMPRESS)) + compressLevel = attributes.value(m_strings.ATTRIBUTE_COMPRESS).toString().toInt(); + + compressThreshold = m_compressThreshold; + if (attributes.hasAttribute(m_strings.ATTRIBUTE_THRESHOLD)) + compressThreshold = attributes.value(m_strings.ATTRIBUTE_THRESHOLD).toString().toInt(); + + // Special case for -no-compress. Overrides all other settings. + if (m_compressLevel == -2) + compressLevel = 0; + } + } else { + reader.raiseError(QString(QLatin1String("unexpected tag: %1")).arg(reader.name().toString())); + } + break; + + case QXmlStreamReader::EndElement: + if (reader.name() == m_strings.TAG_RCC) { + if (!tokens.isEmpty() && tokens.top() == RccTag) + tokens.pop(); + else + reader.raiseError(QLatin1String("unexpected closing tag")); + } else if (reader.name() == m_strings.TAG_RESOURCE) { + if (!tokens.isEmpty() && tokens.top() == ResourceTag) + tokens.pop(); + else + reader.raiseError(QLatin1String("unexpected closing tag")); + } else if (reader.name() == m_strings.TAG_FILE) { + if (!tokens.isEmpty() && tokens.top() == FileTag) + tokens.pop(); + else + reader.raiseError(QLatin1String("unexpected closing tag")); + } + break; + + case QXmlStreamReader::Characters: + if (reader.isWhitespace()) + break; + if (tokens.isEmpty() || tokens.top() != FileTag) { + reader.raiseError(QLatin1String("unexpected text")); + } else { + QString fileName = reader.text().toString(); + if (fileName.isEmpty()) { + const QString msg = QString::fromLatin1("RCC: Warning: Null node in XML of '%1'\n").arg(fname); + m_errorDevice->write(msg.toUtf8()); } - QString prefix; - if (child.hasAttribute(m_strings.ATTRIBUTE_PREFIX)) - prefix = child.attribute(m_strings.ATTRIBUTE_PREFIX); - if (!prefix.startsWith(slash)) - prefix.prepend(slash); - if (!prefix.endsWith(slash)) - prefix += slash; - - for (QDomNode res = child.firstChild(); !res.isNull(); res = res.nextSibling()) { - if (res.isElement() && res.toElement().tagName() == m_strings.TAG_FILE) { - - QString fileName(res.firstChild().toText().data()); - if (fileName.isEmpty()) { - const QString msg = QString::fromUtf8("RCC: Warning: Null node in XML of '%1'\n").arg(fname); - m_errorDevice->write(msg.toUtf8()); - } - QString alias; - if (res.toElement().hasAttribute(m_strings.ATTRIBUTE_ALIAS)) - alias = res.toElement().attribute(m_strings.ATTRIBUTE_ALIAS); - else - alias = fileName; - - int compressLevel = m_compressLevel; - if (res.toElement().hasAttribute(m_strings.ATTRIBUTE_COMPRESS)) - compressLevel = res.toElement().attribute(m_strings.ATTRIBUTE_COMPRESS).toInt(); - int compressThreshold = m_compressThreshold; - if (res.toElement().hasAttribute(m_strings.ATTRIBUTE_THRESHOLD)) - compressThreshold = res.toElement().attribute(m_strings.ATTRIBUTE_THRESHOLD).toInt(); - - // Special case for -no-compress. Overrides all other settings. - if (m_compressLevel == -2) - compressLevel = 0; - - alias = QDir::cleanPath(alias); - while (alias.startsWith(QLatin1String("../"))) - alias.remove(0, 3); - alias = QDir::cleanPath(m_resourceRoot) + prefix + alias; - - QString absFileName = fileName; - if (QDir::isRelativePath(absFileName)) - absFileName.prepend(currentPath); - QFileInfo file(absFileName); - if (!file.exists()) { - m_failedResources.push_back(absFileName); - const QString msg = QString::fromUtf8("RCC: Error in '%1': Cannot find file '%2'\n").arg(fname).arg(fileName); - m_errorDevice->write(msg.toUtf8()); - if (ignoreErrors) - continue; - else - return false; - } else if (file.isFile()) { + if (alias.isNull()) + alias = fileName; + + alias = QDir::cleanPath(alias); + while (alias.startsWith(QLatin1String("../"))) + alias.remove(0, 3); + alias = QDir::cleanPath(m_resourceRoot) + prefix + alias; + + QString absFileName = fileName; + if (QDir::isRelativePath(absFileName)) + absFileName.prepend(currentPath); + QFileInfo file(absFileName); + if (!file.exists()) { + m_failedResources.push_back(absFileName); + const QString msg = QString::fromLatin1("RCC: Error in '%1': Cannot find file '%2'\n").arg(fname).arg(fileName); + m_errorDevice->write(msg.toUtf8()); + if (ignoreErrors) + continue; + else + return false; + } else if (file.isFile()) { + const bool arc = + addFile(alias, + RCCFileInfo(alias.section(slash, -1), + file, + language, + country, + RCCFileInfo::NoFlags, + compressLevel, + compressThreshold) + ); + if (!arc) + m_failedResources.push_back(absFileName); + } else { + QDir dir; + if (file.isDir()) { + dir.setPath(file.filePath()); + } else { + dir.setPath(file.path()); + dir.setNameFilters(QStringList(file.fileName())); + if (alias.endsWith(file.fileName())) + alias = alias.left(alias.length()-file.fileName().length()); + } + if (!alias.endsWith(slash)) + alias += slash; + QDirIterator it(dir, QDirIterator::FollowSymlinks|QDirIterator::Subdirectories); + while (it.hasNext()) { + it.next(); + QFileInfo child(it.fileInfo()); + if (child.fileName() != QLatin1String(".") && child.fileName() != QLatin1String("..")) { const bool arc = - addFile(alias, - RCCFileInfo(alias.section(slash, -1), - file, + addFile(alias + child.fileName(), + RCCFileInfo(child.fileName(), + child, language, country, RCCFileInfo::NoFlags, @@ -463,44 +538,29 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice, compressThreshold) ); if (!arc) - m_failedResources.push_back(absFileName); - } else { - QDir dir; - if (file.isDir()) { - dir.setPath(file.filePath()); - } else { - dir.setPath(file.path()); - dir.setNameFilters(QStringList(file.fileName())); - if (alias.endsWith(file.fileName())) - alias = alias.left(alias.length()-file.fileName().length()); - } - if (!alias.endsWith(slash)) - alias += slash; - QDirIterator it(dir, QDirIterator::FollowSymlinks|QDirIterator::Subdirectories); - while (it.hasNext()) { - it.next(); - QFileInfo child(it.fileInfo()); - if (child.fileName() != QLatin1String(".") && child.fileName() != QLatin1String("..")) { - const bool arc = - addFile(alias + child.fileName(), - RCCFileInfo(child.fileName(), - child, - language, - country, - RCCFileInfo::NoFlags, - compressLevel, - compressThreshold) - ); - if (!arc) - m_failedResources.push_back(child.fileName()); - } - } + m_failedResources.push_back(child.fileName()); } } } } + break; + + default: + break; } } + + if (reader.hasError()) { + if (ignoreErrors) + return true; + int errorLine = reader.lineNumber(); + int errorColumn = reader.columnNumber(); + QString errorMessage = reader.errorString(); + QString msg = QString::fromLatin1("RCC Parse Error: '%1' Line: %2 Column: %3 [%4]\n").arg(fname).arg(errorLine).arg(errorColumn).arg(errorMessage); + m_errorDevice->write(msg.toUtf8()); + return false; + } + if (m_root == 0) { const QString msg = QString::fromUtf8("RCC: Warning: No resources in '%1'.\n").arg(fname); m_errorDevice->write(msg.toUtf8()); diff --git a/tests/auto/tools/rcc/.gitignore b/tests/auto/tools/rcc/.gitignore index 1da39db..6d81961 100644 --- a/tests/auto/tools/rcc/.gitignore +++ b/tests/auto/tools/rcc/.gitignore @@ -1 +1,2 @@ tst_rcc +data/binary/*.rcc diff --git a/tests/auto/tools/rcc/data/binary/aliasdir/aliasdir.txt b/tests/auto/tools/rcc/data/binary/aliasdir/aliasdir.txt new file mode 100644 index 0000000..dcf7937 --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/aliasdir/aliasdir.txt @@ -0,0 +1 @@ +"This is a korean text file" diff --git a/tests/auto/tools/rcc/data/binary/aliasdir/compressme.txt b/tests/auto/tools/rcc/data/binary/aliasdir/compressme.txt new file mode 100644 index 0000000..bd596cd --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/aliasdir/compressme.txt @@ -0,0 +1,322 @@ +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 diff --git a/tests/auto/tools/rcc/data/binary/aliases.expected b/tests/auto/tools/rcc/data/binary/aliases.expected new file mode 100644 index 0000000..693b633 --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/aliases.expected @@ -0,0 +1,4 @@ +currentdir.txt currentdir.txt +alias.txt currentdir2.txt +otheralias.txt blahblah.txt +alias3 ../parentdir.txt diff --git a/tests/auto/tools/rcc/data/binary/aliases.qrc b/tests/auto/tools/rcc/data/binary/aliases.qrc new file mode 100644 index 0000000..ac049c3 --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/aliases.qrc @@ -0,0 +1,10 @@ + + + currentdir.txt + currentdir2.txt + blahblah.txt + + + ../parentdir.txt + + diff --git a/tests/auto/tools/rcc/data/binary/allfeatures.de.expected b/tests/auto/tools/rcc/data/binary/allfeatures.de.expected new file mode 100644 index 0000000..fa918d0 --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/allfeatures.de.expected @@ -0,0 +1,13 @@ +/test/abc/123/+++/currentdir.txt currentdir.txt +/test/abc/123/+++/currentdir2.txt ./currentdir2.txt +/test/abc/123/+++/parentdir.txt ../parentdir.txt +/test/abc/123/+++/subdir/subdir.txt subdir/subdir.txt +/search_file.txt search_file.txt +/searchpath1/search_file.txt searchpath1/search_file.txt +/searchpath2/search_file.txt searchpath2/search_file.txt +test/testdir.txt test/testdir.txt +otherdir/otherdir.txt otherdir/otherdir.txt +aliasdir/aliasdir.txt test/german.txt +test/test/test1.txt test/test/test1.txt +test/test/test2.txt test/test/test2.txt +withoutslashes/blahblah.txt blahblah.txt diff --git a/tests/auto/tools/rcc/data/binary/allfeatures.de_CH.expected b/tests/auto/tools/rcc/data/binary/allfeatures.de_CH.expected new file mode 100644 index 0000000..59960d4 --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/allfeatures.de_CH.expected @@ -0,0 +1,13 @@ +/test/abc/123/+++/currentdir.txt currentdir.txt +/test/abc/123/+++/currentdir2.txt ./currentdir2.txt +/test/abc/123/+++/parentdir.txt ../parentdir.txt +/test/abc/123/+++/subdir/subdir.txt subdir/subdir.txt +/search_file.txt search_file.txt +/searchpath1/search_file.txt searchpath1/search_file.txt +/searchpath2/search_file.txt searchpath2/search_file.txt +test/testdir.txt test/testdir.txt +otherdir/otherdir.txt otherdir/otherdir.txt +aliasdir/aliasdir.txt aliasdir/compressme.txt +test/test/test1.txt test/test/test1.txt +test/test/test2.txt test/test/test2.txt +withoutslashes/blahblah.txt blahblah.txt diff --git a/tests/auto/tools/rcc/data/binary/allfeatures.expected b/tests/auto/tools/rcc/data/binary/allfeatures.expected new file mode 100644 index 0000000..831120c --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/allfeatures.expected @@ -0,0 +1,13 @@ +/test/abc/123/+++/currentdir.txt currentdir.txt +/test/abc/123/+++/currentdir2.txt ./currentdir2.txt +/test/abc/123/+++/parentdir.txt ../parentdir.txt +/test/abc/123/+++/subdir/subdir.txt subdir/subdir.txt +/search_file.txt search_file.txt +/searchpath1/search_file.txt searchpath1/search_file.txt +/searchpath2/search_file.txt searchpath2/search_file.txt +test/testdir.txt test/testdir.txt +otherdir/otherdir.txt otherdir/otherdir.txt +aliasdir/aliasdir.txt test/testdir2.txt +test/test/test1.txt test/test/test1.txt +test/test/test2.txt test/test/test2.txt +withoutslashes/blahblah.txt blahblah.txt diff --git a/tests/auto/tools/rcc/data/binary/allfeatures.ko.expected b/tests/auto/tools/rcc/data/binary/allfeatures.ko.expected new file mode 100644 index 0000000..80b42c3 --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/allfeatures.ko.expected @@ -0,0 +1,13 @@ +/test/abc/123/+++/currentdir.txt currentdir.txt +/test/abc/123/+++/currentdir2.txt ./currentdir2.txt +/test/abc/123/+++/parentdir.txt ../parentdir.txt +/test/abc/123/+++/subdir/subdir.txt subdir/subdir.txt +/search_file.txt search_file.txt +/searchpath1/search_file.txt searchpath1/search_file.txt +/searchpath2/search_file.txt searchpath2/search_file.txt +test/testdir.txt test/testdir.txt +otherdir/otherdir.txt otherdir/otherdir.txt +aliasdir/aliasdir.txt aliasdir/aliasdir.txt +test/test/test1.txt test/test/test1.txt +test/test/test2.txt test/test/test2.txt +withoutslashes/blahblah.txt blahblah.txt diff --git a/tests/auto/tools/rcc/data/binary/allfeatures.locale b/tests/auto/tools/rcc/data/binary/allfeatures.locale new file mode 100644 index 0000000..a6fcbab --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/allfeatures.locale @@ -0,0 +1,3 @@ +ko +de_CH +de diff --git a/tests/auto/tools/rcc/data/binary/allfeatures.qrc b/tests/auto/tools/rcc/data/binary/allfeatures.qrc new file mode 100644 index 0000000..1b88b1f --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/allfeatures.qrc @@ -0,0 +1,30 @@ + + + currentdir.txt + ./currentdir2.txt + ../parentdir.txt + subdir/subdir.txt + + + searchpath1/search_file.txt + searchpath2/search_file.txt + search_file.txt + + test/testdir.txt + otherdir/otherdir.txt + test/testdir2.txt + test/test + + + aliasdir/aliasdir.txt + + + aliasdir/compressme.txt + + + test/german.txt + + + blahblah.txt + + diff --git a/tests/auto/tools/rcc/data/binary/blahblah.txt b/tests/auto/tools/rcc/data/binary/blahblah.txt new file mode 100644 index 0000000..19f0805 --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/blahblah.txt @@ -0,0 +1 @@ +qwerty diff --git a/tests/auto/tools/rcc/data/binary/currentdir.txt b/tests/auto/tools/rcc/data/binary/currentdir.txt new file mode 100644 index 0000000..65f1f43 --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/currentdir.txt @@ -0,0 +1 @@ +"This is the current dir" diff --git a/tests/auto/tools/rcc/data/binary/currentdir2.txt b/tests/auto/tools/rcc/data/binary/currentdir2.txt new file mode 100644 index 0000000..7d89108 --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/currentdir2.txt @@ -0,0 +1 @@ +"This is also the current dir" diff --git a/tests/auto/tools/rcc/data/binary/locale.de.expected b/tests/auto/tools/rcc/data/binary/locale.de.expected new file mode 100644 index 0000000..649e56b --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/locale.de.expected @@ -0,0 +1,5 @@ +currentdir.txt currentdir.txt +currentdir2.txt currentdir2.txt +search_file.txt search_file.txt +/root/test/testdir.txt test/testdir.txt +test/testdir2.txt test/testdir2.txt diff --git a/tests/auto/tools/rcc/data/binary/locale.de_CH.expected b/tests/auto/tools/rcc/data/binary/locale.de_CH.expected new file mode 100644 index 0000000..55b57f4 --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/locale.de_CH.expected @@ -0,0 +1,6 @@ +currentdir.txt blahblah.txt +currentdir2.txt currentdir2.txt +search_file.txt search_file.txt +/root/test/testdir.txt test/testdir.txt +test/testdir2.txt test/testdir2.txt +parentdir.txt ../parentdir.txt diff --git a/tests/auto/tools/rcc/data/binary/locale.expected b/tests/auto/tools/rcc/data/binary/locale.expected new file mode 100644 index 0000000..ef693bc --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/locale.expected @@ -0,0 +1,4 @@ +currentdir.txt currentdir.txt +search_file.txt search_file.txt +/root/test/testdir.txt test/testdir.txt +test/testdir2.txt test/testdir2.txt diff --git a/tests/auto/tools/rcc/data/binary/locale.it.expected b/tests/auto/tools/rcc/data/binary/locale.it.expected new file mode 100644 index 0000000..0a1066e --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/locale.it.expected @@ -0,0 +1,6 @@ +currentdir.txt currentdir.txt +search_file.txt search_file.txt +/root/test/testdir.txt test/testdir.txt +test/testdir2.txt test/testdir2.txt +/root/otherdir/otherdir.txt otherdir/otherdir.txt +/root/currentdir.txt subdir/subdir.txt diff --git a/tests/auto/tools/rcc/data/binary/locale.locale b/tests/auto/tools/rcc/data/binary/locale.locale new file mode 100644 index 0000000..828b9e4 --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/locale.locale @@ -0,0 +1,3 @@ +de +de_CH +it diff --git a/tests/auto/tools/rcc/data/binary/locale.qrc b/tests/auto/tools/rcc/data/binary/locale.qrc new file mode 100644 index 0000000..6cef47b --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/locale.qrc @@ -0,0 +1,30 @@ + + + currentdir.txt + + + currentdir2.txt + ../parentdir.txt + blahblah.txt + + + search_file.txt + + + + test/testdir.txt + + + + + test/testdir2.txt + + + + otherdir/otherdir.txt + subdir/subdir.txt + + + + + diff --git a/tests/auto/tools/rcc/data/binary/multiple.expected b/tests/auto/tools/rcc/data/binary/multiple.expected new file mode 100644 index 0000000..6515e29 --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/multiple.expected @@ -0,0 +1,5 @@ +blahblah.txt blahblah.txt +currentdir.txt currentdir.txt +currentdir2.txt currentdir2.txt +subdir/subdir.txt subdir/subdir.txt +otherdir/otherdir.txt otherdir/otherdir.txt diff --git a/tests/auto/tools/rcc/data/binary/multiple.qrc b/tests/auto/tools/rcc/data/binary/multiple.qrc new file mode 100644 index 0000000..80745ac --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/multiple.qrc @@ -0,0 +1,10 @@ + + + blahblah.txt + currentdir.txt + currentdir2.txt + + subdir/subdir.txt + otherdir/ + + diff --git a/tests/auto/tools/rcc/data/binary/otherdir/otherdir.txt b/tests/auto/tools/rcc/data/binary/otherdir/otherdir.txt new file mode 100644 index 0000000..e1b430f --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/otherdir/otherdir.txt @@ -0,0 +1 @@ +"This is the other dir" diff --git a/tests/auto/tools/rcc/data/binary/prefixes.expected b/tests/auto/tools/rcc/data/binary/prefixes.expected new file mode 100644 index 0000000..db07fec --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/prefixes.expected @@ -0,0 +1,6 @@ +blahblah.txt blahblah.txt +/myroot/currentdir.txt currentdir.txt +/myroot/currentdir2.txt currentdir2.txt +/anotherroot/aliased.txt search_file.txt +/anotherroot/parentdir.txt ../parentdir.txt +/myroot/subdir/subdir.txt subdir/subdir.txt diff --git a/tests/auto/tools/rcc/data/binary/prefixes.qrc b/tests/auto/tools/rcc/data/binary/prefixes.qrc new file mode 100644 index 0000000..db6b15c --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/prefixes.qrc @@ -0,0 +1,21 @@ + + + blahblah.txt + + + + + currentdir.txt + + currentdir2.txt + + + + + + search_file.txt + ../parentdir.txt + + subdir/subdir.txt + + diff --git a/tests/auto/tools/rcc/data/binary/search_file.txt b/tests/auto/tools/rcc/data/binary/search_file.txt new file mode 100644 index 0000000..d8649da --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/search_file.txt @@ -0,0 +1 @@ +root diff --git a/tests/auto/tools/rcc/data/binary/searchpath1/search_file.txt b/tests/auto/tools/rcc/data/binary/searchpath1/search_file.txt new file mode 100644 index 0000000..3f31b59 --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/searchpath1/search_file.txt @@ -0,0 +1 @@ +path1 diff --git a/tests/auto/tools/rcc/data/binary/searchpath2/search_file.txt b/tests/auto/tools/rcc/data/binary/searchpath2/search_file.txt new file mode 100644 index 0000000..8e3be1f --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/searchpath2/search_file.txt @@ -0,0 +1 @@ +path2 diff --git a/tests/auto/tools/rcc/data/binary/simple.expected b/tests/auto/tools/rcc/data/binary/simple.expected new file mode 100644 index 0000000..913a33c --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/simple.expected @@ -0,0 +1,3 @@ +blahblah.txt blahblah.txt +currentdir.txt currentdir.txt +currentdir2.txt currentdir2.txt diff --git a/tests/auto/tools/rcc/data/binary/simple.qrc b/tests/auto/tools/rcc/data/binary/simple.qrc new file mode 100644 index 0000000..0d4da19 --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/simple.qrc @@ -0,0 +1,7 @@ + + + blahblah.txt + currentdir.txt + currentdir2.txt + + diff --git a/tests/auto/tools/rcc/data/binary/subdir/subdir.txt b/tests/auto/tools/rcc/data/binary/subdir/subdir.txt new file mode 100644 index 0000000..4506acf --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/subdir/subdir.txt @@ -0,0 +1 @@ +"This is in the sub directory" diff --git a/tests/auto/tools/rcc/data/binary/test/german.txt b/tests/auto/tools/rcc/data/binary/test/german.txt new file mode 100644 index 0000000..12b1cb7 --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/test/german.txt @@ -0,0 +1 @@ +Deutsch diff --git a/tests/auto/tools/rcc/data/binary/test/test/test1.txt b/tests/auto/tools/rcc/data/binary/test/test/test1.txt new file mode 100644 index 0000000..8baef1b --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/test/test/test1.txt @@ -0,0 +1 @@ +abc diff --git a/tests/auto/tools/rcc/data/binary/test/test/test2.txt b/tests/auto/tools/rcc/data/binary/test/test/test2.txt new file mode 100644 index 0000000..24c5735 --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/test/test/test2.txt @@ -0,0 +1 @@ +def diff --git a/tests/auto/tools/rcc/data/binary/test/testdir.txt b/tests/auto/tools/rcc/data/binary/test/testdir.txt new file mode 100644 index 0000000..b8cb3a8 --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/test/testdir.txt @@ -0,0 +1 @@ +"This is in the test directory" diff --git a/tests/auto/tools/rcc/data/binary/test/testdir2.txt b/tests/auto/tools/rcc/data/binary/test/testdir2.txt new file mode 100644 index 0000000..dccfdc9 --- /dev/null +++ b/tests/auto/tools/rcc/data/binary/test/testdir2.txt @@ -0,0 +1 @@ +"This is another file in this directory" diff --git a/tests/auto/tools/rcc/data/images.bin.expected b/tests/auto/tools/rcc/data/images/images.bin.expected similarity index 100% rename from tests/auto/tools/rcc/data/images.bin.expected rename to tests/auto/tools/rcc/data/images/images.bin.expected diff --git a/tests/auto/tools/rcc/data/images.expected b/tests/auto/tools/rcc/data/images/images.expected similarity index 100% rename from tests/auto/tools/rcc/data/images.expected rename to tests/auto/tools/rcc/data/images/images.expected diff --git a/tests/auto/tools/rcc/data/images.qrc b/tests/auto/tools/rcc/data/images/images.qrc similarity index 100% rename from tests/auto/tools/rcc/data/images.qrc rename to tests/auto/tools/rcc/data/images/images.qrc diff --git a/tests/auto/tools/rcc/data/images/circle.png b/tests/auto/tools/rcc/data/images/images/circle.png similarity index 100% rename from tests/auto/tools/rcc/data/images/circle.png rename to tests/auto/tools/rcc/data/images/images/circle.png diff --git a/tests/auto/tools/rcc/data/images/square.png b/tests/auto/tools/rcc/data/images/images/square.png similarity index 100% rename from tests/auto/tools/rcc/data/images/square.png rename to tests/auto/tools/rcc/data/images/images/square.png diff --git a/tests/auto/tools/rcc/data/images/subdir/triangle.png b/tests/auto/tools/rcc/data/images/images/subdir/triangle.png similarity index 100% rename from tests/auto/tools/rcc/data/images/subdir/triangle.png rename to tests/auto/tools/rcc/data/images/images/subdir/triangle.png diff --git a/tests/auto/tools/rcc/data/parentdir.txt b/tests/auto/tools/rcc/data/parentdir.txt new file mode 100644 index 0000000..da8195e --- /dev/null +++ b/tests/auto/tools/rcc/data/parentdir.txt @@ -0,0 +1 @@ +abcdefgihklmnopqrstuvwxyz diff --git a/tests/auto/tools/rcc/rcc.pro b/tests/auto/tools/rcc/rcc.pro index ebe36cf..264b8ec 100644 --- a/tests/auto/tools/rcc/rcc.pro +++ b/tests/auto/tools/rcc/rcc.pro @@ -3,10 +3,3 @@ QT = core testlib TARGET = tst_rcc SOURCES += tst_rcc.cpp - -wince* { - DEFINES += SRCDIR=\\\"\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} - diff --git a/tests/auto/tools/rcc/tst_rcc.cpp b/tests/auto/tools/rcc/tst_rcc.cpp index 0124b58..dbf5ceb 100644 --- a/tests/auto/tools/rcc/tst_rcc.cpp +++ b/tests/auto/tools/rcc/tst_rcc.cpp @@ -1,5 +1,6 @@ /**************************************************************************** ** +** Copyright (C) 2012 Giuseppe D'Angelo ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** @@ -39,28 +40,34 @@ ** ****************************************************************************/ +#include +#include #include #include -#include #include #include #include -#include - -#include +#include +#include +#include +#include +#include +typedef QMap QStringMap; +Q_DECLARE_METATYPE(QStringMap) class tst_rcc : public QObject { Q_OBJECT -public: - tst_rcc() {} private slots: void rcc_data(); void rcc(); -}; + void binary_data(); + void binary(); + void cleanupTestCase(); +}; QString findExpectedFile(const QString &base) { @@ -95,14 +102,16 @@ static QString doCompare(const QStringList &actual, const QStringList &expected) return ba; } - void tst_rcc::rcc_data() { QTest::addColumn("directory"); QTest::addColumn("qrcfile"); QTest::addColumn("expected"); - QTest::newRow("images") << SRCDIR "data" << "images.qrc" << "images.expected"; + QString dataPath = QFINDTESTDATA("data/images/"); + if (dataPath.isEmpty()) + QFAIL("data path not found"); + QTest::newRow("images") << dataPath << "images.qrc" << "images.expected"; } void tst_rcc::rcc() @@ -157,6 +166,191 @@ void tst_rcc::rcc() +static void createRccBinaryData(const QString &baseDir, const QString &qrcFileName, const QString &rccFileName) +{ + QString currentDir = QDir::currentPath(); + QDir::setCurrent(baseDir); + + QProcess rccProcess; + rccProcess.start("rcc", QStringList() << "-binary" << "-o" << rccFileName << qrcFileName); + bool ok = rccProcess.waitForFinished(); + if (!ok) { + QString errorString = QString::fromLatin1("Could not start rcc (is it in PATH?): %1").arg(rccProcess.errorString()); + QFAIL(qPrintable(errorString)); + } + + QByteArray output = rccProcess.readAllStandardOutput(); + if (!output.isEmpty()) { + QString errorMessage = QString::fromLatin1("rcc stdout: %1").arg(QString::fromLocal8Bit(output)); + QWARN(qPrintable(errorMessage)); + } + + output = rccProcess.readAllStandardError(); + if (!output.isEmpty()) { + QString errorMessage = QString::fromLatin1("rcc stderr: %1").arg(QString::fromLocal8Bit(output)); + QWARN(qPrintable(errorMessage)); + } + + QDir::setCurrent(currentDir); +} + +static QStringList readLinesFromFile(const QString &fileName) +{ + QFile file(fileName); + + bool ok = file.open(QIODevice::ReadOnly | QIODevice::Text); + if (!ok) + QWARN(qPrintable(QString::fromLatin1("Could not open testdata file %1: %2").arg(fileName, file.errorString()))); + + QStringList lines = QString::fromUtf8(file.readAll()).split(QLatin1Char('\n'), QString::SkipEmptyParts); + return lines; +} + +static QStringMap readExpectedFiles(const QString &fileName) +{ + QStringMap expectedFiles; + + QStringList lines = readLinesFromFile(fileName); + foreach (const QString &line, lines) { + QString resourceFileName = line.section(QLatin1Char(' '), 0, 0, QString::SectionSkipEmpty); + QString actualFileName = line.section(QLatin1Char(' '), 1, 1, QString::SectionSkipEmpty); + expectedFiles[resourceFileName] = actualFileName; + } + + return expectedFiles; +} + +/* + The following test looks for all *.qrc files under data/binary/. For each + .qrc file found, these files are processed (assuming the file found is + called "base.qrc"): + + - base.qrc : processed by rcc; creates base.rcc + - base.locale : (optional) list of locales to test, one per line + - base.expected : list of pairs (file path in resource, path to real file), + one per line; the pair separated by a whitespace; the paths to real files + relative to data/binary/ (for testing the C locale) + - base.localeName.expected : for each localeName in the base.locale file, + as the above .expected file +*/ + +void tst_rcc::binary_data() +{ + QTest::addColumn("resourceFile"); + QTest::addColumn("locale"); + QTest::addColumn("baseDirectory"); + QTest::addColumn("expectedFiles"); + + QString dataPath = QFINDTESTDATA("data/binary/"); + if (dataPath.isEmpty()) + QFAIL("data path not found"); + + QDirIterator iter(dataPath, QStringList() << QLatin1String("*.qrc")); + while (iter.hasNext()) + { + iter.next(); + QFileInfo qrcFileInfo = iter.fileInfo(); + QString absoluteBaseName = QFileInfo(qrcFileInfo.absolutePath(), qrcFileInfo.baseName()).absoluteFilePath(); + QString rccFileName = absoluteBaseName + QLatin1String(".rcc"); + createRccBinaryData(dataPath, qrcFileInfo.absoluteFilePath(), rccFileName); + + QString localeFileName = absoluteBaseName + QLatin1String(".locale"); + QFile localeFile(localeFileName); + if (localeFile.exists()) { + QStringList locales = readLinesFromFile(localeFileName); + foreach (const QString &locale, locales) { + QString expectedFileName = QString::fromLatin1("%1.%2.%3").arg(absoluteBaseName, locale, QLatin1String("expected")); + QStringMap expectedFiles = readExpectedFiles(expectedFileName); + QTest::newRow(qPrintable(qrcFileInfo.baseName() + QLatin1Char('_') + locale)) << rccFileName + << QLocale(locale) + << dataPath + << expectedFiles; + } + } + + // always test for the C locale as well + QString expectedFileName = absoluteBaseName + QLatin1String(".expected"); + QStringMap expectedFiles = readExpectedFiles(expectedFileName); + QTest::newRow(qPrintable(qrcFileInfo.baseName() + QLatin1String("_C"))) << rccFileName + << QLocale::c() + << dataPath + << expectedFiles; + } +} + +void tst_rcc::binary() +{ + QFETCH(QString, baseDirectory); + QFETCH(QString, resourceFile); + QFETCH(QLocale, locale); + QFETCH(QStringMap, expectedFiles); + + const QString rootPrefix = QLatin1String("/test_root/"); + const QString resourceRootPrefix = QLatin1Char(':') + rootPrefix; + + QLocale oldDefaultLocale; + QLocale::setDefault(locale); + QVERIFY(QFile::exists(resourceFile)); + QVERIFY(QResource::registerResource(resourceFile, rootPrefix)); + + { // need to destroy the iterators on the resource, in order to be able to unregister it + + // read all the files inside the resources + QDirIterator iter(resourceRootPrefix, QDir::Files, QDirIterator::Subdirectories); + QList filesFound; + while (iter.hasNext()) + filesFound << iter.next(); + + // add the test root prefix to the expected file names + QList expectedFileNames = expectedFiles.keys(); + for (QList::iterator i = expectedFileNames.begin(); i < expectedFileNames.end(); ++i) { + // poor man's canonicalPath, which doesn't work with resources + if ((*i).startsWith(QLatin1Char('/'))) + (*i).remove(0, 1); + *i = resourceRootPrefix + *i; + } + + // check that we have all (and only) the expected files + qSort(filesFound); + qSort(expectedFileNames); + QCOMPARE(filesFound, expectedFileNames); + + // now actually check the file contents + QDir directory(baseDirectory); + for (QStringMap::const_iterator i = expectedFiles.constBegin(); i != expectedFiles.constEnd(); ++i) { + QString resourceFileName = i.key(); + QString actualFileName = i.value(); + + QFile resourceFile(resourceRootPrefix + resourceFileName); + QVERIFY(resourceFile.open(QIODevice::ReadOnly)); + QByteArray resourceData = resourceFile.readAll(); + resourceFile.close(); + + QFile actualFile(QFileInfo(directory, actualFileName).absoluteFilePath()); + QVERIFY(actualFile.open(QIODevice::ReadOnly)); + QByteArray actualData = actualFile.readAll(); + actualFile.close(); + QCOMPARE(resourceData, actualData); + } + + } + + QVERIFY(QResource::unregisterResource(resourceFile, rootPrefix)); + QLocale::setDefault(oldDefaultLocale); +} + + +void tst_rcc::cleanupTestCase() +{ + QString dataPath = QFINDTESTDATA("data/binary/"); + if (dataPath.isEmpty()) + return; + QDir dataDir(dataPath); + QFileInfoList entries = dataDir.entryInfoList(QStringList() << QLatin1String("*.rcc")); + foreach (const QFileInfo &entry, entries) + QFile::remove(entry.absoluteFilePath()); +} + QTEST_APPLESS_MAIN(tst_rcc) #include "tst_rcc.moc"