# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1284701323 -10800 # Node ID e9675fb210bd50b846e47292e1c55e73f6d40637 # Parent 01f0bb65bcf1a050838b70db650bb6e9de2a8b46 Revision: 201035 Kit: 201037 diff -r 01f0bb65bcf1 -r e9675fb210bd mmsharing/Conf/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmsharing/Conf/bld.inf Fri Sep 17 08:28:43 2010 +0300 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Exports for mmsharing +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../mmshshared/loc/mus.loc APP_LAYER_LOC_EXPORT_PATH(mus.loc) +../mmshshared/loc/musoperator.loc APP_LAYER_LOC_EXPORT_PATH(musoperator.loc) +multimediasharing.confml APP_LAYER_CONFML(multimediasharing.confml) +multimediasharing_1028238B.crml APP_LAYER_CRML(multimediasharing_1028238B.crml) +../cenrep/backup_registration.xml /epoc32/data/z/private/1028238D/backup_registration.xml + diff -r 01f0bb65bcf1 -r e9675fb210bd mmsharing/livecommsui/lcui/tsrc/ut_lcui/src/main.cpp --- a/mmsharing/livecommsui/lcui/tsrc/ut_lcui/src/main.cpp Thu Sep 02 20:23:40 2010 +0300 +++ b/mmsharing/livecommsui/lcui/tsrc/ut_lcui/src/main.cpp Fri Sep 17 08:28:43 2010 +0300 @@ -21,7 +21,7 @@ #include "ut_lcview.h" #include "ut_lceffecthandler.h" #include "ut_lcvideowidget.h" -#include "testresultxmlparser.h" +#include "testrunner.h" #include #include #include @@ -29,55 +29,40 @@ #include #include -#define UT_ARGS( args, file )\ - QStringList args( "ut_lcui");\ - args << "-silent" << "-xml" << "-o" << file - int main(int argc, char *argv[]) { - bool promptOnExit(true); - for (int i=0; i #include "ut_lcuiengine.h" -#include "testresultxmlparser.h" +#include "testrunner.h" #if defined(Q_OS_SYMBIAN) #include "ut_lcactivitymanager.h" @@ -27,36 +27,31 @@ int main(int argc, char *argv[]) { - bool promptOnExit(true); - for (int i=0; i #include "ut_lcapplication.h" -#include "testresultxmlparser.h" +#include "testrunner.h" int main(int argc, char *argv[]) { - bool promptOnExit(true); - for (int i=0; iCamerasAvailable() ) { diff -r 01f0bb65bcf1 -r e9675fb210bd package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Fri Sep 17 08:28:43 2010 +0300 @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 01f0bb65bcf1 -r e9675fb210bd package_map.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_map.xml Fri Sep 17 08:28:43 2010 +0300 @@ -0,0 +1,1 @@ + diff -r 01f0bb65bcf1 -r e9675fb210bd rom/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/bld.inf Fri Sep 17 08:28:43 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Exports for mmsharinguis. +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +multimediasharing.iby CORE_APP_LAYER_IBY_EXPORT_PATH(multimediasharing.iby) +multimediasharingresources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(multimediasharingresources.iby) +multimediasharing_stub.SIS /epoc32/data/z/system/install/multimediasharing_stub.SIS + \ No newline at end of file diff -r 01f0bb65bcf1 -r e9675fb210bd tsrc/qtestutils/inc/testresultxmlparser.h --- a/tsrc/qtestutils/inc/testresultxmlparser.h Thu Sep 02 20:23:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef TESTRESULTXMLPARSER_H -#define TESTRESULTXMLPARSER_H - -#include - - -class TestResultXmlParser : public QXmlDefaultHandler -{ -public: // Constructors and destructor - TestResultXmlParser(); - ~TestResultXmlParser(); - -public: // From QXmlContentHandler - bool startElement( - const QString& namespaceURI, - const QString& localName, - const QString& qName, - const QXmlAttributes& atts); - - bool endElement( - const QString& namespaceURI, - const QString& localName, - const QString& qName); - - bool characters(const QString& ch); - -public: // New functions - - int parse(const QString& fileName); - - int parseAndPrintResults( - const QString& fileName, - bool printDetails=false); - - int testCount(); - - QStringList errors(); - -private: // Data - int mTestCount; - QStringList* mErrors; - bool mParsingIncidentElement; - bool mParsingDescriptionElement; - bool mCurrentTestFailed; - QString mCurrentTestName; - QString mCurrentTestFile; - int mCurrentTestFailureLine; -}; - - -#endif // TESTRESULTXMLPARSER_H diff -r 01f0bb65bcf1 -r e9675fb210bd tsrc/qtestutils/inc/testrunner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tsrc/qtestutils/inc/testrunner.h Fri Sep 17 08:28:43 2010 +0300 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef TESTRUNNER_H +#define TESTRUNNER_H + +#include + +class QXmlStreamWriter; +class QXmlStreamReader; + +class TestRunner : public QXmlDefaultHandler +{ +public: // Constructors and destructor + TestRunner(const QString& name, const QString& combinedOutputFileName = QString() ); + ~TestRunner(); + +public: // New functions + + int runTests(QObject& testObject); + void printResults(); + +protected: // From QXmlContentHandler + bool startElement( + const QString& namespaceURI, + const QString& localName, + const QString& qName, + const QXmlAttributes& atts); + + bool endElement( + const QString& namespaceURI, + const QString& localName, + const QString& qName); + + bool characters(const QString& ch); + +private: // New functions + + void parse(const QString& fileName); + void combineResults(); + void appendToXml(QXmlStreamWriter& writer, QXmlStreamReader& reader, QString& caseName); + +private: // Data + QStringList mTestRunParams; + QString mHomeDir; + int mTestCount; + QStringList mErrors; + bool mParsingIncidentElement; + bool mParsingDescriptionElement; + bool mCurrentTestFailed; + QString mCurrentTestName; + QString mCurrentTestFile; + int mCurrentTestFailureLine; + QString mCombinedOutputFileName; + QStringList mResultFiles; +}; + + +#endif // TESTRUNNER_H diff -r 01f0bb65bcf1 -r e9675fb210bd tsrc/qtestutils/src/testresultxmlparser.cpp --- a/tsrc/qtestutils/src/testresultxmlparser.cpp Thu Sep 02 20:23:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,178 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "testresultxmlparser.h" -#include - -const char testFunctionElement[] = "TestFunction"; -const char incidentElement[] = "Incident"; -const char descriptionElement[] = "Description"; -const char nameAttr[] = "name"; -const char typeAttr[] = "type"; -const char fileAttr[] = "file"; -const char lineAttr[] = "line"; -const char attrValueFail[] = "fail"; - - -// ----------------------------------------------------------------------------- -// TestResultXmlParser::TestResultXmlParser -// ----------------------------------------------------------------------------- -// -TestResultXmlParser::TestResultXmlParser() -: mTestCount(0), - mParsingIncidentElement(false), - mParsingDescriptionElement(false), - mCurrentTestFailed(false), - mCurrentTestFailureLine(0) -{ - mErrors = new QStringList; -} - -// ----------------------------------------------------------------------------- -// TestResultXmlParser::TestResultXmlParser -// ----------------------------------------------------------------------------- -// -TestResultXmlParser::~TestResultXmlParser() -{ - delete mErrors; -} - -// ----------------------------------------------------------------------------- -// TestResultXmlParser::startElement -// ----------------------------------------------------------------------------- -// -bool TestResultXmlParser::startElement( - const QString& /*namespaceURI*/, - const QString& /*localName*/, - const QString& qName, - const QXmlAttributes& atts) -{ - if (qName == testFunctionElement) { - mTestCount++; - mCurrentTestName = atts.value(nameAttr); - return true; - } - if (qName == incidentElement) { - mParsingIncidentElement = true; - if (atts.value(typeAttr) == attrValueFail) { - mCurrentTestFailed = true; - mCurrentTestFile = atts.value(fileAttr); - mCurrentTestFailureLine = atts.value(lineAttr).toInt(); - } - return true; - } - mParsingDescriptionElement = (qName == descriptionElement); - return true; -} - -// ----------------------------------------------------------------------------- -// TestResultXmlParser::endElement -// ----------------------------------------------------------------------------- -// -bool TestResultXmlParser::endElement( - const QString& /*namespaceURI*/, - const QString& /*localName*/, - const QString& qName) -{ - if (qName == incidentElement) { - mParsingIncidentElement = false; - mCurrentTestFailed = false; - return true; - } - if (qName == descriptionElement) { - mParsingDescriptionElement = false; - } - return true; -} - -// ----------------------------------------------------------------------------- -// TestResultXmlParser::characters -// ----------------------------------------------------------------------------- -// -bool TestResultXmlParser::characters(const QString& ch) -{ - if (mParsingIncidentElement && - mParsingDescriptionElement && - mCurrentTestFailed) { - QString testResult = mCurrentTestName + " failed:\n"; - testResult += "File: "; - testResult += mCurrentTestFile; - testResult += "\n"; - testResult += "Line: "; - testResult += QString::number(mCurrentTestFailureLine); - testResult += "\n"; - testResult += "Reason: "; - testResult += ch; - testResult += "\n"; - mErrors->append(testResult); - } - return true; -} - -// ----------------------------------------------------------------------------- -// TestResultXmlParser::parse -// ----------------------------------------------------------------------------- -// -int TestResultXmlParser::parse(const QString& fileName) -{ - QFile file(fileName); - QXmlInputSource inputSource(&file); - QXmlSimpleReader reader; - reader.setContentHandler(this); - return reader.parse(inputSource); -} - -// ----------------------------------------------------------------------------- -// TestResultXmlParser::parseAndPrintResults -// ----------------------------------------------------------------------------- -// -int TestResultXmlParser::parseAndPrintResults( - const QString& fileName, - bool printDetails) -{ - printf("Parsing: %s\n", fileName.toUtf8().data()); - int error = parse(fileName); - printf("%d tests executed. Failed total: %d\n", mTestCount, mErrors->count()); - if (printDetails) { - printf("\n"); - foreach(QString error, *mErrors) { - printf(error.toUtf8().data()); - printf("\n"); - } - } - return error; -} - -// ----------------------------------------------------------------------------- -// TestResultXmlParser::testCount -// ----------------------------------------------------------------------------- -// -int TestResultXmlParser::testCount() -{ - return mTestCount; -} - -// ----------------------------------------------------------------------------- -// TestResultXmlParser::errors -// ----------------------------------------------------------------------------- -// -QStringList TestResultXmlParser::errors() -{ - return *mErrors; -} - -// End of File. diff -r 01f0bb65bcf1 -r e9675fb210bd tsrc/qtestutils/src/testrunner.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tsrc/qtestutils/src/testrunner.cpp Fri Sep 17 08:28:43 2010 +0300 @@ -0,0 +1,217 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "testrunner.h" +#include +#include +#include + +const char testCaseElement[] = "TestCase"; +const char testFunctionElement[] = "TestFunction"; +const char incidentElement[] = "Incident"; +const char descriptionElement[] = "Description"; +const char nameAttr[] = "name"; +const char typeAttr[] = "type"; +const char fileAttr[] = "file"; +const char lineAttr[] = "line"; +const char attrValueFail[] = "fail"; + + +TestRunner::TestRunner(const QString& name, const QString& combinedOutputFileName) +: mTestCount(0), + mParsingIncidentElement(false), + mParsingDescriptionElement(false), + mCurrentTestFailed(false), + mCurrentTestFailureLine(0), + mCombinedOutputFileName(combinedOutputFileName) +{ + mTestRunParams.append(name); + mTestRunParams.append("-xml"); + mTestRunParams.append("-o"); + mHomeDir = QDir::homePath(); + mTestRunParams.append(QString()); // Initial result file name + + if (!mHomeDir.endsWith(QString::fromAscii("/"))) + mHomeDir += QString::fromAscii("/"); +} + +TestRunner::~TestRunner() +{ +} + +int TestRunner::runTests(QObject& testObject) +{ + QString className(testObject.metaObject()->className()); + printf("Running tests for %s ... ", className.toUtf8().data()); + QString resultFileName = mHomeDir + className + ".xml"; + mTestRunParams.replace(mTestRunParams.count()-1,resultFileName); + int errorsBefore = mErrors.count(); + int error = QTest::qExec(&testObject, mTestRunParams); + parse(resultFileName); + mResultFiles.append(resultFileName); + printf("Failures: %d\n",mErrors.count()-errorsBefore); + fflush(stdout); + return error; +} + +void TestRunner::printResults() +{ + printf("\nTests executed: %d\n",mTestCount); + if (mErrors.count() > 0) { + printf("Failures (%d):\n", mErrors.count()); + foreach(QString error, mErrors) { + printf("\n%s", error.toUtf8().data()); + } + printf("\n"); + } else { + printf("All passed.\n\n"); + } + fflush(stdout); + + combineResults(); +} + +void TestRunner::parse(const QString& fileName) +{ + QFile file(fileName); + QXmlInputSource inputSource(&file); + QXmlSimpleReader reader; + reader.setContentHandler(this); + reader.parse(inputSource); +} + +bool TestRunner::startElement( + const QString& /*namespaceURI*/, + const QString& /*localName*/, + const QString& qName, + const QXmlAttributes& atts) +{ + if (qName == QString::fromAscii(testFunctionElement)) { + mTestCount++; + mCurrentTestName = atts.value(QString::fromAscii(nameAttr)); + return true; + } + if (qName == QString::fromAscii(incidentElement)) { + mParsingIncidentElement = true; + if (atts.value(QString::fromAscii(typeAttr)) == QString::fromAscii(attrValueFail)) { + mCurrentTestFailed = true; + mCurrentTestFile = atts.value(QString::fromAscii(fileAttr)); + mCurrentTestFailureLine = atts.value(QString::fromAscii(lineAttr)).toInt(); + } + return true; + } + mParsingDescriptionElement = + (qName == QString::fromAscii(descriptionElement)); + return true; +} + +bool TestRunner::endElement( + const QString& /*namespaceURI*/, + const QString& /*localName*/, + const QString& qName) +{ + if (qName == QString::fromAscii(incidentElement)) { + mParsingIncidentElement = false; + mCurrentTestFailed = false; + return true; + } + if (qName == QString::fromAscii(descriptionElement)) { + mParsingDescriptionElement = false; + } + return true; +} + +bool TestRunner::characters(const QString& ch) +{ + if (mParsingIncidentElement && + mParsingDescriptionElement && + mCurrentTestFailed) { + QByteArray testResult = mCurrentTestName.toAscii() + " failed:\n"; + testResult += "File: "; + testResult += mCurrentTestFile.toAscii(); + testResult += "\n"; + testResult += "Line: "; + testResult += QByteArray::number(mCurrentTestFailureLine); + testResult += "\n"; + testResult += "Reason: "; + testResult += ch.toAscii(); + testResult += "\n"; + mErrors.append(QString::fromAscii(testResult.data())); + } + return true; +} + +void TestRunner::combineResults() +{ + if ( mCombinedOutputFileName.isEmpty() ){ + return; + } + if ( !mCombinedOutputFileName.contains(QString::fromAscii("/")) ){ + mCombinedOutputFileName.prepend( mHomeDir ); + } + QFile file(mCombinedOutputFileName); + if (!file.open(QIODevice::WriteOnly)){ + return; + } + + QXmlStreamWriter writer(&file); + writer.setAutoFormatting(true); + writer.writeStartDocument(); + QString caseName; + foreach ( QString resultFile, mResultFiles ){ + QFile readFile( resultFile ); + if ( resultFile != mCombinedOutputFileName && readFile.open(QIODevice::ReadOnly) ){ + QXmlStreamReader reader(&readFile); + appendToXml(writer, reader, caseName); + readFile.close(); + } + } + writer.writeEndDocument(); + file.close(); +} + +void TestRunner::appendToXml(QXmlStreamWriter& writer, QXmlStreamReader& reader, QString& caseName) +{ + while (!reader.atEnd()) { + QXmlStreamReader::TokenType type = reader.readNext(); + if ( type == QXmlStreamReader::StartDocument || + type == QXmlStreamReader::EndDocument ){ + // Ignored + } else if ( reader.name() == testCaseElement ){ + if ( type == QXmlStreamReader::StartElement ){ + QString tempCaseName = reader.attributes().value(nameAttr).toString(); + if ( caseName.isEmpty() && type == QXmlStreamReader::StartElement){ + writer.writeStartElement(testCaseElement); + writer.writeAttribute(nameAttr, mTestRunParams.at(0)); + } + caseName = tempCaseName; + } + } else if ( type == QXmlStreamReader::StartElement ) { + if ( reader.name() == testFunctionElement ){ + QString tempFuncName = reader.attributes().value(nameAttr).toString(); + if ( !tempFuncName.isEmpty() ){ + writer.writeStartElement(testFunctionElement); + writer.writeAttribute(nameAttr, caseName + "::" + tempFuncName); + } + } else { + writer.writeCurrentToken( reader ); + } + } else { + writer.writeCurrentToken( reader ); + } + } +} diff -r 01f0bb65bcf1 -r e9675fb210bd tsrc/unittestrunner/unittest_qt_config.txt --- a/tsrc/unittestrunner/unittest_qt_config.txt Thu Sep 02 20:23:40 2010 +0300 +++ b/tsrc/unittestrunner/unittest_qt_config.txt Fri Sep 17 08:28:43 2010 +0300 @@ -1,3 +1,3 @@ -ut_lcuieng -noprompt,ut_lcui_lcUiEngine.xml,ut_lcui_lcactivitymanager.xml -ut_lcui -noprompt,ut_lcui_LcViewManager.xml,ut_lcui_LcUiComponentRepository.xml,ut_lcui_LcView.xml,ut_lcui_LcEffectHandler.xml,ut_lcui_LcVideoWidget.xml -ut_mmshapp -noprompt,ut_lcapplication.xml \ No newline at end of file +ut_lcuieng -noprompt -o C:/ut_lcuieng_all.xml,ut_lcuieng_all.xml +ut_lcui -noprompt -o C:/ut_lcui_all.xml,ut_lcui_all.xml +ut_mmshapp -noprompt -o C:/ut_lcapplication_all.xml,ut_lcapplication_all.xml