diff options
166 files changed, 1754 insertions, 2317 deletions
diff --git a/.gitignore b/.gitignore index 5199d726b9..8ea5270519 100644 --- a/.gitignore +++ b/.gitignore @@ -126,6 +126,7 @@ src/openvg/qtopenvgversion.h src/sql/qtsqlversion.h src/testlib/qttestversion.h src/xml/qtxmlversion.h +src/v8/qtv8version.h # Test generated files QObject.log diff --git a/bin/qtmodule-configtests b/bin/qtmodule-configtests index ab03908c84..4b4c5ae96c 100755 --- a/bin/qtmodule-configtests +++ b/bin/qtmodule-configtests @@ -299,9 +299,10 @@ if (abs_path($out_basedir) ne abs_path($qtbasedir)) { # Generate the new contents my $newContents = $existingContents; - # Strip out any existing config test results - $newContents =~ s/^config_test_.*$//gms; - $newContents =~ s/^# Compile time test results.*$//gms; + # Strip out any existing config test results or include statements + $newContents =~ s/^config_test_[^\$]*$//gm; + $newContents =~ s/^# Compile time test results[^\$]*$//gm; + $newContents =~ s/include\(\$\$PWD\/..\/.qmake.cache\)$//gm; # Add any remaining content and make sure we start on a new line if ($newContents and chop $newContents ne '\n') { @@ -318,6 +319,12 @@ if (abs_path($out_basedir) ne abs_path($qtbasedir)) { } } + # Remove blank lines + $newContents =~ s/^[\s]*$//gms; + + # Include top level .qmake.cache + $newContents = $newContents . "include(\$\$PWD/../.qmake.cache)\n"; + # and open the file open my $cacheFileHandle, ">$qmakeCachePath" or die "Unable to open $qmakeCachePath for writing: $!\n"; @@ -780,7 +780,6 @@ CFG_AVX=auto CFG_REDUCE_RELOCATIONS=no CFG_NAS=no CFG_QWS_DEPTHS=all -CFG_USER_BUILD_KEY= CFG_ACCESSIBILITY=auto CFG_QT3SUPPORT=no CFG_ENDIAN=auto @@ -1058,7 +1057,7 @@ while [ "$#" -gt 0 ]; do shift VAL=$1 ;; - -prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-depths|-make|-nomake|-platform|-xplatform|-buildkey|-sdk|-arch|-host-arch|-mysql_config) + -prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-depths|-make|-nomake|-platform|-xplatform|-sdk|-arch|-host-arch|-mysql_config) VAR=`echo $1 | sed "s,^-\(.*\),\1,"` shift VAL="$1" @@ -1321,9 +1320,6 @@ while [ "$#" -gt 0 ]; do bindir) QT_INSTALL_BINS="$VAL" ;; - buildkey) - CFG_USER_BUILD_KEY="$VAL" - ;; sxe) CFG_SXE="$VAL" ;; @@ -3721,7 +3717,7 @@ if [ "$OPT_HELP" = "yes" ]; then Usage: $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir <dir>] [-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-importdir <dir>] [-datadir <dir>] [-translationdir <dir>] [-sysconfdir <dir>] [-examplesdir <dir>] - [-buildkey <key>] [-release] [-debug] [-debug-and-release] + [-release] [-debug] [-debug-and-release] [-developer-build] [-shared] [-static] [-no-fast] [-fast] [-no-largefile] [-largefile] [-no-exceptions] [-exceptions] [-no-accessibility] [-accessibility] [-no-stl] [-stl] [-no-sql-<driver>] [-sql-<driver>] @@ -3799,12 +3795,6 @@ cat <<EOF -examplesdir <dir> .... Examples will be installed to <dir> (default PREFIX/examples) - You may use these options to turn on strict plugin loading. - - -buildkey <key> .... Build the Qt library and plugins using the specified - <key>. When the library loads plugins, it will only - load those that have a matching key. - Configure options: The defaults (*) are usually acceptable. A plus (+) denotes a default value @@ -7611,7 +7601,7 @@ if [ "$CFG_DECLARATIVE" = "yes" ]; then fi fi if [ "$CFG_DECLARATIVE" = "auto" ]; then - if [ "$CFG_SCRIPT" = "no" -o "$CFG_GUI" = "no" ]; then + if [ "$CFG_V8" = "no" -o "$CFG_GUI" = "no" ]; then CFG_DECLARATIVE=no else CFG_DECLARATIVE=yes @@ -7696,226 +7686,6 @@ if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" != "no" ] ; then fi #------------------------------------------------------------------------------- -# generate QT_BUILD_KEY -#------------------------------------------------------------------------------- - -# some compilers generate binary incompatible code between different versions, -# so we need to generate a build key that is different between these compilers -COMPAT_COMPILER= -case "$COMPILER" in -g++*) - # GNU C++ - COMPILER_VERSION=`${QMAKE_CONF_COMPILER} -dumpversion 2>/dev/null` - - case "$COMPILER_VERSION" in - *.*.*) - QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'` - QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'` - QT_GCC_PATCH_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'` - ;; - *.*) - QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\1,'` - QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\2,'` - QT_GCC_PATCH_VERSION=0 - ;; - esac - - case "$COMPILER_VERSION" in - 2.95.*) - COMPILER_VERSION="2.95.*" - ;; - 3.*) - COMPILER_VERSION="3.*" - ;; - 4.*) - COMPILER_VERSION="4" - ;; - *) - ;; - esac - [ '!' -z "$COMPILER_VERSION" ] && COMPILER="g++-${COMPILER_VERSION}" - ;; -icc*) - # The Intel CC compiler on Unix systems matches the ABI of the g++ - # that is found on PATH - COMPAT_COMPILER="icc" - COMPILER="g++-4" - case "`g++ -dumpversion` 2>/dev/null" in - 2.95.*) - COMPILER="g++-2.95.*" - ;; - 3.*) -a COMPILER="g++-3.*" - ;; - *) - ;; - esac - ;; -*) - # - ;; -esac - -# QT_CONFIG can contain the following: -# -# Things that affect the Qt API/ABI: -# -# Options: -# minimal-config small-config medium-config large-config full-config -# -# Different edition modules: -# gui network canvas table xml opengl sql -# -# Things that do not affect the Qt API/ABI: -# stl -# system-jpeg no-jpeg jpeg -# system-mng no-mng mng -# system-png no-png png -# system-zlib no-zlib zlib -# system-libtiff no-libtiff -# no-gif gif -# debug release -# dll staticlib -# -# nocrosscompiler -# GNUmake -# largefile -# nis -# nas -# tablet -# ipv6 -# -# X11 : x11sm xinerama xcursor xfixes xrandr xrender mitshm fontconfig xkb -# Embedded: embedded qpa freetype -# -ALL_OPTIONS= -BUILD_CONFIG= -BUILD_OPTIONS= - -# determine the build options -for config_option in $QMAKE_CONFIG $QT_CONFIG; do - SKIP="yes" - case "$config_option" in - *-config) - # take the last *-config setting. this is the highest config being used, - # and is the one that we will use for tagging plugins - BUILD_CONFIG="$config_option" - ;; - - *) # skip all other options since they don't affect the Qt API/ABI. - ;; - esac - - if [ "$SKIP" = "no" ]; then - BUILD_OPTIONS="$BUILD_OPTIONS $config_option" - fi -done - -# put the options that we are missing into .options -rm -f .options -for opt in `echo $ALL_OPTIONS`; do - SKIP="no" - if echo $BUILD_OPTIONS | grep $opt >/dev/null 2>&1; then - SKIP="yes" - fi - if [ "$SKIP" = "no" ]; then - echo "$opt" >> .options - fi -done - -# reconstruct BUILD_OPTIONS with a sorted negative feature list -# (ie. only things that are missing are will be put into the build key) -BUILD_OPTIONS= -if [ -f .options ]; then - for opt in `sort -f .options | uniq`; do - BUILD_OPTIONS="$BUILD_OPTIONS no-$opt" - done -fi -rm -f .options - -# QT_NO* defines affect the Qt API (and binary compatibility). they need -# to be included in the build key -for build_option in $D_FLAGS; do - build_option=`echo $build_option | cut -d \" -f 2 -` - case "$build_option" in - QT_NO*) - echo "$build_option" >> .options - ;; - *) - # skip all other compiler defines - ;; - esac -done - -# sort the compile time defines (helps ensure that changes in this configure -# script don't affect the QT_BUILD_KEY generation) -if [ -f .options ]; then - for opt in `sort -f .options | uniq`; do - BUILD_OPTIONS="$BUILD_OPTIONS $opt" - done -fi -rm -f .options - -BUILD_OPTIONS="$BUILD_CONFIG $BUILD_OPTIONS" -# extract the operating system from the XPLATFORM -TARGET_OPERATING_SYSTEM=`echo $XPLATFORM | cut -f 2- -d/ | cut -f -1 -d-` -if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then - QT_BUILD_KEY_SYSTEM_PART="Symbian" -else - QT_BUILD_KEY_SYSTEM_PART="$CFG_ARCH $TARGET_OPERATING_SYSTEM $COMPILER" -fi - -# when cross-compiling, don't include build-host information (build key is target specific) -QT_BUILD_KEY="$CFG_USER_BUILD_KEY $QT_BUILD_KEY_SYSTEM_PART $BUILD_OPTIONS" -if [ -n "$QT_NAMESPACE" ]; then - QT_BUILD_KEY="$QT_BUILD_KEY $QT_NAMESPACE" -fi -MAC_NEED_TWO_BUILD_KEYS="no" -if [ "$PLATFORM_MAC" = "yes" -a "$CFG_MAC_COCOA" = "yes" ]; then - QT_BUILD_KEY_CARBON=$QT_BUILD_KEY - TARGET_OPERATING_SYSTEM="$TARGET_OPERATING_SYSTEM-cocoa" - QT_BUILD_KEY_COCOA="$CFG_USER_BUILD_KEY $CFG_ARCH $TARGET_OPERATING_SYSTEM $COMPILER $BUILD_OPTIONS" - if [ "$CFG_MAC_CARBON" = "no" ]; then - QT_BUILD_KEY=$QT_BUILD_KEY_COCOA - else - MAC_NEED_TWO_BUILD_KEYS="yes" - fi -fi -# don't break loading plugins build with an older version of Qt -QT_BUILD_KEY_COMPAT= -if [ "$QT_CROSS_COMPILE" = "no" ]; then - # previous versions of Qt used a build key built from the uname - QT_BUILD_KEY_COMPAT="$CFG_USER_BUILD_KEY $UNAME_MACHINE $UNAME_SYSTEM $COMPILER $BUILD_OPTIONS" - if [ -n "$QT_NAMESPACE" ]; then - QT_BUILD_KEY_COMPAT="$QT_BUILD_KEY_COMPAT $QT_NAMESPACE" - fi -fi - -# is this compiler compatible with some other "standard" build key -QT_BUILD_KEY_COMPAT_COMPILER= -if [ ! -z "$COMPAT_COMPILER" ]; then - QT_BUILD_KEY_COMPAT_COMPILER="$CFG_USER_BUILD_KEY $CFG_ARCH $TARGET_OPERATING_SYSTEM $COMPAT_COMPILER $BUILD_OPTIONS" - if [ -n "$QT_NAMESPACE" ]; then - QT_BUILD_KEY_COMPAT_COMPILER="$QT_BUILD_KEY_COMPAT_COMPILER $QT_NAMESPACE" - fi -fi - -# is this arch compatible with some other "standard" build key -QT_BUILD_KEY_COMPAT_ARCH= -if [ ! -z "$COMPAT_ARCH" ]; then - QT_BUILD_KEY_COMPAT_ARCH="$CFG_USER_BUILD_KEY $COMPAT_ARCH $TARGET_OPERATING_SYSTEM $COMPILER $BUILD_OPTIONS" - if [ -n "$QT_NAMESPACE" ]; then - QT_BUILD_KEY_COMPAT_COMPILER="$QT_BUILD_KEY_COMPAT_ARCH $QT_NAMESPACE" - fi -fi - -# strip out leading/trailing/extra whitespace -QT_BUILD_KEY=`echo $QT_BUILD_KEY | sed -e "s, *, ,g" -e "s,^ *,," -e "s, *$,,"` -QT_BUILD_KEY_COMPAT=`echo $QT_BUILD_KEY_COMPAT | sed -e "s, *, ,g" -e "s,^ *,," -e "s, *$,,"` -QT_BUILD_KEY_COMPAT_COMPILER=`echo $QT_BUILD_KEY_COMPAT_COMPILER | sed -e "s, *, ,g" -e "s,^ *,," -e "s, *$,,"` -QT_BUILD_KEY_COMPAT_ARCH=`echo $QT_BUILD_KEY_COMPAT_ARCH | sed -e "s, *, ,g" -e "s,^ *,," -e "s, *$,,"` - -#------------------------------------------------------------------------------- # part of configuration information goes into qconfig.h #------------------------------------------------------------------------------- @@ -7947,32 +7717,6 @@ cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF #define Q_LITTLE_ENDIAN 1234 EOF -if [ "$MAC_NEED_TWO_BUILD_KEYS" = "no" ]; then - echo "#define QT_BUILD_KEY \"$QT_BUILD_KEY\"" \ - >> "$outpath/src/corelib/global/qconfig.h.new" -else - cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF - -#define QT_BUILD_KEY_CARBON "$QT_BUILD_KEY_CARBON" -#define QT_BUILD_KEY_COCOA "$QT_BUILD_KEY_COCOA" -EOF -fi - -if [ -n "$QT_BUILD_KEY_COMPAT" ]; then - echo "#define QT_BUILD_KEY_COMPAT \"$QT_BUILD_KEY_COMPAT\"" \ - >> "$outpath/src/corelib/global/qconfig.h.new" -fi -if [ -n "$QT_BUILD_KEY_COMPAT_COMPILER" ]; then - echo "#define QT_BUILD_KEY_COMPAT2 \"$QT_BUILD_KEY_COMPAT_COMPILER\"" \ - >> "$outpath/src/corelib/global/qconfig.h.new" -fi -if [ -n "$QT_BUILD_KEY_COMPAT_ARCH" ]; then - echo "#define QT_BUILD_KEY_COMPAT3 \"$QT_BUILD_KEY_COMPAT_ARCH\"" \ - >> "$outpath/src/corelib/global/qconfig.h.new" -fi - -echo "" >>"$outpath/src/corelib/global/qconfig.h.new" - echo "#ifdef QT_BOOTSTRAPPED" >>"$outpath/src/corelib/global/qconfig.h.new" if [ "$CFG_HOST_ENDIAN" = "auto" ]; then cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0 index 32ca8dbd66..abe5a825d1 100644 --- a/dist/changes-5.0.0 +++ b/dist/changes-5.0.0 @@ -24,6 +24,10 @@ information about a particular change. via QT_DISABLE_DEPRECATED_BEFORE), use QSslCertificate::subjectAlternativeNames() instead. +- QLibraryInfo::buildKey() has been removed. Likewise, the QT_BUILD_KEY + preprocessor #define has also been removed. The build-key is obsolete + and is no longer necessary. + **************************************************************************** * General * **************************************************************************** diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index c3e85ac0b1..71d0c720e6 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1182,10 +1182,6 @@ Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max class QDataStream; -#ifndef QT_BUILD_KEY -#define QT_BUILD_KEY "unspecified" -#endif - #if defined(Q_WS_MAC) # ifndef QMAC_QMENUBAR_NO_EVENT # define QMAC_QMENUBAR_NO_EVENT diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 88f12ab1f7..d70c77afae 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -203,21 +203,6 @@ QLibraryInfo::licensedProducts() } /*! - Returns a unique key identifying this build of Qt and its - configurations. This key is not globally unique, rather only useful - for establishing of two configurations are compatible. This can be - used to compare with the \c QT_BUILD_KEY preprocessor symbol. - - \sa location() -*/ - -QString -QLibraryInfo::buildKey() -{ - return QString::fromLatin1(QT_BUILD_KEY); -} - -/*! \since 4.6 Returns the installation date for this build of Qt. The install date will usually be the last time that Qt sources were configured. @@ -514,18 +499,6 @@ void qt_core_boilerplate() "Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).\n" "Contact: Nokia Corporation (qt-info@nokia.com)\n" "\n" - "Build key: " QT_BUILD_KEY "\n" - "Compat build key: " -#ifdef QT_BUILD_KEY_COMPAT - "| " QT_BUILD_KEY_COMPAT " " -#endif -#ifdef QT_BUILD_KEY_COMPAT2 - "| " QT_BUILD_KEY_COMPAT2 " " -#endif -#ifdef QT_BUILD_KEY_COMPAT3 - "| " QT_BUILD_KEY_COMPAT3 " " -#endif - "|\n" "Build date: %s\n" "Installation prefix: %s\n" "Library path: %s\n" diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h index a8fb90968c..4dcd8e1e5e 100644 --- a/src/corelib/global/qlibraryinfo.h +++ b/src/corelib/global/qlibraryinfo.h @@ -59,7 +59,6 @@ public: static QString licensee(); static QString licensedProducts(); - static QString buildKey(); #ifndef QT_NO_DATESTRING static QDate buildDate(); #endif //QT_NO_DATESTRING diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 3621deea28..731c485b34 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -190,7 +190,7 @@ inline void QDirPrivate::resolveAbsoluteEntry() const QString absoluteName; if (fileEngine.isNull()) { - if (!dirEntry.isRelative()) { + if (!dirEntry.isRelative() && dirEntry.isClean()) { absoluteDirEntry = dirEntry; return; } diff --git a/src/corelib/io/qfilesystemengine_symbian.cpp b/src/corelib/io/qfilesystemengine_symbian.cpp index 18c52cbb17..c8c1dfdc84 100644 --- a/src/corelib/io/qfilesystemengine_symbian.cpp +++ b/src/corelib/io/qfilesystemengine_symbian.cpp @@ -114,9 +114,7 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry) { QString orig = entry.filePath(); const bool isAbsolute = entry.isAbsolute(); - const bool isDirty = (orig.contains(QLatin1String("/../")) || orig.contains(QLatin1String("/./")) || - orig.contains(QLatin1String("//")) || - orig.endsWith(QLatin1String("/..")) || orig.endsWith(QLatin1String("/."))); + const bool isDirty = !entry.isClean(); if (isAbsolute && !isDirty) return entry; diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index f1e0758bbe..966daba021 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -218,7 +218,7 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry, //static QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry) { - if (entry.isAbsolute()) + if (entry.isAbsolute() && entry.isClean()) return entry; QByteArray orig = entry.nativeFilePath(); diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index f704fc3e90..df34184091 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -508,11 +508,7 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry) if (!entry.isRelative()) { #if !defined(Q_OS_WINCE) - if (entry.isAbsolute() - && !entry.filePath().contains(QLatin1String("/../")) - && !entry.filePath().contains(QLatin1String("/./")) - && !entry.filePath().endsWith(QLatin1String("/..")) - && !entry.filePath().endsWith(QLatin1String("/."))) { + if (entry.isAbsolute() && entry.isClean()) { ret = entry.filePath(); } else { ret = QDir::fromNativeSeparators(nativeAbsoluteFilePath(entry.filePath())); diff --git a/src/corelib/io/qfilesystementry.cpp b/src/corelib/io/qfilesystementry.cpp index bb7cb4e6ab..2f37542f66 100644 --- a/src/corelib/io/qfilesystementry.cpp +++ b/src/corelib/io/qfilesystementry.cpp @@ -380,4 +380,35 @@ void QFileSystemEntry::findFileNameSeparators() const } } +bool QFileSystemEntry::isClean() const +{ + resolveFilePath(); + int dots = 0; + bool dotok = true; // checking for ".." or "." starts to relative paths + bool slashok = true; + for (QString::const_iterator iter = m_filePath.constBegin(); iter != m_filePath.constEnd(); iter++) { + if (*iter == QLatin1Char('/')) { + if (dots == 1 || dots == 2) + return false; // path contains "./" or "../" + if (!slashok) + return false; // path contains "//" + dots = 0; + dotok = true; + slashok = false; + } else if (dotok) { + slashok = true; + if (*iter == QLatin1Char('.')) { + dots++; + if (dots > 2) + dotok = false; + } else { + //path element contains a character other than '.', it's clean + dots = 0; + dotok = false; + } + } + } + return (dots != 1 && dots != 2); // clean if path doesn't end in . or .. +} + QT_END_NAMESPACE diff --git a/src/corelib/io/qfilesystementry_p.h b/src/corelib/io/qfilesystementry_p.h index 34b083a03e..8d524c087e 100644 --- a/src/corelib/io/qfilesystementry_p.h +++ b/src/corelib/io/qfilesystementry_p.h @@ -91,6 +91,7 @@ public: QString completeSuffix() const; bool isAbsolute() const; bool isRelative() const; + bool isClean() const; #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) bool isDriveRoot() const; diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index d12391914b..7252a34a2d 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -266,18 +266,6 @@ bool QCoreApplicationPrivate::is_app_closing = false; // initialized in qcoreapplication and in qtextstream autotest when setlocale is called. Q_CORE_EXPORT bool qt_locale_initialized = false; - -/* - Create an instance of Trolltech.conf. This ensures that the settings will not - be thrown out of QSetting's cache for unused settings. - */ -Q_GLOBAL_STATIC_WITH_ARGS(QSettings, staticTrolltechConf, (QSettings::UserScope, QLatin1String("Trolltech"))) - -QSettings *QCoreApplicationPrivate::trolltechConf() -{ - return staticTrolltechConf(); -} - Q_CORE_EXPORT uint qGlobalPostedEventsCount() { QThreadData *currentThreadData = QThreadData::current(); diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index 62026141a1..0914b24a16 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -141,7 +141,6 @@ public: static uint attribs; static inline bool testAttribute(uint flag) { return attribs & (1 << flag); } static int app_compile_version; - static QSettings *trolltechConf(); }; QT_END_NAMESPACE diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index c8831e5ae5..c175dcfe1b 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -45,7 +45,6 @@ #include "qfactoryinterface.h" #include "qmap.h" #include <qdir.h> -#include <qsettings.h> #include <qdebug.h> #include "qmutex.h" #include "qplugin.h" @@ -107,7 +106,6 @@ void QFactoryLoader::update() #ifdef QT_SHARED Q_D(QFactoryLoader); QStringList paths = QCoreApplication::libraryPaths(); - QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); for (int i = 0; i < paths.count(); ++i) { const QString &pluginDir = paths.at(i); // Already loaded, skip it... @@ -127,7 +125,7 @@ void QFactoryLoader::update() qDebug() << "QFactoryLoader::QFactoryLoader() looking at" << fileName; } library = QLibraryPrivate::findOrCreate(QFileInfo(fileName).canonicalFilePath()); - if (!library->isPlugin(&settings)) { + if (!library->isPlugin()) { if (qt_debug_component()) { qDebug() << library->errorString; qDebug() << " not a plugin"; @@ -135,45 +133,26 @@ void QFactoryLoader::update() library->release(); continue; } - QString regkey = QString::fromLatin1("Qt Factory Cache %1.%2/%3:/%4") - .arg((QT_VERSION & 0xff0000) >> 16) - .arg((QT_VERSION & 0xff00) >> 8) - .arg(QLatin1String(d->iid)) - .arg(fileName); - QStringList reg, keys; - reg = settings.value(regkey).toStringList(); - if (reg.count() && library->lastModified == reg[0]) { - keys = reg; - keys.removeFirst(); - } else { - if (!library->loadPlugin()) { - if (qt_debug_component()) { - qDebug() << library->errorString; - qDebug() << " could not load"; - } - library->release(); - continue; - } - QObject *instance = library->instance(); - if (!instance) { - library->release(); - // ignore plugins that have a valid signature but cannot be loaded. - continue; + QStringList keys; + if (!library->loadPlugin()) { + if (qt_debug_component()) { + qDebug() << library->errorString; + qDebug() << " could not load"; } - QFactoryInterface *factory = qobject_cast<QFactoryInterface*>(instance); - if (instance && factory && instance->qt_metacast(d->iid)) - keys = factory->keys(); - if (keys.isEmpty()) - library->unload(); - reg.clear(); - reg << library->lastModified; - reg += keys; - settings.setValue(regkey, reg); + library->release(); + continue; } - if (qt_debug_component()) { - qDebug() << "keys" << keys; + QObject *instance = library->instance(); + if (!instance) { + library->release(); + // ignore plugins that have a valid signature but cannot be loaded. + continue; } - + QFactoryInterface *factory = qobject_cast<QFactoryInterface*>(instance); + if (instance && factory && instance->qt_metacast(d->iid)) + keys = factory->keys(); + if (keys.isEmpty()) + library->unload(); if (keys.isEmpty()) { library->release(); continue; diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 45515f32e1..580dc37bd2 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -50,8 +50,6 @@ #include <qfileinfo.h> #include <qmutex.h> #include <qmap.h> -#include <qsettings.h> -#include <qdatetime.h> #include <private/qcoreapplication_p.h> #ifdef Q_OS_MAC # include <private/qcore_mac_p.h> @@ -250,7 +248,7 @@ static int qt_tokenize(const char *s, ulong s_len, ulong *advance, /* returns true if the string s was correctly parsed, false otherwise. */ -static bool qt_parse_pattern(const char *s, uint *version, bool *debug, QByteArray *key) +static bool qt_parse_pattern(const char *s, uint *version, bool *debug) { bool ret = true; @@ -282,10 +280,6 @@ static bool qt_parse_pattern(const char *s, uint *version, bool *debug, QByteArr } } else if (qstrncmp("debug", pinfo.results[0], pinfo.lengths[0]) == 0) { *debug = qstrncmp("true", pinfo.results[1], pinfo.lengths[1]) == 0; - } else if (qstrncmp("buildkey", pinfo.results[0], - pinfo.lengths[0]) == 0){ - // save buildkey - *key = QByteArray(pinfo.results[1], pinfo.lengths[1]); } } while (parse == 1 && parselen > 0); @@ -337,11 +331,11 @@ static long qt_find_pattern(const char *s, ulong s_len, we can get the verification data without have to actually load the library. This lets us detect mismatches more safely. - Returns false if version/key information is not present, or if the + Returns false if version information is not present, or if the information could not be read. - Returns true if version/key information is present and successfully read. + Returns true if version information is present and successfully read. */ -static bool qt_unix_query(const QString &library, uint *version, bool *debug, QByteArray *key, QLibraryPrivate *lib = 0) +static bool qt_unix_query(const QString &library, uint *version, bool *debug, QLibraryPrivate *lib = 0) { QFile file(library); if (!file.open(QIODevice::ReadOnly)) { @@ -396,7 +390,7 @@ static bool qt_unix_query(const QString &library, uint *version, bool *debug, QB #endif // defined(Q_OF_ELF) && defined(Q_CC_GNU) bool ret = false; if (pos >= 0) - ret = qt_parse_pattern(filedata + pos, version, debug, key); + ret = qt_parse_pattern(filedata + pos, version, debug); if (!ret && lib) lib->errorString = QLibrary::tr("Plugin verification data mismatch in '%1'").arg(library); @@ -636,7 +630,7 @@ typedef const char * __stdcall (*QtPluginQueryVerificationDataFunction)(); typedef const char * (*QtPluginQueryVerificationDataFunction)(); #endif -bool qt_get_verificationdata(QtPluginQueryVerificationDataFunction pfn, uint *qt_version, bool *debug, QByteArray *key, bool *exceptionThrown) +bool qt_get_verificationdata(QtPluginQueryVerificationDataFunction pfn, uint *qt_version, bool *debug, bool *exceptionThrown) { *exceptionThrown = false; const char *szData = 0; @@ -649,10 +643,10 @@ bool qt_get_verificationdata(QtPluginQueryVerificationDataFunction pfn, uint *qt #else szData = pfn(); #endif - return qt_parse_pattern(szData, qt_version, debug, key); + return qt_parse_pattern(szData, qt_version, debug); } -bool QLibraryPrivate::isPlugin(QSettings *settings) +bool QLibraryPrivate::isPlugin() { errorString.clear(); if (pluginState != MightBeAPlugin) @@ -660,7 +654,6 @@ bool QLibraryPrivate::isPlugin(QSettings *settings) #ifndef QT_NO_PLUGIN_CHECK bool debug = !QLIBRARY_AS_DEBUG; - QByteArray key; bool success = false; #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) @@ -677,141 +670,88 @@ bool QLibraryPrivate::isPlugin(QSettings *settings) } #endif - QFileInfo fileinfo(fileName); - -#ifndef QT_NO_DATESTRING - lastModified = fileinfo.lastModified().toString(Qt::ISODate); -#endif - QString regkey = QString::fromLatin1("Qt Plugin Cache %1.%2.%3/%4") - .arg((QT_VERSION & 0xff0000) >> 16) - .arg((QT_VERSION & 0xff00) >> 8) - .arg(QLIBRARY_AS_DEBUG ? QLatin1String("debug") : QLatin1String("false")) - .arg(fileName); -#ifdef Q_WS_MAC - // On Mac, add the application arch to the reg key in order to - // cache plugin information separately for each arch. This prevents - // Qt from wrongly caching plugin load failures when the archs - // don't match. -#if defined(__x86_64__) - regkey += QLatin1String("-x86_64"); -#elif defined(__i386__) - regkey += QLatin1String("-i386"); -#elif defined(__ppc64__) - regkey += QLatin1String("-ppc64"); -#elif defined(__ppc__) - regkey += QLatin1String("-ppc"); -#endif -#endif // Q_WS_MAC - - QStringList reg; -#ifndef QT_NO_SETTINGS - if (!settings) { - settings = QCoreApplicationPrivate::trolltechConf(); - } - reg = settings->value(regkey).toStringList(); -#endif - if (reg.count() == 4 && lastModified == reg.at(3)) { - qt_version = reg.at(0).toUInt(0, 16); - debug = bool(reg.at(1).toInt()); - key = reg.at(2).toLatin1(); - success = qt_version != 0; - } else { #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_SYMBIAN) - if (!pHnd) { - // use unix shortcut to avoid loading the library - success = qt_unix_query(fileName, &qt_version, &debug, &key, this); - } else + if (!pHnd) { + // use unix shortcut to avoid loading the library + success = qt_unix_query(fileName, &qt_version, &debug, this); + } else #endif - { - bool retryLoadLibrary = false; // Only used on Windows with MS compiler.(false in other cases) - do { - bool temporary_load = false; + { + bool retryLoadLibrary = false; // Only used on Windows with MS compiler.(false in other cases) + do { + bool temporary_load = false; #ifdef Q_OS_WIN - HMODULE hTempModule = 0; + HMODULE hTempModule = 0; #endif - if (!pHnd) { + if (!pHnd) { #ifdef Q_OS_WIN - DWORD dwFlags = (retryLoadLibrary) ? 0: DONT_RESOLVE_DLL_REFERENCES; - //avoid 'Bad Image' message box - UINT oldmode = SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX); - hTempModule = ::LoadLibraryEx((wchar_t*)QDir::toNativeSeparators(fileName).utf16(), 0, dwFlags); - SetErrorMode(oldmode); + DWORD dwFlags = (retryLoadLibrary) ? 0: DONT_RESOLVE_DLL_REFERENCES; + //avoid 'Bad Image' message box + UINT oldmode = SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX); + hTempModule = ::LoadLibraryEx((wchar_t*)QDir::toNativeSeparators(fileName).utf16(), 0, dwFlags); + SetErrorMode(oldmode); #else # if defined(Q_OS_SYMBIAN) - //Guard against accidentally trying to load non-plugin libraries by making sure the stub exists - if (fileinfo.exists()) + //Guard against accidentally trying to load non-plugin libraries by making sure the stub exists + if (fileinfo.exists()) # endif - temporary_load = load_sys(); + temporary_load = load_sys(); #endif - } + } #ifdef Q_OS_WIN - QtPluginQueryVerificationDataFunction qtPluginQueryVerificationDataFunction = hTempModule ? (QtPluginQueryVerificationDataFunction) + QtPluginQueryVerificationDataFunction qtPluginQueryVerificationDataFunction = hTempModule ? (QtPluginQueryVerificationDataFunction) #ifdef Q_OS_WINCE - ::GetProcAddress(hTempModule, L"qt_plugin_query_verification_data") + ::GetProcAddress(hTempModule, L"qt_plugin_query_verification_data") #else - ::GetProcAddress(hTempModule, "qt_plugin_query_verification_data") + ::GetProcAddress(hTempModule, "qt_plugin_query_verification_data") #endif - : (QtPluginQueryVerificationDataFunction) resolve("qt_plugin_query_verification_data"); + : (QtPluginQueryVerificationDataFunction) resolve("qt_plugin_query_verification_data"); #else - QtPluginQueryVerificationDataFunction qtPluginQueryVerificationDataFunction = NULL; + QtPluginQueryVerificationDataFunction qtPluginQueryVerificationDataFunction = NULL; # if defined(Q_OS_SYMBIAN) - if (temporary_load) { - qtPluginQueryVerificationDataFunction = (QtPluginQueryVerificationDataFunction) resolve("qt_plugin_query_verification_data"); - // If resolving with function name failed (i.e. not STDDLL), try resolving using known ordinal - if (!qtPluginQueryVerificationDataFunction) - qtPluginQueryVerificationDataFunction = (QtPluginQueryVerificationDataFunction) resolve("1"); - } -# else + if (temporary_load) { qtPluginQueryVerificationDataFunction = (QtPluginQueryVerificationDataFunction) resolve("qt_plugin_query_verification_data"); + // If resolving with function name failed (i.e. not STDDLL), try resolving using known ordinal + if (!qtPluginQueryVerificationDataFunction) + qtPluginQueryVerificationDataFunction = (QtPluginQueryVerificationDataFunction) resolve("1"); + } +# else + qtPluginQueryVerificationDataFunction = (QtPluginQueryVerificationDataFunction) resolve("qt_plugin_query_verification_data"); # endif #endif - bool exceptionThrown = false; - bool ret = qt_get_verificationdata(qtPluginQueryVerificationDataFunction, - &qt_version, &debug, &key, &exceptionThrown); - if (!exceptionThrown) { - if (!ret) { - qt_version = 0; - key = "unknown"; - if (temporary_load) - unload_sys(); - } else { - success = true; - } - retryLoadLibrary = false; + bool exceptionThrown = false; + bool ret = qt_get_verificationdata(qtPluginQueryVerificationDataFunction, + &qt_version, &debug, &exceptionThrown); + if (!exceptionThrown) { + if (!ret) { + qt_version = 0; + if (temporary_load) + unload_sys(); + } else { + success = true; } + retryLoadLibrary = false; + } #ifdef QT_USE_MS_STD_EXCEPTION - else { - // An exception was thrown when calling qt_plugin_query_verification_data(). - // This usually happens when plugin is compiled with the /clr compiler flag, - // & will only work if the dependencies are loaded & DLLMain() is called. - // LoadLibrary() will do this, try once with this & if it fails dont load. - retryLoadLibrary = !retryLoadLibrary; - } + else { + // An exception was thrown when calling qt_plugin_query_verification_data(). + // This usually happens when plugin is compiled with the /clr compiler flag, + // & will only work if the dependencies are loaded & DLLMain() is called. + // LoadLibrary() will do this, try once with this & if it fails dont load. + retryLoadLibrary = !retryLoadLibrary; + } #endif #ifdef Q_OS_WIN - if (hTempModule) { - BOOL ok = ::FreeLibrary(hTempModule); - if (ok) { - hTempModule = 0; - } - + if (hTempModule) { + BOOL ok = ::FreeLibrary(hTempModule); + if (ok) { + hTempModule = 0; } -#endif - } while(retryLoadLibrary); // Will be 'false' in all cases other than when an - // exception is thrown(will happen only when using a MS compiler) - } - - // Qt 4.5 compatibility: stl doesn't affect binary compatibility - key.replace(" no-stl", ""); -#ifndef QT_NO_SETTINGS - QStringList queried; - queried << QString::number(qt_version,16) - << QString::number((int)debug) - << QLatin1String(key) - << lastModified; - settings->setValue(regkey, queried); + } #endif + } while (retryLoadLibrary); // Will be 'false' in all cases other than when an + // exception is thrown(will happen only when using a MS compiler) } if (!success) { @@ -840,31 +780,6 @@ bool QLibraryPrivate::isPlugin(QSettings *settings) .arg((qt_version&0xff00) >> 8) .arg(qt_version&0xff) .arg(debug ? QLatin1String("debug") : QLatin1String("release")); - } else if (key != QT_BUILD_KEY - // we may have some compatibility keys, try them too: -#ifdef QT_BUILD_KEY_COMPAT - && key != QT_BUILD_KEY_COMPAT -#endif -#ifdef QT_BUILD_KEY_COMPAT2 - && key != QT_BUILD_KEY_COMPAT2 -#endif -#ifdef QT_BUILD_KEY_COMPAT3 - && key != QT_BUILD_KEY_COMPAT3 -#endif - ) { - if (qt_debug_component()) { - qWarning("In %s:\n" - " Plugin uses incompatible Qt library\n" - " expected build key \"%s\", got \"%s\"", - (const char*) QFile::encodeName(fileName), - QT_BUILD_KEY, - key.isEmpty() ? "<null>" : (const char *) key); - } - errorString = QLibrary::tr("The plugin '%1' uses incompatible Qt library." - " Expected build key \"%2\", got \"%3\"") - .arg(fileName) - .arg(QLatin1String(QT_BUILD_KEY)) - .arg(key.isEmpty() ? QLatin1String("<null>") : QLatin1String((const char *) key)); #ifndef QT_NO_DEBUG_PLUGIN_CHECK } else if(debug != QLIBRARY_AS_DEBUG) { //don't issue a qWarning since we will hopefully find a non-debug? --Sam diff --git a/src/corelib/plugin/qlibrary_p.h b/src/corelib/plugin/qlibrary_p.h index c6804955d9..15825c699f 100644 --- a/src/corelib/plugin/qlibrary_p.h +++ b/src/corelib/plugin/qlibrary_p.h @@ -68,7 +68,6 @@ QT_BEGIN_NAMESPACE bool qt_debug_component(); -class QSettings; class QLibraryPrivate { public: @@ -99,7 +98,7 @@ public: QString errorString; QLibrary::LoadHints loadHints; - bool isPlugin(QSettings *settings = 0); + bool isPlugin(); private: diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h index 40e6e66de3..52661671b5 100644 --- a/src/corelib/plugin/qplugin.h +++ b/src/corelib/plugin/qplugin.h @@ -117,8 +117,7 @@ void Q_CORE_EXPORT qRegisterStaticPluginInstanceFunction(QtPluginInstanceFunctio static const char qt_plugin_verification_data[] = \ "pattern=""QT_PLUGIN_VERIFICATION_DATA""\n" \ "version="QT_VERSION_STR"\n" \ - "debug="QPLUGIN_DEBUG_STR"\n" \ - "buildkey="QT_BUILD_KEY; + "debug="QPLUGIN_DEBUG_STR; # if defined (Q_OF_ELF) && defined (Q_CC_GNU) # define Q_PLUGIN_VERIFICATION_SECTION \ diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp index bbb64e42e7..591e36e20a 100644 --- a/src/corelib/plugin/qpluginloader.cpp +++ b/src/corelib/plugin/qpluginloader.cpp @@ -98,22 +98,6 @@ QT_BEGIN_NAMESPACE every instance has called unload(). Right before the unloading happen, the root component will also be deleted. - In order to speed up loading and validation of plugins, some of - the information that is collected during loading is cached in - persistent memory (through QSettings). For instance, the result - of a load operation (e.g. succeeded or failed) is stored in the - cache, so that subsequent load operations don't try to load an - invalid plugin. However, if the "last modified" timestamp of - a plugin has changed, the plugin's cache entry is invalidated - and the plugin is reloaded regardless of the values in the cache - entry. The cache entry is then updated with the new result of the - load operation. - - This also means that the timestamp must be updated each time the - plugin or any dependent resources (such as a shared library) is - updated, since the dependent resources might influence the result - of loading a plugin. - See \l{How to Create Qt Plugins} for more information about how to make your application extensible through plugins. diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp index 736bc63b11..b68da9def4 100644 --- a/src/corelib/tools/qchar.cpp +++ b/src/corelib/tools/qchar.cpp @@ -1402,7 +1402,8 @@ static void decomposeHelper(QString *str, bool canonical, QChar::UnicodeVersion ucs4 = QChar::surrogateToUcs4(high, ucs4); } } - if (QChar::unicodeVersion(ucs4) > version) + const QChar::UnicodeVersion v = QChar::unicodeVersion(ucs4); + if (v > version || v == QChar::Unicode_Unassigned) continue; int length; int tag; @@ -1462,7 +1463,7 @@ static ushort ligatureHelper(ushort u1, ushort u2) return 0; } -static void composeHelper(QString *str, int from) +static void composeHelper(QString *str, QChar::UnicodeVersion version, int from) { QString &s = *str; @@ -1482,7 +1483,14 @@ static void composeHelper(QString *str, int from) ++pos; } } - int combining = QChar::combiningClass(uc); + const QUnicodeTables::Properties *p = qGetProp(uc); + if (p->unicodeVersion > version || p->unicodeVersion == QChar::Unicode_Unassigned) { + starter = -1; // to prevent starter == pos - 1 + lastCombining = 0; + ++pos; + continue; + } + int combining = p->combiningClass; if (starter == pos - 1 || combining > lastCombining) { // allowed to form ligature with S QChar ligature = ligatureHelper(s.at(starter).unicode(), uc); @@ -1529,7 +1537,7 @@ static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, in ushort c2 = 0; { const QUnicodeTables::Properties *p = qGetProp(u2); - if ((QChar::UnicodeVersion)p->unicodeVersion <= version) + if (p->unicodeVersion <= version && p->unicodeVersion != QChar::Unicode_Unassigned) c2 = p->combiningClass; } if (c2 == 0) { @@ -1540,7 +1548,7 @@ static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, in ushort c1 = 0; { const QUnicodeTables::Properties *p = qGetProp(u1); - if ((QChar::UnicodeVersion)p->unicodeVersion <= version) + if (p->unicodeVersion <= version && p->unicodeVersion != QChar::Unicode_Unassigned) c1 = p->combiningClass; } diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp index e0b69d4361..4c04385033 100644 --- a/src/corelib/tools/qlist.cpp +++ b/src/corelib/tools/qlist.cpp @@ -181,7 +181,7 @@ void **QListData::append() } // ensures that enough space is available to append the list -void **QListData::append2(const QListData& l) +void **QListData::append(const QListData& l) { return append(l.d->end - l.d->begin); } diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index f8f62cc8b2..b4c35b8d35 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -79,9 +79,6 @@ struct Q_CORE_EXPORT QListData { Data *detach(int alloc); Data *detach_grow(int *i, int n); - Data *detach(); // remove in 5.0 - Data *detach2(); // remove in 5.0 - Data *detach3(); // remove in 5.0 void realloc(int alloc); static Data shared_null; Data *d; @@ -89,7 +86,6 @@ struct Q_CORE_EXPORT QListData { void **append(int n); void **append(); void **append(const QListData &l); - void **append2(const QListData &l); // remove in 5.0 void **prepend(); void **insert(int i); void remove(int i); @@ -338,7 +334,7 @@ private: Node *detach_helper_grow(int i, int n); void detach_helper(int alloc); void detach_helper(); - void free(QListData::Data *d); + void dealloc(QListData::Data *d); void node_construct(Node *n, const T &t); void node_destruct(Node *n); @@ -426,7 +422,7 @@ Q_INLINE_TEMPLATE QList<T> &QList<T>::operator=(const QList<T> &l) QListData::Data *o = l.d; o->ref.ref(); if (!d->ref.deref()) - free(d); + dealloc(d); d = o; if (!d->sharable) detach_helper(); @@ -683,7 +679,7 @@ Q_OUTOFLINE_TEMPLATE typename QList<T>::Node *QList<T>::detach_helper_grow(int i } if (!x->ref.deref()) - free(x); + dealloc(x); return reinterpret_cast<Node *>(p.begin() + i); } @@ -702,7 +698,7 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::detach_helper(int alloc) } if (!x->ref.deref()) - free(x); + dealloc(x); } template <typename T> @@ -715,7 +711,7 @@ template <typename T> Q_OUTOFLINE_TEMPLATE QList<T>::~QList() { if (!d->ref.deref()) - free(d); + dealloc(d); } template <typename T> @@ -736,9 +732,8 @@ Q_OUTOFLINE_TEMPLATE bool QList<T>::operator==(const QList<T> &l) const return true; } -// ### Qt 5: rename freeData() to avoid confusion with std::free() template <typename T> -Q_OUTOFLINE_TEMPLATE void QList<T>::free(QListData::Data *data) +Q_OUTOFLINE_TEMPLATE void QList<T>::dealloc(QListData::Data *data) { node_destruct(reinterpret_cast<Node *>(data->array + data->begin), reinterpret_cast<Node *>(data->array + data->end)); @@ -802,7 +797,7 @@ Q_OUTOFLINE_TEMPLATE QList<T> &QList<T>::operator+=(const QList<T> &l) } else { Node *n = (d->ref != 1) ? detach_helper_grow(INT_MAX, l.size()) - : reinterpret_cast<Node *>(p.append2(l.p)); + : reinterpret_cast<Node *>(p.append(l.p)); QT_TRY { node_copy(n, reinterpret_cast<Node *>(p.end()), reinterpret_cast<Node *>(l.p.begin())); diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 63ffae4e2b..d2bb752c6d 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -89,6 +89,8 @@ Q_GLOBAL_STATIC(QLocalePrivate, globalLocalePrivate) #ifdef QT_USE_ICU extern bool qt_initIcu(const QString &localeName); +extern bool qt_u_strToUpper(const QString &str, QString *out, const QLocale &locale); +extern bool qt_u_strToLower(const QString &str, QString *out, const QLocale &locale); #endif /****************************************************************************** @@ -2171,6 +2173,42 @@ Qt::LayoutDirection QLocale::textDirection() const return Qt::LeftToRight; } +/*! + \since 4.8 + + Returns an uppercase copy of \a str. +*/ +QString QLocale::toUpper(const QString &str) const +{ +#ifdef QT_USE_ICU + { + QString result; + if (qt_u_strToUpper(str, &result, *this)) + return result; + // else fall through and use Qt's toUpper + } +#endif + return str.toUpper(); +} + +/*! + \since 4.8 + + Returns a lowercase copy of \a str. +*/ +QString QLocale::toLower(const QString &str) const +{ +#ifdef QT_USE_ICU + { + QString result; + if (qt_u_strToLower(str, &result, *this)) + return result; + // else fall through and use Qt's toUpper + } +#endif + return str.toLower(); +} + /*! \since 4.5 diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h index 8a5d526e8d..55dd55b984 100644 --- a/src/corelib/tools/qlocale.h +++ b/src/corelib/tools/qlocale.h @@ -724,6 +724,9 @@ public: Qt::LayoutDirection textDirection() const; + QString toUpper(const QString &str) const; + QString toLower(const QString &str) const; + QString currencySymbol(CurrencySymbolFormat = CurrencySymbol) const; QString toCurrencyString(qlonglong, const QString &symbol = QString()) const; QString toCurrencyString(qulonglong, const QString &symbol = QString()) const; diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 9ce5eead8c..c56c050f76 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -105,8 +105,6 @@ QTextCodec *QString::codecForCStrings; #ifdef QT_USE_ICU // qlocale_icu.cpp extern bool qt_ucol_strcoll(const QChar *source, int sourceLength, const QChar *target, int targetLength, int *result); -extern bool qt_u_strToUpper(const QString &str, QString *out, const QLocale &locale); -extern bool qt_u_strToLower(const QString &str, QString *out, const QLocale &locale); #endif @@ -4878,7 +4876,10 @@ QString QString::rightJustified(int width, QChar fill, bool truncate) const \snippet doc/src/snippets/qstring/main.cpp 75 - \sa toUpper() + The case conversion will always happen in the 'C' locale. For locale dependent + case folding use QLocale::toLower() + + \sa toUpper(), QLocale::toLower() */ QString QString::toLower() const @@ -4889,15 +4890,6 @@ QString QString::toLower() const if (!d->size) return *this; -#ifdef QT_USE_ICU - { - QString result; - if (qt_u_strToLower(*this, &result, QLocale())) - return result; - // else fall through and use Qt's toUpper - } -#endif - const ushort *e = d->data() + d->size; // this avoids one out of bounds check in the loop @@ -4978,7 +4970,10 @@ QString QString::toCaseFolded() const \snippet doc/src/snippets/qstring/main.cpp 81 - \sa toLower() + The case conversion will always happen in the 'C' locale. For locale dependent + case folding use QLocale::toUpper() + + \sa toLower(), QLocale::toLower() */ QString QString::toUpper() const @@ -4989,15 +4984,6 @@ QString QString::toUpper() const if (!d->size) return *this; -#ifdef QT_USE_ICU - { - QString result; - if (qt_u_strToUpper(*this, &result, QLocale())) - return result; - // else fall through and use Qt's toUpper - } -#endif - const ushort *e = d->data() + d->size; // this avoids one out of bounds check in the loop @@ -6244,7 +6230,7 @@ void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar:: if (mode == QString::NormalizationForm_D || mode == QString::NormalizationForm_KD) return; - composeHelper(data, from); + composeHelper(data, version, from); } diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index f7d07a5b14..1714442eb6 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -58,6 +58,29 @@ #include <pngconf.h> #endif +#if PNG_LIBPNG_VER >= 10400 && PNG_LIBPNG_VER <= 10502 \ + && defined(PNG_PEDANTIC_WARNINGS_SUPPORTED) +/* + Versions 1.4.0 to 1.5.2 of libpng declare png_longjmp_ptr to + have a noreturn attribute if PNG_PEDANTIC_WARNINGS_SUPPORTED + is enabled, but most declarations of longjmp in the wild do + not add this attribute. This causes problems when the png_jmpbuf + macro expands to calling png_set_longjmp_fn with a mismatched + longjmp, as compilers such as Clang will treat this as an error. + + To work around this we override the png_jmpbuf macro to cast + longjmp to a png_longjmp_ptr. +*/ +# undef png_jmpbuf +# ifdef PNG_SETJMP_SUPPORTED +# define png_jmpbuf(png_ptr) \ + (*png_set_longjmp_fn((png_ptr), (png_longjmp_ptr)longjmp, sizeof(jmp_buf))) +# else +# define png_jmpbuf(png_ptr) \ + (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP) +# endif +#endif + #ifdef Q_OS_WINCE #define CALLBACK_CALL_TYPE __cdecl #else diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp index 20d136e691..7b9ff4a7a5 100644 --- a/src/gui/kernel/qplatformnativeinterface_qpa.cpp +++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp @@ -64,4 +64,45 @@ void * QPlatformNativeInterface::nativeResourceForBackingStore(const QByteArray return 0; } +/*! + Contains generic window properties that the platform may utilize. +*/ +QVariantMap QPlatformNativeInterface::windowProperties(QPlatformWindow *window) const +{ + return QVariantMap(); +} + +/*! + Returns a window property with \a name. + + If the property does not exist, returns a default-constructed value. +*/ +QVariant QPlatformNativeInterface::windowProperty(QPlatformWindow *window, const QString &name) const +{ + Q_UNUSED(window); + Q_UNUSED(name); + return QVariant(); +} + +/*! + Returns a window property with \a name. If the value does not exist, defaultValue is returned. +*/ +QVariant QPlatformNativeInterface::windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const +{ + Q_UNUSED(window); + Q_UNUSED(name); + Q_UNUSED(defaultValue); + return QVariant(); +} + +/*! + Sets a window property with \a name to \a value. +*/ +void QPlatformNativeInterface::setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value) +{ + Q_UNUSED(window); + Q_UNUSED(name); + Q_UNUSED(value); +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.h b/src/gui/kernel/qplatformnativeinterface_qpa.h index 6ea8104fa3..bfcf78813b 100644 --- a/src/gui/kernel/qplatformnativeinterface_qpa.h +++ b/src/gui/kernel/qplatformnativeinterface_qpa.h @@ -43,6 +43,8 @@ #define QPLATFORMNATIVEINTERFACE_QPA_H #include <QtGui/qwindowdefs.h> +#include <QtCore/QObject> +#include <QtCore/QVariant> QT_BEGIN_HEADER @@ -52,14 +54,24 @@ QT_MODULE(Gui) class QOpenGLContext; class QWindow; +class QPlatformWindow; class QBackingStore; -class Q_GUI_EXPORT QPlatformNativeInterface +class Q_GUI_EXPORT QPlatformNativeInterface : public QObject { + Q_OBJECT public: virtual void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context); virtual void *nativeResourceForWindow(const QByteArray &resource, QWindow *window); virtual void *nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *backingStore); + + virtual QVariantMap windowProperties(QPlatformWindow *window) const; + virtual QVariant windowProperty(QPlatformWindow *window, const QString &name) const; + virtual QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const; + virtual void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value); + +Q_SIGNALS: + void windowPropertyChanged(QPlatformWindow *window, const QString &propertyName); }; QT_END_NAMESPACE diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp index dbe957e68d..3528e6f215 100644 --- a/src/gui/painting/qcosmeticstroker.cpp +++ b/src/gui/painting/qcosmeticstroker.cpp @@ -425,13 +425,12 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal swapped = true; qSwap(y1, y2); qSwap(x1, x2); - --x1; --x2; --y1; --y2; } int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1); int x = x1 << 10; - int y = (y1+32) >> 6; - int ys = (y2+32) >> 6; + int y = y1 >> 6; + int ys = y2 >> 6; if (y != ys) { x += ( ((((y << 6) + 32 - y1))) * xinc ) >> 6; @@ -457,13 +456,12 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal swapped = true; qSwap(x1, x2); qSwap(y1, y2); - --x1; --x2; --y1; --y2; } int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1); int y = y1 << 10; - int x = (x1+32) >> 6; - int xs = (x2+32) >> 6; + int x = x1 >> 6; + int xs = x2 >> 6; if (x != xs) { y += ( ((((x << 6) + 32 - x1))) * yinc ) >> 6; @@ -716,10 +714,11 @@ static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, QCosmeticStroker::Point last = stroker->lastPixel; -// qDebug() << "stroke" << x1/64. << y1/64. << x2/64. << y2/64. << capString(caps); +// qDebug() << "stroke" << x1/64. << y1/64. << x2/64. << y2/64.; if (dx < dy) { // vertical + QCosmeticStroker::Direction dir = QCosmeticStroker::TopToBottom; bool swapped = false; if (y1 > y2) { @@ -727,30 +726,31 @@ static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, qSwap(y1, y2); qSwap(x1, x2); caps = swapCaps(caps); - --x1; --x2; --y1; --y2; + dir = QCosmeticStroker::BottomToTop; } int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1); int x = x1 << 10; + if ((stroker->lastDir ^ QCosmeticStroker::VerticalMask) == dir) + caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin; + capAdjust(caps, y1, y2, x, xinc); - int y = (y1+32) >> 6; - int ys = (y2+32) >> 6; + int y = y1 >> 6; + int ys = y2 >> 6; if (y != ys) { x += ( ((((y << 6) + 32 - y1))) * xinc ) >> 6; // calculate first and last pixel and perform dropout control - QCosmeticStroker::Direction dir = QCosmeticStroker::TopToBottom; QCosmeticStroker::Point first; first.x = x >> 16; first.y = y; last.x = (x + (ys - y - 1)*xinc) >> 16; last.y = ys - 1; - if (swapped) { + if (swapped) qSwap(first, last); - dir = QCosmeticStroker::BottomToTop; - } + bool axisAligned = qAbs(xinc) < (1 << 14); if (stroker->lastPixel.x >= 0) { if (first.x == stroker->lastPixel.x && @@ -765,7 +765,7 @@ static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, } else if (stroker->lastDir != dir && (((axisAligned && stroker->lastAxisAligned) && stroker->lastPixel.x != first.x && stroker->lastPixel.y != first.y) || - (qAbs(stroker->lastPixel.x - first.x) > 1 && + (qAbs(stroker->lastPixel.x - first.x) > 1 || qAbs(stroker->lastPixel.y - first.y) > 1))) { // have a missing pixel, insert it if (swapped) { @@ -793,37 +793,39 @@ static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, if (!dx) return; + QCosmeticStroker::Direction dir = QCosmeticStroker::LeftToRight; + bool swapped = false; if (x1 > x2) { swapped = true; qSwap(x1, x2); qSwap(y1, y2); caps = swapCaps(caps); - --x1; --x2; --y1; --y2; + dir = QCosmeticStroker::RightToLeft; } int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1); int y = y1 << 10; - capAdjust(caps, x1, x2, y, yinc); + if ((stroker->lastDir ^ QCosmeticStroker::HorizontalMask) == dir) + caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin; - int x = (x1+32) >> 6; - int xs = (x2+32) >> 6; + capAdjust(caps, x1, x2, y, yinc); + int x = x1 >> 6; + int xs = x2 >> 6; if (x != xs) { y += ( ((((x << 6) + 32 - x1))) * yinc ) >> 6; // calculate first and last pixel to perform dropout control - QCosmeticStroker::Direction dir = QCosmeticStroker::LeftToRight; QCosmeticStroker::Point first; first.x = x; first.y = y >> 16; last.x = xs - 1; last.y = (y + (xs - x - 1)*yinc) >> 16; - if (swapped) { + if (swapped) qSwap(first, last); - dir = QCosmeticStroker::RightToLeft; - } + bool axisAligned = qAbs(yinc) < (1 << 14); if (stroker->lastPixel.x >= 0) { if (first.x == stroker->lastPixel.x && first.y == stroker->lastPixel.y) { @@ -837,7 +839,7 @@ static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, } else if (stroker->lastDir != dir && (((axisAligned && stroker->lastAxisAligned) && stroker->lastPixel.x != first.x && stroker->lastPixel.y != first.y) || - (qAbs(stroker->lastPixel.x - first.x) > 1 && + (qAbs(stroker->lastPixel.x - first.x) > 1 || qAbs(stroker->lastPixel.y - first.y) > 1))) { // have a missing pixel, insert it if (swapped) { diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h index d7bd79ad15..53cdf2c0ac 100644 --- a/src/gui/painting/qcosmeticstroker_p.h +++ b/src/gui/painting/qcosmeticstroker_p.h @@ -78,10 +78,12 @@ public: // used to avoid drop outs or duplicated points enum Direction { - TopToBottom, - BottomToTop, - LeftToRight, - RightToLeft + TopToBottom = 0x1, + BottomToTop = 0x2, + LeftToRight = 0x4, + RightToLeft = 0x8, + VerticalMask = 0x3, + HorizontalMask = 0xc }; QCosmeticStroker(QRasterPaintEngineState *s, const QRect &dr) diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index f7ea2fa34a..204f71eced 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -685,20 +685,30 @@ void QTextControlPrivate::extendWordwiseSelection(int suggestedNewPosition, qrea if (!wordSelectionEnabled && (mouseXPosition < wordStartX || mouseXPosition > wordEndX)) return; - // keep the already selected word even when moving to the left - // (#39164) - if (suggestedNewPosition < selectedWordOnDoubleClick.position()) - cursor.setPosition(selectedWordOnDoubleClick.selectionEnd()); - else - cursor.setPosition(selectedWordOnDoubleClick.selectionStart()); + if (wordSelectionEnabled) { + if (suggestedNewPosition < selectedWordOnDoubleClick.position()) { + cursor.setPosition(selectedWordOnDoubleClick.selectionEnd()); + setCursorPosition(wordStartPos, QTextCursor::KeepAnchor); + } else { + cursor.setPosition(selectedWordOnDoubleClick.selectionStart()); + setCursorPosition(wordEndPos, QTextCursor::KeepAnchor); + } + } else { + // keep the already selected word even when moving to the left + // (#39164) + if (suggestedNewPosition < selectedWordOnDoubleClick.position()) + cursor.setPosition(selectedWordOnDoubleClick.selectionEnd()); + else + cursor.setPosition(selectedWordOnDoubleClick.selectionStart()); - const qreal differenceToStart = mouseXPosition - wordStartX; - const qreal differenceToEnd = wordEndX - mouseXPosition; + const qreal differenceToStart = mouseXPosition - wordStartX; + const qreal differenceToEnd = wordEndX - mouseXPosition; - if (differenceToStart < differenceToEnd) - setCursorPosition(wordStartPos, QTextCursor::KeepAnchor); - else - setCursorPosition(wordEndPos, QTextCursor::KeepAnchor); + if (differenceToStart < differenceToEnd) + setCursorPosition(wordStartPos, QTextCursor::KeepAnchor); + else + setCursorPosition(wordEndPos, QTextCursor::KeepAnchor); + } if (interactionFlags & Qt::TextSelectableByMouse) { #ifndef QT_NO_CLIPBOARD @@ -1591,8 +1601,10 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons #endif //QT_NO_IM } else { //emit q->visibilityRequest(QRectF(mousePos, QSizeF(1, 1))); - if (cursor.position() != oldCursorPos) + if (cursor.position() != oldCursorPos) { emit q->cursorPositionChanged(); + emit q->microFocusChanged(); + } } selectionChanged(true); repaintOldAndNewSelection(oldSelection); @@ -1636,8 +1648,10 @@ void QTextControlPrivate::mouseReleaseEvent(QEvent *e, Qt::MouseButton button, c repaintOldAndNewSelection(oldSelection); - if (cursor.position() != oldCursorPos) + if (cursor.position() != oldCursorPos) { emit q->cursorPositionChanged(); + emit q->microFocusChanged(); + } if (interactionFlags & Qt::LinksAccessibleByMouse) { if (!(button & Qt::LeftButton)) diff --git a/src/network/ssl/qssl.h b/src/network/ssl/qssl.h index 7b76b64b4c..c8af346800 100644 --- a/src/network/ssl/qssl.h +++ b/src/network/ssl/qssl.h @@ -63,6 +63,7 @@ namespace QSsl { }; enum KeyAlgorithm { + Opaque, Rsa, Dsa }; diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index bbc60f674c..fa97ccb78c 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -892,23 +892,24 @@ QList<QSslCertificate> QSslCertificatePrivate::certificatesFromDer(const QByteAr // These certificates are known to be fraudulent and were created during the comodo // compromise. See http://www.comodo.com/Comodo-Fraud-Incident-2011-03-23.html static const char *certificate_blacklist[] = { - "04:7e:cb:e9:fc:a5:5f:7b:d0:9e:ae:36:e1:0c:ae:1e", - "f5:c8:6a:f3:61:62:f1:3a:64:f5:4f:6d:c9:58:7c:06", - "d7:55:8f:da:f5:f1:10:5b:b2:13:28:2b:70:77:29:a3", - "39:2a:43:4f:0e:07:df:1f:8a:a3:05:de:34:e0:c2:29", - "3e:75:ce:d4:6b:69:30:21:21:88:30:ae:86:a8:2a:71", - "e9:02:8b:95:78:e4:15:dc:1a:71:0a:2b:88:15:44:47", - "92:39:d5:34:8f:40:d1:69:5a:74:54:70:e1:f2:3f:43", - "b0:b7:13:3e:d0:96:f9:b5:6f:ae:91:c8:74:bd:3a:c0", - "d8:f3:5f:4e:b7:87:2b:2d:ab:06:92:e3:15:38:2f:b0", - "05:e2:e6:a4:cd:09:ea:54:d6:65:b0:75:fe:22:a2:56", + "04:7e:cb:e9:fc:a5:5f:7b:d0:9e:ae:36:e1:0c:ae:1e", "mail.google.com", // Comodo + "f5:c8:6a:f3:61:62:f1:3a:64:f5:4f:6d:c9:58:7c:06", "www.google.com", // Comodo + "d7:55:8f:da:f5:f1:10:5b:b2:13:28:2b:70:77:29:a3", "login.yahoo.com", // Comodo + "39:2a:43:4f:0e:07:df:1f:8a:a3:05:de:34:e0:c2:29", "login.yahoo.com", // Comodo + "3e:75:ce:d4:6b:69:30:21:21:88:30:ae:86:a8:2a:71", "login.yahoo.com", // Comodo + "e9:02:8b:95:78:e4:15:dc:1a:71:0a:2b:88:15:44:47", "login.skype.com", // Comodo + "92:39:d5:34:8f:40:d1:69:5a:74:54:70:e1:f2:3f:43", "addons.mozilla.org", // Comodo + "b0:b7:13:3e:d0:96:f9:b5:6f:ae:91:c8:74:bd:3a:c0", "login.live.com", // Comodo + "d8:f3:5f:4e:b7:87:2b:2d:ab:06:92:e3:15:38:2f:b0", "global trustee", // Comodo + "05:e2:e6:a4:cd:09:ea:54:d6:65:b0:75:fe:22:a2:56", "*.google.com", // DigiNotar 0 }; bool QSslCertificatePrivate::isBlacklisted(const QSslCertificate &certificate) { for (int a = 0; certificate_blacklist[a] != 0; a++) { - if (certificate.serialNumber() == certificate_blacklist[a]) + if (certificate.serialNumber() == certificate_blacklist[a++] && + certificate.subjectInfo(QSslCertificate::CommonName).contains(QString::fromUtf8(certificate_blacklist[a]))) return true; } return false; diff --git a/src/network/ssl/qsslkey.cpp b/src/network/ssl/qsslkey.cpp index 29cfd0a77d..580b71bca9 100644 --- a/src/network/ssl/qsslkey.cpp +++ b/src/network/ssl/qsslkey.cpp @@ -89,6 +89,11 @@ void QSslKeyPrivate::clear(bool deep) q_DSA_free(dsa); dsa = 0; } + if (opaque) { + if (deep) + q_EVP_PKEY_free(opaque); + opaque = 0; + } } /*! @@ -265,6 +270,23 @@ QSslKey::QSslKey(QIODevice *device, QSsl::KeyAlgorithm algorithm, QSsl::Encoding } /*! + Constructs a QSslKey from a valid native key \a handle. + \a type specifies whether the key is public or private. + + QSslKey will take ownership for this key and you must not + free the key using the native library. The algorithm used + when creating a key from a handle will always be QSsl::Opaque. +*/ +QSslKey::QSslKey(Qt::HANDLE handle, QSsl::KeyType type) + : d(new QSslKeyPrivate) +{ + d->opaque = reinterpret_cast<EVP_PKEY *>(handle); + d->algorithm = QSsl::Opaque; + d->type = type; + d->isNull = !d->opaque; +} + +/*! Constructs an identical copy of \a other. */ QSslKey::QSslKey(const QSslKey &other) : d(other.d) @@ -315,8 +337,9 @@ void QSslKey::clear() */ int QSslKey::length() const { - if (d->isNull) + if (d->isNull || d->algorithm == QSsl::Opaque) return -1; + return (d->algorithm == QSsl::Rsa) ? q_BN_num_bits(d->rsa->n) : q_BN_num_bits(d->dsa->p); } @@ -345,8 +368,9 @@ QSsl::KeyAlgorithm QSslKey::algorithm() const // ### autotest failure for non-empty passPhrase and private key QByteArray QSslKey::toDer(const QByteArray &passPhrase) const { - if (d->isNull) + if (d->isNull || d->algorithm == QSsl::Opaque) return QByteArray(); + return d->derFromPem(toPem(passPhrase)); } @@ -357,7 +381,7 @@ QByteArray QSslKey::toDer(const QByteArray &passPhrase) const */ QByteArray QSslKey::toPem(const QByteArray &passPhrase) const { - if (!QSslSocket::supportsSsl() || d->isNull) + if (!QSslSocket::supportsSsl() || d->isNull || d->algorithm == QSsl::Opaque) return QByteArray(); BIO *bio = q_BIO_new(q_BIO_s_mem()); @@ -417,7 +441,16 @@ QByteArray QSslKey::toPem(const QByteArray &passPhrase) const */ Qt::HANDLE QSslKey::handle() const { - return (d->algorithm == QSsl::Rsa) ? Qt::HANDLE(d->rsa) : Qt::HANDLE(d->dsa); + switch (d->algorithm) { + case QSsl::Opaque: + return Qt::HANDLE(d->opaque); + case QSsl::Rsa: + return Qt::HANDLE(d->rsa); + case QSsl::Dsa: + return Qt::HANDLE(d->dsa); + default: + return Qt::HANDLE(NULL); + } } /*! @@ -435,6 +468,8 @@ bool QSslKey::operator==(const QSslKey &other) const return false; if (length() != other.length()) return false; + if (algorithm() == QSsl::Opaque) + return handle() == other.handle(); return toDer() == other.toDer(); } @@ -450,7 +485,8 @@ QDebug operator<<(QDebug debug, const QSslKey &key) { debug << "QSslKey(" << (key.type() == QSsl::PublicKey ? "PublicKey" : "PrivateKey") - << ", " << (key.algorithm() == QSsl::Rsa ? "RSA" : "DSA") + << ", " << (key.algorithm() == QSsl::Opaque ? "OPAQUE" : + (key.algorithm() == QSsl::Rsa ? "RSA" : "DSA")) << ", " << key.length() << ')'; return debug; diff --git a/src/network/ssl/qsslkey.h b/src/network/ssl/qsslkey.h index 5ee1b4ad2f..7064d22eb4 100644 --- a/src/network/ssl/qsslkey.h +++ b/src/network/ssl/qsslkey.h @@ -73,6 +73,7 @@ public: QSsl::EncodingFormat format = QSsl::Pem, QSsl::KeyType type = QSsl::PrivateKey, const QByteArray &passPhrase = QByteArray()); + explicit QSslKey(Qt::HANDLE handle, QSsl::KeyType type = QSsl::PrivateKey); QSslKey(const QSslKey &other); ~QSslKey(); QSslKey &operator=(const QSslKey &other); diff --git a/src/network/ssl/qsslkey_p.h b/src/network/ssl/qsslkey_p.h index f4a77b3c3f..14075ecad0 100644 --- a/src/network/ssl/qsslkey_p.h +++ b/src/network/ssl/qsslkey_p.h @@ -67,6 +67,7 @@ public: inline QSslKeyPrivate() : rsa(0) , dsa(0) + , opaque(0) { clear(); } @@ -88,6 +89,7 @@ public: QSsl::KeyAlgorithm algorithm; RSA *rsa; DSA *dsa; + EVP_PKEY *opaque; QAtomicInt ref; diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 300a5c84d5..0ff17910f3 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -322,7 +322,7 @@ init_context: if (! caCertificate.isValid()) { expiredCerts.append(caCertificate); } else { - q_X509_STORE_add_cert(ctx->cert_store, (X509 *)caCertificate.handle()); + q_X509_STORE_add_cert(ctx->cert_store, reinterpret_cast<X509 *>(caCertificate.handle())); } } @@ -335,7 +335,7 @@ init_context: // now add the expired certs if (addExpiredCerts) { foreach (const QSslCertificate &caCertificate, expiredCerts) { - q_X509_STORE_add_cert(ctx->cert_store, (X509 *)caCertificate.handle()); + q_X509_STORE_add_cert(ctx->cert_store, reinterpret_cast<X509 *>(caCertificate.handle())); } } @@ -358,26 +358,33 @@ init_context: } // Load certificate - if (!q_SSL_CTX_use_certificate(ctx, (X509 *)configuration.localCertificate.handle())) { + if (!q_SSL_CTX_use_certificate(ctx, reinterpret_cast<X509 *>(configuration.localCertificate.handle()))) { q->setErrorString(QSslSocket::tr("Error loading local certificate, %1").arg(getErrorsFromOpenSsl())); emit q->error(QAbstractSocket::UnknownSocketError); return false; } - // Load private key - pkey = q_EVP_PKEY_new(); - // before we were using EVP_PKEY_assign_R* functions and did not use EVP_PKEY_free. - // this lead to a memory leak. Now we use the *_set1_* functions which do not - // take ownership of the RSA/DSA key instance because the QSslKey already has ownership. - if (configuration.privateKey.algorithm() == QSsl::Rsa) - q_EVP_PKEY_set1_RSA(pkey, (RSA *)configuration.privateKey.handle()); - else - q_EVP_PKEY_set1_DSA(pkey, (DSA *)configuration.privateKey.handle()); + if (configuration.privateKey.algorithm() == QSsl::Opaque) { + pkey = reinterpret_cast<EVP_PKEY *>(configuration.privateKey.handle()); + } else { + // Load private key + pkey = q_EVP_PKEY_new(); + // before we were using EVP_PKEY_assign_R* functions and did not use EVP_PKEY_free. + // this lead to a memory leak. Now we use the *_set1_* functions which do not + // take ownership of the RSA/DSA key instance because the QSslKey already has ownership. + if (configuration.privateKey.algorithm() == QSsl::Rsa) + q_EVP_PKEY_set1_RSA(pkey, reinterpret_cast<RSA *>(configuration.privateKey.handle())); + else + q_EVP_PKEY_set1_DSA(pkey, reinterpret_cast<DSA *>(configuration.privateKey.handle())); + } + if (!q_SSL_CTX_use_PrivateKey(ctx, pkey)) { q->setErrorString(QSslSocket::tr("Error loading private key, %1").arg(getErrorsFromOpenSsl())); emit q->error(QAbstractSocket::UnknownSocketError); return false; } + if (configuration.privateKey.algorithm() == QSsl::Opaque) + pkey = 0; // Don't free the private key, it belongs to QSslKey // Check if the certificate matches the private key. if (!q_SSL_CTX_check_private_key(ctx)) { @@ -1383,7 +1390,6 @@ void QSslSocketBackendPrivate::disconnected() q_EVP_PKEY_free(pkey); pkey = 0; } - } QSslCipher QSslSocketBackendPrivate::sessionCipher() const @@ -1508,7 +1514,7 @@ QList<QSslError> QSslSocketBackendPrivate::verify(QList<QSslCertificate> certifi if (!caCertificate.isValid()) { expiredCerts.append(caCertificate); } else { - q_X509_STORE_add_cert(certStore, (X509 *)caCertificate.handle()); + q_X509_STORE_add_cert(certStore, reinterpret_cast<X509 *>(caCertificate.handle())); } } @@ -1521,7 +1527,7 @@ QList<QSslError> QSslSocketBackendPrivate::verify(QList<QSslCertificate> certifi // now add the expired certs if (addExpiredCerts) { foreach (const QSslCertificate &caCertificate, expiredCerts) { - q_X509_STORE_add_cert(certStore, (X509 *)caCertificate.handle()); + q_X509_STORE_add_cert(certStore, reinterpret_cast<X509 *>(caCertificate.handle())); } } @@ -1548,9 +1554,9 @@ QList<QSslError> QSslSocketBackendPrivate::verify(QList<QSslCertificate> certifi continue; } #if OPENSSL_VERSION_NUMBER >= 0x10000000L - q_sk_push( (_STACK *)intermediates, (X509 *)cert.handle()); + q_sk_push( (_STACK *)intermediates, reinterpret_cast<X509 *>(cert.handle())); #else - q_sk_push( (STACK *)intermediates, (X509 *)cert.handle()); + q_sk_push( (STACK *)intermediates, reinterpret_cast<X509 *>(cert.handle())); #endif } } @@ -1562,7 +1568,7 @@ QList<QSslError> QSslSocketBackendPrivate::verify(QList<QSslCertificate> certifi return errors; } - if (!q_X509_STORE_CTX_init(storeContext, certStore, (X509 *)certificateChain[0].handle(), intermediates)) { + if (!q_X509_STORE_CTX_init(storeContext, certStore, reinterpret_cast<X509 *>(certificateChain[0].handle()), intermediates)) { q_X509_STORE_CTX_free(storeContext); q_X509_STORE_free(certStore); errors << QSslError(QSslError::UnspecifiedError); diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h index a1db6d9320..d1705b3680 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols_p.h +++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h @@ -228,13 +228,13 @@ char *q_ERR_error_string(unsigned long a, char *b); unsigned long q_ERR_get_error(); const EVP_CIPHER *q_EVP_des_ede3_cbc(); int q_EVP_PKEY_assign(EVP_PKEY *a, int b, char *c); -int q_EVP_PKEY_set1_RSA(EVP_PKEY *a, RSA *b); +Q_AUTOTEST_EXPORT int q_EVP_PKEY_set1_RSA(EVP_PKEY *a, RSA *b); int q_EVP_PKEY_set1_DSA(EVP_PKEY *a, DSA *b); void q_EVP_PKEY_free(EVP_PKEY *a); RSA *q_EVP_PKEY_get1_RSA(EVP_PKEY *a); DSA *q_EVP_PKEY_get1_DSA(EVP_PKEY *a); int q_EVP_PKEY_type(int a); -EVP_PKEY *q_EVP_PKEY_new(); +Q_AUTOTEST_EXPORT EVP_PKEY *q_EVP_PKEY_new(); int q_i2d_X509(X509 *a, unsigned char **b); const char *q_OBJ_nid2sn(int a); const char *q_OBJ_nid2ln(int a); diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index 3158c73605..d81fa350e9 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -40,12 +40,13 @@ ****************************************************************************/ #include "qwaylandnativeinterface.h" - #include "qwaylanddisplay.h" #include "qwaylandwindow.h" #include <QtGui/private/qguiapplication_p.h> #include <QtGui/QScreen> +#include "windowmanager_integration/qwaylandwindowmanagerintegration.h" + void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) { QByteArray lowerCaseResource = resourceString.toLower(); @@ -71,3 +72,32 @@ QWaylandScreen * QWaylandNativeInterface::qPlatformScreenForWindow(QWindow *wind } return screen; } + +QVariantMap QWaylandNativeInterface::windowProperties(QPlatformWindow *window) const +{ + return m_windowProperties.value(window); +} + +QVariant QWaylandNativeInterface::windowProperty(QPlatformWindow *window, const QString &name) const +{ + const QVariantMap properties = m_windowProperties.value(window); + return properties.value(name); +} + +QVariant QWaylandNativeInterface::windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const +{ + const QVariantMap properties = m_windowProperties.value(window); + return properties.value(name, defaultValue); +} + +void QWaylandNativeInterface::setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value) +{ + QVariantMap props = m_windowProperties.value(window); + props.insert(name, value); + m_windowProperties.insert(window, props); + + QWaylandWindow *wlWindow = static_cast<QWaylandWindow*>(window); + QWaylandWindowManagerIntegration::instance()->setWindowProperty(wlWindow, name, value); + + emit windowPropertyChanged(window, name); +} diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.h b/src/plugins/platforms/wayland/qwaylandnativeinterface.h index f1d4fe9402..9db442a265 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.h @@ -43,7 +43,7 @@ #define QWAYLANDNATIVEINTERFACE_H #include "qwaylandscreen.h" - +#include <QVariantMap> #include <QtGui/QPlatformNativeInterface> class QWaylandNativeInterface : public QPlatformNativeInterface @@ -52,8 +52,16 @@ public: void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window); + QVariantMap windowProperties(QPlatformWindow *window) const; + QVariant windowProperty(QPlatformWindow *window, const QString &name) const; + QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const; + void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value); + private: static QWaylandScreen *qPlatformScreenForWindow(QWindow *window); + +private: + QHash<QPlatformWindow*, QVariantMap> m_windowProperties; }; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 48da7b537e..6011621044 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -149,6 +149,9 @@ void QWaylandWindow::newSurfaceCreated() // do not damage the surface here, as this leads to graphical corruptions in the compositor until // the first frame has been rendered } +#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT + QWaylandWindowManagerIntegration::instance()->flushPropertyChanges(this); +#endif } void QWaylandWindow::frameCallback(struct wl_surface *surface, void *data, uint32_t time) diff --git a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanager-client-protocol.h b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanager-client-protocol.h deleted file mode 100644 index e781b16c41..0000000000 --- a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanager-client-protocol.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright © 2010 Kristian Høgsberg - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - - -#ifndef WAYLAND_WINDOWMANAGER_CLIENT_PROTOCOL_H -#define WAYLAND_WINDOWMANAGER_CLIENT_PROTOCOL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> -#include <stddef.h> -#include "wayland-util.h" - -struct wl_client; - -struct wl_windowmanager; - -extern const struct wl_interface wl_windowmanager_interface; - -struct wl_windowmanager_listener { - void (*client_onscreen_visibility)(void *data, - struct wl_windowmanager *wl_windowmanager, - int visible); - void (*set_screen_rotation)(void *data, - struct wl_windowmanager *wl_windowmanager, - int rotation); -}; - -static inline int -wl_windowmanager_add_listener(struct wl_windowmanager *wl_windowmanager, - const struct wl_windowmanager_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) wl_windowmanager, - (void (**)(void)) listener, data); -} - -#define WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS 0 -#define WL_WINDOWMANAGER_AUTHENTICATE_WITH_TOKEN 1 - -static inline struct wl_windowmanager * -wl_windowmanager_create(struct wl_display *display, uint32_t id, uint32_t version) -{ - wl_display_bind(display, id, "wl_windowmanager", version); - - return (struct wl_windowmanager *) - wl_proxy_create_for_id(display, &wl_windowmanager_interface, id); -} - -static inline void -wl_windowmanager_set_user_data(struct wl_windowmanager *wl_windowmanager, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) wl_windowmanager, user_data); -} - -static inline void * -wl_windowmanager_get_user_data(struct wl_windowmanager *wl_windowmanager) -{ - return wl_proxy_get_user_data((struct wl_proxy *) wl_windowmanager); -} - -static inline void -wl_windowmanager_destroy(struct wl_windowmanager *wl_windowmanager) -{ - wl_proxy_destroy((struct wl_proxy *) wl_windowmanager); -} - -static inline void -wl_windowmanager_map_client_to_process(struct wl_windowmanager *wl_windowmanager, uint32_t processid) -{ - wl_proxy_marshal((struct wl_proxy *) wl_windowmanager, - WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS, processid); -} - -static inline void -wl_windowmanager_authenticate_with_token(struct wl_windowmanager *wl_windowmanager, const char *processid) -{ - wl_proxy_marshal((struct wl_proxy *) wl_windowmanager, - WL_WINDOWMANAGER_AUTHENTICATE_WITH_TOKEN, processid); -} - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp index 60b0a5605e..7d68571c24 100644 --- a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp @@ -40,17 +40,43 @@ ****************************************************************************/ #include "qwaylandwindowmanagerintegration.h" -#include "qwaylandwindowmanager-client-protocol.h" +#include "wayland-windowmanager-client-protocol.h" +#include "qwaylandwindow.h" #include <stdint.h> -#include <QDebug> -#include <QEvent> +#include <QtCore/QEvent> +#include <QtCore/QHash> +#include <QtGui/QPlatformNativeInterface> +#include <QtGui/QPlatformWindow> #include <QtGui/QtEvents> -#include <QCoreApplication> +#include <QtGui/QGuiApplication> + +#include <QDebug> + +class QWaylandWindowManagerIntegrationPrivate { +public: + QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay); + bool m_blockPropertyUpdates; + QWaylandDisplay *m_waylandDisplay; + struct wl_windowmanager *m_waylandWindowManager; + QHash<QWaylandWindow*,QVariantMap> m_queuedProperties; -const struct wl_windowmanager_listener QWaylandWindowManagerIntegration::mWindowManagerListener = { +}; + +QWaylandWindowManagerIntegrationPrivate::QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay) + : m_blockPropertyUpdates(false) + , m_waylandDisplay(waylandDisplay) + , m_waylandWindowManager(0) +{ + +} + +QWaylandWindowManagerIntegration *QWaylandWindowManagerIntegration::m_instance = 0; + +const struct wl_windowmanager_listener QWaylandWindowManagerIntegration::m_windowManagerListener = { QWaylandWindowManagerIntegration::wlHandleOnScreenVisibilityChange, QWaylandWindowManagerIntegration::wlHandleScreenOrientationChange, + QWaylandWindowManagerIntegration::wlHandleWindowPropertyChange }; QWaylandWindowManagerIntegration *QWaylandWindowManagerIntegration::createIntegration(QWaylandDisplay *waylandDisplay) @@ -59,10 +85,11 @@ QWaylandWindowManagerIntegration *QWaylandWindowManagerIntegration::createIntegr } QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay) - : mWaylandDisplay(waylandDisplay) - , mWaylandWindowManager(0) + : d_ptr(new QWaylandWindowManagerIntegrationPrivate(waylandDisplay)) { - wl_display_add_global_listener(mWaylandDisplay->wl_display(), + m_instance = this; + + wl_display_add_global_listener(d_ptr->m_waylandDisplay->wl_display(), QWaylandWindowManagerIntegration::wlHandleListenerGlobal, this); } @@ -72,9 +99,15 @@ QWaylandWindowManagerIntegration::~QWaylandWindowManagerIntegration() } +QWaylandWindowManagerIntegration *QWaylandWindowManagerIntegration::instance() +{ + return m_instance; +} + struct wl_windowmanager *QWaylandWindowManagerIntegration::windowManager() const { - return mWaylandWindowManager; + Q_D(const QWaylandWindowManagerIntegration); + return d->m_waylandWindowManager; } void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(wl_display *display, uint32_t id, const char *interface, uint32_t version, void *data) @@ -82,29 +115,95 @@ void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(wl_display *displa Q_UNUSED(version); if (strcmp(interface, "wl_windowmanager") == 0) { QWaylandWindowManagerIntegration *integration = static_cast<QWaylandWindowManagerIntegration *>(data); - integration->mWaylandWindowManager = wl_windowmanager_create(display, id, 1); - - wl_windowmanager_add_listener(integration->mWaylandWindowManager, &mWindowManagerListener, integration); + integration->d_ptr->m_waylandWindowManager = wl_windowmanager_create(display, id, 1); + wl_windowmanager *windowManager = integration->d_ptr->m_waylandWindowManager; + wl_windowmanager_add_listener(windowManager, &m_windowManagerListener, integration); } } void QWaylandWindowManagerIntegration::mapClientToProcess(long long processId) { - if (mWaylandWindowManager) - wl_windowmanager_map_client_to_process(mWaylandWindowManager, (uint32_t) processId); + Q_D(QWaylandWindowManagerIntegration); + if (d->m_waylandWindowManager) + wl_windowmanager_map_client_to_process(d->m_waylandWindowManager, (uint32_t) processId); } void QWaylandWindowManagerIntegration::authenticateWithToken(const QByteArray &token) { + Q_D(QWaylandWindowManagerIntegration); QByteArray authToken = token; if (authToken.isEmpty()) authToken = qgetenv("WL_AUTHENTICATION_TOKEN"); - if (mWaylandWindowManager && !authToken.isEmpty()) { - wl_windowmanager_authenticate_with_token(mWaylandWindowManager, authToken.constData()); + if (d->m_waylandWindowManager && !authToken.isEmpty()) { + wl_windowmanager_authenticate_with_token(d->m_waylandWindowManager, authToken.constData()); + } +} + +static wl_array writePropertyValue(const QVariant &value) +{ + QByteArray byteValue; + QDataStream ds(&byteValue, QIODevice::WriteOnly); + ds << value; + + wl_array data; + data.size = byteValue.size(); + data.data = (void*)byteValue.constData(); + data.alloc = 0; + + return data; +} + +void QWaylandWindowManagerIntegration::setWindowProperty(QWaylandWindow *window, const QString &propertyName, const QVariant &propertyValue) +{ + Q_D(QWaylandWindowManagerIntegration); + if (d->m_blockPropertyUpdates) + return; + + if (window->wl_surface()) { + wl_array data = writePropertyValue(propertyValue); + wl_windowmanager_update_generic_property(d->m_waylandWindowManager, window->wl_surface(), + propertyName.toLatin1().constData(), + &data); + } else { + QVariantMap props = d->m_queuedProperties.value(window); + props.insert(propertyName, propertyValue); + d->m_queuedProperties.insert(window, props); + // ### TODO we'll need to add listening to destroyed() of QWindow that owns QWaylandWindow + // once refactor changes are in, and connect to removeQueuedPropertiesForWindow(). } } +void QWaylandWindowManagerIntegration::flushPropertyChanges(QWaylandWindow *windowToFlush) +{ + // write all changes we got while we did not have a surface. + // this can happen during startup, for example, or while the window is hidden. + Q_D(QWaylandWindowManagerIntegration); + + if (!windowToFlush) + return; + + QVariantMap properties = d->m_queuedProperties.value(windowToFlush); + wl_surface *surface = windowToFlush->wl_surface(); + + QMapIterator<QString, QVariant> pIt(properties); + while (pIt.hasNext()) { + pIt.next(); + wl_array data = writePropertyValue(pIt.value()); + wl_windowmanager_update_generic_property(d->m_waylandWindowManager, surface, pIt.key().toLatin1().constData(), &data); + } + + d->m_queuedProperties.clear(); +} + +void QWaylandWindowManagerIntegration::removeQueuedPropertiesForWindow() +{ + // TODO enable this later once refactor changes are in. +// Q_D(QWaylandWindowManagerIntegration); +// QWaylandWindow *window = 0; +// d->m_queuedProperties.remove(window); +} + void QWaylandWindowManagerIntegration::wlHandleOnScreenVisibilityChange(void *data, struct wl_windowmanager *wl_windowmanager, int visible) { Q_UNUSED(data); @@ -120,3 +219,45 @@ void QWaylandWindowManagerIntegration::wlHandleScreenOrientationChange(void *dat QScreenOrientationChangeEvent event(screenOrientation); QCoreApplication::sendEvent(QCoreApplication::instance(), &event); } + +void QWaylandWindowManagerIntegration::wlHandleWindowPropertyChange(void *data, struct wl_windowmanager *wl_windowmanager, + struct wl_surface *surface, + const char *propertyName, struct wl_array *propertyValue) +{ + // window manager changes a window property + Q_UNUSED(data); + Q_UNUSED(wl_windowmanager); + + QVariant variantValue; + QByteArray baValue = QByteArray((const char*)propertyValue->data, propertyValue->size); + QDataStream ds(&baValue, QIODevice::ReadOnly); + ds >> variantValue; + + QPlatformNativeInterface *nativeInterface = qApp->platformNativeInterface(); + QWaylandWindowManagerIntegration *inst = QWaylandWindowManagerIntegration::instance(); + + QList<QWindow *> windows = qApp->topLevelWindows(); + foreach (QWindow *window, windows) { + QPlatformWindow *platformWindowForWindow = window->handle(); + if (!platformWindowForWindow) + continue; + QWaylandWindow *waylandWindow = static_cast<QWaylandWindow*>(platformWindowForWindow); + wl_surface *windowSurface = (wl_surface*)nativeInterface->nativeResourceForWindow(QByteArray("surface"), window); + if (windowSurface == surface) { + inst->handleWindowPropertyChange(waylandWindow, QString(propertyName), variantValue); + break; + } + } +} + +void QWaylandWindowManagerIntegration::handleWindowPropertyChange(QWaylandWindow *window, + const QString &propertyName, const QVariant &propertyValue) +{ + Q_D(QWaylandWindowManagerIntegration); + d->m_blockPropertyUpdates = true; + + QPlatformNativeInterface *nativeInterface = qApp->platformNativeInterface(); + nativeInterface->setWindowProperty(window, propertyName, propertyValue); + + d->m_blockPropertyUpdates = false; +} diff --git a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h index 6b4658c7e1..1372fb81b8 100644 --- a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h +++ b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h @@ -42,21 +42,37 @@ #ifndef QWAYLANDWINDOWMANAGERINTEGRATION_H #define QWAYLANDWINDOWMANAGERINTEGRATION_H -#include <QObject> +#include <QtCore/QObject> +#include <QtCore/QScopedPointer> + #include "wayland-client.h" #include "qwaylanddisplay.h" -class QWaylandWindowManagerIntegration +class QWaylandWindow; + +class QWaylandWindowManagerIntegrationPrivate; + +class QWaylandWindowManagerIntegration : public QObject { + Q_OBJECT + Q_DECLARE_PRIVATE(QWaylandWindowManagerIntegration) public: explicit QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay); virtual ~QWaylandWindowManagerIntegration(); static QWaylandWindowManagerIntegration *createIntegration(QWaylandDisplay *waylandDisplay); struct wl_windowmanager *windowManager() const; + static QWaylandWindowManagerIntegration *instance(); + void mapSurfaceToProcess(struct wl_surface *surface, long long processId); void mapClientToProcess(long long processId); void authenticateWithToken(const QByteArray &token = QByteArray()); + void setWindowProperty(QWaylandWindow *window, const QString &propertyName, const QVariant &propertyValue); + + void flushPropertyChanges(QWaylandWindow *windowToFlush); + +private slots: + void removeQueuedPropertiesForWindow(); private: static void wlHandleListenerGlobal(wl_display *display, uint32_t id, @@ -64,12 +80,17 @@ private: static void wlHandleOnScreenVisibilityChange(void *data, struct wl_windowmanager *wl_windowmanager, int visible); static void wlHandleScreenOrientationChange(void *data, struct wl_windowmanager *wl_windowmanager, int screenOrientation); -private: + static void wlHandleWindowPropertyChange(void *data, struct wl_windowmanager *wl_windowmanager, + struct wl_surface *surface, + const char *propertyName, struct wl_array *propertyValue); - QWaylandDisplay *mWaylandDisplay; - struct wl_windowmanager *mWaylandWindowManager; + void handleWindowPropertyChange(QWaylandWindow *window, const QString &propertyName, const QVariant &propertyValue); + +private: + QScopedPointer<QWaylandWindowManagerIntegrationPrivate> d_ptr; + static QWaylandWindowManagerIntegration *m_instance; - static const struct wl_windowmanager_listener mWindowManagerListener; + static const struct wl_windowmanager_listener m_windowManagerListener; }; #endif // QWAYLANDWINDOWMANAGERINTEGRATION_H diff --git a/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-client-protocol.h b/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-client-protocol.h new file mode 100644 index 0000000000..034c08f28a --- /dev/null +++ b/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-client-protocol.h @@ -0,0 +1,96 @@ +#ifndef WAYLAND_WINDOWMANAGER_CLIENT_PROTOCOL_H +#define WAYLAND_WINDOWMANAGER_CLIENT_PROTOCOL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> +#include <stddef.h> +#include "wayland-util.h" + +struct wl_client; + +struct wl_windowmanager; + +extern const struct wl_interface wl_windowmanager_interface; + +struct wl_windowmanager_listener { + void (*client_onscreen_visibility)(void *data, + struct wl_windowmanager *wl_windowmanager, + int32_t visible); + void (*set_screen_rotation)(void *data, + struct wl_windowmanager *wl_windowmanager, + int32_t rotation); + void (*set_generic_property)(void *data, + struct wl_windowmanager *wl_windowmanager, + struct wl_surface *surface, + const char *name, + struct wl_array *value); +}; + +static inline int +wl_windowmanager_add_listener(struct wl_windowmanager *wl_windowmanager, + const struct wl_windowmanager_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) wl_windowmanager, + (void (**)(void)) listener, data); +} + +#define WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS 0 +#define WL_WINDOWMANAGER_AUTHENTICATE_WITH_TOKEN 1 +#define WL_WINDOWMANAGER_UPDATE_GENERIC_PROPERTY 2 + +static inline struct wl_windowmanager * +wl_windowmanager_create(struct wl_display *display, uint32_t id, uint32_t version) +{ + wl_display_bind(display, id, "wl_windowmanager", version); + + return (struct wl_windowmanager *) + wl_proxy_create_for_id(display, &wl_windowmanager_interface, id); +} + +static inline void +wl_windowmanager_set_user_data(struct wl_windowmanager *wl_windowmanager, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) wl_windowmanager, user_data); +} + +static inline void * +wl_windowmanager_get_user_data(struct wl_windowmanager *wl_windowmanager) +{ + return wl_proxy_get_user_data((struct wl_proxy *) wl_windowmanager); +} + +static inline void +wl_windowmanager_destroy(struct wl_windowmanager *wl_windowmanager) +{ + wl_proxy_destroy((struct wl_proxy *) wl_windowmanager); +} + +static inline void +wl_windowmanager_map_client_to_process(struct wl_windowmanager *wl_windowmanager, uint32_t processid) +{ + wl_proxy_marshal((struct wl_proxy *) wl_windowmanager, + WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS, processid); +} + +static inline void +wl_windowmanager_authenticate_with_token(struct wl_windowmanager *wl_windowmanager, const char *processid) +{ + wl_proxy_marshal((struct wl_proxy *) wl_windowmanager, + WL_WINDOWMANAGER_AUTHENTICATE_WITH_TOKEN, processid); +} + +static inline void +wl_windowmanager_update_generic_property(struct wl_windowmanager *wl_windowmanager, struct wl_surface *surface, const char *name, struct wl_array *value) +{ + wl_proxy_marshal((struct wl_proxy *) wl_windowmanager, + WL_WINDOWMANAGER_UPDATE_GENERIC_PROPERTY, surface, name, value); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c b/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c index 8125dec4d3..1d231f5d22 100644 --- a/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c +++ b/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c @@ -1,38 +1,29 @@ -/* - * Copyright © 2010 Kristian Høgsberg - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - - #include <stdlib.h> #include <stdint.h> #include "wayland-util.h" +extern const struct wl_interface wl_surface_interface; + +static const struct wl_interface *types[] = { + NULL, + &wl_surface_interface, + NULL, + NULL, + &wl_surface_interface, + NULL, + NULL, +}; + static const struct wl_message wl_windowmanager_requests[] = { - { "map_client_to_process", "u", NULL }, - { "authenticate_with_token", "s", NULL }, + { "map_client_to_process", "u", types + 0 }, + { "authenticate_with_token", "s", types + 0 }, + { "update_generic_property", "osa", types + 1 }, }; static const struct wl_message wl_windowmanager_events[] = { - { "client_onscreen_visibility", "i", NULL }, - { "set_screen_rotation", "i", NULL }, + { "client_onscreen_visibility", "i", types + 0 }, + { "set_screen_rotation", "i", types + 0 }, + { "set_generic_property", "osa", types + 4 }, }; WL_EXPORT const struct wl_interface wl_windowmanager_interface = { diff --git a/src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri b/src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri index a28218272d..45118b5d50 100644 --- a/src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri +++ b/src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri @@ -3,7 +3,7 @@ DEFINES += QT_WAYLAND_WINDOWMANAGER_SUPPORT contains(DEFINES, QT_WAYLAND_WINDOWMANAGER_SUPPORT) { HEADERS += \ - $$PWD/qwaylandwindowmanager-client-protocol.h \ + $$PWD/wayland-windowmanager-client-protocol.h \ $$PWD/qwaylandwindowmanagerintegration.h SOURCES += \ diff --git a/src/src.pro b/src/src.pro index a531355ae9..4263c0eb92 100644 --- a/src/src.pro +++ b/src/src.pro @@ -15,7 +15,7 @@ nacl: SRC_SUBDIRS -= src_network src_testlib !symbian:contains(QT_CONFIG, dbus):SRC_SUBDIRS += src_dbus contains(QT_CONFIG, no-gui): SRC_SUBDIRS -= src_gui -!contains(QT_CONFIG, no-v8): SRC_SUBDIRS += src_v8 +contains(QT_CONFIG, v8): SRC_SUBDIRS += src_v8 contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2): SRC_SUBDIRS += src_opengl SRC_SUBDIRS += src_plugins diff --git a/src/testlib/qabstracttestlogger.cpp b/src/testlib/qabstracttestlogger.cpp index d71addb655..e2f253c22e 100644 --- a/src/testlib/qabstracttestlogger.cpp +++ b/src/testlib/qabstracttestlogger.cpp @@ -54,18 +54,8 @@ QT_BEGIN_NAMESPACE -void QAbstractTestLogger::outputString(const char *msg) +QAbstractTestLogger::QAbstractTestLogger(const char *filename) { - QTEST_ASSERT(stream); - - ::fputs(msg, stream); - ::fflush(stream); -} - -void QAbstractTestLogger::startLogging(const char *filename) -{ - QTEST_ASSERT(!stream); - if (!filename) { stream = stdout; return; @@ -81,7 +71,7 @@ void QAbstractTestLogger::startLogging(const char *filename) } } -void QAbstractTestLogger::stopLogging() +QAbstractTestLogger::~QAbstractTestLogger() { QTEST_ASSERT(stream); if (stream != stdout) { @@ -97,6 +87,22 @@ void QAbstractTestLogger::stopLogging() stream = 0; } +void QAbstractTestLogger::outputString(const char *msg) +{ + QTEST_ASSERT(stream); + + ::fputs(msg, stream); + ::fflush(stream); +} + +void QAbstractTestLogger::startLogging() +{ +} + +void QAbstractTestLogger::stopLogging() +{ +} + namespace QTest { diff --git a/src/testlib/qabstracttestlogger_p.h b/src/testlib/qabstracttestlogger_p.h index 3ac6787754..3e11863012 100644 --- a/src/testlib/qabstracttestlogger_p.h +++ b/src/testlib/qabstracttestlogger_p.h @@ -80,10 +80,10 @@ public: Info }; - QAbstractTestLogger() : stream(0) {} - virtual ~QAbstractTestLogger() {} + QAbstractTestLogger(const char *filename); + virtual ~QAbstractTestLogger(); - virtual void startLogging(const char *filename); + virtual void startLogging(); virtual void stopLogging(); virtual void enterTestFunction(const char *function) = 0; @@ -98,7 +98,7 @@ public: void outputString(const char *msg); -private: +protected: FILE *stream; }; diff --git a/src/testlib/qbenchmark.cpp b/src/testlib/qbenchmark.cpp index 1cb10a7ac6..49fad5da4d 100644 --- a/src/testlib/qbenchmark.cpp +++ b/src/testlib/qbenchmark.cpp @@ -119,7 +119,6 @@ QBenchmarkTestMethodData *QBenchmarkTestMethodData::current; QBenchmarkTestMethodData::QBenchmarkTestMethodData() :resultAccepted(false), runOnce(false), iterationCount(-1) { - } QBenchmarkTestMethodData::~QBenchmarkTestMethodData() @@ -134,7 +133,6 @@ void QBenchmarkTestMethodData::beginDataRun() void QBenchmarkTestMethodData::endDataRun() { - } int QBenchmarkTestMethodData::adjustIterationCount(int suggestion) @@ -164,7 +162,7 @@ void QBenchmarkTestMethodData::setResult( accepted = true; } - // Test the result directly without calling the measurer if the minimum time + // Test the result directly without calling the measurer if the minimum time // has been specified on the command line with -minimumvalue. else if (QBenchmarkGlobalData::current->walltimeMinimum != -1) accepted = (value > QBenchmarkGlobalData::current->walltimeMinimum); @@ -196,7 +194,7 @@ QTest::QBenchmarkIterationController::QBenchmarkIterationController(RunMode runM { i = 0; if (runMode == RunOnce) - QBenchmarkTestMethodData::current->runOnce = true; + QBenchmarkTestMethodData::current->runOnce = true; QTest::beginBenchmarkMeasurement(); } @@ -265,16 +263,16 @@ void QTest::beginBenchmarkMeasurement() quint64 QTest::endBenchmarkMeasurement() { // the clock is ticking before the line below, don't add code here. - return QBenchmarkGlobalData::current->measurer->stop(); + return QBenchmarkGlobalData::current->measurer->stop(); } /*! Sets the benchmark result for this test function to \a result. - + Use this function if you want to report benchmark results without using the QBENCHMARK macro. Use \a metric to specify how QTestLib should interpret the results. - + The context for the result will be the test function name and any data tag from the _data function. This function can only be called once in each test function, subsequent calls will replace the diff --git a/src/testlib/qbenchmark_p.h b/src/testlib/qbenchmark_p.h index e5e07c0035..36e4b35493 100644 --- a/src/testlib/qbenchmark_p.h +++ b/src/testlib/qbenchmark_p.h @@ -58,7 +58,7 @@ #include <QtCore/qglobal.h> #if (defined(Q_OS_LINUX) || defined Q_OS_MAC) && !defined(QT_NO_PROCESS) -#define QTESTLIB_USE_VALGRIND +#define QTESTLIB_USE_VALGRIND #else #undef QTESTLIB_USE_VALGRIND #endif @@ -119,7 +119,7 @@ public: , valid(true) { } - bool operator<(const QBenchmarkResult &other) const + bool operator<(const QBenchmarkResult &other) const { return (value / iterations) < (other.value / other.iterations); } diff --git a/src/testlib/qbenchmarkevent_p.h b/src/testlib/qbenchmarkevent_p.h index fc0729e82f..2cf17ea6a2 100644 --- a/src/testlib/qbenchmarkevent_p.h +++ b/src/testlib/qbenchmarkevent_p.h @@ -69,12 +69,12 @@ public: bool isMeasurementAccepted(qint64 measurement); int adjustIterationCount(int suggestion); int adjustMedianCount(int suggestion); - bool repeatCount() { return 1; } + bool repeatCount() { return 1; } QTest::QBenchmarkMetric metricType(); static bool eventCountingMechanism(void *message); static qint64 eventCounter; }; QT_END_NAMESPACE - + #endif // QBENCHMARKEVENT_H diff --git a/src/testlib/qbenchmarkmeasurement.cpp b/src/testlib/qbenchmarkmeasurement.cpp index 4aad71da34..2c14f5d3fe 100644 --- a/src/testlib/qbenchmarkmeasurement.cpp +++ b/src/testlib/qbenchmarkmeasurement.cpp @@ -60,7 +60,7 @@ qint64 QBenchmarkTimeMeasurer::checkpoint() } qint64 QBenchmarkTimeMeasurer::stop() -{ +{ return time.elapsed(); } @@ -70,8 +70,8 @@ bool QBenchmarkTimeMeasurer::isMeasurementAccepted(qint64 measurement) } int QBenchmarkTimeMeasurer::adjustIterationCount(int suggestion) -{ - return suggestion; +{ + return suggestion; } bool QBenchmarkTimeMeasurer::needsWarmupIteration() @@ -80,8 +80,8 @@ bool QBenchmarkTimeMeasurer::needsWarmupIteration() } int QBenchmarkTimeMeasurer::adjustMedianCount(int) -{ - return 1; +{ + return 1; } QTest::QBenchmarkMetric QBenchmarkTimeMeasurer::metricType() @@ -114,18 +114,18 @@ bool QBenchmarkTickMeasurer::isMeasurementAccepted(qint64) } int QBenchmarkTickMeasurer::adjustIterationCount(int) -{ - return 1; +{ + return 1; } int QBenchmarkTickMeasurer::adjustMedianCount(int) -{ - return 1; +{ + return 1; } bool QBenchmarkTickMeasurer::needsWarmupIteration() -{ - return true; +{ + return true; } QTest::QBenchmarkMetric QBenchmarkTickMeasurer::metricType() diff --git a/src/testlib/qbenchmarkmeasurement_p.h b/src/testlib/qbenchmarkmeasurement_p.h index 8242365f20..6d7d8c6c0d 100644 --- a/src/testlib/qbenchmarkmeasurement_p.h +++ b/src/testlib/qbenchmarkmeasurement_p.h @@ -72,8 +72,8 @@ public: virtual bool isMeasurementAccepted(qint64 measurement) = 0; virtual int adjustIterationCount(int suggestion) = 0; virtual int adjustMedianCount(int suggestion) = 0; - virtual bool repeatCount() { return 1; } - virtual bool needsWarmupIteration() { return false; } + virtual bool repeatCount() { return 1; } + virtual bool needsWarmupIteration() { return false; } virtual QTest::QBenchmarkMetric metricType() = 0; }; diff --git a/src/testlib/qbenchmarkmetric.cpp b/src/testlib/qbenchmarkmetric.cpp index d4efe84989..fb7f8f857a 100644 --- a/src/testlib/qbenchmarkmetric.cpp +++ b/src/testlib/qbenchmarkmetric.cpp @@ -46,7 +46,7 @@ \since 4.7 This enum lists all the things that can be benchmarked. - + \value FramesPerSecond Frames per second \value BitsPerSecond Bits per second \value BytesPerSecond Bytes per second diff --git a/src/testlib/qbenchmarkvalgrind.cpp b/src/testlib/qbenchmarkvalgrind.cpp index 4b260e8597..7e43d555e0 100644 --- a/src/testlib/qbenchmarkvalgrind.cpp +++ b/src/testlib/qbenchmarkvalgrind.cpp @@ -238,7 +238,7 @@ qint64 QBenchmarkCallgrindMeasurer::checkpoint() } qint64 QBenchmarkCallgrindMeasurer::stop() -{ +{ return checkpoint(); } @@ -249,17 +249,17 @@ bool QBenchmarkCallgrindMeasurer::isMeasurementAccepted(qint64 measurement) } int QBenchmarkCallgrindMeasurer::adjustIterationCount(int) -{ +{ return 1; } int QBenchmarkCallgrindMeasurer::adjustMedianCount(int) -{ +{ return 1; } bool QBenchmarkCallgrindMeasurer::needsWarmupIteration() -{ +{ return true; } diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp index bd1bc11582..14fa752c40 100644 --- a/src/testlib/qplaintestlogger.cpp +++ b/src/testlib/qplaintestlogger.cpp @@ -211,7 +211,7 @@ void QPlainTestLogger::outputMessage(const char *str) OutputDebugString((wchar_t*)tmp.utf16()); strUtf16.remove(0, maxOutputLength); } while (!strUtf16.isEmpty()); - if (QTestLog::outputFileName()) + if (stream != stdout) #elif defined(Q_OS_WIN) EnterCriticalSection(&QTest::outputCriticalSection); // OutputDebugString is not threadsafe @@ -344,7 +344,8 @@ void QPlainTestLogger::printBenchmarkResult(const QBenchmarkResult &result) outputMessage(buf); } -QPlainTestLogger::QPlainTestLogger() +QPlainTestLogger::QPlainTestLogger(const char *filename) + : QAbstractTestLogger(filename) { #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) InitializeCriticalSection(&QTest::outputCriticalSection); @@ -358,9 +359,9 @@ QPlainTestLogger::~QPlainTestLogger() #endif } -void QPlainTestLogger::startLogging(const char *filename) +void QPlainTestLogger::startLogging() { - QAbstractTestLogger::startLogging(filename); + QAbstractTestLogger::startLogging(); char buf[1024]; if (QTestLog::verboseLevel() < 0) { diff --git a/src/testlib/qplaintestlogger_p.h b/src/testlib/qplaintestlogger_p.h index baa1e24828..432e900320 100644 --- a/src/testlib/qplaintestlogger_p.h +++ b/src/testlib/qplaintestlogger_p.h @@ -60,10 +60,10 @@ QT_BEGIN_NAMESPACE class QPlainTestLogger : public QAbstractTestLogger { public: - QPlainTestLogger(); + QPlainTestLogger(const char *filename); ~QPlainTestLogger(); - void startLogging(const char *filename); + void startLogging(); void stopLogging(); void enterTestFunction(const char *function); diff --git a/src/testlib/qtestassert.h b/src/testlib/qtestassert.h index fa1ee0caec..24edab278d 100644 --- a/src/testlib/qtestassert.h +++ b/src/testlib/qtestassert.h @@ -50,9 +50,9 @@ QT_BEGIN_NAMESPACE QT_MODULE(Test) -#define QTEST_ASSERT(cond) do {if(!(cond))qt_assert(#cond,__FILE__,__LINE__);} while (0) +#define QTEST_ASSERT(cond) do { if (!(cond)) qt_assert(#cond,__FILE__,__LINE__); } while (0) -#define QTEST_ASSERT_X(cond, where, what) do {if(!(cond))qt_assert_x(where, what,__FILE__,__LINE__);} while (0) +#define QTEST_ASSERT_X(cond, where, what) do { if (!(cond)) qt_assert_x(where, what,__FILE__,__LINE__); } while (0) QT_END_NAMESPACE diff --git a/src/testlib/qtestbasicstreamer.cpp b/src/testlib/qtestbasicstreamer.cpp deleted file mode 100644 index d371b4d08e..0000000000 --- a/src/testlib/qtestbasicstreamer.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtTest module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestbasicstreamer.h" -#include "qtestlogger_p.h" -#include "qtestelement.h" -#include "qtestelementattribute.h" -#include "qtestassert.h" - -#include <stdio.h> -#include <stdlib.h> - -#ifndef Q_OS_WIN -#include <unistd.h> -#endif - -QT_BEGIN_NAMESPACE - -QTestBasicStreamer::QTestBasicStreamer(QTestLogger *logger) - :testLogger(logger) -{ - QTEST_ASSERT(testLogger); -} - -QTestBasicStreamer::~QTestBasicStreamer() -{} - -void QTestBasicStreamer::formatStart(const QTestElement *element, QTestCharBuffer *formatted) const -{ - if(!element || !formatted ) - return; - formatted->data()[0] = '\0'; -} - -void QTestBasicStreamer::formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const -{ - if(!element || !formatted ) - return; - formatted->data()[0] = '\0'; -} - -void QTestBasicStreamer::formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const -{ - if(!element || !formatted ) - return; - formatted->data()[0] = '\0'; -} - -void QTestBasicStreamer::formatAfterAttributes(const QTestElement *element, QTestCharBuffer *formatted) const -{ - if(!element || !formatted ) - return; - formatted->data()[0] = '\0'; -} - -void QTestBasicStreamer::formatAttributes(const QTestElement *, const QTestElementAttribute *attribute, QTestCharBuffer *formatted) const -{ - if(!attribute || !formatted ) - return; - formatted->data()[0] = '\0'; -} - -void QTestBasicStreamer::output(QTestElement *element) const -{ - if(!element) - return; - - outputElements(element); -} - -void QTestBasicStreamer::outputElements(QTestElement *element, bool) const -{ - QTestCharBuffer buf; - bool hasChildren; - /* - Elements are in reverse order of occurrence, so start from the end and work - our way backwards. - */ - while (element && element->nextElement()) { - element = element->nextElement(); - } - while (element) { - hasChildren = element->childElements(); - - formatStart(element, &buf); - outputString(buf.data()); - - formatBeforeAttributes(element, &buf); - outputString(buf.data()); - - outputElementAttributes(element, element->attributes()); - - formatAfterAttributes(element, &buf); - outputString(buf.data()); - - if(hasChildren) - outputElements(element->childElements(), true); - - formatEnd(element, &buf); - outputString(buf.data()); - - element = element->previousElement(); - } -} - -void QTestBasicStreamer::outputElementAttributes(const QTestElement* element, QTestElementAttribute *attribute) const -{ - QTestCharBuffer buf; - while(attribute){ - formatAttributes(element, attribute, &buf); - outputString(buf.data()); - attribute = attribute->nextElement(); - } -} - -void QTestBasicStreamer::outputString(const char *msg) const -{ - testLogger->outputString(msg); -} - -QTestLogger *QTestBasicStreamer::logger() const -{ - return testLogger; -} - -QT_END_NAMESPACE - diff --git a/src/testlib/qtestbasicstreamer.h b/src/testlib/qtestbasicstreamer.h deleted file mode 100644 index 04bc40638f..0000000000 --- a/src/testlib/qtestbasicstreamer.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtTest module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTBASICSTREAMER_H -#define QTESTBASICSTREAMER_H - -#include <QtCore/qglobal.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Test) - -class QTestElement; -class QTestElementAttribute; -class QTestLogger; -struct QTestCharBuffer; - -class QTestBasicStreamer -{ - public: - QTestBasicStreamer(QTestLogger *logger); - virtual ~QTestBasicStreamer(); - - virtual void output(QTestElement *element) const; - - void outputString(const char *msg) const; - - QTestLogger *logger() const; - - protected: - virtual void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const; - virtual void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const; - virtual void formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const; - virtual void formatAfterAttributes(const QTestElement *element, QTestCharBuffer *formatted) const; - virtual void formatAttributes(const QTestElement *element, const QTestElementAttribute *attribute, QTestCharBuffer *formatted) const; - virtual void outputElements(QTestElement *element, bool isChildElement = false) const; - virtual void outputElementAttributes(const QTestElement *element, QTestElementAttribute *attribute) const; - - private: - QTestLogger *testLogger; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 3802794281..9bb591989d 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1000,40 +1000,44 @@ static int qToInt(char *str) Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) { + QTestLog::LogMode logFormat = QTestLog::Plain; + const char *logFilename = 0; + const char *testOptions = - " options:\n" - " -functions : Returns a list of current testfunctions\n" - " -xunitxml : Outputs results as XML XUnit document\n" - " -xml : Outputs results as XML document\n" - " -lightxml : Outputs results as stream of XML tags\n" - " -flush : Flushes the results\n" - " -o filename: Writes all output into a file\n" - " -silent : Only outputs warnings and failures\n" - " -v1 : Print enter messages for each testfunction\n" - " -v2 : Also print out each QVERIFY/QCOMPARE/QTEST\n" - " -vs : Print every signal emitted\n" - " -eventdelay ms : Set default delay for mouse and keyboard simulation to ms milliseconds\n" - " -keydelay ms : Set default delay for keyboard simulation to ms milliseconds\n" - " -mousedelay ms : Set default delay for mouse simulation to ms milliseconds\n" - " -keyevent-verbose : Turn on verbose messages for keyboard simulation\n" - " -maxwarnings n : Sets the maximum amount of messages to output.\n" - " 0 means unlimited, default: 2000\n" + " Output options:\n" + " -xunitxml : Outputs results as XML XUnit document\n" + " -xml : Outputs results as XML document\n" + " -lightxml : Outputs results as stream of XML tags\n" + " -o filename : Writes all output into a file\n" + " -silent : Only outputs warnings and failures\n" + " -v1 : Print enter messages for each testfunction\n" + " -v2 : Also print out each QVERIFY/QCOMPARE/QTEST\n" + " -vs : Print every signal emitted\n" + "\n" + " Testing options:\n" + " -functions : Returns a list of current testfunctions\n" + " -eventdelay ms : Set default delay for mouse and keyboard simulation to ms milliseconds\n" + " -keydelay ms : Set default delay for keyboard simulation to ms milliseconds\n" + " -mousedelay ms : Set default delay for mouse simulation to ms milliseconds\n" + " -keyevent-verbose : Turn on verbose messages for keyboard simulation\n" + " -maxwarnings n : Sets the maximum amount of messages to output.\n" + " 0 means unlimited, default: 2000\n" #if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) - " -nocrashhandler : Disables the crash handler\n" + " -nocrashhandler : Disables the crash handler\n" #endif "\n" - " Benchmark related options:\n" + " Benchmarking options:\n" #ifdef QTESTLIB_USE_VALGRIND - " -callgrind : Use callgrind to time benchmarks\n" + " -callgrind : Use callgrind to time benchmarks\n" #endif #ifdef HAVE_TICK_COUNTER - " -tickcounter : Use CPU tick counters to time benchmarks\n" + " -tickcounter : Use CPU tick counters to time benchmarks\n" #endif - " -eventcounter : Counts events received during benchmarks\n" - " -minimumvalue n : Sets the minimum acceptable measurement value\n" - " -iterations n : Sets the number of accumulation iterations.\n" - " -median n : Sets the number of median iterations.\n" - " -vb : Print out verbose benchmarking information.\n"; + " -eventcounter : Counts events received during benchmarks\n" + " -minimumvalue n : Sets the minimum acceptable measurement value\n" + " -iterations n : Sets the number of accumulation iterations.\n" + " -median n : Sets the number of median iterations.\n" + " -vb : Print out verbose benchmarking information.\n"; for (int i = 1; i < argc; ++i) { if (strcmp(argv[i], "-help") == 0 || strcmp(argv[i], "--help") == 0 @@ -1043,15 +1047,16 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) "%s", argv[0], testOptions); if (qml) { - printf ("\nqmltest related options:\n" - " -import : Specify an import directory.\n" - " -input : Specify the root directory for test cases.\n" - " -qtquick1 : Run with QtQuick 1 rather than QtQuick 2.\n" + printf ("\n" + " QmlTest options:\n" + " -import : Specify an import directory.\n" + " -input : Specify the root directory for test cases.\n" + " -qtquick1 : Run with QtQuick 1 rather than QtQuick 2.\n" ); } printf("\n" - " -help : This help\n"); + " -help : This help\n"); exit(0); } else if (strcmp(argv[i], "-functions") == 0) { if (qml) { @@ -1060,14 +1065,12 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) qPrintTestSlots(stdout); exit(0); } - } else if(strcmp(argv[i], "-xunitxml") == 0){ - QTestLog::setLogMode(QTestLog::XunitXML); + } else if (strcmp(argv[i], "-xunitxml") == 0) { + logFormat = QTestLog::XunitXML; } else if (strcmp(argv[i], "-xml") == 0) { - QTestLog::setLogMode(QTestLog::XML); + logFormat = QTestLog::XML; } else if (strcmp(argv[i], "-lightxml") == 0) { - QTestLog::setLogMode(QTestLog::LightXML); - } else if (strcmp(argv[i], "-flush") == 0){ - QTestLog::setFlushMode(QTestLog::FlushOn); + logFormat = QTestLog::LightXML; } else if (strcmp(argv[i], "-silent") == 0) { QTestLog::setVerboseLevel(-1); } else if (strcmp(argv[i], "-v1") == 0) { @@ -1081,7 +1084,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) fprintf(stderr, "-o needs an extra parameter specifying the filename\n"); exit(1); } else { - QTestLog::redirectOutput(argv[++i]); + logFilename = argv[++i]; } } else if (strcmp(argv[i], "-eventdelay") == 0) { if (i + 1 >= argc) { @@ -1192,7 +1195,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) // we load the QML files. So just store the data for now. int colon = -1; int offset; - for(offset = 0; *(argv[i]+offset); ++offset) { + for (offset = 0; *(argv[i]+offset); ++offset) { if (*(argv[i]+offset) == ':') { if (*(argv[i]+offset+1) == ':') { // "::" is used as a test name separator. @@ -1221,13 +1224,13 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) int colon = -1; char buf[512], *data=0; int off; - for(off = 0; *(argv[i]+off); ++off) { + for (off = 0; *(argv[i]+off); ++off) { if (*(argv[i]+off) == ':') { colon = off; break; } } - if(colon != -1) { + if (colon != -1) { data = qstrdup(argv[i]+colon+1); } QTest::qt_snprintf(buf, qMin(512, off + 1), "%s", argv[i]); // copy text before the ':' into buf @@ -1244,6 +1247,9 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) QTEST_ASSERT(QTest::testFuncCount < 512); } } + + // Create the logger + QTestLog::initLogger(logFormat, logFilename); } QBenchmarkResult qMedian(const QList<QBenchmarkResult> &container) @@ -1428,7 +1434,7 @@ static bool qInvokeTestMethod(const char *slotName, const char *data=0) if (data && !foundFunction) { fprintf(stderr, "Unknown testdata for function %s: '%s'\n", slotName, data); fprintf(stderr, "Available testdata:\n"); - for(int i = 0; i < table.dataCount(); ++i) + for (int i = 0; i < table.dataCount(); ++i) fprintf(stderr, "%s\n", table.testData(i)->dataTag()); return false; } @@ -1479,7 +1485,7 @@ void *fetchData(QTestData *data, const char *tagName, int typeId) */ char *toHexRepresentation(const char *ba, int length) { - if(length == 0) + if (length == 0) return qstrdup(""); /* We output at maximum about maxLen characters in order to avoid @@ -1493,7 +1499,7 @@ char *toHexRepresentation(const char *ba, int length) const int len = qMin(maxLen, length); char *result = 0; - if(length > maxLen) { + if (length > maxLen) { const int size = len * 3 + 4; result = new char[size]; @@ -1514,7 +1520,7 @@ char *toHexRepresentation(const char *ba, int length) int i = 0; int o = 0; - while(true) { + while (true) { const char at = ba[i]; result[o] = toHex[(at >> 4) & 0x0F]; @@ -1523,7 +1529,7 @@ char *toHexRepresentation(const char *ba, int length) ++i; ++o; - if(i == len) + if (i == len) break; else { result[o] = ' '; @@ -1552,7 +1558,7 @@ static void qInvokeTestMethods(QObject *testObject) const bool previousFailed = QTestResult::testFailed(); QTestResult::finishedCurrentTestFunction(); - if(!QTestResult::skipCurrentTest() && !previousFailed) { + if (!QTestResult::skipCurrentTest() && !previousFailed) { if (QTest::testFuncs) { for (int i = 0; i != QTest::testFuncCount; i++) { @@ -1725,18 +1731,18 @@ int QTest::qExec(QObject *testObject, int argc, char **argv) #endif #ifdef Q_WS_MAC - bool macNeedsActivate = qApp && (qstrcmp(qApp->metaObject()->className(), "QApplication") == 0); + bool macNeedsActivate = qApp && (qstrcmp(qApp->metaObject()->className(), "QApplication") == 0); #ifdef QT_MAC_USE_COCOA - IOPMAssertionID powerID; + IOPMAssertionID powerID; #endif #endif #ifndef QT_NO_EXCEPTIONS try { #endif - #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) - SetErrorMode(SetErrorMode(0) | SEM_NOGPFAULTERRORBOX); - #endif +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + SetErrorMode(SetErrorMode(0) | SEM_NOGPFAULTERRORBOX); +#endif #ifdef Q_WS_MAC // Starting with Qt 4.4, applications launched from the command line @@ -1745,13 +1751,13 @@ int QTest::qExec(QObject *testObject, int argc, char **argv) if (macNeedsActivate) { ProcessSerialNumber psn = { 0, kCurrentProcess }; SetFrontProcess(&psn); -# ifdef QT_MAC_USE_COCOA +#ifdef QT_MAC_USE_COCOA IOReturn ok = IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, &powerID); if (ok != kIOReturnSuccess) macNeedsActivate = false; // no need to release the assertion on exit. -# else +#else UpdateSystemActivity(1); // Wake the display. -# endif +#endif } #endif @@ -1813,7 +1819,7 @@ int QTest::qExec(QObject *testObject, int argc, char **argv) throw; return 1; } -# endif +#endif currentTestObject = 0; #ifdef QT_MAC_USE_COCOA @@ -1846,7 +1852,7 @@ int QTest::qExec(QObject *testObject, const QStringList &arguments) QVector<QByteArray> args; args.reserve(argc); - for(int i = 0; i < argc; ++i) + for (int i = 0; i < argc; ++i) { args.append(arguments.at(i).toLocal8Bit().constData()); argv[i] = args.last().data(); diff --git a/src/testlib/qtestcoreelement.h b/src/testlib/qtestcoreelement.h index ecd088ad12..1d06c8d8cd 100644 --- a/src/testlib/qtestcoreelement.h +++ b/src/testlib/qtestcoreelement.h @@ -87,10 +87,7 @@ QTestCoreElement<ElementType>::~QTestCoreElement() template <class ElementType> void QTestCoreElement<ElementType>::addAttribute(const QTest::AttributeIndex attributeIndex, const char *value) { - if(attributeIndex == -1) - return; - - if (attribute(attributeIndex)) + if (attributeIndex == -1 || attribute(attributeIndex)) return; QTestElementAttribute *testAttribute = new QTestElementAttribute; @@ -108,7 +105,7 @@ template <class ElementType> const char *QTestCoreElement<ElementType>::attributeValue(QTest::AttributeIndex index) const { const QTestElementAttribute *attrb = attribute(index); - if(attrb) + if (attrb) return attrb->value(); return 0; @@ -118,7 +115,7 @@ template <class ElementType> const char *QTestCoreElement<ElementType>::attributeName(QTest::AttributeIndex index) const { const QTestElementAttribute *attrb = attribute(index); - if(attrb) + if (attrb) return attrb->name(); return 0; @@ -139,7 +136,7 @@ const char *QTestCoreElement<ElementType>::elementName() const "system-err" }; - if(type != QTest::LET_Undefined) + if (type != QTest::LET_Undefined) return xmlElementNames[type]; return 0; @@ -155,8 +152,8 @@ template <class ElementType> const QTestElementAttribute *QTestCoreElement<ElementType>::attribute(QTest::AttributeIndex index) const { QTestElementAttribute *iterator = listOfAttributes; - while(iterator){ - if(iterator->index() == index) + while (iterator) { + if (iterator->index() == index) return iterator; iterator = iterator->nextElement(); diff --git a/src/testlib/qtestcorelist.h b/src/testlib/qtestcorelist.h index 0790ea5c39..5027e4fcf9 100644 --- a/src/testlib/qtestcorelist.h +++ b/src/testlib/qtestcorelist.h @@ -70,8 +70,8 @@ class QTestCoreList template <class T> QTestCoreList<T>::QTestCoreList() -:next(0) -,prev(0) + : next(0) + , prev(0) { } @@ -121,7 +121,7 @@ int QTestCoreList<T>::count() int numOfElements = 0; T *it = next; - while(it){ + while (it) { ++numOfElements; it = it->nextElement(); } diff --git a/src/testlib/qtestdata.cpp b/src/testlib/qtestdata.cpp index d32a591eff..6797abf1d0 100644 --- a/src/testlib/qtestdata.cpp +++ b/src/testlib/qtestdata.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE class QTestDataPrivate { public: - QTestDataPrivate(): tag(0), parent(0), data(0), dataCount(0) {} + QTestDataPrivate() : tag(0), parent(0), data(0), dataCount(0) {} char *tag; QTestTable *parent; diff --git a/src/testlib/qtestelement.cpp b/src/testlib/qtestelement.cpp index 3dc5ba60a8..a3c002f964 100644 --- a/src/testlib/qtestelement.cpp +++ b/src/testlib/qtestelement.cpp @@ -44,9 +44,9 @@ QT_BEGIN_NAMESPACE QTestElement::QTestElement(int type) - :QTestCoreElement<QTestElement>(type), - listOfChildren(0), - parent(0) + : QTestCoreElement<QTestElement>(type) + , listOfChildren(0) + , parent(0) { } @@ -57,10 +57,10 @@ QTestElement::~QTestElement() bool QTestElement::addLogElement(QTestElement *element) { - if(!element) + if (!element) return false; - if(element->elementType() != QTest::LET_Undefined){ + if (element->elementType() != QTest::LET_Undefined) { element->addToList(&listOfChildren); element->setParent(this); return true; diff --git a/src/testlib/qtestelementattribute.cpp b/src/testlib/qtestelementattribute.cpp index dcd518ca2a..9799ade577 100644 --- a/src/testlib/qtestelementattribute.cpp +++ b/src/testlib/qtestelementattribute.cpp @@ -50,37 +50,37 @@ QT_BEGIN_NAMESPACE This enum numbers the different tests. \value AI_Undefined - + \value AI_Name - + \value AI_Result - + \value AI_Tests - + \value AI_Failures - + \value AI_Errors - + \value AI_Type - + \value AI_Description - + \value AI_PropertyValue - + \value AI_QTestVersion - + \value AI_QtVersion - + \value AI_File - + \value AI_Line - + \value AI_Metric - + \value AI_Tag - + \value AI_Value - + \value AI_Iterations */ @@ -144,7 +144,7 @@ const char *QTestElementAttribute::name() const "iterations" }; - if(attributeIndex != QTest::AI_Undefined) + if (attributeIndex != QTest::AI_Undefined) return AttributeNames[attributeIndex]; return 0; @@ -162,7 +162,7 @@ bool QTestElementAttribute::isNull() const bool QTestElementAttribute::setPair(QTest::AttributeIndex index, const char *value) { - if(!value) + if (!value) return false; delete[] attributeValue; diff --git a/src/testlib/qtestkeyboard.h b/src/testlib/qtestkeyboard.h index be141642e8..9f8bf2536a 100644 --- a/src/testlib/qtestkeyboard.h +++ b/src/testlib/qtestkeyboard.h @@ -75,7 +75,7 @@ namespace QTest if (delay == -1 || delay < defaultKeyDelay()) delay = defaultKeyDelay(); - if(delay > 0) + if (delay > 0) QTest::qWait(delay); QKeyEvent a(press ? QEvent::KeyPress : QEvent::KeyRelease, code, modifier, text, repeat); diff --git a/src/testlib/qtestlightxmlstreamer.cpp b/src/testlib/qtestlightxmlstreamer.cpp deleted file mode 100644 index c0010cc522..0000000000 --- a/src/testlib/qtestlightxmlstreamer.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtTest module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlightxmlstreamer.h" -#include "qtestelement.h" -#include "qtestelementattribute.h" -#include "qtestlogger_p.h" - -#include "QtTest/private/qtestlog_p.h" -#include "QtTest/private/qtestresult_p.h" -#include "QtTest/private/qxmltestlogger_p.h" - -#include <string.h> - -QT_BEGIN_NAMESPACE - -QTestLightXmlStreamer::QTestLightXmlStreamer(QTestLogger *logger) - : QTestBasicStreamer(logger) -{ -} - -QTestLightXmlStreamer::~QTestLightXmlStreamer() -{} - -void QTestLightXmlStreamer::formatStart(const QTestElement *element, QTestCharBuffer *formatted) const -{ - if(!element || !formatted) - return; - - switch(element->elementType()){ - case QTest::LET_TestCase: { - QTestCharBuffer quotedTf; - QXmlTestLogger::xmlQuote("edTf, element->attributeValue(QTest::AI_Name)); - - QTest::qt_asprintf(formatted, "<TestFunction name=\"%s\">\n", quotedTf.constData()); - break; - } - case QTest::LET_Failure: { - QTestCharBuffer cdataDesc; - QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description)); - - QTest::qt_asprintf(formatted, " <Description><![CDATA[%s]]></Description>\n", - cdataDesc.constData()); - break; - } - case QTest::LET_Error: { - // assuming type and attribute names don't need quoting - QTestCharBuffer quotedFile; - QTestCharBuffer cdataDesc; - QXmlTestLogger::xmlQuote("edFile, element->attributeValue(QTest::AI_File)); - QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description)); - - QTest::qt_asprintf(formatted, "<Message type=\"%s\" %s=\"%s\" %s=\"%s\">\n <Description><![CDATA[%s]]></Description>\n</Message>\n", - element->attributeValue(QTest::AI_Type), - element->attributeName(QTest::AI_File), - quotedFile.constData(), - element->attributeName(QTest::AI_Line), - element->attributeValue(QTest::AI_Line), - cdataDesc.constData()); - break; - } - case QTest::LET_Benchmark: { - // assuming value and iterations don't need quoting - QTestCharBuffer quotedMetric; - QTestCharBuffer quotedTag; - QXmlTestLogger::xmlQuote("edMetric, element->attributeValue(QTest::AI_Metric)); - QXmlTestLogger::xmlQuote("edTag, element->attributeValue(QTest::AI_Tag)); - - QTest::qt_asprintf(formatted, "<BenchmarkResult %s=\"%s\" %s=\"%s\" %s=\"%s\" %s=\"%s\" />\n", - element->attributeName(QTest::AI_Metric), - quotedMetric.constData(), - element->attributeName(QTest::AI_Tag), - quotedTag.constData(), - element->attributeName(QTest::AI_Value), - element->attributeValue(QTest::AI_Value), - element->attributeName(QTest::AI_Iterations), - element->attributeValue(QTest::AI_Iterations) ); - break; - } - default: - formatted->data()[0] = '\0'; - } -} - -void QTestLightXmlStreamer::formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const -{ - if(!element || !formatted) - return; - - if (element->elementType() == QTest::LET_TestCase) { - if( element->attribute(QTest::AI_Result) && element->childElements()) - QTest::qt_asprintf(formatted, "</Incident>\n</TestFunction>\n"); - else - QTest::qt_asprintf(formatted, "</TestFunction>\n"); - } else { - formatted->data()[0] = '\0'; - } -} - -void QTestLightXmlStreamer::formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const -{ - if(!element || !formatted) - return; - - if (element->elementType() == QTest::LET_TestCase && element->attribute(QTest::AI_Result)) { - QTestCharBuffer buf; - QTestCharBuffer quotedFile; - QXmlTestLogger::xmlQuote("edFile, element->attributeValue(QTest::AI_File)); - - QTest::qt_asprintf(&buf, "%s=\"%s\" %s=\"%s\"", - element->attributeName(QTest::AI_File), - quotedFile.constData(), - element->attributeName(QTest::AI_Line), - element->attributeValue(QTest::AI_Line)); - - if( !element->childElements() ) - QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s/>\n", - element->attributeValue(QTest::AI_Result), buf.constData()); - else - QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s>\n", - element->attributeValue(QTest::AI_Result), buf.constData()); - } else { - formatted->data()[0] = '\0'; - } -} - -void QTestLightXmlStreamer::output(QTestElement *element) const -{ - QTestCharBuffer buf; - QTest::qt_asprintf(&buf, "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n", - qVersion(), QTEST_VERSION_STR ); - outputString(buf.constData()); - - QTest::qt_asprintf(&buf, "</Environment>\n"); - outputString(buf.constData()); - - QTestBasicStreamer::output(element); -} - -QT_END_NAMESPACE - diff --git a/src/testlib/qtestlightxmlstreamer.h b/src/testlib/qtestlightxmlstreamer.h deleted file mode 100644 index b3076c1623..0000000000 --- a/src/testlib/qtestlightxmlstreamer.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtTest module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLIGHTXMLSTREAMER_H -#define QTESTLIGHTXMLSTREAMER_H - -#include <QtTest/qtestbasicstreamer.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Test) - -class QTestElement; -class QTestElementAttribute; - -class QTestLightXmlStreamer: public QTestBasicStreamer -{ - public: - QTestLightXmlStreamer(QTestLogger *logger); - ~QTestLightXmlStreamer(); - - void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const; - void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const; - void formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const; - void output(QTestElement *element) const; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 0a87a4ce14..d53b00ca7f 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -45,7 +45,7 @@ #include "QtTest/private/qtestresult_p.h" #include "QtTest/private/qabstracttestlogger_p.h" #include "QtTest/private/qplaintestlogger_p.h" -#include "QtTest/private/qtestlogger_p.h" +#include "QtTest/private/qxunittestlogger_p.h" #include "QtTest/private/qxmltestlogger_p.h" #include <QtCore/qatomic.h> #include <QtCore/qbytearray.h> @@ -83,12 +83,10 @@ namespace QTest { static IgnoreResultList *ignoreResultList = 0; static QTestLog::LogMode logMode = QTestLog::Plain; - static QTestLog::FlushMode flushMode = QTestLog::NoFlush; static int verbosity = 0; static int maxWarnings = 2002; static QAbstractTestLogger *testLogger = 0; - static const char *outFile = 0; static QtMsgHandler oldMessageHandler; @@ -165,30 +163,6 @@ namespace QTest { break; } } - - void initLogger() - { - switch (QTest::logMode) { - case QTestLog::Plain: - QTest::testLogger = new QPlainTestLogger; - break; - case QTestLog::XML: - if (QTest::flushMode == QTestLog::FlushOn) - QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Complete); - else - QTest::testLogger = new QTestLogger(QTestLogger::TLF_XML); - break; - case QTestLog::LightXML: - if (QTest::flushMode == QTestLog::FlushOn) - QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Light); - else - QTest::testLogger = new QTestLogger(QTestLogger::TLF_LightXml); - break; - case QTestLog::XunitXML: - QTest::testLogger = new QTestLogger(QTestLogger::TLF_XunitXml); - } - } - } void QTestLog::enterTestFunction(const char* function) @@ -283,9 +257,8 @@ void QTestLog::addBenchmarkResult(const QBenchmarkResult &result) void QTestLog::startLogging() { - QTEST_ASSERT(!QTest::testLogger); - QTest::initLogger(); - QTest::testLogger->startLogging(QTest::outFile); + QTEST_ASSERT(QTest::testLogger); + QTest::testLogger->startLogging(); QTest::oldMessageHandler = qInstallMsgHandler(QTest::messageHandler); } @@ -299,6 +272,27 @@ void QTestLog::stopLogging() QTest::testLogger = 0; } +void QTestLog::initLogger(LogMode mode, const char *filename) +{ + QTest::logMode = mode; + + switch (mode) { + case QTestLog::Plain: + QTest::testLogger = new QPlainTestLogger(filename); + break; + case QTestLog::XML: + QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Complete, filename); + break; + case QTestLog::LightXML: + QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Light, filename); + break; + case QTestLog::XunitXML: + QTest::testLogger = new QXunitTestLogger(filename); + break; + } + QTEST_ASSERT(QTest::testLogger); +} + void QTestLog::warn(const char *msg) { QTEST_ASSERT(QTest::testLogger); @@ -315,11 +309,6 @@ void QTestLog::info(const char *msg, const char *file, int line) QTest::testLogger->addMessage(QAbstractTestLogger::Info, msg, file, line); } -void QTestLog::setLogMode(LogMode mode) -{ - QTest::logMode = mode; -} - QTestLog::LogMode QTestLog::logMode() { return QTest::logMode; @@ -351,26 +340,9 @@ void QTestLog::addIgnoreMessage(QtMsgType type, const char *msg) list->next = item; } -void QTestLog::redirectOutput(const char *fileName) -{ - QTEST_ASSERT(fileName); - - QTest::outFile = fileName; -} - -const char *QTestLog::outputFileName() -{ - return QTest::outFile; -} - void QTestLog::setMaxWarnings(int m) { QTest::maxWarnings = m <= 0 ? INT_MAX : m + 2; } -void QTestLog::setFlushMode(FlushMode mode) -{ - QTest::flushMode = mode; -} - QT_END_NAMESPACE diff --git a/src/testlib/qtestlog_p.h b/src/testlib/qtestlog_p.h index 9b580eb8cc..f06382978f 100644 --- a/src/testlib/qtestlog_p.h +++ b/src/testlib/qtestlog_p.h @@ -63,7 +63,6 @@ class Q_TESTLIB_EXPORT QTestLog { public: enum LogMode { Plain = 0, XML, LightXML, XunitXML }; - enum FlushMode { NoFlush = 0, FlushOn }; static void enterTestFunction(const char* function); static void leaveTestFunction(); @@ -84,18 +83,15 @@ public: static void startLogging(); static void stopLogging(); - static void setLogMode(LogMode mode); + static void initLogger(LogMode mode, const char *filename); + static LogMode logMode(); static void setVerboseLevel(int level); static int verboseLevel(); - static void redirectOutput(const char *fileName); - static const char *outputFileName(); - static void setMaxWarnings(int max); - static void setFlushMode(FlushMode mode); private: QTestLog(); ~QTestLog(); diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h index c8fe0b4849..1bdb0241c0 100644 --- a/src/testlib/qtestmouse.h +++ b/src/testlib/qtestmouse.h @@ -76,7 +76,7 @@ namespace QTest if (delay == -1 || delay < defaultMouseDelay()) delay = defaultMouseDelay(); - if(delay > 0) + if (delay > 0) QTest::qWait(delay); if (pos.isNull()) diff --git a/src/testlib/qtestxmlstreamer.cpp b/src/testlib/qtestxmlstreamer.cpp deleted file mode 100644 index 47c4463b5a..0000000000 --- a/src/testlib/qtestxmlstreamer.cpp +++ /dev/null @@ -1,222 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtTest module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestxmlstreamer.h" -#include "qtestelement.h" -#include "qtestelementattribute.h" -#include "qtestlogger_p.h" - -#include "QtTest/private/qtestlog_p.h" -#include "QtTest/private/qtestresult_p.h" -#include "QtTest/private/qxmltestlogger_p.h" - -#include <string.h> -#include <stdio.h> - -QT_BEGIN_NAMESPACE - -QTestXmlStreamer::QTestXmlStreamer(QTestLogger *logger) - : QTestBasicStreamer(logger) -{ -} - -QTestXmlStreamer::~QTestXmlStreamer() -{} - -void QTestXmlStreamer::formatStart(const QTestElement *element, QTestCharBuffer *formatted) const -{ - if(!element || !formatted) - return; - - switch(element->elementType()){ - case QTest::LET_TestCase: { - QTestCharBuffer quotedTf; - QXmlTestLogger::xmlQuote("edTf, element->attributeValue(QTest::AI_Name)); - - QTest::qt_asprintf(formatted, "<TestFunction name=\"%s\">\n", quotedTf.constData()); - break; - } - case QTest::LET_Failure: { - QTestCharBuffer cdataDesc; - QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description)); - - QTestCharBuffer location; - QTestCharBuffer quotedFile; - QXmlTestLogger::xmlQuote("edFile, element->attributeValue(QTest::AI_File)); - - QTest::qt_asprintf(&location, "%s=\"%s\" %s=\"%s\"", - element->attributeName(QTest::AI_File), - quotedFile.constData(), - element->attributeName(QTest::AI_Line), - element->attributeValue(QTest::AI_Line)); - - if (element->attribute(QTest::AI_Tag)) { - QTestCharBuffer cdataTag; - QXmlTestLogger::xmlCdata(&cdataTag, element->attributeValue(QTest::AI_Tag)); - QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s>\n" - " <DataTag><![CDATA[%s]]></DataTag>\n" - " <Description><![CDATA[%s]]></Description>\n" - "</Incident>\n", element->attributeValue(QTest::AI_Result), - location.constData(), cdataTag.constData(), cdataDesc.constData()); - } - else { - QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s>\n" - " <Description><![CDATA[%s]]></Description>\n" - "</Incident>\n", element->attributeValue(QTest::AI_Result), - location.constData(), cdataDesc.constData()); - } - break; - } - case QTest::LET_Error: { - // assuming type and attribute names don't need quoting - QTestCharBuffer quotedFile; - QTestCharBuffer cdataDesc; - QXmlTestLogger::xmlQuote("edFile, element->attributeValue(QTest::AI_File)); - QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description)); - - QTestCharBuffer tagbuf; - if (element->attribute(QTest::AI_Tag)) { - QTestCharBuffer cdataTag; - QXmlTestLogger::xmlCdata(&cdataTag, element->attributeValue(QTest::AI_Tag)); - QTest::qt_asprintf(&tagbuf, " <DataTag><![CDATA[%s]]></DataTag>\n", cdataTag.constData()); - } - - QTest::qt_asprintf(formatted, "<Message type=\"%s\" %s=\"%s\" %s=\"%s\">\n%s <Description><![CDATA[%s]]></Description>\n</Message>\n", - element->attributeValue(QTest::AI_Type), - element->attributeName(QTest::AI_File), - quotedFile.constData(), - element->attributeName(QTest::AI_Line), - element->attributeValue(QTest::AI_Line), - tagbuf.constData(), - cdataDesc.constData()); - break; - } - case QTest::LET_Benchmark: { - // assuming value and iterations don't need quoting - QTestCharBuffer quotedMetric; - QTestCharBuffer quotedTag; - QXmlTestLogger::xmlQuote("edMetric, element->attributeValue(QTest::AI_Metric)); - QXmlTestLogger::xmlQuote("edTag, element->attributeValue(QTest::AI_Tag)); - - QTest::qt_asprintf(formatted, "<BenchmarkResult %s=\"%s\" %s=\"%s\" %s=\"%s\" %s=\"%s\" />\n", - element->attributeName(QTest::AI_Metric), - quotedMetric.constData(), - element->attributeName(QTest::AI_Tag), - quotedTag.constData(), - element->attributeName(QTest::AI_Value), - element->attributeValue(QTest::AI_Value), - element->attributeName(QTest::AI_Iterations), - element->attributeValue(QTest::AI_Iterations) ); - break; - } - default: - formatted->data()[0] = '\0'; - } -} - -void QTestXmlStreamer::formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const -{ - if(!element || !formatted) - return; - - if (element->elementType() == QTest::LET_TestCase) { - bool failed = false; - for (QTestElement* child = element->childElements(); child; child = child->nextElement()) { - if ( child->elementType() == QTest::LET_Failure - && child->attribute(QTest::AI_Result) - && ( !strcmp(child->attributeValue(QTest::AI_Result), "fail") - || !strcmp(child->attributeValue(QTest::AI_Result), "xpass")) - ) - { - failed = true; - break; - } - } - - // For passing functions, no Incident has been output yet. - // For failing functions, we already output one. - // Please note: we are outputting "pass" even if there was an xfail etc. - // This is by design (arguably bad design, but dangerous to change now!) - if (element->attribute(QTest::AI_Result) && !failed) { - QTest::qt_asprintf(formatted, "<Incident type=\"pass\" file=\"\" line=\"0\" />\n</TestFunction>\n"); - } - else { - QTest::qt_asprintf(formatted, "</TestFunction>\n"); - } - } else { - formatted->data()[0] = '\0'; - } -} - -void QTestXmlStreamer::formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const -{ - Q_UNUSED(element); - if (!formatted) - return; - - formatted->data()[0] = '\0'; -} - -void QTestXmlStreamer::output(QTestElement *element) const -{ - QTestCharBuffer buf; - QTestCharBuffer quotedTc; - QXmlTestLogger::xmlQuote("edTc, QTestResult::currentTestObjectName()); - - QTest::qt_asprintf(&buf, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<TestCase name=\"%s\">\n", - quotedTc.constData()); - outputString(buf.constData()); - - QTest::qt_asprintf(&buf, "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n", - qVersion(), QTEST_VERSION_STR ); - outputString(buf.constData()); - - QTest::qt_asprintf(&buf, "</Environment>\n"); - outputString(buf.constData()); - - QTestBasicStreamer::output(element); - - QTest::qt_asprintf(&buf, "</TestCase>\n"); - outputString(buf.constData()); -} - -QT_END_NAMESPACE - diff --git a/src/testlib/qtestxmlstreamer.h b/src/testlib/qtestxmlstreamer.h deleted file mode 100644 index 96e8246779..0000000000 --- a/src/testlib/qtestxmlstreamer.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtTest module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTXMLSTREAMER_H -#define QTESTXMLSTREAMER_H - -#include <QtTest/qtestbasicstreamer.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Test) - -class QTestElement; -class QTestElementAttribute; - -class QTestXmlStreamer: public QTestBasicStreamer -{ - public: - QTestXmlStreamer(QTestLogger *logger); - ~QTestXmlStreamer(); - - void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const; - void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const; - void formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const; - void output(QTestElement *element) const; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/testlib/qtestxunitstreamer.cpp b/src/testlib/qtestxunitstreamer.cpp index fb9699eef1..3e9c2feffc 100644 --- a/src/testlib/qtestxunitstreamer.cpp +++ b/src/testlib/qtestxunitstreamer.cpp @@ -40,7 +40,10 @@ ****************************************************************************/ #include "qtestxunitstreamer.h" +#include "qxunittestlogger_p.h" #include "qtestelement.h" +#include "qtestelementattribute.h" +#include "qtestassert.h" #include "QtTest/private/qtestlog_p.h" #include "QtTest/private/qtestresult_p.h" @@ -48,9 +51,11 @@ QT_BEGIN_NAMESPACE -QTestXunitStreamer::QTestXunitStreamer(QTestLogger *logger) - : QTestBasicStreamer(logger) -{} +QTestXunitStreamer::QTestXunitStreamer(QXunitTestLogger *logger) + : testLogger(logger) +{ + QTEST_ASSERT(testLogger); +} QTestXunitStreamer::~QTestXunitStreamer() {} @@ -75,7 +80,7 @@ void QTestXunitStreamer::indentForElement(const QTestElement* element, char* buf void QTestXunitStreamer::formatStart(const QTestElement *element, QTestCharBuffer *formatted) const { - if(!element || !formatted ) + if (!element || !formatted ) return; char indent[20]; @@ -99,7 +104,7 @@ void QTestXunitStreamer::formatEnd(const QTestElement *element, QTestCharBuffer if (!element || !formatted ) return; - if (!element->childElements()){ + if (!element->childElements()) { formatted->data()[0] = '\0'; return; } @@ -112,7 +117,7 @@ void QTestXunitStreamer::formatEnd(const QTestElement *element, QTestCharBuffer void QTestXunitStreamer::formatAttributes(const QTestElement* element, const QTestElementAttribute *attribute, QTestCharBuffer *formatted) const { - if(!attribute || !formatted ) + if (!attribute || !formatted ) return; QTest::AttributeIndex attrindex = attribute->index(); @@ -144,7 +149,7 @@ void QTestXunitStreamer::formatAttributes(const QTestElement* element, const QTe void QTestXunitStreamer::formatAfterAttributes(const QTestElement *element, QTestCharBuffer *formatted) const { - if(!element || !formatted ) + if (!element || !formatted ) return; // Errors are written as CDATA within system-err, comments elsewhere @@ -157,7 +162,7 @@ void QTestXunitStreamer::formatAfterAttributes(const QTestElement *element, QTes return; } - if(!element->childElements()) + if (!element->childElements()) QTest::qt_asprintf(formatted, "/>\n"); else QTest::qt_asprintf(formatted, ">\n"); @@ -165,8 +170,10 @@ void QTestXunitStreamer::formatAfterAttributes(const QTestElement *element, QTes void QTestXunitStreamer::output(QTestElement *element) const { + QTEST_ASSERT(element); + outputString("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"); - QTestBasicStreamer::output(element); + outputElements(element); } void QTestXunitStreamer::outputElements(QTestElement *element, bool) const @@ -183,19 +190,16 @@ void QTestXunitStreamer::outputElements(QTestElement *element, bool) const while (element) { hasChildren = element->childElements(); - if(element->elementType() != QTest::LET_Benchmark){ + if (element->elementType() != QTest::LET_Benchmark) { formatStart(element, &buf); outputString(buf.data()); - formatBeforeAttributes(element, &buf); - outputString(buf.data()); - outputElementAttributes(element, element->attributes()); formatAfterAttributes(element, &buf); outputString(buf.data()); - if(hasChildren) + if (hasChildren) outputElements(element->childElements(), true); formatEnd(element, &buf); @@ -205,5 +209,19 @@ void QTestXunitStreamer::outputElements(QTestElement *element, bool) const } } -QT_END_NAMESPACE +void QTestXunitStreamer::outputElementAttributes(const QTestElement* element, QTestElementAttribute *attribute) const +{ + QTestCharBuffer buf; + while (attribute) { + formatAttributes(element, attribute, &buf); + outputString(buf.data()); + attribute = attribute->nextElement(); + } +} +void QTestXunitStreamer::outputString(const char *msg) const +{ + testLogger->outputString(msg); +} + +QT_END_NAMESPACE diff --git a/src/testlib/qtestxunitstreamer.h b/src/testlib/qtestxunitstreamer.h index 4d1cb2734a..127c9b1780 100644 --- a/src/testlib/qtestxunitstreamer.h +++ b/src/testlib/qtestxunitstreamer.h @@ -42,7 +42,7 @@ #ifndef QTESTXUNITSTREAMER_H #define QTESTXUNITSTREAMER_H -#include <QtTest/qtestbasicstreamer.h> +#include <QtCore/qglobal.h> QT_BEGIN_HEADER @@ -50,12 +50,15 @@ QT_BEGIN_NAMESPACE QT_MODULE(Test) -class QTestLogger; +class QTestElement; +class QTestElementAttribute; +class QXunitTestLogger; +struct QTestCharBuffer; -class QTestXunitStreamer: public QTestBasicStreamer +class QTestXunitStreamer { public: - QTestXunitStreamer(QTestLogger *logger); + QTestXunitStreamer(QXunitTestLogger *logger); ~QTestXunitStreamer(); void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const; @@ -64,10 +67,15 @@ class QTestXunitStreamer: public QTestBasicStreamer void formatAttributes(const QTestElement *element, const QTestElementAttribute *attribute, QTestCharBuffer *formatted) const; void output(QTestElement *element) const; void outputElements(QTestElement *element, bool isChildElement = false) const; + void outputElementAttributes(const QTestElement *element, QTestElementAttribute *attribute) const; + + void outputString(const char *msg) const; private: void displayXunitXmlHeader() const; static void indentForElement(const QTestElement* element, char* buf, int size); + + QXunitTestLogger *testLogger; }; QT_END_NAMESPACE diff --git a/src/testlib/qxmltestlogger.cpp b/src/testlib/qxmltestlogger.cpp index 5ed7079ab6..304cd0a0ef 100644 --- a/src/testlib/qxmltestlogger.cpp +++ b/src/testlib/qxmltestlogger.cpp @@ -92,8 +92,8 @@ namespace QTest { } -QXmlTestLogger::QXmlTestLogger(XmlMode mode ) - : xmlmode(mode) +QXmlTestLogger::QXmlTestLogger(XmlMode mode, const char *filename) + : QAbstractTestLogger(filename), xmlmode(mode) { } @@ -101,9 +101,9 @@ QXmlTestLogger::~QXmlTestLogger() { } -void QXmlTestLogger::startLogging(const char *filename) +void QXmlTestLogger::startLogging() { - QAbstractTestLogger::startLogging(filename); + QAbstractTestLogger::startLogging(); QTestCharBuffer buf; if (xmlmode == QXmlTestLogger::Complete) { @@ -115,7 +115,7 @@ void QXmlTestLogger::startLogging(const char *filename) outputString(buf.constData()); } - QTest::qt_asprintf(&buf, + QTest::qt_asprintf(&buf, "<Environment>\n" " <QtVersion>%s</QtVersion>\n" " <QTestVersion>"QTEST_VERSION_STR"</QTestVersion>\n" diff --git a/src/testlib/qxmltestlogger_p.h b/src/testlib/qxmltestlogger_p.h index c08f5e469e..c273493c48 100644 --- a/src/testlib/qxmltestlogger_p.h +++ b/src/testlib/qxmltestlogger_p.h @@ -63,10 +63,10 @@ class QXmlTestLogger : public QAbstractTestLogger public: enum XmlMode { Complete = 0, Light }; - QXmlTestLogger(XmlMode mode = Complete); + QXmlTestLogger(XmlMode mode, const char *filename); ~QXmlTestLogger(); - void startLogging(const char *filename); + void startLogging(); void stopLogging(); void enterTestFunction(const char *function); diff --git a/src/testlib/qtestlogger.cpp b/src/testlib/qxunittestlogger.cpp index 385fb866c2..f923b2334b 100644 --- a/src/testlib/qtestlogger.cpp +++ b/src/testlib/qxunittestlogger.cpp @@ -39,11 +39,9 @@ ** ****************************************************************************/ -#include "qtestlogger_p.h" +#include "qxunittestlogger_p.h" #include "qtestelement.h" #include "qtestxunitstreamer.h" -#include "qtestxmlstreamer.h" -#include "qtestlightxmlstreamer.h" #include "QtTest/qtestcase.h" #include "QtTest/private/qtestresult_p.h" @@ -53,102 +51,84 @@ QT_BEGIN_NAMESPACE -QTestLogger::QTestLogger(int fm) - : listOfTestcases(0) +QXunitTestLogger::QXunitTestLogger(const char *filename) + : QAbstractTestLogger(filename) + , listOfTestcases(0) , currentLogElement(0) , errorLogElement(0) , logFormatter(0) - , format( (TestLoggerFormat)fm ) , testCounter(0) , failureCounter(0) , errorCounter(0) { } -QTestLogger::~QTestLogger() +QXunitTestLogger::~QXunitTestLogger() { - if(format == TLF_XunitXml) - delete currentLogElement; - else - delete listOfTestcases; - + delete currentLogElement; delete logFormatter; } -void QTestLogger::startLogging(const char *filename) +void QXunitTestLogger::startLogging() { - QAbstractTestLogger::startLogging(filename); + QAbstractTestLogger::startLogging(); - switch(format){ - case TLF_LightXml: - logFormatter = new QTestLightXmlStreamer(this); - break; - case TLF_XML: - logFormatter = new QTestXmlStreamer(this); - break; - case TLF_XunitXml: - logFormatter = new QTestXunitStreamer(this); - delete errorLogElement; - errorLogElement = new QTestElement(QTest::LET_SystemError); - break; - } + logFormatter = new QTestXunitStreamer(this); + delete errorLogElement; + errorLogElement = new QTestElement(QTest::LET_SystemError); } -void QTestLogger::stopLogging() +void QXunitTestLogger::stopLogging() { QTestElement *iterator = listOfTestcases; - if(format == TLF_XunitXml ){ - char buf[10]; + char buf[10]; - currentLogElement = new QTestElement(QTest::LET_TestSuite); - currentLogElement->addAttribute(QTest::AI_Name, QTestResult::currentTestObjectName()); + currentLogElement = new QTestElement(QTest::LET_TestSuite); + currentLogElement->addAttribute(QTest::AI_Name, QTestResult::currentTestObjectName()); - QTest::qt_snprintf(buf, sizeof(buf), "%i", testCounter); - currentLogElement->addAttribute(QTest::AI_Tests, buf); + QTest::qt_snprintf(buf, sizeof(buf), "%i", testCounter); + currentLogElement->addAttribute(QTest::AI_Tests, buf); - QTest::qt_snprintf(buf, sizeof(buf), "%i", failureCounter); - currentLogElement->addAttribute(QTest::AI_Failures, buf); + QTest::qt_snprintf(buf, sizeof(buf), "%i", failureCounter); + currentLogElement->addAttribute(QTest::AI_Failures, buf); - QTest::qt_snprintf(buf, sizeof(buf), "%i", errorCounter); - currentLogElement->addAttribute(QTest::AI_Errors, buf); + QTest::qt_snprintf(buf, sizeof(buf), "%i", errorCounter); + currentLogElement->addAttribute(QTest::AI_Errors, buf); - QTestElement *property; - QTestElement *properties = new QTestElement(QTest::LET_Properties); + QTestElement *property; + QTestElement *properties = new QTestElement(QTest::LET_Properties); - property = new QTestElement(QTest::LET_Property); - property->addAttribute(QTest::AI_Name, "QTestVersion"); - property->addAttribute(QTest::AI_PropertyValue, QTEST_VERSION_STR); - properties->addLogElement(property); + property = new QTestElement(QTest::LET_Property); + property->addAttribute(QTest::AI_Name, "QTestVersion"); + property->addAttribute(QTest::AI_PropertyValue, QTEST_VERSION_STR); + properties->addLogElement(property); - property = new QTestElement(QTest::LET_Property); - property->addAttribute(QTest::AI_Name, "QtVersion"); - property->addAttribute(QTest::AI_PropertyValue, qVersion()); - properties->addLogElement(property); + property = new QTestElement(QTest::LET_Property); + property->addAttribute(QTest::AI_Name, "QtVersion"); + property->addAttribute(QTest::AI_PropertyValue, qVersion()); + properties->addLogElement(property); - currentLogElement->addLogElement(properties); + currentLogElement->addLogElement(properties); - currentLogElement->addLogElement(iterator); + currentLogElement->addLogElement(iterator); - /* For correct indenting, make sure every testcase knows its parent */ - QTestElement* testcase = iterator; - while (testcase) { - testcase->setParent(currentLogElement); - testcase = testcase->nextElement(); - } + /* For correct indenting, make sure every testcase knows its parent */ + QTestElement* testcase = iterator; + while (testcase) { + testcase->setParent(currentLogElement); + testcase = testcase->nextElement(); + } - currentLogElement->addLogElement(errorLogElement); + currentLogElement->addLogElement(errorLogElement); - QTestElement *it = currentLogElement; - logFormatter->output(it); - }else{ - logFormatter->output(iterator); - } + QTestElement *it = currentLogElement; + logFormatter->output(it); QAbstractTestLogger::stopLogging(); } -void QTestLogger::enterTestFunction(const char *function) +void QXunitTestLogger::enterTestFunction(const char *function) { currentLogElement = new QTestElement(QTest::LET_TestCase); currentLogElement->addAttribute(QTest::AI_Name, function); @@ -157,12 +137,12 @@ void QTestLogger::enterTestFunction(const char *function) ++testCounter; } -void QTestLogger::leaveTestFunction() +void QXunitTestLogger::leaveTestFunction() { } -void QTestLogger::addIncident(IncidentTypes type, const char *description, - const char *file, int line) +void QXunitTestLogger::addIncident(IncidentTypes type, const char *description, + const char *file, int line) { const char *typeBuf = 0; char buf[100]; @@ -187,11 +167,10 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description, break; } - if (type == QAbstractTestLogger::Fail || type == QAbstractTestLogger::XPass - || ((format != TLF_XunitXml) && (type == QAbstractTestLogger::XFail))) { + if (type == QAbstractTestLogger::Fail || type == QAbstractTestLogger::XPass) { QTestElement *failureElement = new QTestElement(QTest::LET_Failure); failureElement->addAttribute(QTest::AI_Result, typeBuf); - if(file) + if (file) failureElement->addAttribute(QTest::AI_File, file); else failureElement->addAttribute(QTest::AI_File, ""); @@ -229,7 +208,7 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description, currentLogElement->addAttribute(QTest::AI_Result, typeBuf); } - if(file) + if (file) currentLogElement->addAttribute(QTest::AI_File, file); else currentLogElement->addAttribute(QTest::AI_File, ""); @@ -241,12 +220,12 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description, Since XFAIL does not add a failure to the testlog in xunitxml, add a message, so we still have some information about the expected failure. */ - if (format == TLF_XunitXml && type == QAbstractTestLogger::XFail) { - QTestLogger::addMessage(QAbstractTestLogger::Info, description, file, line); + if (type == QAbstractTestLogger::XFail) { + QXunitTestLogger::addMessage(QAbstractTestLogger::Info, description, file, line); } } -void QTestLogger::addBenchmarkResult(const QBenchmarkResult &result) +void QXunitTestLogger::addBenchmarkResult(const QBenchmarkResult &result) { QTestElement *benchmarkElement = new QTestElement(QTest::LET_Benchmark); @@ -262,7 +241,7 @@ void QTestLogger::addBenchmarkResult(const QBenchmarkResult &result) currentLogElement->addLogElement(benchmarkElement); } -void QTestLogger::addTag(QTestElement* element) +void QXunitTestLogger::addTag(QTestElement* element) { const char *tag = QTestResult::currentDataTag(); const char *gtag = QTestResult::currentGlobalDataTag(); @@ -283,7 +262,7 @@ void QTestLogger::addTag(QTestElement* element) element->addAttribute(QTest::AI_Tag, buf.constData()); } -void QTestLogger::addMessage(MessageTypes type, const char *message, const char *file, int line) +void QXunitTestLogger::addMessage(MessageTypes type, const char *message, const char *file, int line) { QTestElement *errorElement = new QTestElement(QTest::LET_Error); const char *typeBuf = 0; @@ -319,7 +298,7 @@ void QTestLogger::addMessage(MessageTypes type, const char *message, const char errorElement->addAttribute(QTest::AI_Description, message); addTag(errorElement); - if(file) + if (file) errorElement->addAttribute(QTest::AI_File, file); else errorElement->addAttribute(QTest::AI_File, ""); diff --git a/src/testlib/qtestlogger_p.h b/src/testlib/qxunittestlogger_p.h index 5e5b0f2f3f..a51d70533d 100644 --- a/src/testlib/qtestlogger_p.h +++ b/src/testlib/qxunittestlogger_p.h @@ -57,23 +57,16 @@ QT_BEGIN_NAMESPACE -class QTestBasicStreamer; +class QTestXunitStreamer; class QTestElement; -class QTestLogger : public QAbstractTestLogger +class QXunitTestLogger : public QAbstractTestLogger { public: - QTestLogger(int fm = 0); - ~QTestLogger(); + QXunitTestLogger(const char *filename); + ~QXunitTestLogger(); - enum TestLoggerFormat - { - TLF_XML = 0, - TLF_LightXml = 1, - TLF_XunitXml = 2 - }; - - void startLogging(const char *filename); + void startLogging(); void stopLogging(); void enterTestFunction(const char *function); @@ -91,8 +84,7 @@ class QTestLogger : public QAbstractTestLogger QTestElement *listOfTestcases; QTestElement *currentLogElement; QTestElement *errorLogElement; - QTestBasicStreamer *logFormatter; - TestLoggerFormat format; + QTestXunitStreamer *logFormatter; int testCounter; int failureCounter; diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro index a65510f567..e8858ea1c4 100644 --- a/src/testlib/testlib.pro +++ b/src/testlib/testlib.pro @@ -18,7 +18,6 @@ HEADERS = qbenchmark.h \ qsignalspy.h \ qtestaccessible.h \ qtestassert.h \ - qtestbasicstreamer.h \ qtestcase.h \ qtestcoreelement.h \ qtestcorelist.h \ @@ -31,12 +30,10 @@ HEADERS = qbenchmark.h \ qtest_gui.h \ qtest.h \ qtestkeyboard.h \ - qtestlightxmlstreamer.h \ qtestmouse.h \ qtestspontaneevent.h \ qtestsystem.h \ qtesttouch.h \ - qtestxmlstreamer.h \ qtestxunitstreamer.h SOURCES = qtestcase.cpp \ qtestlog.cpp \ @@ -55,11 +52,8 @@ SOURCES = qtestcase.cpp \ qbenchmarkmetric.cpp \ qtestelement.cpp \ qtestelementattribute.cpp \ - qtestbasicstreamer.cpp \ qtestxunitstreamer.cpp \ - qtestxmlstreamer.cpp \ - qtestlightxmlstreamer.cpp \ - qtestlogger.cpp + qxunittestlogger.cpp DEFINES *= QT_NO_CAST_TO_ASCII \ QT_NO_CAST_FROM_ASCII \ QTESTLIB_MAKEDLL \ diff --git a/src/tools/uic/qclass_lib_map.h b/src/tools/uic/qclass_lib_map.h index 2d176552a8..09d275d8a1 100644 --- a/src/tools/uic/qclass_lib_map.h +++ b/src/tools/uic/qclass_lib_map.h @@ -514,7 +514,6 @@ QT_CLASS_LIB(QTest, QtTest, qtest.h) QT_CLASS_LIB(QtTestGui, QtTest, qtest_gui.h) QT_CLASS_LIB(QTestAccessibilityEvent, QtTest, qtestaccessible.h) QT_CLASS_LIB(QTestAccessibility, QtTest, qtestaccessible.h) -QT_CLASS_LIB(QTestBasicStreamer, QtTest, qtestbasicstreamer.h) QT_CLASS_LIB(QTestCoreElement, QtTest, qtestcoreelement.h) QT_CLASS_LIB(QTestCoreList, QtTest, qtestcorelist.h) QT_CLASS_LIB(QTestData, QtTest, qtestdata.h) @@ -527,11 +526,9 @@ QT_CLASS_LIB(QTestMouseEvent, QtTest, qtestevent.h) QT_CLASS_LIB(QTestDelayEvent, QtTest, qtestevent.h) QT_CLASS_LIB(QTestEventList, QtTest, qtestevent.h) QT_CLASS_LIB(QTestEventLoop, QtTest, qtesteventloop.h) -QT_CLASS_LIB(QTestLightXmlStreamer, QtTest, qtestlightxmlstreamer.h) QT_CLASS_LIB(QEventSizeOfChecker, QtTest, qtestspontaneevent.h) QT_CLASS_LIB(QEventSizeOfChecker, QtTest, qtestspontaneevent.h) QT_CLASS_LIB(QSpontaneKeyEvent, QtTest, qtestspontaneevent.h) -QT_CLASS_LIB(QTestXmlStreamer, QtTest, qtestxmlstreamer.h) QT_CLASS_LIB(QTestXunitStreamer, QtTest, qtestxunitstreamer.h) QT_CLASS_LIB(QDBusAbstractAdaptor, QtDBus, qdbusabstractadaptor.h) QT_CLASS_LIB(QDBusAbstractInterfaceBase, QtDBus, qdbusabstractinterface.h) diff --git a/src/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch b/src/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch index 54a35fda9f..4ec44e3547 100644 --- a/src/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch +++ b/src/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch @@ -1,7 +1,7 @@ From e13ce09287a56c920d5ffdc5d4662d49f1838f16 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy <aaron.kennedy@nokia.com> Date: Mon, 23 May 2011 15:47:20 +1000 -Subject: [PATCH 01/13] Add hashing and comparison methods to v8::String +Subject: [PATCH 01/16] Add hashing and comparison methods to v8::String This allows us to more rapidly search for a v8::String inside a hash of QStrings. @@ -339,5 +339,5 @@ index e966b3d..6e26f57 100644 // Maximal memory usage for a single sequential two-byte string. -- -1.7.2.3 +1.7.6 diff --git a/src/v8/0002-Add-a-bit-field-3-to-Map.patch b/src/v8/0002-Add-a-bit-field-3-to-Map.patch index dda9fa0dff..4b21317668 100644 --- a/src/v8/0002-Add-a-bit-field-3-to-Map.patch +++ b/src/v8/0002-Add-a-bit-field-3-to-Map.patch @@ -1,7 +1,7 @@ From 7c9cfff80b7864d5687432d424074e51712c4a07 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy <aaron.kennedy@nokia.com> Date: Mon, 23 May 2011 15:55:26 +1000 -Subject: [PATCH 02/13] Add a bit field 3 to Map +Subject: [PATCH 02/16] Add a bit field 3 to Map Bit field 3 will be used to add QML specific map flags. --- @@ -114,5 +114,5 @@ index 6e26f57..07e1089 100644 static const int kCodeCacheEntrySize = 2; static const int kCodeCacheEntryNameOffset = 0; -- -1.7.2.3 +1.7.6 diff --git a/src/v8/0003-Add-a-fallback-mode-for-named-property-interceptors.patch b/src/v8/0003-Add-a-fallback-mode-for-named-property-interceptors.patch index 50f97c7de8..27529ff3da 100644 --- a/src/v8/0003-Add-a-fallback-mode-for-named-property-interceptors.patch +++ b/src/v8/0003-Add-a-fallback-mode-for-named-property-interceptors.patch @@ -1,7 +1,7 @@ From ae8688b53d67044f2c9b0cce25fc282b078610c1 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy <aaron.kennedy@nokia.com> Date: Mon, 23 May 2011 16:21:02 +1000 -Subject: [PATCH 03/13] Add a "fallback" mode for named property interceptors +Subject: [PATCH 03/16] Add a "fallback" mode for named property interceptors By default interceptors are called before the normal property resolution on objects. When an interceptor is installed as a @@ -360,5 +360,5 @@ index 7335da8..660352c 100644 return isolate->heap()->undefined_value(); } -- -1.7.2.3 +1.7.6 diff --git a/src/v8/0004-Generalize-external-object-resources.patch b/src/v8/0004-Generalize-external-object-resources.patch index f44e7b2134..a05aad0889 100644 --- a/src/v8/0004-Generalize-external-object-resources.patch +++ b/src/v8/0004-Generalize-external-object-resources.patch @@ -1,7 +1,7 @@ From 4827116b12c50f6662794017c5a662b5dbb2da0b Mon Sep 17 00:00:00 2001 From: Aaron Kennedy <aaron.kennedy@nokia.com> Date: Mon, 23 May 2011 16:55:35 +1000 -Subject: [PATCH 04/13] Generalize external object resources +Subject: [PATCH 04/16] Generalize external object resources V8 was already able to manage and finalize an external string resource. This change generalizes that mechanism to handle a @@ -890,5 +890,5 @@ index a209cd0..1bdb5c7 100644 -- -1.7.2.3 +1.7.6 diff --git a/src/v8/0005-Introduce-a-QML-compilation-mode.patch b/src/v8/0005-Introduce-a-QML-compilation-mode.patch index b464e61266..3c1cab2497 100644 --- a/src/v8/0005-Introduce-a-QML-compilation-mode.patch +++ b/src/v8/0005-Introduce-a-QML-compilation-mode.patch @@ -1,7 +1,7 @@ From fd7d475e298e5b63cd6383c78cc900635c82aa38 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy <aaron.kennedy@nokia.com> Date: Mon, 23 May 2011 18:26:19 +1000 -Subject: [PATCH 05/13] Introduce a QML compilation mode +Subject: [PATCH 05/16] Introduce a QML compilation mode In QML mode, there is a second global object - known as the QML global object. During property resolution, if a property is not @@ -1773,5 +1773,5 @@ index 4c17720..aa284ed 100644 static inline Operand StackSpaceOperand(int index) { #ifdef _WIN64 -- -1.7.2.3 +1.7.6 diff --git a/src/v8/0006-Allow-access-to-the-calling-script-data.patch b/src/v8/0006-Allow-access-to-the-calling-script-data.patch index d4acdf7a42..50529d67b1 100644 --- a/src/v8/0006-Allow-access-to-the-calling-script-data.patch +++ b/src/v8/0006-Allow-access-to-the-calling-script-data.patch @@ -1,7 +1,7 @@ From f890f0d1a1e5bd62711815489c87755a4f382436 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy <aaron.kennedy@nokia.com> Date: Wed, 25 May 2011 10:36:13 +1000 -Subject: [PATCH 06/13] Allow access to the calling script data +Subject: [PATCH 06/16] Allow access to the calling script data --- include/v8.h | 1 + @@ -44,5 +44,5 @@ index 39767f4..ff74efb 100644 v8::Local<v8::Object> Context::Global() { if (IsDeadCheck(i::Isolate::Current(), "v8::Context::Global()")) { -- -1.7.2.3 +1.7.6 diff --git a/src/v8/0007-Fix-warnings.patch b/src/v8/0007-Fix-warnings.patch index 26141c8ae8..fe6fa59517 100644 --- a/src/v8/0007-Fix-warnings.patch +++ b/src/v8/0007-Fix-warnings.patch @@ -1,7 +1,7 @@ From dac5d9db84cf20564621c679937ca7b9c6a8e880 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy <aaron.kennedy@nokia.com> Date: Fri, 27 May 2011 13:04:15 +1000 -Subject: [PATCH 07/13] Fix warnings +Subject: [PATCH 07/16] Fix warnings --- include/v8.h | 16 ++++++++-------- @@ -42,5 +42,5 @@ index 9aba4a8..8891dab 100644 } // namespace internal -- -1.7.2.3 +1.7.6 diff --git a/src/v8/0008-Add-custom-object-compare-callback.patch b/src/v8/0008-Add-custom-object-compare-callback.patch index d7ef5c434d..a6973969fe 100644 --- a/src/v8/0008-Add-custom-object-compare-callback.patch +++ b/src/v8/0008-Add-custom-object-compare-callback.patch @@ -1,7 +1,7 @@ From bec11b8b7f89d135e7d9a823ac4fe98c70d017cf Mon Sep 17 00:00:00 2001 From: Aaron Kennedy <aaron.kennedy@nokia.com> Date: Mon, 27 Jun 2011 14:57:28 +1000 -Subject: [PATCH 08/13] Add custom object compare callback +Subject: [PATCH 08/16] Add custom object compare callback A global custom object comparison callback can be set with: V8::SetUserObjectComparisonCallbackFunction() @@ -485,5 +485,5 @@ index d923494..10b9b56 100644 ASSERT(GetCondition() == equal); __ subq(rax, rdx); -- -1.7.2.3 +1.7.6 diff --git a/src/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch b/src/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch index d197ac9e48..242161358f 100644 --- a/src/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch +++ b/src/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch @@ -1,7 +1,8 @@ From 4183b973ed3bd603784c798dfa63ba48f6b68003 Mon Sep 17 00:00:00 2001 -From: ager@chromium.org <ager@chromium.org> +From: "ager@chromium.org" <ager@chromium.org> Date: Wed, 4 May 2011 13:03:08 +0000 -Subject: [PATCH 09/13] Add CallAsFunction method to the Object class in the API +Subject: [PATCH 09/16] Add CallAsFunction method to the Object class in the + API Patch by Peter Varga. @@ -282,5 +283,5 @@ index d7621d1..693d51e 100644 -- -1.7.2.3 +1.7.6 diff --git a/src/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch b/src/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch index cb4dd186d6..ea3802b96d 100644 --- a/src/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch +++ b/src/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch @@ -1,7 +1,8 @@ From 3d6d4249878f7960eac4c9c94e0f2529f9a58c4a Mon Sep 17 00:00:00 2001 -From: ager@chromium.org <ager@chromium.org> +From: "ager@chromium.org" <ager@chromium.org> Date: Fri, 6 May 2011 11:07:52 +0000 -Subject: [PATCH 10/13] Implement CallAsConstructor method for Object in the API +Subject: [PATCH 10/16] Implement CallAsConstructor method for Object in the + API Patch by Peter Varga. @@ -393,5 +394,5 @@ index 693d51e..1334f63 100644 } } -- -1.7.2.3 +1.7.6 diff --git a/src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch b/src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch index 9c0e68352f..aefcae55cd 100644 --- a/src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch +++ b/src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch @@ -1,7 +1,8 @@ From f22d0312faeb93ced8747d9aae8c6d77e11b4aba Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki <jedrzej.nowacki@nokia.com> Date: Tue, 7 Dec 2010 11:56:42 +0100 -Subject: [PATCH 11/13] QtScript/V8: Add new v8 api to check if a value is an error. +Subject: [PATCH 11/16] QtScript/V8: Add new v8 api to check if a value is an + error. New function v8::Value::IsError was created. @@ -59,5 +60,5 @@ index 8cbf378..db90bb9 100644 V(to_string_symbol, "toString") \ V(char_at_symbol, "CharAt") \ -- -1.7.2.3 +1.7.6 diff --git a/src/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch b/src/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch index 77589c8af3..426458dafc 100644 --- a/src/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch +++ b/src/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch @@ -1,7 +1,8 @@ From 472c04c9e7a64e8734c76d2cf97a7cc5b773b788 Mon Sep 17 00:00:00 2001 -From: ager@chromium.org <ager@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00> +From: "ager@chromium.org" + <ager@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00> Date: Mon, 9 May 2011 15:24:48 +0000 -Subject: [PATCH 12/13] Add IsCallable method for Object in the API +Subject: [PATCH 12/16] Add IsCallable method for Object in the API Patch by Peter Varga. @@ -112,5 +113,5 @@ index 1334f63..45db5a1 100644 return v8::HandleScope::NumberOfHandles(); } -- -1.7.2.3 +1.7.6 diff --git a/src/v8/0013-Remove-execute-flag-from-v8-debug.h.patch b/src/v8/0013-Remove-execute-flag-from-v8-debug.h.patch index 6bad561273..f73785d123 100644 --- a/src/v8/0013-Remove-execute-flag-from-v8-debug.h.patch +++ b/src/v8/0013-Remove-execute-flag-from-v8-debug.h.patch @@ -1,7 +1,7 @@ From dc2cad4f8fc88c52fcea09b8d0262d35cd32dc44 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy <aaron.kennedy@nokia.com> Date: Thu, 25 Aug 2011 11:09:58 +1000 -Subject: [PATCH 13/13] Remove execute flag from v8-debug.h +Subject: [PATCH 13/16] Remove execute flag from v8-debug.h --- 0 files changed, 0 insertions(+), 0 deletions(-) @@ -11,5 +11,5 @@ diff --git a/include/v8-debug.h b/include/v8-debug.h old mode 100755 new mode 100644 -- -1.7.2.3 +1.7.6 diff --git a/src/v8/0014-Fix-build-error-suggest-parentheses-around-within.patch b/src/v8/0014-Fix-build-error-suggest-parentheses-around-within.patch new file mode 100644 index 0000000000..bb26b1493f --- /dev/null +++ b/src/v8/0014-Fix-build-error-suggest-parentheses-around-within.patch @@ -0,0 +1,25 @@ +From d7e876decc00c611d327185bf890a7efecb2cf7e Mon Sep 17 00:00:00 2001 +From: Kent Hansen <kent.hansen@nokia.com> +Date: Mon, 29 Aug 2011 13:26:13 +0200 +Subject: [PATCH 14/16] Fix build error: "suggest parentheses around '&&' + within '||'" + +--- + src/mark-compact.cc | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/mark-compact.cc b/src/mark-compact.cc +index 1b1e361..775f787 100644 +--- a/src/mark-compact.cc ++++ b/src/mark-compact.cc +@@ -1020,7 +1020,7 @@ class SymbolTableCleaner : public ObjectVisitor { + // Since no objects have yet been moved we can safely access the map of + // the object. + if ((*p)->IsExternalString() || +- (*p)->IsHeapObject() && HeapObject::cast(*p)->map()->has_external_resource()) { ++ ((*p)->IsHeapObject() && HeapObject::cast(*p)->map()->has_external_resource())) { + heap_->FinalizeExternalString(HeapObject::cast(*p)); + } + // Set the entry to null_value (as deleted). +-- +1.7.6 diff --git a/src/v8/0015-Fix-source-compatibility-where-the-String-Equals-ove.patch b/src/v8/0015-Fix-source-compatibility-where-the-String-Equals-ove.patch new file mode 100644 index 0000000000..003c430f56 --- /dev/null +++ b/src/v8/0015-Fix-source-compatibility-where-the-String-Equals-ove.patch @@ -0,0 +1,25 @@ +From 0af1e15a3d6b28923c262a02a5ace35812c8f5d6 Mon Sep 17 00:00:00 2001 +From: Simon Hausmann <simon.hausmann@nokia.com> +Date: Thu, 4 Aug 2011 21:28:38 +0200 +Subject: [PATCH 15/16] Fix source compatibility where the String::Equals + overloads would shadow the Value::Equals function, + breaking the build. + +--- + include/v8.h | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/include/v8.h b/include/v8.h +index 4194d4a..5e1ce50 100644 +--- a/include/v8.h ++++ b/include/v8.h +@@ -1048,6 +1048,7 @@ class String : public Primitive { + */ + V8EXPORT bool Equals(uint16_t *string, int length); + V8EXPORT bool Equals(char *string, int length); ++ inline bool Equals(Handle<Value> that) const { return v8::Value::Equals(that); } + + /** + * Write the contents of the string to an external buffer. +-- +1.7.6 diff --git a/src/v8/0016-Fix-deprecated-Python-code.patch b/src/v8/0016-Fix-deprecated-Python-code.patch new file mode 100644 index 0000000000..4ecf8d7e6f --- /dev/null +++ b/src/v8/0016-Fix-deprecated-Python-code.patch @@ -0,0 +1,50 @@ +From 97cb46d421faebd2b139570bcf9aaf2d5eadc333 Mon Sep 17 00:00:00 2001 +From: Kent Hansen <kent.hansen@nokia.com> +Date: Fri, 2 Sep 2011 12:03:09 +0200 +Subject: [PATCH 16/16] Fix deprecated Python code + +Needed to make the scripts run on Python 3, which is the +default python interpreter on some newer distros. + +Patch from http://code.google.com/p/v8/issues/detail?id=1391 +--- + tools/js2c.py | 4 ++-- + tools/jsmin.py | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tools/js2c.py b/tools/js2c.py +index 2da132f..d13d53d 100755 +--- a/tools/js2c.py ++++ b/tools/js2c.py +@@ -187,14 +187,14 @@ def ReadMacros(lines): + macro_match = MACRO_PATTERN.match(line) + if macro_match: + name = macro_match.group(1) +- args = map(string.strip, macro_match.group(2).split(',')) ++ args = args = [match.strip() for match in macro_match.group(2).split(',')] + body = macro_match.group(3).strip() + macros.append((re.compile("\\b%s\\(" % name), TextMacro(args, body))) + else: + python_match = PYTHON_MACRO_PATTERN.match(line) + if python_match: + name = python_match.group(1) +- args = map(string.strip, python_match.group(2).split(',')) ++ args = [match.strip() for match in python_match.group(2).split(',')] + body = python_match.group(3).strip() + fun = eval("lambda " + ",".join(args) + ': ' + body) + macros.append((re.compile("\\b%s\\(" % name), PythonMacro(args, fun))) +diff --git a/tools/jsmin.py b/tools/jsmin.py +index 646bf14..395441b 100644 +--- a/tools/jsmin.py ++++ b/tools/jsmin.py +@@ -154,7 +154,7 @@ class JavaScriptMinifier(object): + return var_name + while True: + identifier_first_char = self.identifier_counter % 52 +- identifier_second_char = self.identifier_counter / 52 ++ identifier_second_char = self.identifier_counter // 52 + new_identifier = self.CharFromNumber(identifier_first_char) + if identifier_second_char != 0: + new_identifier = ( +-- +1.7.6 diff --git a/src/v8/v8.pri b/src/v8/v8.pri index 2abf52972c..6300ca989e 100644 --- a/src/v8/v8.pri +++ b/src/v8/v8.pri @@ -1,3 +1,10 @@ +isEmpty(QT_ARCH) { + # We're most likely being parsed in a fromfile() call, in which case the + # QMake environment isn't complete. Load qt_config in an attempt to set + # the variables we need (QT_ARCH and CONFIG, in particular). + load(qt_config) +} + equals(QT_ARCH, x86_64)|contains(CONFIG, x86_64):CONFIG += arch_x86_64 else:equals(QT_ARCH, "i386"):CONFIG += arch_i386 else:equals(QT_ARCH, "arm"):CONFIG += arch_arm diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h index 9cadb596c8..cfe1ecf2b9 100644 --- a/src/widgets/widgets/qmenu_p.h +++ b/src/widgets/widgets/qmenu_p.h @@ -145,6 +145,9 @@ public: #endif scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0), hasCheckableItems(0), sloppyAction(0), doChildEffects(false) +#ifdef QT3_SUPPORT + ,emitHighlighted(false) +#endif #ifdef Q_OS_MAC ,mac_menu(0) #endif @@ -154,9 +157,6 @@ public: #ifdef Q_WS_S60 ,symbian_menu(0) #endif -#ifdef QT3_SUPPORT - ,emitHighlighted(false) -#endif { } ~QMenuPrivate() { diff --git a/src/widgets/widgets/qmenu_symbian.cpp b/src/widgets/widgets/qmenu_symbian.cpp index 56eca9a425..4250601f98 100644 --- a/src/widgets/widgets/qmenu_symbian.cpp +++ b/src/widgets/widgets/qmenu_symbian.cpp @@ -398,12 +398,12 @@ void QMenuPrivate::QSymbianMenuPrivate::rebuild(bool) { } -void QMenuBarPrivate::QSymbianMenuBarPrivate::addAction(QAction *a, QSymbianMenuAction *before) +void QMenuBarPrivate::QSymbianMenuBarPrivate::addAction(QAction *a, QAction *before) { QSymbianMenuAction *action = new QSymbianMenuAction; action->action = a; action->command = qt_symbian_menu_static_cmd_id++; - addAction(action, before); + addAction(action, findAction(before)); } void QMenuBarPrivate::QSymbianMenuBarPrivate::addAction(QSymbianMenuAction *action, QSymbianMenuAction *before) diff --git a/src/widgets/widgets/qmenu_wince.cpp b/src/widgets/widgets/qmenu_wince.cpp index 1157fff8a2..b0c6c1bd12 100644 --- a/src/widgets/widgets/qmenu_wince.cpp +++ b/src/widgets/widgets/qmenu_wince.cpp @@ -504,12 +504,12 @@ void QMenuPrivate::QWceMenuPrivate::removeAction(QWceMenuAction *action) rebuild(); } -void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QAction *a, QWceMenuAction *before) +void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QAction *a, QAction *before) { QWceMenuAction *action = new QWceMenuAction; action->action = a; action->command = qt_wce_menu_static_cmd_id++; - addAction(action, before); + addAction(action, findAction(before)); } void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QWceMenuAction *action, QWceMenuAction *before) diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 700e11a347..b317991570 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -1109,6 +1109,11 @@ void tst_QDir::absolutePath_data() QTest::newRow("4") << "c:/machine/share/dir1" << "c:/machine/share/dir1"; QTest::newRow("5") << "c:\\machine\\share\\dir1" << "c:/machine/share/dir1"; #endif + //test dirty paths are cleaned (QTBUG-19995) + QTest::newRow("/home/qt/.") << QDir::rootPath() + "home/qt/." << QDir::rootPath() + "home/qt"; + QTest::newRow("/system/data/../config") << QDir::rootPath() + "system/data/../config" << QDir::rootPath() + "system/config"; + QTest::newRow("//home//qt/") << QDir::rootPath() + "/home//qt/" << QDir::rootPath() + "home/qt"; + QTest::newRow("foo/../bar") << "foo/../bar" << QDir::currentPath() + "/bar"; QTest::newRow("resource") << ":/prefix/foo.bar" << ":/prefix/foo.bar"; } @@ -1872,6 +1877,14 @@ void tst_QDir::equalityOperator_data() << "./entrylist" << "*.cpp" << int(QDir::Name) << int(QDir::Files) << true; + QTest::newRow("QTBUG-20495") << QDir::currentPath() + "/entrylist/.." << "*.cpp" << int(QDir::Name) << int(QDir::Files) + << "." << "*.cpp" << int(QDir::Name) << int(QDir::Files) + << true; + + QTest::newRow("QTBUG-20495-root") << QDir::rootPath() + "tmp/.." << "*.cpp" << int(QDir::Name) << int(QDir::Files) + << QDir::rootPath() << "*.cpp" << int(QDir::Name) << int(QDir::Files) + << true; + QTest::newRow("diff-filters") << SRCDIR << "*.cpp" << int(QDir::Name) << int(QDir::Files) << SRCDIR << "*.cpp" << int(QDir::Name) << int(QDir::Dirs) << false; diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 9c9c9ec282..1eb59ac96a 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -481,6 +481,11 @@ void tst_QFileInfo::absolutePath_data() QTest::newRow("c:\\autoexec.bat") << "c:\\autoexec.bat" << "C:/" << "autoexec.bat"; #endif + QTest::newRow("QTBUG-19995.1") << drivePrefix + "/System/Library/StartupItems/../Frameworks" + << drivePrefix + "/System/Library" + << "Frameworks"; + QTest::newRow("QTBUG-19995.2") << drivePrefix + "/System/Library/StartupItems/../Frameworks/" + << drivePrefix + "/System/Library/Frameworks" << ""; } void tst_QFileInfo::absolutePath() @@ -502,6 +507,7 @@ void tst_QFileInfo::absFilePath_data() QTest::newRow("relativeFile") << "tmp.txt" << QDir::currentPath() + "/tmp.txt"; QTest::newRow("relativeFileInSubDir") << "temp/tmp.txt" << QDir::currentPath() + "/" + "temp/tmp.txt"; + QString drivePrefix; #if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN) QString curr = QDir::currentPath(); @@ -510,7 +516,7 @@ void tst_QFileInfo::absFilePath_data() QTest::newRow("absFilePath") << "c:\\home\\andy\\tmp.txt" << "C:/home/andy/tmp.txt"; // Make sure drive-relative paths return correct absolute paths (task 255326) - QString drivePrefix = QDir::currentPath().left(2); + drivePrefix = QDir::currentPath().left(2); QString nonCurrentDrivePrefix = drivePrefix.left(1).compare("X", Qt::CaseInsensitive) == 0 ? QString("Y:") : QString("X:"); @@ -520,6 +526,8 @@ void tst_QFileInfo::absFilePath_data() #else QTest::newRow("absFilePath") << "/home/andy/tmp.txt" << "/home/andy/tmp.txt"; #endif + QTest::newRow("QTBUG-19995") << drivePrefix + "/System/Library/StartupItems/../Frameworks" + << drivePrefix + "/System/Library/Frameworks"; } void tst_QFileInfo::absFilePath() diff --git a/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp b/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp index 016bcbfe8a..2daabee48f 100644 --- a/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp +++ b/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp @@ -68,6 +68,8 @@ private slots: void absoluteOrRelative_data(); void absoluteOrRelative(); #endif + void isClean_data(); + void isClean(); }; #if defined(WIN_STUFF) @@ -383,5 +385,35 @@ void tst_QFileSystemEntry::absoluteOrRelative() } #endif +void tst_QFileSystemEntry::isClean_data() +{ + QTest::addColumn<QString>("path"); + QTest::addColumn<bool>("isClean"); + + QTest::newRow("simple") << "foo" << true; + QTest::newRow("complex") << "/foo/bar/bz" << true; + QTest::newRow(".file") << "/foo/.file" << true; + QTest::newRow("..file") << "/foo/..file" << true; + QTest::newRow("...") << "/foo/.../bar" << true; + QTest::newRow("./") << "./" << false; + QTest::newRow("../") << "../" << false; + QTest::newRow(".") << "." << false; + QTest::newRow("..") << ".." << false; + QTest::newRow("/.") << "/." << false; + QTest::newRow("/..") << "/.." << false; + QTest::newRow("/../") << "foo/../bar" << false; + QTest::newRow("/./") << "foo/./bar" << false; + QTest::newRow("//") << "foo//bar" << false; +} + +void tst_QFileSystemEntry::isClean() +{ + QFETCH(QString, path); + QFETCH(bool, isClean); + + QFileSystemEntry fi(path); + QCOMPARE(fi.isClean(), isClean); +} + QTEST_MAIN(tst_QFileSystemEntry) #include <tst_qfilesystementry.moc> diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index 256bbcf4fc..5ef8d70ef6 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -5086,24 +5086,28 @@ void tst_QString::toUpperLower_icu() QLocale::setDefault(QLocale(QLocale::Turkish, QLocale::Turkey)); + QCOMPARE(s.toUpper(), QString::fromLatin1("I")); + QCOMPARE(s.toLower(), QString::fromLatin1("i")); + // turkish locale has a capital I with a dot (U+0130, utf8 c4b0) + QLocale l; - QCOMPARE(s.toUpper(), QString::fromUtf8("\xc4\xb0")); - QCOMPARE(QString::fromUtf8("\xc4\xb0").toLower(), s); + QCOMPARE(l.toUpper(s), QString::fromUtf8("\xc4\xb0")); + QCOMPARE(l.toLower(QString::fromUtf8("\xc4\xb0")), s); // nothing should happen here - QCOMPARE(s.toLower(), s); - QCOMPARE(QString::fromLatin1("I").toUpper(), QString::fromLatin1("I")); + QCOMPARE(l.toLower(s), s); + QCOMPARE(l.toUpper(QString::fromLatin1("I")), QString::fromLatin1("I")); // U+0131, utf8 c4b1 is the lower-case i without a dot QString sup = QString::fromUtf8("\xc4\xb1"); - QCOMPARE(sup.toUpper(), QString::fromLatin1("I")); - QCOMPARE(QString::fromLatin1("I").toLower(), sup); + QCOMPARE(l.toUpper(sup), QString::fromLatin1("I")); + QCOMPARE(l.toLower(QString::fromLatin1("I")), sup); // nothing should happen here - QCOMPARE(sup.toLower(), sup); - QCOMPARE(QString::fromLatin1("i").toLower(), QString::fromLatin1("i")); + QCOMPARE(l.toLower(sup), sup); + QCOMPARE(l.toLower(QString::fromLatin1("i")), QString::fromLatin1("i")); // the cleanup function will restore the default locale } diff --git a/tests/auto/lancelot/paintcommands.cpp b/tests/auto/lancelot/paintcommands.cpp index 8735baa3f0..9659659973 100644 --- a/tests/auto/lancelot/paintcommands.cpp +++ b/tests/auto/lancelot/paintcommands.cpp @@ -2306,7 +2306,11 @@ void PaintCommands::command_gradient_setRadialExtended(QRegExp re) "focal radius=%.2f, spread=%d\n", cx, cy, rad, fx, fy, frad, m_gradientSpread); +#if QT_VERSION >= 0x040800 QRadialGradient rg(QPointF(cx, cy), rad, QPointF(fx, fy), frad); +#else + QRadialGradient rg(QPointF(cx, cy), rad, QPointF(fx, fy)); +#endif rg.setStops(m_gradientStops); rg.setSpread(m_gradientSpread); rg.setCoordinateMode(m_gradientCoordinate); diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index e49a1d69ed..79a221fa0e 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -62,6 +62,7 @@ public: tst_Lancelot(); static bool simfail; + static PlatformInfo clientInfo; private: enum GraphicsEngine { @@ -98,6 +99,7 @@ private slots: }; bool tst_Lancelot::simfail = false; +PlatformInfo tst_Lancelot::clientInfo; tst_Lancelot::tst_Lancelot() { @@ -112,7 +114,7 @@ void tst_Lancelot::initTestCase() #if defined(Q_OS_SOMEPLATFORM) QSKIP("This test is not supported on this platform.", SkipAll); #endif - if (!proto.connect(QLatin1String("tst_Lancelot"), &dryRunMode)) + if (!proto.connect(QLatin1String("tst_Lancelot"), &dryRunMode, clientInfo)) QSKIP(qPrintable(proto.errorMessage()), SkipAll); #if defined(USE_RUNTIME_DIR) @@ -329,13 +331,26 @@ QTEST_MAIN(tst_Lancelot) int main(int argc, char *argv[]) { + tst_Lancelot::clientInfo = PlatformInfo::localHostInfo(); + char *fargv[20]; int fargc = 0; for (int i = 0; i < qMin(argc, 19); i++) { - if (!qstrcmp(argv[i], "-simfail")) + if (!qstrcmp(argv[i], "-simfail")) { tst_Lancelot::simfail = true; - else + } else if (!qstrcmp(argv[i], "-compareto") && i < argc-1) { + QString arg = QString::fromLocal8Bit(argv[++i]); + int split = arg.indexOf(QLC('=')); + if (split < 0) + continue; + QString key = arg.left(split).trimmed(); + QString value = arg.mid(split+1).trimmed(); + if (key.isEmpty() || value.isEmpty()) + continue; + tst_Lancelot::clientInfo.addOverride(key, value); + } else { fargv[fargc++] = argv[i]; + } } fargv[fargc] = 0; return rmain(fargc, fargv); diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index 68e88a87ed..fde77bca51 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -1728,6 +1728,13 @@ void tst_QLineEdit::passwordEchoDelay() QApplication::sendEvent(testWidget, &ev); QCOMPARE(testWidget->displayText(), QString(7, fillChar) + QLatin1Char('7')); + testWidget->setCursorPosition(3); + QCOMPARE(testWidget->displayText(), QString(7, fillChar) + QLatin1Char('7')); + QTest::keyPress(testWidget, 'a'); + QCOMPARE(testWidget->displayText(), QString(3, fillChar) + QLatin1Char('a') + QString(5, fillChar)); + QTest::keyPress(testWidget, Qt::Key_Backspace); + QCOMPARE(testWidget->displayText(), QString(8, fillChar)); + // restore clean state testWidget->setEchoMode(QLineEdit::Normal); } diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted1.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted1.pem index 3945aea91e..7fc0a054c0 100644 --- a/tests/auto/qsslcertificate/more-certificates/blacklisted1.pem +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted1.pem @@ -2,18 +2,18 @@ MIIDDzCCAnigAwIBAgIQBH7L6fylX3vQnq424QyuHjANBgkqhkiG9w0BAQUFADBf MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50 ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMRgwFgYDVQQDEw9tYWlsLmdvb2dsZS5jb20w -HhcNMTEwMzI0MTMwNjI1WhcNMTEwNDIzMTMwNjI1WjBfMQswCQYDVQQGEwJBVTET +HhcNMTEwODMwMTAxOTI2WhcNMjEwODI3MTAxOTI2WjBfMQswCQYDVQQGEwJBVTET MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ dHkgTHRkMRgwFgYDVQQDEw9tYWlsLmdvb2dsZS5jb20wgZ8wDQYJKoZIhvcNAQEB -BQADgY0AMIGJAoGBAOeAGV2FbGnT4rLjTvCNEEDjj0/iIUATa6RT8WKF2PVaOzbE -oceiODx6hTStvBnCgs+h/d3eVKgp+uAyBde5sW/HlOwHrNgKF3ZDvxegzIOEHaVI -ndNtBpFS3UyOEkO0NxfioBatNRYpeTRU/DVmazu3yvzgrV1V2mDsrNngVWxJAgMB -AAGjgcswgcgwHQYDVR0OBBYEFHcF1eqRpm7B78aY8ZjseN6zSYbvMIGYBgNVHSME -gZAwgY2AFHcF1eqRpm7B78aY8ZjseN6zSYbvoWOkYTBfMQswCQYDVQQGEwJBVTET +BQADgY0AMIGJAoGBANOvJQGm9vyX8f61SP1XDp23sEDS2SAsDNIxdeONmFthfQRh +EBlJMNDByegnImZPMN4tA2T2iKcvdkxyQhC9vnQ+HEqJxxu0EhOwO+UdsSII7Lns +yQZVj2QAoTvC0+MFHPo+wl39JEe3ZytNwQZLjfZSLdS/j0cAyoTkFNconK0bAgMB +AAGjgcswgcgwHQYDVR0OBBYEFGFxxhfk1fvT8zPfLKPE0YYp9HZEMIGYBgNVHSME +gZAwgY2AFGFxxhfk1fvT8zPfLKPE0YYp9HZEoWOkYTBfMQswCQYDVQQGEwJBVTET MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ dHkgTHRkMRgwFgYDVQQDEw9tYWlsLmdvb2dsZS5jb22CEAR+y+n8pV970J6uNuEM -rh4wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQBEb1iF+EbhAJli5Sj2 -+iEdJ5xMP8R6FtgqAYknqXD8+tyEyXxJXdN186qdAWuTD9N22AUqi61BPWxUkufW -xH8FYMEHdFCkitvYE0321+GT5pJz6ON/d5Co+wusumt7T5oSjzj8Ax9V+nmo3Nkb -dSANM4/Lnc6moijcpJZq+GC1ng== +rh4wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQAldVSTJ4lNG9Qxx2GG +/y/ccH/BBYkpPXBklKP/U528Zk48jypWsbnZ07rQrPIlSXYQHffdNH3JsEiF/el9 +bIu+6tGJzmjqvtl5fD5S+yBvI3ySx3Fz6lWmUlqT6UY1X8Oob2PsR6u6mfT8Q1da +d02x97EUSiAzYvzxndqD6g8R1w== -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted2.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted2.pem index 4b8d0599d2..3c8489fbcd 100644 --- a/tests/auto/qsslcertificate/more-certificates/blacklisted2.pem +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted2.pem @@ -2,18 +2,18 @@ MIIDDjCCAnegAwIBAgIRAPXIavNhYvE6ZPVPbclYfAYwDQYJKoZIhvcNAQEFBQAw XjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEXMBUGA1UEAxMOd3d3Lmdvb2dsZS5jb20w -HhcNMTEwMzI0MTMwNzExWhcNMTEwNDIzMTMwNzExWjBeMQswCQYDVQQGEwJBVTET +HhcNMTEwODMwMTAxOTUxWhcNMjEwODI3MTAxOTUxWjBeMQswCQYDVQQGEwJBVTET MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ dHkgTHRkMRcwFQYDVQQDEw53d3cuZ29vZ2xlLmNvbTCBnzANBgkqhkiG9w0BAQEF -AAOBjQAwgYkCgYEAy1fNDFl65Njfcd1EUJeaxvyiKln+JKlqUmk1x4mrE1BQoa0C -QZaiXAF21rDhivWejZWBiEQ4IWbg3b12ANY74G1KqAfLC4BNKS9UP94hy18vezRA -pFc+m/HAClwc8AdACpl8eZpQW8cMgdvnMBMZTrQkgV0JYykX+uDD9Tb+QNUCAwEA -AaOByzCByDAdBgNVHQ4EFgQUSelG6IVRj2ZQbp049zkQ0X/Po9wwgZgGA1UdIwSB -kDCBjYAUSelG6IVRj2ZQbp049zkQ0X/Po9yhYqRgMF4xCzAJBgNVBAYTAkFVMRMw +AAOBjQAwgYkCgYEAriNo6jkVPi+gyynL2YiPBqDsBa4MuM4rQwM7vcHDRO9GizKi +6gV7/loaqvr7zqKnHmoARP6OqxDMMEWfZ4QGJjToVKS6srE7dPJEh1lRzK+bsl02 +xGCP/RKJqnZcW1oUpFUceRBQ8TWynZ1L7cE/YUlOhqXnMO9aPibqbWj8AGcCAwEA +AaOByzCByDAdBgNVHQ4EFgQUo/E6UVU6oRgxQF8yftx0/9dvzMgwgZgGA1UdIwSB +kDCBjYAUo/E6UVU6oRgxQF8yftx0/9dvzMihYqRgMF4xCzAJBgNVBAYTAkFVMRMw EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0 eSBMdGQxFzAVBgNVBAMTDnd3dy5nb29nbGUuY29tghEA9chq82Fi8Tpk9U9tyVh8 -BjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALQyDC/AMQMNj2fa6E8L -umILCklWJwG1K1p/1bUAgm0CB8zm94n1xrh/ZK4+HS+k2a9OQmvLRbFyJn8Wua8p -3UU0267UNkCanA1FKHuO3Mo18wLvjMLWjjCQ4g1C9IvJx6P+8EFDQFG+MJBV/w2k -gJXXVl3q1T1dvahIgfav9QBL +BjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAESHOPB9eAsTKkO4lY8d +EKr2XrRqUkk5KqMFraAHWRekJFwl0R39Q6MDjRHr6NpPJkSKuBPppkr9nk6WDfpt +TG+oN3Yb1rFmJv6eZw8ud9btoquc8jAtaQnihbjFPEP9cCLBw3Gz1C/JBjDw1tgK +zXKNU+jMZYk7c5Z64DocggBH -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted3.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted3.pem index e47ece60dd..fa458cca36 100644 --- a/tests/auto/qsslcertificate/more-certificates/blacklisted3.pem +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted3.pem @@ -2,18 +2,18 @@ MIIDETCCAnqgAwIBAgIRANdVj9r18RBbshMoK3B3KaMwDQYJKoZIhvcNAQEFBQAw XzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4ueWFob28uY29t -MB4XDTExMDMyNDEzMDg0MloXDTExMDQyMzEzMDg0MlowXzELMAkGA1UEBhMCQVUx +MB4XDTExMDgzMDEwMjAzNloXDTIxMDgyNzEwMjAzNlowXzELMAkGA1UEBhMCQVUx EzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMg UHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4ueWFob28uY29tMIGfMA0GCSqGSIb3DQEB -AQUAA4GNADCBiQKBgQCosFLKRvGtxjvdAjWdEAHYycFTa4VtdpXmCNhNHf2xbeLn -xzde10KjEe44pQxNI+UUD1rJkyuH6wUfloyefn0D2Mu+MvusmvOEzFosa4EDbK9s -BAAlsSiyJgrp/GgbEPq/XOl4XJRBIVP1WC6LllduNbskFCipDqS+HQwifXmmwQID -AQABo4HMMIHJMB0GA1UdDgQWBBSEgWnsoYtd5GEx/MGJvKxuIuROJzCBmQYDVR0j -BIGRMIGOgBSEgWnsoYtd5GEx/MGJvKxuIuROJ6FjpGEwXzELMAkGA1UEBhMCQVUx +AQUAA4GNADCBiQKBgQC3TVwiPfNClgadKYuX50szBlIaVWDd+UFHsakbGk0bgqlu +YKgC/cmbjgOyrmsEC2HbJISceTz9CK6mCewEgGFWuq6gjYi4UnSFk1o6h6WJV86A +tLpeVti7lN9/04IW7XHyxuhvS71V+JWlqfu3zboyaVoMIlHDrPFtRiAh7vTTjQID +AQABo4HMMIHJMB0GA1UdDgQWBBQrVExlI4rixsrub6IMDDsLPNB4ezCBmQYDVR0j +BIGRMIGOgBQrVExlI4rixsrub6IMDDsLPNB4e6FjpGEwXzELMAkGA1UEBhMCQVUx EzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMg UHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4ueWFob28uY29tghEA11WP2vXxEFuyEygr -cHcpozAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAKNpIrzTOxIykKZt -EE6HU2nW1lrWUkIMjwjL8ntw7QI4JLMDN1ADVIxWaGTeQ+U/eXFou6dDNAYVAijK -ONDXgOItxW2YvSw0wOZsZj6INX2x88/0yRH+19TqaL/r+Y1D1h/0zefkHgfXufnY -Ex7BHju/rGBTp6R1mr+Tlh1tewva +cHcpozAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAFB5SF2ujZzH9KMj +m4ZDTsyy94/YQZdwgLncKUYTxmZe4BdX+42j799pCG+UeQGwqz9hU/soPgibAvGT +1KCEGQ6qtWSqKJYmC8VKenYvvEFIySj5cbSFmId5aNwhjl8AYoLuM0E+2FRVJQ6a +pWyzYUIOqhsCkt9hEPsDVP4hIhP+ -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted4.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted4.pem index 64c7d41516..53761bb36a 100644 --- a/tests/auto/qsslcertificate/more-certificates/blacklisted4.pem +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted4.pem @@ -2,18 +2,18 @@ MIIDDzCCAnigAwIBAgIQOSpDTw4H3x+KowXeNODCKTANBgkqhkiG9w0BAQUFADBf MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50 ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMRgwFgYDVQQDEw9sb2dpbi55YWhvby5jb20w -HhcNMTEwMzI0MTMwOTE1WhcNMTEwNDIzMTMwOTE1WjBfMQswCQYDVQQGEwJBVTET +HhcNMTEwODMwMTAyMTE5WhcNMjEwODI3MTAyMTE5WjBfMQswCQYDVQQGEwJBVTET MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ dHkgTHRkMRgwFgYDVQQDEw9sb2dpbi55YWhvby5jb20wgZ8wDQYJKoZIhvcNAQEB -BQADgY0AMIGJAoGBANO2gz9x2H92xz5OvZSEul9gHxqqd+kdjeoS2exyvjC9wzqb -gYXqNmAsbtNp4WmieEQFd0riCAEkIAn8JpHTCsMHN4rHhS+W+4D5a/drI2jfnZEF -orNYJG1PHSQV/rvh6d7wkVdT+0SYOjrFTAA2biGWaK3W9ztf2yX577w+uQtBAgMB -AAGjgcswgcgwHQYDVR0OBBYEFJjDp8Prs7oReRmskIeFixp0vDkGMIGYBgNVHSME -gZAwgY2AFJjDp8Prs7oReRmskIeFixp0vDkGoWOkYTBfMQswCQYDVQQGEwJBVTET +BQADgY0AMIGJAoGBAML+Z5hpY4VfSeTPbMCGaqe5shwcw3yW/egYY6cXcfxtUkjs +Eai48hP/sqtQeFwi3puJ7HO2iGUX72/UnO0t9qwEGtGOHS1qqAYdTcncY5pTpO9L +e4Tn6CkPwFE4VNXVU96xPlUjP/KBZ43VH6gW3M1xDI0DmNh2QUXHN5ErQE8nAgMB +AAGjgcswgcgwHQYDVR0OBBYEFI+gG6PT7vQtUVn2xf+wCYZV5Ht8MIGYBgNVHSME +gZAwgY2AFI+gG6PT7vQtUVn2xf+wCYZV5Ht8oWOkYTBfMQswCQYDVQQGEwJBVTET MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ dHkgTHRkMRgwFgYDVQQDEw9sb2dpbi55YWhvby5jb22CEDkqQ08OB98fiqMF3jTg -wikwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQAZyo0Q3leeM1+lxeCd -Wp0ZYHMSW11ANc6nuMWOmJC+nIQGlyGiP3IqeUvIfekwboV638bahVPwcl2HYWsS -/l01Bgyd25Zn6VTQBfMK01dILyxscjVwdHuojzYBN05sl+qkVoqQr5EroQQbgDc9 -6I88p6Kjajv3IusCwfK6wlqISw== +wikwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQA3eZG/dOXrL7YBPCA8 +joDGfhra98T1iCpul4/L/L4dt/9+QVAu+agbZmHWLYzuAvuB1zj8go0BLIE7b4ap +HPLFYXV3iAWjIRhNEix4FWohlds1B+IwpvWdsl3Op1pZfHQ0yq8wFGawdQTAKUII +lLu1cd6E8B6pCfWwSr+9h6gnTg== -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted5.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted5.pem index c7ddbf2839..81211ee694 100644 --- a/tests/auto/qsslcertificate/more-certificates/blacklisted5.pem +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted5.pem @@ -2,18 +2,18 @@ MIIDDzCCAnigAwIBAgIQPnXO1GtpMCEhiDCuhqgqcTANBgkqhkiG9w0BAQUFADBf MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50 ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMRgwFgYDVQQDEw9sb2dpbi55YWhvby5jb20w -HhcNMTEwMzI0MTMwOTQ4WhcNMTEwNDIzMTMwOTQ4WjBfMQswCQYDVQQGEwJBVTET +HhcNMTEwODMwMTAyMTQ4WhcNMjEwODI3MTAyMTQ4WjBfMQswCQYDVQQGEwJBVTET MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ dHkgTHRkMRgwFgYDVQQDEw9sb2dpbi55YWhvby5jb20wgZ8wDQYJKoZIhvcNAQEB -BQADgY0AMIGJAoGBALkiHG9TgTw/00CMW8D23NBDAa3331AL5kTkAaXbAWg2R/1o -yKQfXq3hgHbyWGPccUT+tU6FmaBf3bIndLK7iGx81RGzGgXeoQ5mpgnJ50iCeW73 -G99VlVwutPia7d9qqui84YdcG9t+P2Fuxv+xRqAB6lKOaa4qTPIbH50PgwOvAgMB -AAGjgcswgcgwHQYDVR0OBBYEFBWJrs8bnZ5fikfaLbTxK0ssj69MMIGYBgNVHSME -gZAwgY2AFBWJrs8bnZ5fikfaLbTxK0ssj69MoWOkYTBfMQswCQYDVQQGEwJBVTET +BQADgY0AMIGJAoGBAL5IeUbbQ7HxCBLQaOASV2HyI1tRwPm/7JNsRfh5ipM1sCWE +xnPoqFznX6ZUKi8d61/EIycwUd+FvOp9zoRxDlngoRdhqMCTTG3JfxNf6ZXJPCYd +qPjOKAkMwyG8bbhGCsoCws9b2rpN9536qVXc2QR39F9/ZE5t73oKtEd1fyNnAgMB +AAGjgcswgcgwHQYDVR0OBBYEFNXCkfGdW3WYzBBqB2jWppl6sL99MIGYBgNVHSME +gZAwgY2AFNXCkfGdW3WYzBBqB2jWppl6sL99oWOkYTBfMQswCQYDVQQGEwJBVTET MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ dHkgTHRkMRgwFgYDVQQDEw9sb2dpbi55YWhvby5jb22CED51ztRraTAhIYgwroao -KnEwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCIfqqs1a7RzdmV8U00 -v/xAsxscKvQvmu6BK+HwvY5iL2pSwXTYgRLJLoj5QGOd3mmgOFsyW3BPSCP1+fVE -M1ROhU2u8wHub+hGGds18Fx6F4yZjdh8pNUoOUR9A0Ym+VDJr2p50oUNTTy0RbH8 -9ns/gbemx84cjF9DD2G5stQhYg== +KnEwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCOeih7N7fmkqECWZD/ +bYsFLtbKOwD4YMPIV2wayvaLg2dFwqhBkGml+5ulOh5KTiUh0/nnGmGAU/3K9nt5 +TCMjwMGHm/C5pp7THQriiY8Qw0QVtnFiJGnjblhAbJVIvBJJ42/Qq7T4IzEwqShW +hO2g1M0MUGiOw4vyXJRGc4dg2w== -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted6.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted6.pem index bc2be2adcf..4264a678f1 100644 --- a/tests/auto/qsslcertificate/more-certificates/blacklisted6.pem +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted6.pem @@ -2,18 +2,18 @@ MIIDETCCAnqgAwIBAgIRAOkCi5V45BXcGnEKK4gVREcwDQYJKoZIhvcNAQEFBQAw XzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4uc2t5cGUuY29t -MB4XDTExMDMyNDEzMTAxNloXDTExMDQyMzEzMTAxNlowXzELMAkGA1UEBhMCQVUx +MB4XDTExMDgzMDEwMjIxOFoXDTIxMDgyNzEwMjIxOFowXzELMAkGA1UEBhMCQVUx EzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMg UHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4uc2t5cGUuY29tMIGfMA0GCSqGSIb3DQEB -AQUAA4GNADCBiQKBgQDFq06qqRl86pP7GRX3m7FMMSaSU6zlNGAo+WPoRfYAzB6x -5KpvlfxMCo3T/nWtInX3Bw9TBWCZSweQ2GEjggO0irjw5UX3MiToLxK+rwzWztm9 -H3LBxTWR0cOOa78kRFvNQ1onvNHbs8fJzXjG7b2IJDOIwG1HAT1LK80oPXZc1wID -AQABo4HMMIHJMB0GA1UdDgQWBBTiGNxw0ImW/wfW0mD3eA65PY5CAzCBmQYDVR0j -BIGRMIGOgBTiGNxw0ImW/wfW0mD3eA65PY5CA6FjpGEwXzELMAkGA1UEBhMCQVUx +AQUAA4GNADCBiQKBgQDAAkuUFRdz1bm95jFsyQRb4PBrly4pJK4f5pSZy99eY8FM +iZbr7brnkiheN4qeJfS1dv/B/B4kAVoGD2Y0KmpZ5ZZYmm3TxopoP0Yeg6juWNKa +iFlfKQIvk0GEmD8oGfEqW1+72p040jAuTn+OQx+7VpydqB/RJoY8qK3zEXbB7wID +AQABo4HMMIHJMB0GA1UdDgQWBBSE9drle8VwSlwYIX5mKaIEvQYX/zCBmQYDVR0j +BIGRMIGOgBSE9drle8VwSlwYIX5mKaIEvQYX/6FjpGEwXzELMAkGA1UEBhMCQVUx EzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMg UHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4uc2t5cGUuY29tghEA6QKLlXjkFdwacQor -iBVERzAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAHdb1QY/oxuro/4x -GX9jbm930ysoeXkWZSKVtVxoxrPIferu8jVpb1SLRjGcMnmjJoNWNFpvnbZgoYei -f3wdSWun7ndyQBh61k8eM7UABDOUXUHOsHuHj7s1koMKtet4gykmMfd6VxBkwBvN -ZXOll4X+TKe8nrxbnGUByIwQaRM+ +iBVERzAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBACm4/Q6e001Fg9uu +ieqHOAxfBafkOsXtgKqTFFdpt9Hbmo9j/BfvrtvfFN5Ph4fV46useGjW79P1IeNK ++KqcaqOKy2q6j1em4j8C5Mx6S4ksZJC25jIPEM7cdxiDGcV505X5mynlu1+WkZAf +nQhnJpA8o3p462ON4S+GXTfOLfoN -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted7.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted7.pem index 19d4353fab..03ab7d46b0 100644 --- a/tests/auto/qsslcertificate/more-certificates/blacklisted7.pem +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted7.pem @@ -2,18 +2,18 @@ MIIDGjCCAoOgAwIBAgIRAJI51TSPQNFpWnRUcOHyP0MwDQYJKoZIhvcNAQEFBQAw YjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEbMBkGA1UEAxMSYWRkb25zLm1vemlsbGEu -b3JnMB4XDTExMDMyNDEzMTA0NFoXDTExMDQyMzEzMTA0NFowYjELMAkGA1UEBhMC +b3JnMB4XDTExMDgzMDEwMjIzOVoXDTIxMDgyNzEwMjIzOVowYjELMAkGA1UEBhMC QVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdp dHMgUHR5IEx0ZDEbMBkGA1UEAxMSYWRkb25zLm1vemlsbGEub3JnMIGfMA0GCSqG -SIb3DQEBAQUAA4GNADCBiQKBgQC1lsoAcZTwF8Pf0E9do5avLdobB/O7EhhrCMs2 -/EMO07aIlrLwl3UP/Fmu/cAkKuX8Mx+Eif9x+XT3ZqGKGYKiqPTJcNfeZvgwbn0j -wXDtEo4DuURrwtBU9okS+v4dF6F4RtHQKAGcsXoOjhR7ah71kve+PG2GG0sJ167V -klK1xwIDAQABo4HPMIHMMB0GA1UdDgQWBBRgGDJ4Qp0WFyLIzm4Nz5wgqDSSxjCB -nAYDVR0jBIGUMIGRgBRgGDJ4Qp0WFyLIzm4Nz5wgqDSSxqFmpGQwYjELMAkGA1UE +SIb3DQEBAQUAA4GNADCBiQKBgQC9Yo3DJvs+vewelK5qoK+0Xn4zeRIQ/wJCrQBg +5tNXja+NZsHb0/enlwAZ3dAwCfI0G12mTowgSuZyDX7oN2+G+k6Q5LPnGhj1E5s5 +OJ+ZYsAjTdU0SCAPquva55+jyhqo5w/B5Il7w84mppUrAZgqEGhYkhXeDOULe1Vm +4iLMQwIDAQABo4HPMIHMMB0GA1UdDgQWBBSb8lAIgOnUitVOuZIx3s+5MN1sBzCB +nAYDVR0jBIGUMIGRgBSb8lAIgOnUitVOuZIx3s+5MN1sB6FmpGQwYjELMAkGA1UE BhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdp ZGdpdHMgUHR5IEx0ZDEbMBkGA1UEAxMSYWRkb25zLm1vemlsbGEub3JnghEAkjnV -NI9A0WladFRw4fI/QzAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBACeE -DHMQ+LWEuoa/6z2EgrgM1k9rvBbUtCR+rjTuyzVW4OLXdpiVwZPOAiKphpq7q8Sb -TQ3zwsCoPLLJk5VolwcPfcD8Y2/tYK3NCYl+HzGxxnzPDFVaZM5Jh8RI861Hc00D -hVoQaptPK/V/lr0KEevqjhusAdFZbwlWA923zASa +NI9A0WladFRw4fI/QzAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAFpg +tcp6ynOZ/hwr2axTYK+4rtXmTUJdsg7NUHhXSwGANAuYuc7PYwqtmz3B2W90t3TA +D3pNMRBEXrBXufC0p9vu/hQgb+mdQ7DG6j1Gkkpq4Sq/Puv1bO96KpAufmevnWWB +48kzCgAdfk/N04k7kdPHCp5MjjgmY3kGdsg+jroj -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted8.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted8.pem index aedf3f7010..acef06ffb0 100644 --- a/tests/auto/qsslcertificate/more-certificates/blacklisted8.pem +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted8.pem @@ -2,18 +2,18 @@ MIIDDjCCAnegAwIBAgIRALC3Ez7Qlvm1b66RyHS9OsAwDQYJKoZIhvcNAQEFBQAw XjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEXMBUGA1UEAxMObG9naW4ubGl2ZS5jb20w -HhcNMTEwMzI0MTMxMTA2WhcNMTEwNDIzMTMxMTA2WjBeMQswCQYDVQQGEwJBVTET +HhcNMTEwODMwMTAyMzA0WhcNMjEwODI3MTAyMzA0WjBeMQswCQYDVQQGEwJBVTET MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ dHkgTHRkMRcwFQYDVQQDEw5sb2dpbi5saXZlLmNvbTCBnzANBgkqhkiG9w0BAQEF -AAOBjQAwgYkCgYEA3OVNj9ijzMewvDeZYzgCWoKtyjclyIHxrQfHZpcexaKbxUap -1MtF6L0ayjtRWpiBYuPteUSy/Ja4Oh6zZz8K6z5rVgXhmy3xPIYuOoWaTKEOhb0Z -oHTBtGh8aWWai1XWw37HIm2FP8cmfgdH4lZwVvpTZIUxYidsyqyjB9IrhiMCAwEA -AaOByzCByDAdBgNVHQ4EFgQU4CcQcIvEhJC0tqHlNFMkv6MlDN4wgZgGA1UdIwSB -kDCBjYAU4CcQcIvEhJC0tqHlNFMkv6MlDN6hYqRgMF4xCzAJBgNVBAYTAkFVMRMw +AAOBjQAwgYkCgYEA5JK77+1zFatj8xeItZaDW5XaU+ssc5jq2Ww4ANaxJi+wdRVU +qVLauEJPKEXC51fuYHa7U8yoSTgJZA7JL07cdSxgsVj8RR4Uf5k4Jf5Vdz5w8+TT +W33I3zurA2xB+wfup2VPmS8Alg07w6POrzlQYgtcUcELZhjcdypk96NOdPECAwEA +AaOByzCByDAdBgNVHQ4EFgQUTWM20msyZUcNEYOyNbgevBPIoF8wgZgGA1UdIwSB +kDCBjYAUTWM20msyZUcNEYOyNbgevBPIoF+hYqRgMF4xCzAJBgNVBAYTAkFVMRMw EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0 eSBMdGQxFzAVBgNVBAMTDmxvZ2luLmxpdmUuY29tghEAsLcTPtCW+bVvrpHIdL06 -wDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAMNzIStXDNSNQ8ayxrcj -4RrUMsHWUG/6XPrgfYqCP5TfPGAa5qBfNb9LfUbiS4b0flJVN1RlHVwwRo0yf9v4 -LGg0dSuPQAOWlLeUR1GminO1jHZw7E4dYfR7QEmiiOgaQU+CbxLsf5vCaKInN9Gu -jv/5xytVCbMoLoZ4EBVb0tka +wDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBACQqnu1KywflnNiqIU01 +95z/qjmZTvSWafM/HLOFUg8ls7g32l5gCCrsc8ypiCff+S3+9teYQOII7oW3hzw4 +BH10m0LTRxGig5U9XVkH4076SALkPoky1z+onMmLk7AE96kSJ+rq30VvcSSl9BaW +DwcQGIhCZANgZrNW9AJ+cweQ -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted9.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted9.pem index d179b29288..cc99b08e5f 100644 --- a/tests/auto/qsslcertificate/more-certificates/blacklisted9.pem +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted9.pem @@ -2,18 +2,18 @@ MIIDDjCCAnegAwIBAgIRANjzX063hystqwaS4xU4L7AwDQYJKoZIhvcNAQEFBQAw XjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEXMBUGA1UEAxMOZ2xvYmFsIHRydXN0ZWUw -HhcNMTEwMzI0MTMxMTM3WhcNMTEwNDIzMTMxMTM3WjBeMQswCQYDVQQGEwJBVTET +HhcNMTEwODMwMTAyMzI1WhcNMjEwODI3MTAyMzI1WjBeMQswCQYDVQQGEwJBVTET MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ dHkgTHRkMRcwFQYDVQQDEw5nbG9iYWwgdHJ1c3RlZTCBnzANBgkqhkiG9w0BAQEF -AAOBjQAwgYkCgYEArHCVym7AEZDBhDkrUSG3Q94a+caNcCk5fE6ltZHiZHv096xr -cixHYvSGvms780bkI+oot2xI/e9awwkV+7VjWNvr0HrajzBWeimwk+myjP+3ddMY -Kmr0eI6bmvmPHtOFJE5Ar8/62FwD0wlLogRIx56JtXcCpkiUQktJVPz2gtMCAwEA -AaOByzCByDAdBgNVHQ4EFgQUUJwC/qSGBmcB+DVrd43ovRLdLmQwgZgGA1UdIwSB -kDCBjYAUUJwC/qSGBmcB+DVrd43ovRLdLmShYqRgMF4xCzAJBgNVBAYTAkFVMRMw +AAOBjQAwgYkCgYEAw0CpZXrd6oI8/PHo8/bnNwB7UA7OKsRFuqKljr9F5lCJAVkT +zRDlXuTDeXGfQiYhJTF7GRunPRJ7O5SsflwoxktH/F91yFpgxY5DqRZ1ZHdZgW3b +W0uweBxJv9684ihXY4YR3Yznf0js7YAgVd8a3qhOUODiC/Beb8tmDBNL2c0CAwEA +AaOByzCByDAdBgNVHQ4EFgQU/rUvQ2rG7pg2muUiLm6V93ZgmGcwgZgGA1UdIwSB +kDCBjYAU/rUvQ2rG7pg2muUiLm6V93ZgmGehYqRgMF4xCzAJBgNVBAYTAkFVMRMw EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0 eSBMdGQxFzAVBgNVBAMTDmdsb2JhbCB0cnVzdGVlghEA2PNfTreHKy2rBpLjFTgv -sDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBACAYxI+r3+JNelL6SBB0 -Pda3LkbCm+schP64NBYDdGl2Kus2b2QZ83T7xENBFEhyNoXvc6pRI4/Oh6JDxmG1 -7WmqOVStS/4JeAu6ygiyI1ImRKq2/MvJx/kaKh6IiXanB5nW1U+fhDV6kMOEfpwV -i6FBibpHboPQoqzPPRe7qHSL +sDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALvmmUx47DcUAIsPkI0Y +DTvcXV6k2JHwdrdlPsrn9A5TLppfxPNrDMiweitr8cMkKEtkm6LRTt2yvDFcMIwy +/+F5+XO0k9sKde6xHfWvOvndIycj3Lt4tIRW8jUauJENyMa4M57qpqkgkJEmflkI +/pb9fQZbfg70o9wvbNK0RONo -----END CERTIFICATE----- diff --git a/tests/auto/qsslsocket/qsslsocket.pro b/tests/auto/qsslsocket/qsslsocket.pro index 76d73b7cb3..1f5c7f6aaf 100644 --- a/tests/auto/qsslsocket/qsslsocket.pro +++ b/tests/auto/qsslsocket/qsslsocket.pro @@ -15,6 +15,17 @@ win32 { } } +# OpenSSL support +contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) { + symbian { + INCLUDEPATH *= $$OS_LAYER_SSL_SYSTEMINCLUDE + } else { + include($$QT_SOURCE_TREE/config.tests/unix/openssl/openssl.pri) + } + # Add optional SSL libs + LIBS += $$OPENSSL_LIBS +} + wince* { DEFINES += SRCDIR=\\\"./\\\" diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 7f613241a0..ee2d15b1ff 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -54,9 +54,10 @@ #include <QNetworkProxy> #include <QAuthenticator> -#include <private/qhostinfo_p.h> +#include "private/qhostinfo_p.h" #ifndef QT_NO_OPENSSL -# include <private/qsslsocket_openssl_p.h> +#include "private/qsslsocket_openssl_p.h" +#include "private/qsslsocket_openssl_symbols_p.h" #endif #include "../network-settings.h" @@ -148,6 +149,7 @@ private slots: void peerCertificate(); void peerCertificateChain(); void privateKey(); + void privateKeyOpaque(); void protocol(); void protocolServerSide_data(); void protocolServerSide(); @@ -766,6 +768,34 @@ void tst_QSslSocket::privateKey() { } +void tst_QSslSocket::privateKeyOpaque() +{ + if (!QSslSocket::supportsSsl()) + return; + + QFile file(SRCDIR "certs/fluke.key"); + QVERIFY(file.open(QIODevice::ReadOnly)); + QSslKey key(file.readAll(), QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey); + QVERIFY(!key.isNull()); + + EVP_PKEY *pkey = q_EVP_PKEY_new(); + q_EVP_PKEY_set1_RSA(pkey, reinterpret_cast<RSA *>(key.handle())); + + // This test does not make 100% sense yet. We just set some local CA/cert/key and use it + // to authenticate ourselves against the server. The server does not actually check this + // values. This test should just run the codepath inside qsslsocket_openssl.cpp + + QSslSocketPtr socket = newSocket(); + QList<QSslCertificate> localCert = QSslCertificate::fromPath(SRCDIR "certs/qt-test-server-cacert.pem"); + socket->setCaCertificates(localCert); + socket->setLocalCertificate(QLatin1String(SRCDIR "certs/fluke.cert")); + socket->setPrivateKey(QSslKey(reinterpret_cast<Qt::HANDLE>(pkey))); + + socket->setPeerVerifyMode(QSslSocket::QueryPeer); + socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + QVERIFY(socket->waitForEncrypted(10000)); +} + void tst_QSslSocket::protocol() { if (!QSslSocket::supportsSsl()) diff --git a/tests/auto/selftests/assert/assert.pro b/tests/auto/selftests/assert/assert.pro index e8d60bda6d..a1ed578a31 100644 --- a/tests/auto/selftests/assert/assert.pro +++ b/tests/auto/selftests/assert/assert.pro @@ -8,7 +8,5 @@ QT = core mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target -!win32:CONFIG += debug - TARGET = assert diff --git a/tests/auto/selftests/assert/tst_assert.cpp b/tests/auto/selftests/assert/tst_assert.cpp index 6e1fbdb509..bd44162971 100644 --- a/tests/auto/selftests/assert/tst_assert.cpp +++ b/tests/auto/selftests/assert/tst_assert.cpp @@ -39,6 +39,10 @@ ** ****************************************************************************/ +// Make sure we get a real Q_ASSERT even in release builds +#ifdef QT_NO_DEBUG +# undef QT_NO_DEBUG +#endif #include <QtCore> #include <QtTest/QtTest> diff --git a/tests/auto/selftests/badxml/badxml.pro b/tests/auto/selftests/badxml/badxml.pro index f55636de2b..126ac379d7 100644 --- a/tests/auto/selftests/badxml/badxml.pro +++ b/tests/auto/selftests/badxml/badxml.pro @@ -8,7 +8,6 @@ QT = core mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target -!win32:CONFIG += debug TARGET = badxml diff --git a/tests/auto/selftests/expected_assert.lightxml b/tests/auto/selftests/expected_assert.lightxml index f49cdf0826..c9a1978e9e 100644 --- a/tests/auto/selftests/expected_assert.lightxml +++ b/tests/auto/selftests/expected_assert.lightxml @@ -3,16 +3,16 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="testNumber1"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="testNumber2"> -<Incident type="fail" file="Unknown file" line="0"> <Message type="qfatal" file="" line="0"> - <Description><![CDATA[ASSERT: "false" in file /local/user_builds/qt/4.6/tests/auto/selftests/assert/tst_assert.cpp, line 62]]></Description> + <Description><![CDATA[ASSERT: "false" in file tst_assert.cpp, line 62]]></Description> </Message> +<Incident type="fail" file="Unknown file" line="0"> <Description><![CDATA[Received a fatal error.]]></Description> </Incident> </TestFunction> diff --git a/tests/auto/selftests/expected_assert.txt b/tests/auto/selftests/expected_assert.txt index 0203f2b74e..f57eb55604 100644 --- a/tests/auto/selftests/expected_assert.txt +++ b/tests/auto/selftests/expected_assert.txt @@ -2,7 +2,7 @@ Config: Using QTest library 4.3.0, Qt 4.3.0 PASS : tst_Assert::initTestCase() PASS : tst_Assert::testNumber1() -QFATAL : tst_Assert::testNumber2() ASSERT: "false" in file /home/fenglich/dev/qt-4.3/tests/auto/selftests/assert/tst_assert.cpp, line 29 +QFATAL : tst_Assert::testNumber2() ASSERT: "false" in file tst_assert.cpp, line 62 FAIL! : tst_Assert::testNumber2() Received a fatal error. Loc: [Unknown file(0)] Totals: 2 passed, 1 failed, 0 skipped diff --git a/tests/auto/selftests/expected_assert.xml b/tests/auto/selftests/expected_assert.xml index 3a7152c71a..60085aa2b9 100644 --- a/tests/auto/selftests/expected_assert.xml +++ b/tests/auto/selftests/expected_assert.xml @@ -12,7 +12,7 @@ </TestFunction> <TestFunction name="testNumber2"> <Message type="qfatal" file="" line="0"> - <Description><![CDATA[ASSERT: "false" in file /local/user_builds/qt/4.6/tests/auto/selftests/assert/tst_assert.cpp, line 62]]></Description> + <Description><![CDATA[ASSERT: "false" in file tst_assert.cpp, line 62]]></Description> </Message> <Incident type="fail" file="Unknown file" line="0"> <Description><![CDATA[Received a fatal error.]]></Description> diff --git a/tests/auto/selftests/expected_assert.xunitxml b/tests/auto/selftests/expected_assert.xunitxml index 2a7d5ebce8..87617003c5 100644 --- a/tests/auto/selftests/expected_assert.xunitxml +++ b/tests/auto/selftests/expected_assert.xunitxml @@ -7,10 +7,10 @@ <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="testNumber1"/> <testcase result="fail" name="testNumber2"> - <!-- message="ASSERT: "false" in file /local/user_builds/qt/4.6/tests/auto/selftests/assert/tst_assert.cpp, line 62" type="qfatal" --> + <!-- message="ASSERT: "false" in file tst_assert.cpp, line 62" type="qfatal" --> <failure message="Received a fatal error." result="fail"/> </testcase> <system-err> -<![CDATA[ASSERT: "false" in file /local/user_builds/qt/4.6/tests/auto/selftests/assert/tst_assert.cpp, line 62]]> +<![CDATA[ASSERT: "false" in file tst_assert.cpp, line 62]]> </system-err> </testsuite> diff --git a/tests/auto/selftests/expected_badxml.lightxml b/tests/auto/selftests/expected_badxml.lightxml index 0875a62bae..19bec33e1e 100644 --- a/tests/auto/selftests/expected_badxml.lightxml +++ b/tests/auto/selftests/expected_badxml.lightxml @@ -3,47 +3,64 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="badDataTag"> -<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/badxml/tst_badxml.cpp" line="109"> <Message type="qdebug" file="" line="0"> + <DataTag><![CDATA[end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag> <Description><![CDATA[a message]]></Description> </Message> +<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/badxml/tst_badxml.cpp" line="109"> + <DataTag><![CDATA[end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag> <Description><![CDATA[a failure]]></Description> +</Incident> <BenchmarkResult metric="Events" tag="end cdata ]]> text ]]> more text" value="0" iterations="1" /> <Message type="qdebug" file="" line="0"> + <DataTag><![CDATA[quotes " text" more text]]></DataTag> <Description><![CDATA[a message]]></Description> </Message> +<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/badxml/tst_badxml.cpp" line="109"> + <DataTag><![CDATA[quotes " text" more text]]></DataTag> <Description><![CDATA[a failure]]></Description> +</Incident> <BenchmarkResult metric="Events" tag="quotes " text" more text" value="0" iterations="1" /> <Message type="qdebug" file="" line="0"> + <DataTag><![CDATA[xml close > open < tags < text]]></DataTag> <Description><![CDATA[a message]]></Description> </Message> +<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/badxml/tst_badxml.cpp" line="109"> + <DataTag><![CDATA[xml close > open < tags < text]]></DataTag> <Description><![CDATA[a failure]]></Description> +</Incident> <BenchmarkResult metric="Events" tag="xml close > open < tags < text" value="0" iterations="1" /> <Message type="qdebug" file="" line="0"> + <DataTag><![CDATA[all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag> <Description><![CDATA[a message]]></Description> </Message> +<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/badxml/tst_badxml.cpp" line="109"> + <DataTag><![CDATA[all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag> <Description><![CDATA[a failure]]></Description> -<BenchmarkResult metric="Events" tag="all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs" value="0" iterations="1" /> </Incident> +<BenchmarkResult metric="Events" tag="all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs" value="0" iterations="1" /> </TestFunction> <TestFunction name="badMessage"> -<Incident type="pass" file="" line="0"> <Message type="qdebug" file="" line="0"> + <DataTag><![CDATA[string 0]]></DataTag> <Description><![CDATA[end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></Description> </Message> <Message type="qdebug" file="" line="0"> + <DataTag><![CDATA[string 1]]></DataTag> <Description><![CDATA[quotes " text" more text]]></Description> </Message> <Message type="qdebug" file="" line="0"> + <DataTag><![CDATA[string 2]]></DataTag> <Description><![CDATA[xml close > open < tags < text]]></Description> </Message> <Message type="qdebug" file="" line="0"> + <DataTag><![CDATA[string 3]]></DataTag> <Description><![CDATA[all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></Description> </Message> -</Incident> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="failWithNoFile"> <Incident type="fail" file="" line="0"> @@ -51,5 +68,5 @@ </Incident> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_benchlibcallgrind.lightxml b/tests/auto/selftests/expected_benchlibcallgrind.lightxml index bdc3d77212..c2394e545e 100644 --- a/tests/auto/selftests/expected_benchlibcallgrind.lightxml +++ b/tests/auto/selftests/expected_benchlibcallgrind.lightxml @@ -3,13 +3,12 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="twoHundredMillionInstructions"> -<Incident type="pass" file="" line="0"> <BenchmarkResult metric="InstructionReads" tag="" value="200000000" iterations="1" /> -</Incident> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_benchlibeventcounter.lightxml b/tests/auto/selftests/expected_benchlibeventcounter.lightxml index 218f4c8916..3bede6de83 100644 --- a/tests/auto/selftests/expected_benchlibeventcounter.lightxml +++ b/tests/auto/selftests/expected_benchlibeventcounter.lightxml @@ -3,10 +3,9 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="events"> -<Incident type="pass" file="" line="0"> <BenchmarkResult metric="Events" tag="0" value="0" iterations="1" /> <BenchmarkResult metric="Events" tag="1" value="1" iterations="1" /> <BenchmarkResult metric="Events" tag="10" value="10" iterations="1" /> @@ -14,8 +13,8 @@ <BenchmarkResult metric="Events" tag="500" value="500" iterations="1" /> <BenchmarkResult metric="Events" tag="5000" value="5000" iterations="1" /> <BenchmarkResult metric="Events" tag="100000" value="100000" iterations="1" /> -</Incident> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_benchliboptions.lightxml b/tests/auto/selftests/expected_benchliboptions.lightxml index 7a42cc750f..63d0218b2c 100644 --- a/tests/auto/selftests/expected_benchliboptions.lightxml +++ b/tests/auto/selftests/expected_benchliboptions.lightxml @@ -3,7 +3,7 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="threeEvents"> <Incident type="pass" file="" line="0"> @@ -11,5 +11,5 @@ </Incident> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_benchlibtickcounter.lightxml b/tests/auto/selftests/expected_benchlibtickcounter.lightxml index ea926c2073..845fd9c161 100644 --- a/tests/auto/selftests/expected_benchlibtickcounter.lightxml +++ b/tests/auto/selftests/expected_benchlibtickcounter.lightxml @@ -3,7 +3,7 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="threeBillionTicks"> <Incident type="pass" file="" line="0"> @@ -11,5 +11,5 @@ </Incident> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_benchlibwalltime.lightxml b/tests/auto/selftests/expected_benchlibwalltime.lightxml index 500647d606..f1d89328ef 100644 --- a/tests/auto/selftests/expected_benchlibwalltime.lightxml +++ b/tests/auto/selftests/expected_benchlibwalltime.lightxml @@ -3,7 +3,7 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<ncident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="waitForOneThousand"> <Incident type="pass" file="" line="0"> @@ -21,5 +21,5 @@ </Incident> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_cmptest.lightxml b/tests/auto/selftests/expected_cmptest.lightxml index a6d35e47ac..72d1caf5f8 100644 --- a/tests/auto/selftests/expected_cmptest.lightxml +++ b/tests/auto/selftests/expected_cmptest.lightxml @@ -3,30 +3,40 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="compare_boolfuncs"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="compare_pointerfuncs"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="compare_tostring"> <Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/cmptest/tst_cmptest.cpp" line="122"> + <DataTag><![CDATA[int, string]]></DataTag> <Description><![CDATA[Compared values are not the same Actual (actual): QVariant(int,123) Expected (expected): QVariant(QString,hi)]]></Description> +</Incident> +<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/cmptest/tst_cmptest.cpp" line="122"> + <DataTag><![CDATA[null hash, invalid]]></DataTag> <Description><![CDATA[Compared values are not the same Actual (actual): QVariant(QVariantHash) Expected (expected): QVariant()]]></Description> +</Incident> +<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/cmptest/tst_cmptest.cpp" line="122"> + <DataTag><![CDATA[string, null user type]]></DataTag> <Description><![CDATA[Compared values are not the same Actual (actual): QVariant(QString,A simple string) Expected (expected): QVariant(PhonyClass)]]></Description> +</Incident> +<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/cmptest/tst_cmptest.cpp" line="122"> + <DataTag><![CDATA[both non-null user type]]></DataTag> <Description><![CDATA[Compared values are not the same Actual (actual): QVariant(PhonyClass,<value not representable as string>) Expected (expected): QVariant(PhonyClass,<value not representable as string>)]]></Description> </Incident> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_commandlinedata.lightxml b/tests/auto/selftests/expected_commandlinedata.lightxml index ad1f893519..6907b7211f 100644 --- a/tests/auto/selftests/expected_commandlinedata.lightxml +++ b/tests/auto/selftests/expected_commandlinedata.lightxml @@ -3,34 +3,38 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="fiveTablePasses"> -<Incident type="pass" file="" line="0"> <Message type="info" file="/local/user_builds/qt/4.6/tests/auto/selftests/commandlinedata/tst_commandlinedata.cpp" line="65"> + <DataTag><![CDATA[fiveTablePasses_data1]]></DataTag> <Description><![CDATA[QVERIFY(test)]]></Description> </Message> <Message type="info" file="/local/user_builds/qt/4.6/tests/auto/selftests/commandlinedata/tst_commandlinedata.cpp" line="65"> + <DataTag><![CDATA[fiveTablePasses_data2]]></DataTag> <Description><![CDATA[QVERIFY(test)]]></Description> </Message> <Message type="info" file="/local/user_builds/qt/4.6/tests/auto/selftests/commandlinedata/tst_commandlinedata.cpp" line="65"> + <DataTag><![CDATA[fiveTablePasses_data3]]></DataTag> <Description><![CDATA[QVERIFY(test)]]></Description> </Message> <Message type="info" file="/local/user_builds/qt/4.6/tests/auto/selftests/commandlinedata/tst_commandlinedata.cpp" line="65"> + <DataTag><![CDATA[fiveTablePasses_data4]]></DataTag> <Description><![CDATA[QVERIFY(test)]]></Description> </Message> <Message type="info" file="/local/user_builds/qt/4.6/tests/auto/selftests/commandlinedata/tst_commandlinedata.cpp" line="65"> + <DataTag><![CDATA[fiveTablePasses_data5]]></DataTag> <Description><![CDATA[QVERIFY(test)]]></Description> </Message> -</Incident> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="fiveTablePasses"> -<Incident type="pass" file="" line="0"> <Message type="info" file="/local/user_builds/qt/4.6/tests/auto/selftests/commandlinedata/tst_commandlinedata.cpp" line="65"> + <DataTag><![CDATA[fiveTablePasses_data1]]></DataTag> <Description><![CDATA[QVERIFY(test)]]></Description> </Message> -</Incident> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_crashes.lightxml b/tests/auto/selftests/expected_crashes.lightxml index 2eee3cc3a1..76890deb75 100644 --- a/tests/auto/selftests/expected_crashes.lightxml +++ b/tests/auto/selftests/expected_crashes.lightxml @@ -3,7 +3,7 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="crash"> <Incident type="fail" file="Unknown file" line="0"> diff --git a/tests/auto/selftests/expected_datatable.lightxml b/tests/auto/selftests/expected_datatable.lightxml index a1c9d2b057..e14d1e2abb 100644 --- a/tests/auto/selftests/expected_datatable.lightxml +++ b/tests/auto/selftests/expected_datatable.lightxml @@ -3,50 +3,79 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="singleTestFunction1"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="singleTestFunction2"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="fiveTablePasses"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="fiveTableFailures"> <Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/datatable/tst_datatable.cpp" line="91"> + <DataTag><![CDATA[fiveTableFailures_data 1]]></DataTag> <Description><![CDATA['test' returned FALSE. ()]]></Description> +</Incident> +<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/datatable/tst_datatable.cpp" line="91"> + <DataTag><![CDATA[fiveTableFailures_data 2]]></DataTag> <Description><![CDATA['test' returned FALSE. ()]]></Description> +</Incident> +<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/datatable/tst_datatable.cpp" line="91"> + <DataTag><![CDATA[fiveTableFailures_data 3]]></DataTag> <Description><![CDATA['test' returned FALSE. ()]]></Description> +</Incident> +<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/datatable/tst_datatable.cpp" line="91"> + <DataTag><![CDATA[fiveTableFailures_data 4]]></DataTag> <Description><![CDATA['test' returned FALSE. ()]]></Description> +</Incident> +<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/datatable/tst_datatable.cpp" line="91"> + <DataTag><![CDATA[fiveTableFailures_data 5]]></DataTag> <Description><![CDATA['test' returned FALSE. ()]]></Description> </Incident> </TestFunction> <TestFunction name="startsWithFailure"> <Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/datatable/tst_datatable.cpp" line="91"> + <DataTag><![CDATA[startsWithFailure_data 1]]></DataTag> <Description><![CDATA['test' returned FALSE. ()]]></Description> </Incident> </TestFunction> <TestFunction name="endsWithFailure"> <Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/datatable/tst_datatable.cpp" line="91"> + <DataTag><![CDATA[endsWithFailure 5]]></DataTag> <Description><![CDATA['test' returned FALSE. ()]]></Description> </Incident> </TestFunction> <TestFunction name="failureInMiddle"> <Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/datatable/tst_datatable.cpp" line="91"> + <DataTag><![CDATA[failureInMiddle_data 3]]></DataTag> <Description><![CDATA['test' returned FALSE. ()]]></Description> </Incident> </TestFunction> <TestFunction name="fiveIsolatedFailures"> <Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/datatable/tst_datatable.cpp" line="173"> + <DataTag><![CDATA[fiveIsolatedFailures_data 1]]></DataTag> <Description><![CDATA['!test' returned FALSE. ()]]></Description> +</Incident> +<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/datatable/tst_datatable.cpp" line="173"> + <DataTag><![CDATA[fiveIsolatedFailures_data 2]]></DataTag> <Description><![CDATA['!test' returned FALSE. ()]]></Description> +</Incident> +<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/datatable/tst_datatable.cpp" line="173"> + <DataTag><![CDATA[fiveIsolatedFailures_data 3]]></DataTag> <Description><![CDATA['!test' returned FALSE. ()]]></Description> +</Incident> +<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/datatable/tst_datatable.cpp" line="173"> + <DataTag><![CDATA[fiveIsolatedFailures_data 4]]></DataTag> <Description><![CDATA['!test' returned FALSE. ()]]></Description> +</Incident> +<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/datatable/tst_datatable.cpp" line="173"> + <DataTag><![CDATA[fiveIsolatedFailures_data 5]]></DataTag> <Description><![CDATA['!test' returned FALSE. ()]]></Description> </Incident> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_datetime.lightxml b/tests/auto/selftests/expected_datetime.lightxml index edad6aa832..49f8546e6a 100644 --- a/tests/auto/selftests/expected_datetime.lightxml +++ b/tests/auto/selftests/expected_datetime.lightxml @@ -3,7 +3,7 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="dateTime"> <Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/datetime/tst_datetime.cpp" line="66"> @@ -17,11 +17,13 @@ <Description><![CDATA[Compared values are not the same Actual (operandA): http://example.com Expected (operandB): ]]></Description> +</Incident> +<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/datetime/tst_datetime.cpp" line="74"> <Description><![CDATA[Compared values are not the same Actual (operandA): Expected (operandB): http://example.com]]></Description> </Incident> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_exceptionthrow.lightxml b/tests/auto/selftests/expected_exceptionthrow.lightxml index 90371e4e36..0b8de0a6ba 100644 --- a/tests/auto/selftests/expected_exceptionthrow.lightxml +++ b/tests/auto/selftests/expected_exceptionthrow.lightxml @@ -3,7 +3,7 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="throwException"> <Incident type="fail" file="/local/user_builds/qt/4.6/src/testlib/qtestcase.cpp" line="1691"> diff --git a/tests/auto/selftests/expected_expectfail.lightxml b/tests/auto/selftests/expected_expectfail.lightxml index d3fb05bb48..003b8e866d 100644 --- a/tests/auto/selftests/expected_expectfail.lightxml +++ b/tests/auto/selftests/expected_expectfail.lightxml @@ -3,33 +3,38 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="expectAndContinue"> -<Incident type="xfail" file="/local/user_builds/qt/4.6/tests/auto/selftests/expectfail/tst_expectfail.cpp" line="60"> <Message type="qdebug" file="" line="0"> <Description><![CDATA[begin]]></Description> </Message> +<Incident type="xfail" file="/local/user_builds/qt/4.6/tests/auto/selftests/expectfail/tst_expectfail.cpp" line="60"> <Description><![CDATA[This should xfail]]></Description> +</Incident> <Message type="qdebug" file="" line="0"> <Description><![CDATA[after]]></Description> </Message> -</Incident> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="expectAndAbort"> -<Incident type="xfail" file="/local/user_builds/qt/4.6/tests/auto/selftests/expectfail/tst_expectfail.cpp" line="68"> <Message type="qdebug" file="" line="0"> <Description><![CDATA[begin]]></Description> </Message> +<Incident type="xfail" file="/local/user_builds/qt/4.6/tests/auto/selftests/expectfail/tst_expectfail.cpp" line="68"> <Description><![CDATA[This should xfail]]></Description> </Incident> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="xfailWithQString"> <Incident type="xfail" file="/local/user_builds/qt/4.6/tests/auto/selftests/expectfail/tst_expectfail.cpp" line="75"> <Description><![CDATA[A string]]></Description> +</Incident> +<Incident type="xfail" file="/local/user_builds/qt/4.6/tests/auto/selftests/expectfail/tst_expectfail.cpp" line="80"> <Description><![CDATA[Bug 5 (The message)]]></Description> </Incident> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_failinit.lightxml b/tests/auto/selftests/expected_failinit.lightxml index 93a4e3f90e..0edf225bf1 100644 --- a/tests/auto/selftests/expected_failinit.lightxml +++ b/tests/auto/selftests/expected_failinit.lightxml @@ -8,5 +8,5 @@ </Incident> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_fetchbogus.lightxml b/tests/auto/selftests/expected_fetchbogus.lightxml index c53d851d79..1812c0e6b5 100644 --- a/tests/auto/selftests/expected_fetchbogus.lightxml +++ b/tests/auto/selftests/expected_fetchbogus.lightxml @@ -3,13 +3,15 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="fetchBogus"> -<Incident type="fail" file="Unknown file" line="0"> <Message type="qfatal" file="" line="0"> + <DataTag><![CDATA[foo]]></DataTag> <Description><![CDATA[QFETCH: Requested testdata 'bubu' not available, check your _data function.]]></Description> </Message> +<Incident type="fail" file="Unknown file" line="0"> + <DataTag><![CDATA[foo]]></DataTag> <Description><![CDATA[Received a fatal error.]]></Description> </Incident> </TestFunction> diff --git a/tests/auto/selftests/expected_globaldata.lightxml b/tests/auto/selftests/expected_globaldata.lightxml index 2d195ee58b..c4db4bc90c 100644 --- a/tests/auto/selftests/expected_globaldata.lightxml +++ b/tests/auto/selftests/expected_globaldata.lightxml @@ -3,28 +3,30 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="testGlobal"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="skip"> <Message type="skip" file="/local/user_builds/qt/4.6/tests/auto/selftests/globaldata/tst_globaldata.cpp" line="128"> + <DataTag><![CDATA[1]]></DataTag> <Description><![CDATA[skipping]]></Description> </Message> </TestFunction> <TestFunction name="skipLocal"> <Message type="skip" file="/local/user_builds/qt/4.6/tests/auto/selftests/globaldata/tst_globaldata.cpp" line="148"> + <DataTag><![CDATA[1:local 1]]></DataTag> <Description><![CDATA[skipping]]></Description> </Message> </TestFunction> <TestFunction name="skipSingle"> -<Incident type="pass" file="" line="0"> <Message type="skip" file="/local/user_builds/qt/4.6/tests/auto/selftests/globaldata/tst_globaldata.cpp" line="142"> + <DataTag><![CDATA[2:local 1]]></DataTag> <Description><![CDATA[skipping]]></Description> </Message> -</Incident> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_longstring.lightxml b/tests/auto/selftests/expected_longstring.lightxml index a186ccc604..945a9f3d94 100644 --- a/tests/auto/selftests/expected_longstring.lightxml +++ b/tests/auto/selftests/expected_longstring.lightxml @@ -3,7 +3,7 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="failWithLongString"> <Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/longstring/tst_longstring.cpp" line="67"> @@ -19,5 +19,5 @@ Aenean posuere, tortor sed cursus feugiat, nunc augue blandit nunc, eu sollicitu </Incident> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_maxwarnings.lightxml b/tests/auto/selftests/expected_maxwarnings.lightxml index f9320ea151..054108fe6d 100644 --- a/tests/auto/selftests/expected_maxwarnings.lightxml +++ b/tests/auto/selftests/expected_maxwarnings.lightxml @@ -3,10 +3,9 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="warn"> -<Incident type="pass" file="" line="0"> <Message type="qwarn" file="" line="0"> <Description><![CDATA[0]]></Description> </Message> @@ -6013,8 +6012,8 @@ <Message type="system" file="" line="0"> <Description><![CDATA[Maximum amount of warnings exceeded. Use -maxwarnings to override.]]></Description> </Message> -</Incident> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_multiexec.lightxml b/tests/auto/selftests/expected_multiexec.lightxml index 1f42eac34e..1a66e92f8f 100644 --- a/tests/auto/selftests/expected_multiexec.lightxml +++ b/tests/auto/selftests/expected_multiexec.lightxml @@ -3,11 +3,11 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="nothing"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_singleskip.lightxml b/tests/auto/selftests/expected_singleskip.lightxml index 971a999643..bcddcae004 100644 --- a/tests/auto/selftests/expected_singleskip.lightxml +++ b/tests/auto/selftests/expected_singleskip.lightxml @@ -3,7 +3,7 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="myTest"> <Message type="skip" file="/local/user_builds/qt/4.6/tests/auto/selftests/singleskip/tst_singleskip.cpp" line="56"> @@ -11,5 +11,5 @@ </Message> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_skip.lightxml b/tests/auto/selftests/expected_skip.lightxml index 145704ef7a..61cfe7db72 100644 --- a/tests/auto/selftests/expected_skip.lightxml +++ b/tests/auto/selftests/expected_skip.lightxml @@ -3,7 +3,7 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="test"> <Message type="skip" file="/local/user_builds/qt/4.6/tests/auto/selftests/skip/tst_skip.cpp" line="68"> @@ -16,15 +16,16 @@ </Message> </TestFunction> <TestFunction name="singleSkip"> -<Incident type="pass" file="" line="0"> <Message type="skip" file="/local/user_builds/qt/4.6/tests/auto/selftests/skip/tst_skip.cpp" line="97"> + <DataTag><![CDATA[local 1]]></DataTag> <Description><![CDATA[skipping one]]></Description> </Message> <Message type="qdebug" file="" line="0"> + <DataTag><![CDATA[local 2]]></DataTag> <Description><![CDATA[this line should only be reached once (true)]]></Description> </Message> -</Incident> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_skipinit.lightxml b/tests/auto/selftests/expected_skipinit.lightxml index ea07bd7b9d..005169e7e6 100644 --- a/tests/auto/selftests/expected_skipinit.lightxml +++ b/tests/auto/selftests/expected_skipinit.lightxml @@ -8,5 +8,5 @@ </Message> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_sleep.lightxml b/tests/auto/selftests/expected_sleep.lightxml index d7e8ea970f..1a056c8562 100644 --- a/tests/auto/selftests/expected_sleep.lightxml +++ b/tests/auto/selftests/expected_sleep.lightxml @@ -3,11 +3,11 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="sleep"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_strcmp.lightxml b/tests/auto/selftests/expected_strcmp.lightxml index 40b5da4878..28dc9335ec 100644 --- a/tests/auto/selftests/expected_strcmp.lightxml +++ b/tests/auto/selftests/expected_strcmp.lightxml @@ -3,16 +3,22 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="compareCharStars"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="compareByteArray"> -<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/strcmp/tst_strcmp.cpp" line="88"> +<Incident type="xfail" file="/local/user_builds/qt/4.6/tests/auto/selftests/strcmp/tst_strcmp.cpp" line="88"> <Description><![CDATA[Next test should fail]]></Description> +</Incident> +<Incident type="xfail" file="/local/user_builds/qt/4.6/tests/auto/selftests/strcmp/tst_strcmp.cpp" line="95"> <Description><![CDATA[Next test should fail]]></Description> +</Incident> +<Incident type="xfail" file="/local/user_builds/qt/4.6/tests/auto/selftests/strcmp/tst_strcmp.cpp" line="102"> <Description><![CDATA[Next test should fail]]></Description> +</Incident> +<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/strcmp/tst_strcmp.cpp" line="109"> <Description><![CDATA[Compared values are not the same Actual (a): 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 ... Expected (b): 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 ...]]></Description> @@ -47,5 +53,5 @@ </Incident> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_subtest.lightxml b/tests/auto/selftests/expected_subtest.lightxml index c2b8d4d2f7..00c1a992bd 100644 --- a/tests/auto/selftests/expected_subtest.lightxml +++ b/tests/auto/selftests/expected_subtest.lightxml @@ -3,13 +3,13 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="test1"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="test2"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="test3"> <Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/subtest/tst_subtest.cpp" line="157"> @@ -45,5 +45,5 @@ </Incident> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_warnings.lightxml b/tests/auto/selftests/expected_warnings.lightxml index 4e0ae8a789..116156ed8a 100644 --- a/tests/auto/selftests/expected_warnings.lightxml +++ b/tests/auto/selftests/expected_warnings.lightxml @@ -3,10 +3,9 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="testWarnings"> -<Incident type="pass" file="" line="0"> <Message type="qwarn" file="" line="0"> <Description><![CDATA[Warning]]></Description> </Message> @@ -25,19 +24,19 @@ <Message type="qdebug" file="" line="0"> <Description><![CDATA[Baba]]></Description> </Message> -</Incident> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="testMissingWarnings"> -<Incident type="fail" file="" line="0"> <Message type="info" file="" line="0"> <Description><![CDATA[Did not receive message: "Warning0"]]></Description> </Message> <Message type="info" file="" line="0"> <Description><![CDATA[Did not receive message: "Warning1"]]></Description> </Message> +<Incident type="fail" file="" line="0"> <Description><![CDATA[Not all expected messages were received]]></Description> </Incident> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/expected_xunit.lightxml b/tests/auto/selftests/expected_xunit.lightxml index 726f08d321..92772015c8 100644 --- a/tests/auto/selftests/expected_xunit.lightxml +++ b/tests/auto/selftests/expected_xunit.lightxml @@ -3,20 +3,19 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="testFunc1"> -<Incident type="pass" file="" line="0"> <Message type="warn" file="" line="0"> <Description><![CDATA[just a QWARN() !]]></Description> </Message> -</Incident> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="testFunc2"> -<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/xunit/tst_xunit.cpp" line="74"> <Message type="qdebug" file="" line="0"> <Description><![CDATA[a qDebug() call with comment-ending stuff -->]]></Description> </Message> +<Incident type="fail" file="/local/user_builds/qt/4.6/tests/auto/selftests/xunit/tst_xunit.cpp" line="74"> <Description><![CDATA[Compared values are not the same Actual (2): 2 Expected (3): 3]]></Description> @@ -36,11 +35,13 @@ <Incident type="xfail" file="/local/user_builds/qt/4.6/tests/auto/selftests/xunit/tst_xunit.cpp" line="98"> <Description><![CDATA[this failure is expected]]></Description> </Incident> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="testFunc6"> <Incident type="xfail" file="/local/user_builds/qt/4.6/tests/auto/selftests/xunit/tst_xunit.cpp" line="104"> <Description><![CDATA[this failure is also expected]]></Description> </Incident> +<Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="testFunc7"> <Incident type="xpass" file="/local/user_builds/qt/4.6/tests/auto/selftests/xunit/tst_xunit.cpp" line="110"> @@ -48,5 +49,5 @@ </Incident> </TestFunction> <TestFunction name="cleanupTestCase"> -<Incident type="pass" file="" line="0"/> +<Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp index 78f0620779..138e47927f 100644 --- a/tests/auto/selftests/tst_selftests.cpp +++ b/tests/auto/selftests/tst_selftests.cpp @@ -173,11 +173,10 @@ Logger::Logger(QString const& _name, QString const& _testdata_suffix, QStringLis static QList<Logger> allLoggers() { return QList<Logger>() - << Logger("plain", "txt", QStringList()) - << Logger("xml", "xml", QStringList() << "-xml") - << Logger("xml flush", "xml", QStringList() << "-xml" << "-flush") - << Logger("xunitxml", "xunitxml", QStringList() << "-xunitxml") - << Logger("lightxml", "lightxml", QStringList() << "-lightxml") + << Logger("plain", "txt", QStringList()) + << Logger("xml", "xml", QStringList() << "-xml") + << Logger("xunitxml", "xunitxml", QStringList() << "-xunitxml") + << Logger("lightxml", "lightxml", QStringList() << "-lightxml") ; } @@ -415,12 +414,16 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QString const& logger, Q const QString output(QString::fromLatin1(line)); const QString expected(QString::fromLatin1(exp.at(i)).replace("@INSERT_QT_VERSION_HERE@", QT_VERSION_STR)); + // Q_ASSERT uses __FILE__. Some compilers include the absolute path in + // __FILE__, while others do not. if (line.contains("ASSERT") && output != expected) { - QEXPECT_FAIL("assert", "QTestLib prints out the absolute path.", Continue); - QEXPECT_FAIL("assert xml", "QTestLib prints out the absolute path.", Continue); - QEXPECT_FAIL("assert xml flush","QTestLib prints out the absolute path.", Continue); - QEXPECT_FAIL("assert lightxml", "QTestLib prints out the absolute path.", Continue); - QEXPECT_FAIL("assert xunitxml", "QTestLib prints out the absolute path.", Continue); + const char msg[] = "Q_ASSERT prints out the absolute path on this platform."; + QEXPECT_FAIL("assert", msg, Continue); + QEXPECT_FAIL("assert xml", msg, Continue); + QEXPECT_FAIL("assert xml flush", msg, Continue); + QEXPECT_FAIL("assert lightxml", msg, Continue); + QEXPECT_FAIL("assert lightxml flush", msg, Continue); + QEXPECT_FAIL("assert xunitxml", msg, Continue); } /* On some platforms we compile without RTTI, and as a result we never throw an exception. */ diff --git a/tests/baselineserver/shared/baselineprotocol.cpp b/tests/baselineserver/shared/baselineprotocol.cpp index 0fe3aa22a9..9cbf67856d 100644 --- a/tests/baselineserver/shared/baselineprotocol.cpp +++ b/tests/baselineserver/shared/baselineprotocol.cpp @@ -56,7 +56,6 @@ const QString PI_HostAddress(QLS("HostAddress")); const QString PI_OSName(QLS("OSName")); const QString PI_OSVersion(QLS("OSVersion")); const QString PI_QtVersion(QLS("QtVersion")); -const QString PI_BuildKey(QLS("BuildKey")); const QString PI_GitCommit(QLS("GitCommit")); const QString PI_QMakeSpec(QLS("QMakeSpec")); const QString PI_PulseGitBranch(QLS("PulseGitBranch")); @@ -83,7 +82,7 @@ void BaselineProtocol::sysSleep(int ms) } PlatformInfo::PlatformInfo() - : QMap<QString, QString>(), replaceDefault(false) + : QMap<QString, QString>(), adHoc(true) { } @@ -93,7 +92,6 @@ PlatformInfo PlatformInfo::localHostInfo() pi.insert(PI_HostName, QHostInfo::localHostName()); pi.insert(PI_QtVersion, QLS(qVersion())); pi.insert(PI_QMakeSpec, QString(QLS(QMAKESPEC)).remove(QRegExp(QLS("^.*mkspecs/")))); - pi.insert(PI_BuildKey, QLibraryInfo::buildKey()); #if defined(Q_OS_LINUX) pi.insert(PI_OSName, QLS("Linux")); QProcess uname; @@ -134,11 +132,15 @@ PlatformInfo PlatformInfo::localHostInfo() pi.insert(PI_GitCommit, QLS("Unknown")); QByteArray gb = qgetenv("PULSE_GIT_BRANCH"); - if (!gb.isEmpty()) + if (!gb.isEmpty()) { pi.insert(PI_PulseGitBranch, QString::fromLatin1(gb)); + pi.setAdHocRun(false); + } QByteArray tb = qgetenv("PULSE_TESTR_BRANCH"); - if (!tb.isEmpty()) + if (!tb.isEmpty()) { pi.insert(PI_PulseTestrBranch, QString::fromLatin1(tb)); + pi.setAdHocRun(false); + } return pi; } @@ -147,43 +149,49 @@ PlatformInfo PlatformInfo::localHostInfo() PlatformInfo::PlatformInfo(const PlatformInfo &other) : QMap<QString, QString>(other) { - sigKeys = other.sigKeys; - replaceDefault = other.replaceDefault; + orides = other.orides; + adHoc = other.adHoc; } PlatformInfo &PlatformInfo::operator=(const PlatformInfo &other) { QMap<QString, QString>::operator=(other); - sigKeys = other.sigKeys; - replaceDefault = other.replaceDefault; + orides = other.orides; + adHoc = other.adHoc; return *this; } -void PlatformInfo::addSignificantKeys(const QStringList &keys, bool replaceDefaultKeys) +void PlatformInfo::addOverride(const QString& key, const QString& value) +{ + orides.append(key); + orides.append(value); +} + + +QStringList PlatformInfo::overrides() const { - sigKeys = keys; - replaceDefault = replaceDefaultKeys; + return orides; } -QStringList PlatformInfo::addedKeys() const +void PlatformInfo::setAdHocRun(bool isAdHoc) { - return sigKeys; + adHoc = isAdHoc; } -bool PlatformInfo::addedKeysReplaceDefault() const +bool PlatformInfo::isAdHocRun() const { - return replaceDefault; + return adHoc; } QDataStream & operator<< (QDataStream &stream, const PlatformInfo &pi) { stream << static_cast<const QMap<QString, QString>&>(pi); - stream << pi.sigKeys << pi.replaceDefault; + stream << pi.orides << pi.adHoc; return stream; } @@ -191,7 +199,7 @@ QDataStream & operator<< (QDataStream &stream, const PlatformInfo &pi) QDataStream & operator>> (QDataStream &stream, PlatformInfo &pi) { stream >> static_cast<QMap<QString, QString>&>(pi); - stream >> pi.sigKeys >> pi.replaceDefault; + stream >> pi.orides >> pi.adHoc; return stream; } @@ -346,7 +354,7 @@ BaselineProtocol::~BaselineProtocol() } -bool BaselineProtocol::connect(const QString &testCase, bool *dryrun) +bool BaselineProtocol::connect(const QString &testCase, bool *dryrun, const PlatformInfo& clientInfo) { errMsg.clear(); QByteArray serverName(qgetenv("QT_LANCELOT_SERVER")); @@ -362,7 +370,7 @@ bool BaselineProtocol::connect(const QString &testCase, bool *dryrun) } } - PlatformInfo pi = PlatformInfo::localHostInfo(); + PlatformInfo pi = clientInfo.isEmpty() ? PlatformInfo::localHostInfo() : clientInfo; pi.insert(PI_TestCase, testCase); QByteArray block; QDataStream ds(&block, QIODevice::ReadWrite); diff --git a/tests/baselineserver/shared/baselineprotocol.h b/tests/baselineserver/shared/baselineprotocol.h index 2d09e683d4..cc501e1d53 100644 --- a/tests/baselineserver/shared/baselineprotocol.h +++ b/tests/baselineserver/shared/baselineprotocol.h @@ -61,7 +61,6 @@ extern const QString PI_HostAddress; extern const QString PI_OSName; extern const QString PI_OSVersion; extern const QString PI_QtVersion; -extern const QString PI_BuildKey; extern const QString PI_GitCommit; extern const QString PI_QMakeSpec; extern const QString PI_PulseGitBranch; @@ -78,13 +77,14 @@ public: static PlatformInfo localHostInfo(); - void addSignificantKeys(const QStringList& keys, bool replaceDefaultKeys=false); - QStringList addedKeys() const; - bool addedKeysReplaceDefault() const; + void addOverride(const QString& key, const QString& value); + QStringList overrides() const; + bool isAdHocRun() const; + void setAdHocRun(bool isAdHoc); private: - QStringList sigKeys; - bool replaceDefault; + QStringList orides; + bool adHoc; friend QDataStream & operator<< (QDataStream &stream, const PlatformInfo &pi); friend QDataStream & operator>> (QDataStream &stream, PlatformInfo& pi); }; @@ -165,7 +165,7 @@ public: // For client: // For advanced client: - bool connect(const QString &testCase, bool *dryrun = 0); + bool connect(const QString &testCase, bool *dryrun = 0, const PlatformInfo& clientInfo = PlatformInfo()); bool requestBaselineChecksums(const QString &testFunction, ImageItemList *itemList); bool submitNewBaseline(const ImageItem &item, QByteArray *serverMsg); bool submitMismatch(const ImageItem &item, QByteArray *serverMsg); diff --git a/tests/baselineserver/src/baselineserver.cpp b/tests/baselineserver/src/baselineserver.cpp index 6ff0a0c72d..5ac78d4b32 100644 --- a/tests/baselineserver/src/baselineserver.cpp +++ b/tests/baselineserver/src/baselineserver.cpp @@ -172,27 +172,31 @@ const char *BaselineHandler::logtime() bool BaselineHandler::establishConnection() { - if (!proto.acceptConnection(&plat)) { + if (!proto.acceptConnection(&clientInfo)) { qWarning() << runId << logtime() << "Accepting new connection from" << proto.socket.peerAddress().toString() << "failed." << proto.errorMessage(); proto.sendBlock(BaselineProtocol::Abort, proto.errorMessage().toLatin1()); // In case the client can hear us, tell it what's wrong. proto.socket.disconnectFromHost(); return false; } QString logMsg; - foreach (QString key, plat.keys()) { + foreach (QString key, clientInfo.keys()) { if (key != PI_HostName && key != PI_HostAddress) - logMsg += key + QLS(": '") + plat.value(key) + QLS("', "); + logMsg += key + QLS(": '") + clientInfo.value(key) + QLS("', "); } - qDebug() << runId << logtime() << "Connection established with" << plat.value(PI_HostName) - << "[" << qPrintable(plat.value(PI_HostAddress)) << "]" << logMsg; + qDebug() << runId << logtime() << "Connection established with" << clientInfo.value(PI_HostName) + << "[" << qPrintable(clientInfo.value(PI_HostAddress)) << "]" << logMsg + << "Overrides:" << clientInfo.overrides() << "AdHoc-Run:" << clientInfo.isAdHocRun(); + + //### Temporarily override the client setting, for client compatibility: + if (!clientInfo.isAdHocRun()) + clientInfo.setAdHocRun(clientInfo.value(PI_PulseGitBranch).isEmpty() && clientInfo.value(PI_PulseTestrBranch).isEmpty()); settings->beginGroup("ClientFilters"); - if (!settings->childKeys().isEmpty() && !plat.value(PI_PulseGitBranch).isEmpty()) { // i.e. not adhoc client - // Abort if client does not match the filters + if (!clientInfo.isAdHocRun()) { // for CI runs, allow filtering of clients. TBD: different filters (settings file) per testCase foreach (QString filterKey, settings->childKeys()) { QString filter = settings->value(filterKey).toString(); - QString platVal = plat.value(filterKey); - if (filter.isEmpty() || platVal.isEmpty()) + QString platVal = clientInfo.value(filterKey); + if (filter.isEmpty()) continue; // tbd: add a syntax for specifying a "value-must-be-present" filter if (!platVal.contains(filter)) { qDebug() << runId << logtime() << "Did not pass client filter on" << filterKey << "; disconnecting."; @@ -206,7 +210,7 @@ bool BaselineHandler::establishConnection() proto.sendBlock(BaselineProtocol::Ack, QByteArray()); - report.init(this, runId, plat); + report.init(this, runId, clientInfo); return true; } @@ -297,6 +301,12 @@ void BaselineHandler::storeImage(const QByteArray &itemBlock, bool isBaseline) ImageItem item; ds >> item; + if (isBaseline && !clientInfo.overrides().isEmpty()) { + qDebug() << runId << logtime() << "Received baseline from client with override info, ignoring. Item:" << item.itemName; + proto.sendBlock(BaselineProtocol::UnknownError, "New baselines not accepted from client with override info."); + return; + } + QString prefix = pathForItem(item, isBaseline); qDebug() << runId << logtime() << "Received" << (isBaseline ? "baseline" : "mismatched") << "image for:" << item.itemName << "Storing in" << prefix; @@ -313,7 +323,7 @@ void BaselineHandler::storeImage(const QByteArray &itemBlock, bool isBaseline) cwd.mkpath(dir); item.image.save(prefix + QLS(FileFormat), FileFormat); - PlatformInfo itemData = plat; + PlatformInfo itemData = clientInfo; itemData.insert(PI_ImageChecksum, QString::number(item.imageChecksums.at(0), 16)); //# Only the first is stored. TBD: get rid of list itemData.insert(PI_RunId, runId); itemData.insert(PI_CreationDate, QDateTime::currentDateTime().toString()); @@ -366,17 +376,16 @@ void BaselineHandler::receiveDisconnect() } -void BaselineHandler::mapPlatformInfo() const +PlatformInfo BaselineHandler::mapPlatformInfo(const PlatformInfo& orig) const { - mapped = plat; + PlatformInfo mapped = orig; // Map hostname - QString host = plat.value(PI_HostName).section(QLC('.'), 0, 0); // Filter away domain, if any + QString host = orig.value(PI_HostName).section(QLC('.'), 0, 0); // Filter away domain, if any if (host.isEmpty() || host == QLS("localhost")) { - host = plat.value(PI_HostAddress); + host = orig.value(PI_HostAddress); } else { - if (!plat.value(PI_PulseGitBranch).isEmpty()) { - // i.e. pulse run, so remove index postfix typical of vm hostnames + if (!orig.isAdHocRun()) { // i.e. CI system run, so remove index postfix typical of vm hostnames host.remove(QRegExp(QLS("\\d+$"))); if (host.endsWith(QLC('-'))) host.chop(1); @@ -387,18 +396,28 @@ void BaselineHandler::mapPlatformInfo() const mapped.insert(PI_HostName, host); // Map qmakespec - QString mkspec = plat.value(PI_QMakeSpec); + QString mkspec = orig.value(PI_QMakeSpec); mapped.insert(PI_QMakeSpec, mkspec.replace(QLC('/'), QLC('_'))); // Map Qt version - QString ver = plat.value(PI_QtVersion); + QString ver = orig.value(PI_QtVersion); mapped.insert(PI_QtVersion, ver.prepend(QLS("Qt-"))); + + return mapped; } + QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline, bool absolute) const { - if (mapped.isEmpty()) - mapPlatformInfo(); + if (mappedClientInfo.isEmpty()) { + mappedClientInfo = mapPlatformInfo(clientInfo); + PlatformInfo oraw = clientInfo; + for (int i = 0; i < clientInfo.overrides().size()-1; i+=2) + oraw.insert(clientInfo.overrides().at(i), clientInfo.overrides().at(i+1)); + overriddenMappedClientInfo = mapPlatformInfo(oraw); + } + + const PlatformInfo& mapped = isBaseline ? overriddenMappedClientInfo : mappedClientInfo; QString itemName = item.itemName.simplified(); itemName.replace(QLC(' '), QLC('_')); @@ -512,13 +531,14 @@ void BaselineHandler::testPathMapping() item.imageChecksums << 0x0123456789abcdefULL; item.itemChecksum = 0x0123; - plat.insert(PI_QtVersion, QLS("5.0.0")); - plat.insert(PI_BuildKey, QLS("(nobuildkey)")); - plat.insert(PI_QMakeSpec, QLS("linux-g++")); - plat.insert(PI_PulseGitBranch, QLS("somebranch")); + clientInfo.insert(PI_QtVersion, QLS("5.0.0")); + clientInfo.insert(PI_BuildKey, QLS("(nobuildkey)")); + clientInfo.insert(PI_QMakeSpec, QLS("linux-g++")); + clientInfo.insert(PI_PulseGitBranch, QLS("somebranch")); + foreach(const QString& host, hosts) { - mapped.clear(); - plat.insert(PI_HostName, host); + mappedClientInfo.clear(); + clientInfo.insert(PI_HostName, host); qDebug() << "Baseline from" << host << "->" << pathForItem(item, true); qDebug() << "Mismatch from" << host << "->" << pathForItem(item, false); } diff --git a/tests/baselineserver/src/baselineserver.h b/tests/baselineserver/src/baselineserver.h index d73bb974f9..333d9ed30b 100644 --- a/tests/baselineserver/src/baselineserver.h +++ b/tests/baselineserver/src/baselineserver.h @@ -125,13 +125,14 @@ private: void storeImage(const QByteArray &itemBlock, bool isBaseline); void storeItemMetadata(const PlatformInfo &metadata, const QString &path); PlatformInfo fetchItemMetadata(const QString &path); - void mapPlatformInfo() const; + PlatformInfo mapPlatformInfo(const PlatformInfo& orig) const; const char *logtime(); QString computeMismatchScore(const QImage& baseline, const QImage& rendered); BaselineProtocol proto; - PlatformInfo plat; - mutable PlatformInfo mapped; + PlatformInfo clientInfo; + mutable PlatformInfo mappedClientInfo; + mutable PlatformInfo overriddenMappedClientInfo; QString runId; bool connectionEstablished; Report report; diff --git a/tests/baselineserver/src/report.cpp b/tests/baselineserver/src/report.cpp index 7c2d6ac6df..16f061c7e7 100644 --- a/tests/baselineserver/src/report.cpp +++ b/tests/baselineserver/src/report.cpp @@ -66,12 +66,13 @@ void Report::init(const BaselineHandler *h, const QString &r, const PlatformInfo runId = r; plat = p; rootDir = BaselineServer::storagePath() + QLC('/'); - reportDir = plat.value(PI_TestCase) + QLC('/') + (plat.value(PI_PulseGitBranch).isEmpty() ? QLS("reports/adhoc/") : QLS("reports/pulse/")); + reportDir = plat.value(PI_TestCase) + QLC('/') + (plat.isAdHocRun() ? QLS("reports/adhoc/") : QLS("reports/pulse/")); QString dir = rootDir + reportDir; QDir cwd; if (!cwd.exists(dir)) cwd.mkpath(dir); path = reportDir + QLS("Report_") + runId + QLS(".html"); + hasOverride = !plat.overrides().isEmpty(); } void Report::addItems(const ImageItemList &items) @@ -141,11 +142,19 @@ void Report::writeHeader() << "<p>Note: This is a <i>static</i> page, generated at " << QDateTime::currentDateTime().toString() << " for the test run with id " << runId << "</p>\n" << "<p>Summary: <b><span style=\"color:red\">" << numMismatches << " of " << numItems << "</b></span> items reported mismatching</p>\n\n"; - out << "<h3>Platform Info:</h3>\n" + out << "<h3>Testing Client Platform Info:</h3>\n" << "<table>\n"; foreach (QString key, plat.keys()) - out << "<tr><td>" << key << "</td><td>" << plat.value(key) << "</td></tr>\n"; + out << "<tr><td>" << key << ":</td><td>" << plat.value(key) << "</td></tr>\n"; out << "</table>\n\n"; + if (hasOverride) { + out << "<span style=\"color:red\"><h4>Note! Platform Override Info:</h4></span>\n" + << "<p>The client's output has been compared to baselines created on a different platform. Differences:</p>\n" + << "<table>\n"; + for (int i = 0; i < plat.overrides().size()-1; i+=2) + out << "<tr><td>" << plat.overrides().at(i) << ":</td><td>" << plat.overrides().at(i+1) << "</td></tr>\n"; + out << "</table>\n\n"; + } } @@ -158,10 +167,12 @@ void Report::writeFunctionResults(const ImageItemList &list) out << "\n<p> </p><h3>Test function: " << testFunction << "</h3>\n"; - out << "<p><a href=\"/cgi-bin/server.cgi?cmd=clearAllBaselines&context=" << ctx << "&url=" << pageUrl - << "\"><b>Clear all baselines</b></a> for this testfunction (They will be recreated by the next run)</p>\n"; - out << "<p><a href=\"/cgi-bin/server.cgi?cmd=updateAllBaselines&context=" << ctx << "&mismatchContext=" << misCtx << "&url=" << pageUrl - << "\"><b>Let these mismatching images be the new baselines</b></a> for this testfunction</p>\n\n"; + if (!hasOverride) { + out << "<p><a href=\"/cgi-bin/server.cgi?cmd=clearAllBaselines&context=" << ctx << "&url=" << pageUrl + << "\"><b>Clear all baselines</b></a> for this testfunction (They will be recreated by the next run)</p>\n"; + out << "<p><a href=\"/cgi-bin/server.cgi?cmd=updateAllBaselines&context=" << ctx << "&mismatchContext=" << misCtx << "&url=" << pageUrl + << "\"><b>Let these mismatching images be the new baselines</b></a> for this testfunction</p>\n\n"; + } out << "<table border=\"2\">\n" "<tr>\n" @@ -192,10 +203,12 @@ void Report::writeFunctionResults(const ImageItemList &list) out << "Baseline not found/regenerated"; break; case ImageItem::IgnoreItem: - out << "<span style=\"background-color:yellow\">Blacklisted</span> " - << "<a href=\"/cgi-bin/server.cgi?cmd=whitelist&context=" << ctx - << "&itemId=" << item.itemName << "&url=" << pageUrl - << "\">Whitelist this item</a>"; + out << "<span style=\"background-color:yellow\">Blacklisted</span> "; + if (!hasOverride) { + out << "<a href=\"/cgi-bin/server.cgi?cmd=whitelist&context=" << ctx + << "&itemId=" << item.itemName << "&url=" << pageUrl + << "\">Whitelist this item</a>"; + } break; case ImageItem::Ok: out << "<span style=\"color:green\"><small>No mismatch reported</small></span>"; @@ -224,12 +237,14 @@ void Report::writeItem(const QString &baseline, const QString &rendered, const I out << "<td align=center>\n" << "<p><span style=\"color:red\">Mismatch reported</span></p>\n" - << "<p><a href=\"/" << metadata << "\">Baseline Info</a>\n" - << "<p><a href=\"/cgi-bin/server.cgi?cmd=updateSingleBaseline&context=" << ctx << "&mismatchContext=" << misCtx - << "&itemFile=" << itemFile << "&url=" << pageUrl << "\">Let this be the new baseline</a></p>\n" - << "<p><a href=\"/cgi-bin/server.cgi?cmd=blacklist&context=" << ctx - << "&itemId=" << item.itemName << "&url=" << pageUrl << "\">Blacklist this item</a></p>\n" - << "<p><a href=\"/cgi-bin/server.cgi?cmd=view&baseline=" << baseline << "&rendered=" << rendered + << "<p><a href=\"/" << metadata << "\">Baseline Info</a>\n"; + if (!hasOverride) { + out << "<p><a href=\"/cgi-bin/server.cgi?cmd=updateSingleBaseline&context=" << ctx << "&mismatchContext=" << misCtx + << "&itemFile=" << itemFile << "&url=" << pageUrl << "\">Let this be the new baseline</a></p>\n" + << "<p><a href=\"/cgi-bin/server.cgi?cmd=blacklist&context=" << ctx + << "&itemId=" << item.itemName << "&url=" << pageUrl << "\">Blacklist this item</a></p>\n"; + } + out << "<p><a href=\"/cgi-bin/server.cgi?cmd=view&baseline=" << baseline << "&rendered=" << rendered << "&compared=" << compared << "&url=" << pageUrl << "\">Inspect</a></p>\n" << "</td>\n"; } diff --git a/tests/baselineserver/src/report.h b/tests/baselineserver/src/report.h index d21102d32f..610497c84b 100644 --- a/tests/baselineserver/src/report.h +++ b/tests/baselineserver/src/report.h @@ -86,6 +86,7 @@ private: int numItems; int numMismatches; QTextStream out; + bool hasOverride; }; #endif // REPORT_H diff --git a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro index 38bcfd0c9e..e6bd962302 100755 --- a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro +++ b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro @@ -11,8 +11,6 @@ INCLUDEPATH += . QT -= gui CONFIG += release -CONFIG += debug - SOURCES += main.cpp diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index eafc6690c8..2df07ef535 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -495,13 +495,6 @@ void Configure::parseCmdLine() dictionary[ "QCONFIG" ] = configCmdLine.at(i); } - else if (configCmdLine.at(i) == "-buildkey") { - ++i; - if (i == argCount) - break; - dictionary[ "USER_BUILD_KEY" ] = configCmdLine.at(i); - } - else if (configCmdLine.at(i) == "-release") { dictionary[ "BUILD" ] = "release"; if (dictionary[ "BUILDALL" ] == "auto") @@ -1661,11 +1654,11 @@ QString Configure::locateFile(const QString &fileName) bool Configure::displayHelp() { if (dictionary[ "HELP" ] == "yes") { - desc("Usage: configure [-buildkey <key>]\n" + desc("Usage: configure\n" // desc("Usage: configure [-prefix dir] [-bindir <dir>] [-libdir <dir>]\n" // "[-docdir <dir>] [-headerdir <dir>] [-plugindir <dir>]\n" // "[-importdir <dir>] [-datadir <dir>] [-translationdir <dir>]\n" -// "[-examplesdir <dir>] [-buildkey <key>]\n" +// "[-examplesdir <dir>]\n" "[-release] [-debug] [-debug-and-release] [-shared] [-static]\n" "[-no-fast] [-fast] [-no-exceptions] [-exceptions]\n" "[-no-accessibility] [-accessibility] [-no-rtti] [-rtti]\n" @@ -1711,10 +1704,6 @@ bool Configure::displayHelp() desc( "-translationdir <dir>","Translations of Qt programs will be installed to dir\n(default PREFIX/translations)\n"); desc( "-examplesdir <dir>", "Examples will be installed to dir\n(default PREFIX/examples)"); */ - desc(" You may use these options to turn on strict plugin loading:\n\n", 0, 1); - - desc( "-buildkey <key>", "Build the Qt library and plugins using the specified <key>. " - "When the library loads plugins, it will only load those that have a matching <key>.\n"); desc("Configure options:\n\n"); @@ -2470,53 +2459,11 @@ void Configure::generateBuildKey() // Sorted defines that start with QT_NO_ QStringList build_defines = qmakeDefines.filter(QRegExp("^QT_NO_")); build_defines.sort(); - - // Build up the QT_BUILD_KEY ifdef - QString buildKey = "QT_BUILD_KEY \""; - if (!dictionary["USER_BUILD_KEY"].isEmpty()) - buildKey += dictionary["USER_BUILD_KEY"] + " "; - - QString build32Key = buildKey + "Windows " + compiler + " %1 " + build_options.join(" ") + " " + build_defines.join(" "); - QString build64Key = buildKey + "Windows x64 " + compiler + " %1 " + build_options.join(" ") + " " + build_defines.join(" "); - QString buildSymbianKey = buildKey + "Symbian " + build_options.join(" ") + " " + build_defines.join(" "); - build32Key = build32Key.simplified(); - build64Key = build64Key.simplified(); - buildSymbianKey = buildSymbianKey.simplified(); - build32Key.prepend("# define "); - build64Key.prepend("# define "); - buildSymbianKey.prepend("# define "); - - QString buildkey = "#if defined(__SYMBIAN32__)\n" - + buildSymbianKey + "\"\n" - "#else\n" - // Debug builds - "# if !defined(QT_NO_DEBUG)\n" - "# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n" - + build64Key.arg("debug") + "\"\n" - "# else\n" - + build32Key.arg("debug") + "\"\n" - "# endif\n" - "# else\n" - // Release builds - "# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n" - + build64Key.arg("release") + "\"\n" - "# else\n" - + build32Key.arg("release") + "\"\n" - "# endif\n" - "# endif\n" - "#endif\n"; - - dictionary["BUILD_KEY"] = buildkey; } void Configure::generateOutputVars() { // Generate variables for output - // Build key ---------------------------------------------------- - if (dictionary.contains("BUILD_KEY")) { - qmakeVars += dictionary.value("BUILD_KEY"); - } - QString build = dictionary[ "BUILD" ]; bool buildAll = (dictionary[ "BUILDALL" ] == "yes"); if (build == "debug") { @@ -3141,8 +3088,6 @@ void Configure::generateConfigfiles() tmpStream << "# define QT_EDITION " << dictionary["QT_EDITION"] << endl; tmpStream << "#endif" << endl; tmpStream << endl; - tmpStream << dictionary["BUILD_KEY"]; - tmpStream << endl; if (dictionary["BUILDDEV"] == "yes") { dictionary["QMAKE_INTERNAL"] = "yes"; tmpStream << "/* Used for example to export symbols for the certain autotests*/" << endl; |