2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-02-18 14:48:16 +01:00
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2011-02-18 14:48:16 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-02-18 14:48:16 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2011-02-18 14:48:16 +01:00
|
|
|
**
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, 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.
|
2011-02-18 14:48:16 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2011-02-18 14:48:16 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-02-18 14:48:16 +01:00
|
|
|
|
2013-01-23 12:25:18 +01:00
|
|
|
#include "debuggerprotocol.h"
|
2013-01-24 14:53:46 +01:00
|
|
|
#include "watchdata.h"
|
|
|
|
#include "watchutils.h"
|
2009-08-26 08:56:33 +02:00
|
|
|
|
2013-03-27 18:54:03 +01:00
|
|
|
#include <cplusplus/CppRewriter.h>
|
2013-03-11 15:16:42 -07:00
|
|
|
#include <utils/environment.h>
|
2013-05-14 15:20:45 +02:00
|
|
|
#include <utils/qtcprocess.h>
|
|
|
|
#include <utils/fileutils.h>
|
|
|
|
#include <utils/synchronousprocess.h>
|
2013-02-01 14:51:46 +01:00
|
|
|
|
2013-02-13 17:47:31 +01:00
|
|
|
#include "temporarydir.h"
|
2009-06-25 15:00:57 +02:00
|
|
|
|
2013-05-14 15:20:45 +02:00
|
|
|
#include <QtTest>
|
|
|
|
|
2013-03-11 15:10:57 +01:00
|
|
|
#if QT_VERSION >= 0x050000
|
|
|
|
#define MSKIP_SINGLE(x) QSKIP(x)
|
|
|
|
#else
|
|
|
|
#define MSKIP_SINGLE(x) QSKIP(x, SkipSingle)
|
|
|
|
#endif
|
|
|
|
|
2009-04-06 14:07:30 +02:00
|
|
|
using namespace Debugger;
|
2013-04-05 15:44:18 +02:00
|
|
|
using namespace Utils;
|
2013-01-23 12:25:18 +01:00
|
|
|
using namespace Internal;
|
2009-08-26 11:46:02 +02:00
|
|
|
|
2013-05-14 15:20:45 +02:00
|
|
|
// Copied from abstractmsvctoolchain.cpp to avoid plugin dependency.
|
|
|
|
|
|
|
|
static bool generateEnvironmentSettings(Utils::Environment &env,
|
|
|
|
const QString &batchFile,
|
|
|
|
const QString &batchArgs,
|
|
|
|
QMap<QString, QString> &envPairs)
|
|
|
|
{
|
|
|
|
// Create a temporary file name for the output. Use a temporary file here
|
|
|
|
// as I don't know another way to do this in Qt...
|
|
|
|
// Note, can't just use a QTemporaryFile all the way through as it remains open
|
|
|
|
// internally so it can't be streamed to later.
|
|
|
|
QString tempOutFile;
|
|
|
|
QTemporaryFile* pVarsTempFile = new QTemporaryFile(QDir::tempPath() + QLatin1String("/XXXXXX.txt"));
|
|
|
|
pVarsTempFile->setAutoRemove(false);
|
|
|
|
pVarsTempFile->open();
|
|
|
|
pVarsTempFile->close();
|
|
|
|
tempOutFile = pVarsTempFile->fileName();
|
|
|
|
delete pVarsTempFile;
|
|
|
|
|
|
|
|
// Create a batch file to create and save the env settings
|
|
|
|
Utils::TempFileSaver saver(QDir::tempPath() + QLatin1String("/XXXXXX.bat"));
|
|
|
|
|
|
|
|
QByteArray call = "call ";
|
|
|
|
call += Utils::QtcProcess::quoteArg(batchFile).toLocal8Bit();
|
|
|
|
if (!batchArgs.isEmpty()) {
|
|
|
|
call += ' ';
|
|
|
|
call += batchArgs.toLocal8Bit();
|
|
|
|
}
|
|
|
|
saver.write(call + "\r\n");
|
|
|
|
|
|
|
|
const QByteArray redirect = "set > " + Utils::QtcProcess::quoteArg(
|
|
|
|
QDir::toNativeSeparators(tempOutFile)).toLocal8Bit() + "\r\n";
|
|
|
|
saver.write(redirect);
|
|
|
|
if (!saver.finalize()) {
|
|
|
|
qWarning("%s: %s", Q_FUNC_INFO, qPrintable(saver.errorString()));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
Utils::QtcProcess run;
|
|
|
|
// As of WinSDK 7.1, there is logic preventing the path from being set
|
|
|
|
// correctly if "ORIGINALPATH" is already set. That can cause problems
|
|
|
|
// if Creator is launched within a session set up by setenv.cmd.
|
|
|
|
env.unset(QLatin1String("ORIGINALPATH"));
|
|
|
|
run.setEnvironment(env);
|
|
|
|
const QString cmdPath = QString::fromLocal8Bit(qgetenv("COMSPEC"));
|
|
|
|
// Windows SDK setup scripts require command line switches for environment expansion.
|
|
|
|
QString cmdArguments = QLatin1String(" /E:ON /V:ON /c \"");
|
|
|
|
cmdArguments += QDir::toNativeSeparators(saver.fileName());
|
|
|
|
cmdArguments += QLatin1Char('"');
|
|
|
|
run.setCommand(cmdPath, cmdArguments);
|
|
|
|
run.start();
|
|
|
|
|
|
|
|
if (!run.waitForStarted()) {
|
|
|
|
qWarning("%s: Unable to run '%s': %s", Q_FUNC_INFO, qPrintable(batchFile),
|
|
|
|
qPrintable(run.errorString()));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (!run.waitForFinished()) {
|
|
|
|
qWarning("%s: Timeout running '%s'", Q_FUNC_INFO, qPrintable(batchFile));
|
|
|
|
Utils::SynchronousProcess::stopProcess(run);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
// The SDK/MSVC scripts do not return exit codes != 0. Check on stdout.
|
|
|
|
const QByteArray stdOut = run.readAllStandardOutput();
|
|
|
|
if (!stdOut.isEmpty() && (stdOut.contains("Unknown") || stdOut.contains("Error")))
|
|
|
|
qWarning("%s: '%s' reports:\n%s", Q_FUNC_INFO, call.constData(), stdOut.constData());
|
|
|
|
|
|
|
|
//
|
|
|
|
// Now parse the file to get the environment settings
|
|
|
|
QFile varsFile(tempOutFile);
|
|
|
|
if (!varsFile.open(QIODevice::ReadOnly))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
QRegExp regexp(QLatin1String("(\\w*)=(.*)"));
|
|
|
|
while (!varsFile.atEnd()) {
|
|
|
|
const QString line = QString::fromLocal8Bit(varsFile.readLine()).trimmed();
|
|
|
|
if (regexp.exactMatch(line)) {
|
|
|
|
const QString varName = regexp.cap(1);
|
|
|
|
const QString varValue = regexp.cap(2);
|
|
|
|
|
|
|
|
if (!varValue.isEmpty())
|
|
|
|
envPairs.insert(varName, varValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tidy up and remove the file
|
|
|
|
varsFile.close();
|
|
|
|
varsFile.remove();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-01-24 14:53:46 +01:00
|
|
|
static QByteArray noValue = "\001";
|
|
|
|
|
2013-02-11 17:58:52 +01:00
|
|
|
static QString toHex(const QString &str)
|
|
|
|
{
|
|
|
|
QString encoded;
|
|
|
|
foreach (const QChar c, str) {
|
|
|
|
encoded += QString::fromLatin1("%1")
|
|
|
|
.arg(c.unicode(), 2, 16, QLatin1Char('0'));
|
|
|
|
}
|
|
|
|
return encoded;
|
|
|
|
}
|
|
|
|
|
2013-02-05 01:47:07 +01:00
|
|
|
|
|
|
|
struct Context
|
|
|
|
{
|
|
|
|
Context() : qtVersion(0) {}
|
|
|
|
|
|
|
|
QByteArray nameSpace;
|
|
|
|
int qtVersion;
|
|
|
|
};
|
|
|
|
|
2013-02-01 17:35:16 +01:00
|
|
|
struct Name
|
|
|
|
{
|
2013-02-05 01:47:07 +01:00
|
|
|
Name() : name(noValue) {}
|
|
|
|
Name(const char *str) : name(str) {}
|
|
|
|
Name(const QByteArray &ba) : name(ba) {}
|
|
|
|
|
|
|
|
bool matches(const QByteArray &actualName0, const Context &context) const
|
2013-02-01 17:35:16 +01:00
|
|
|
{
|
|
|
|
QByteArray actualName = actualName0;
|
|
|
|
QByteArray expectedName = name;
|
2013-02-05 01:47:07 +01:00
|
|
|
expectedName.replace("@Q", context.nameSpace + 'Q');
|
2013-02-01 17:35:16 +01:00
|
|
|
return actualName == expectedName;
|
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray name;
|
|
|
|
};
|
|
|
|
|
|
|
|
static Name nameFromIName(const QByteArray &iname)
|
2013-01-28 17:15:49 +01:00
|
|
|
{
|
|
|
|
int pos = iname.lastIndexOf('.');
|
2013-02-01 17:35:16 +01:00
|
|
|
return Name(pos == -1 ? iname : iname.mid(pos + 1));
|
2013-01-28 17:15:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static QByteArray parentIName(const QByteArray &iname)
|
|
|
|
{
|
|
|
|
int pos = iname.lastIndexOf('.');
|
|
|
|
return pos == -1 ? QByteArray() : iname.left(pos);
|
|
|
|
}
|
|
|
|
|
2013-02-05 01:47:07 +01:00
|
|
|
struct ValueBase
|
2013-01-30 12:52:12 +01:00
|
|
|
{
|
2013-02-05 01:47:07 +01:00
|
|
|
ValueBase() : hasPtrSuffix(false), version(0) {}
|
|
|
|
|
|
|
|
bool hasPtrSuffix;
|
|
|
|
int version;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Value : public ValueBase
|
|
|
|
{
|
2013-02-11 17:58:52 +01:00
|
|
|
Value() : value(QString::fromLatin1(noValue)) {}
|
|
|
|
Value(const char *str) : value(QLatin1String(str)) {}
|
|
|
|
Value(const QByteArray &ba) : value(QString::fromLatin1(ba.data(), ba.size())) {}
|
|
|
|
Value(const QString &str) : value(str) {}
|
2013-01-30 12:52:12 +01:00
|
|
|
|
2013-02-05 01:47:07 +01:00
|
|
|
bool matches(const QString &actualValue0, const Context &context) const
|
2013-01-30 12:52:12 +01:00
|
|
|
{
|
2013-02-11 17:58:52 +01:00
|
|
|
if (value == QString::fromLatin1(noValue))
|
2013-01-30 12:52:12 +01:00
|
|
|
return true;
|
2013-02-05 01:47:07 +01:00
|
|
|
|
|
|
|
if (context.qtVersion) {
|
|
|
|
if (version == 4) {
|
|
|
|
if (context.qtVersion < 0x40000 || context.qtVersion >= 0x50000) {
|
|
|
|
//QWARN("Qt 4 specific case skipped");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} else if (version == 5) {
|
|
|
|
if (context.qtVersion < 0x50000 || context.qtVersion >= 0x60000) {
|
|
|
|
//QWARN("Qt 5 specific case skipped");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-01-30 13:48:23 +01:00
|
|
|
QString actualValue = actualValue0;
|
|
|
|
if (actualValue == QLatin1String(" "))
|
|
|
|
actualValue.clear(); // FIXME: Remove later.
|
2013-02-11 17:58:52 +01:00
|
|
|
QString expectedValue = value;
|
|
|
|
expectedValue.replace(QLatin1Char('@'), QString::fromLatin1(context.nameSpace));
|
2013-02-05 01:47:07 +01:00
|
|
|
|
2013-01-30 12:52:12 +01:00
|
|
|
if (hasPtrSuffix)
|
2013-02-11 17:58:52 +01:00
|
|
|
return actualValue.startsWith(expectedValue + QLatin1String(" @0x"))
|
|
|
|
|| actualValue.startsWith(expectedValue + QLatin1String("@0x"));
|
|
|
|
return actualValue == expectedValue;
|
2013-01-30 12:52:12 +01:00
|
|
|
}
|
|
|
|
|
2013-02-11 17:58:52 +01:00
|
|
|
QString value;
|
2013-01-30 12:52:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Pointer : Value
|
|
|
|
{
|
|
|
|
Pointer() { hasPtrSuffix = true; }
|
|
|
|
Pointer(const QByteArray &value) : Value(value) { hasPtrSuffix = true; }
|
|
|
|
};
|
|
|
|
|
2013-02-05 01:47:07 +01:00
|
|
|
struct Value4 : Value
|
|
|
|
{
|
|
|
|
Value4(const QByteArray &value) : Value(value) { version = 4; }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Value5 : Value
|
|
|
|
{
|
|
|
|
Value5(const QByteArray &value) : Value(value) { version = 5; }
|
|
|
|
};
|
|
|
|
|
2013-01-30 13:48:23 +01:00
|
|
|
struct Type
|
|
|
|
{
|
2013-02-05 01:47:07 +01:00
|
|
|
Type() {}
|
|
|
|
Type(const char *str) : type(str) {}
|
|
|
|
Type(const QByteArray &ba) : type(ba) {}
|
|
|
|
|
|
|
|
bool matches(const QByteArray &actualType0, const Context &context) const
|
2013-01-30 13:48:23 +01:00
|
|
|
{
|
2013-02-01 14:51:46 +01:00
|
|
|
QByteArray actualType =
|
|
|
|
CPlusPlus::simplifySTLType(QString::fromLatin1(actualType0)).toLatin1();
|
2013-01-30 13:48:23 +01:00
|
|
|
actualType.replace(' ', "");
|
|
|
|
QByteArray expectedType = type;
|
|
|
|
expectedType.replace(' ', "");
|
2013-02-05 01:47:07 +01:00
|
|
|
expectedType.replace('@', context.nameSpace);
|
2013-01-30 13:48:23 +01:00
|
|
|
return actualType == expectedType;
|
|
|
|
}
|
|
|
|
QByteArray type;
|
|
|
|
};
|
|
|
|
|
2013-01-28 17:47:56 +01:00
|
|
|
struct Check
|
2013-01-24 14:53:46 +01:00
|
|
|
{
|
|
|
|
Check() {}
|
|
|
|
|
2013-02-01 17:35:16 +01:00
|
|
|
Check(const QByteArray &iname, const Value &value, const Type &type)
|
2013-01-28 17:15:49 +01:00
|
|
|
: iname(iname), expectedName(nameFromIName(iname)),
|
|
|
|
expectedValue(value), expectedType(type)
|
|
|
|
{}
|
|
|
|
|
2013-02-01 17:35:16 +01:00
|
|
|
Check(const QByteArray &iname, const Name &name,
|
2013-01-30 13:48:23 +01:00
|
|
|
const Value &value, const Type &type)
|
2013-01-24 14:53:46 +01:00
|
|
|
: iname(iname), expectedName(name),
|
|
|
|
expectedValue(value), expectedType(type)
|
|
|
|
{}
|
|
|
|
|
|
|
|
QByteArray iname;
|
2013-02-01 17:35:16 +01:00
|
|
|
Name expectedName;
|
2013-01-30 12:52:12 +01:00
|
|
|
Value expectedValue;
|
2013-01-30 13:48:23 +01:00
|
|
|
Type expectedType;
|
2013-01-24 14:53:46 +01:00
|
|
|
};
|
|
|
|
|
2013-01-28 17:47:56 +01:00
|
|
|
struct CheckType : public Check
|
2013-01-24 14:53:46 +01:00
|
|
|
{
|
2013-02-01 17:35:16 +01:00
|
|
|
CheckType(const QByteArray &iname, const Name &name,
|
2013-01-30 13:48:23 +01:00
|
|
|
const Type &type)
|
2013-01-24 14:53:46 +01:00
|
|
|
: Check(iname, name, noValue, type)
|
|
|
|
{}
|
2013-01-25 19:11:14 +01:00
|
|
|
|
2013-01-30 13:48:23 +01:00
|
|
|
CheckType(const QByteArray &iname, const Type &type)
|
2013-01-28 17:15:49 +01:00
|
|
|
: Check(iname, noValue, type)
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
2013-02-11 13:54:17 +01:00
|
|
|
struct CheckPlain : public Check
|
|
|
|
{
|
|
|
|
CheckPlain(const QByteArray &iname, const Name &name,
|
|
|
|
const Type &type)
|
|
|
|
: Check(iname, name, noValue, type)
|
|
|
|
{}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2013-01-28 17:47:56 +01:00
|
|
|
struct Profile
|
2013-01-28 17:15:49 +01:00
|
|
|
{
|
|
|
|
Profile(const QByteArray &contents) : contents(contents) {}
|
|
|
|
|
|
|
|
QByteArray contents;
|
2013-01-24 14:53:46 +01:00
|
|
|
};
|
|
|
|
|
2013-01-28 17:47:56 +01:00
|
|
|
|
2013-01-30 11:25:19 +01:00
|
|
|
struct Cxx11Profile : public Profile
|
|
|
|
{
|
2013-01-30 12:52:12 +01:00
|
|
|
//Cxx11Profile() : Profile("CONFIG += c++11") {}
|
|
|
|
Cxx11Profile() : Profile("QMAKE_CXXFLAGS += -std=c++0x") {}
|
2013-01-30 11:25:19 +01:00
|
|
|
};
|
|
|
|
|
2013-06-04 16:15:56 +02:00
|
|
|
struct GdbOnly {};
|
|
|
|
struct LldbOnly {};
|
|
|
|
|
2013-03-06 12:40:46 +01:00
|
|
|
struct GdbVersion
|
|
|
|
{
|
|
|
|
// Minimum and maximum are inclusive.
|
|
|
|
GdbVersion(int minimum = 0, int maximum = 0)
|
|
|
|
{
|
|
|
|
if (minimum && !maximum)
|
|
|
|
maximum = minimum;
|
|
|
|
if (maximum == 0)
|
|
|
|
maximum = INT_MAX;
|
|
|
|
|
|
|
|
max = maximum;
|
|
|
|
min = minimum;
|
|
|
|
}
|
|
|
|
int min;
|
|
|
|
int max;
|
|
|
|
};
|
|
|
|
|
2013-06-04 16:15:56 +02:00
|
|
|
struct LldbVersion
|
|
|
|
{
|
|
|
|
// Minimum and maximum are inclusive.
|
|
|
|
LldbVersion(int minimum = 0, int maximum = 0)
|
|
|
|
{
|
|
|
|
if (minimum && !maximum)
|
|
|
|
maximum = minimum;
|
|
|
|
if (maximum == 0)
|
|
|
|
maximum = INT_MAX;
|
|
|
|
|
|
|
|
max = maximum;
|
|
|
|
min = minimum;
|
|
|
|
}
|
|
|
|
int min;
|
|
|
|
int max;
|
|
|
|
};
|
|
|
|
|
2013-01-30 13:48:23 +01:00
|
|
|
struct ForceC {};
|
|
|
|
|
2013-02-05 01:47:07 +01:00
|
|
|
struct CoreProfile {};
|
|
|
|
struct CorePrivateProfile {};
|
|
|
|
struct GuiProfile {};
|
|
|
|
|
|
|
|
struct DataBase
|
|
|
|
{
|
2013-06-04 16:15:56 +02:00
|
|
|
DataBase() : useQt(false), forceC(false), gdbOnly(false), lldbOnly(false) {}
|
2013-02-05 01:47:07 +01:00
|
|
|
|
|
|
|
mutable bool useQt;
|
|
|
|
mutable bool forceC;
|
2013-06-04 16:15:56 +02:00
|
|
|
mutable bool gdbOnly;
|
|
|
|
mutable bool lldbOnly;
|
2013-03-06 12:40:46 +01:00
|
|
|
mutable GdbVersion neededGdbVersion;
|
2013-06-04 16:15:56 +02:00
|
|
|
mutable LldbVersion neededLldbVersion;
|
2013-02-05 01:47:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class Data : public DataBase
|
2009-08-26 11:46:02 +02:00
|
|
|
{
|
2013-01-23 12:25:18 +01:00
|
|
|
public:
|
|
|
|
Data() {}
|
2013-02-05 01:47:07 +01:00
|
|
|
Data(const QByteArray &code) : code(code) {}
|
2009-04-06 14:07:30 +02:00
|
|
|
|
2013-01-24 14:53:46 +01:00
|
|
|
Data(const QByteArray &includes, const QByteArray &code)
|
2013-02-05 01:47:07 +01:00
|
|
|
: includes(includes), code(code)
|
2013-01-23 12:25:18 +01:00
|
|
|
{}
|
2009-05-18 14:15:25 +02:00
|
|
|
|
2013-01-24 14:53:46 +01:00
|
|
|
const Data &operator%(const Check &check) const
|
|
|
|
{
|
|
|
|
checks.insert("local." + check.iname, check);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2013-01-28 17:15:49 +01:00
|
|
|
const Data &operator%(const Profile &profile) const
|
|
|
|
{
|
|
|
|
profileExtra += profile.contents;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2013-03-06 12:40:46 +01:00
|
|
|
const Data &operator%(const GdbVersion &gdbVersion) const
|
|
|
|
{
|
|
|
|
neededGdbVersion = gdbVersion;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2013-06-04 16:15:56 +02:00
|
|
|
const Data &operator%(const LldbVersion &lldbVersion) const
|
|
|
|
{
|
|
|
|
neededLldbVersion = lldbVersion;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Data &operator%(const LldbOnly &) const
|
|
|
|
{
|
|
|
|
lldbOnly = true;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Data &operator%(const GdbOnly &) const
|
|
|
|
{
|
|
|
|
gdbOnly = true;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2013-02-05 01:47:07 +01:00
|
|
|
const Data &operator%(const CoreProfile &) const
|
|
|
|
{
|
|
|
|
profileExtra +=
|
|
|
|
"CONFIG += QT\n"
|
|
|
|
"QT += gui\n"
|
|
|
|
"greaterThan(QT_MAJOR_VERSION, 4):QT *= widgets\n";
|
|
|
|
|
|
|
|
useQt = true;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Data &operator%(const GuiProfile &) const
|
|
|
|
{
|
|
|
|
profileExtra +=
|
|
|
|
"CONFIG += QT\n"
|
|
|
|
"QT += gui\n"
|
|
|
|
"greaterThan(QT_MAJOR_VERSION, 4):QT *= widgets\n";
|
|
|
|
|
|
|
|
useQt = true;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Data &operator%(const CorePrivateProfile &) const
|
|
|
|
{
|
|
|
|
profileExtra +=
|
|
|
|
"CONFIG += QT\n"
|
|
|
|
"greaterThan(QT_MAJOR_VERSION, 4) {\n"
|
|
|
|
" QT += core core-private\n"
|
|
|
|
" CONFIG += no_private_qt_headers_warning\n"
|
|
|
|
"}";
|
|
|
|
|
|
|
|
useQt = true;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2013-01-30 13:48:23 +01:00
|
|
|
const Data &operator%(const ForceC &) const
|
|
|
|
{
|
|
|
|
forceC = true;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2013-01-23 12:25:18 +01:00
|
|
|
public:
|
2013-01-28 17:15:49 +01:00
|
|
|
mutable QByteArray profileExtra;
|
2013-01-23 12:25:18 +01:00
|
|
|
QByteArray includes;
|
|
|
|
QByteArray code;
|
2013-02-11 13:54:17 +01:00
|
|
|
mutable QMap<QByteArray, Check> checks; // IName -> Action
|
2009-07-08 17:27:45 +02:00
|
|
|
};
|
|
|
|
|
2013-03-11 15:15:56 -07:00
|
|
|
struct TempStuff
|
|
|
|
{
|
|
|
|
TempStuff() : buildTemp(QLatin1String("qt_tst_dumpers_"))
|
|
|
|
{
|
2013-05-14 18:02:12 +02:00
|
|
|
buildPath = QDir::currentPath() + QLatin1Char('/') + buildTemp.path();
|
2013-03-11 15:15:56 -07:00
|
|
|
buildTemp.setAutoRemove(false);
|
|
|
|
QVERIFY(!buildPath.isEmpty());
|
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray input;
|
|
|
|
QTemporaryDir buildTemp;
|
|
|
|
QString buildPath;
|
|
|
|
};
|
|
|
|
|
2013-04-05 15:44:18 +02:00
|
|
|
enum DebuggerEngine
|
|
|
|
{
|
2013-04-09 00:56:28 -07:00
|
|
|
DumpTestGdbEngine,
|
|
|
|
DumpTestCdbEngine,
|
|
|
|
DumpTestLldbEngine
|
2013-03-11 15:16:42 -07:00
|
|
|
};
|
|
|
|
|
2013-01-23 12:25:18 +01:00
|
|
|
Q_DECLARE_METATYPE(Data)
|
2009-07-08 17:27:45 +02:00
|
|
|
|
2010-09-02 15:32:04 +10:00
|
|
|
class tst_Dumpers : public QObject
|
2009-04-06 14:07:30 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2013-04-05 15:44:18 +02:00
|
|
|
tst_Dumpers()
|
|
|
|
{
|
|
|
|
t = 0;
|
2013-06-04 10:44:20 +02:00
|
|
|
m_keepTemp = true;
|
2013-04-05 15:44:18 +02:00
|
|
|
m_gdbVersion = 0;
|
|
|
|
m_gdbBuildVersion = 0;
|
|
|
|
m_lldbVersion = 0;
|
|
|
|
m_isMacGdb = false;
|
|
|
|
m_isQnxGdb = false;
|
|
|
|
}
|
2009-04-06 14:07:30 +02:00
|
|
|
|
|
|
|
private slots:
|
2013-02-11 13:54:17 +01:00
|
|
|
void initTestCase();
|
2013-01-23 12:25:18 +01:00
|
|
|
void dumper();
|
|
|
|
void dumper_data();
|
2013-03-11 15:15:56 -07:00
|
|
|
void init();
|
|
|
|
void cleanup();
|
2013-02-11 13:54:17 +01:00
|
|
|
|
|
|
|
private:
|
2013-03-11 15:15:56 -07:00
|
|
|
TempStuff *t;
|
2013-02-11 13:54:17 +01:00
|
|
|
QByteArray m_debuggerBinary;
|
|
|
|
QByteArray m_qmakeBinary;
|
2013-03-11 15:16:42 -07:00
|
|
|
QProcessEnvironment m_env;
|
2013-02-11 13:54:17 +01:00
|
|
|
bool m_usePython;
|
2013-03-11 15:16:42 -07:00
|
|
|
DebuggerEngine m_debuggerEngine;
|
2013-02-11 13:54:17 +01:00
|
|
|
bool m_keepTemp;
|
2013-03-06 12:40:46 +01:00
|
|
|
int m_gdbVersion; // 7.5.1 -> 70501
|
|
|
|
int m_gdbBuildVersion;
|
2013-04-05 15:44:18 +02:00
|
|
|
int m_lldbVersion;
|
2013-03-06 12:40:46 +01:00
|
|
|
bool m_isMacGdb;
|
|
|
|
bool m_isQnxGdb;
|
2013-02-11 13:54:17 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
void tst_Dumpers::initTestCase()
|
|
|
|
{
|
2013-05-16 11:40:36 +02:00
|
|
|
m_debuggerBinary = qgetenv("QTC_DEBUGGER_PATH_FOR_TEST");
|
2013-02-11 13:54:17 +01:00
|
|
|
if (m_debuggerBinary.isEmpty())
|
|
|
|
m_debuggerBinary = "gdb";
|
2013-07-01 14:29:00 +02:00
|
|
|
qDebug() << "Debugger : " << m_debuggerBinary.constData();
|
2013-04-05 15:44:18 +02:00
|
|
|
|
2013-04-09 00:56:28 -07:00
|
|
|
m_debuggerEngine = DumpTestGdbEngine;
|
2013-04-05 15:44:18 +02:00
|
|
|
if (m_debuggerBinary.endsWith("cdb.exe"))
|
2013-04-09 00:56:28 -07:00
|
|
|
m_debuggerEngine = DumpTestCdbEngine;
|
2013-05-14 18:02:12 +02:00
|
|
|
|
2013-06-04 10:44:20 +02:00
|
|
|
if (m_debuggerBinary.endsWith("lldb"))
|
2013-04-09 00:56:28 -07:00
|
|
|
m_debuggerEngine = DumpTestLldbEngine;
|
2013-02-11 13:54:17 +01:00
|
|
|
|
2013-06-05 11:26:46 +02:00
|
|
|
m_qmakeBinary = qgetenv("QTC_QMAKE_PATH_FOR_TEST");
|
2013-02-11 13:54:17 +01:00
|
|
|
if (m_qmakeBinary.isEmpty())
|
|
|
|
m_qmakeBinary = "qmake";
|
2013-07-01 14:29:00 +02:00
|
|
|
qDebug() << "QMake : " << m_qmakeBinary.constData();
|
2013-02-11 13:54:17 +01:00
|
|
|
|
2013-04-05 15:44:18 +02:00
|
|
|
Environment utilsEnv = Environment::systemEnvironment();
|
2013-03-11 15:16:42 -07:00
|
|
|
utilsEnv.appendOrSet(QLatin1String("QT_HASH_SEED"), QLatin1String("0"));
|
|
|
|
|
2013-04-09 00:56:28 -07:00
|
|
|
if (m_debuggerEngine == DumpTestGdbEngine) {
|
2013-03-11 15:16:42 -07:00
|
|
|
QProcess debugger;
|
|
|
|
debugger.start(QString::fromLatin1(m_debuggerBinary)
|
|
|
|
+ QLatin1String(" -i mi -quiet -nx"));
|
|
|
|
bool ok = debugger.waitForStarted();
|
|
|
|
debugger.write("set confirm off\npython print 43\nshow version\nquit\n");
|
|
|
|
ok = debugger.waitForFinished();
|
|
|
|
QVERIFY(ok);
|
|
|
|
QByteArray output = debugger.readAllStandardOutput();
|
|
|
|
//qDebug() << "stdout: " << output;
|
|
|
|
m_usePython = !output.contains("Python scripting is not supported in this copy of GDB");
|
2013-07-01 14:29:00 +02:00
|
|
|
qDebug() << "Python : " << (m_usePython ? "ok" : "*** not ok ***");
|
|
|
|
qDebug() << "Dumper dir : " << DUMPERDIR;
|
2013-03-11 15:16:42 -07:00
|
|
|
|
|
|
|
QString version = QString::fromLocal8Bit(output);
|
|
|
|
int pos1 = version.indexOf(QLatin1String("&\"show version\\n"));
|
|
|
|
QVERIFY(pos1 != -1);
|
|
|
|
pos1 += 20;
|
|
|
|
int pos2 = version.indexOf(QLatin1String("~\"Copyright (C) "), pos1);
|
|
|
|
QVERIFY(pos2 != -1);
|
|
|
|
pos2 -= 4;
|
|
|
|
version = version.mid(pos1, pos2 - pos1);
|
2013-04-05 15:44:18 +02:00
|
|
|
extractGdbVersion(version, &m_gdbVersion,
|
2013-03-11 15:16:42 -07:00
|
|
|
&m_gdbBuildVersion, &m_isMacGdb, &m_isQnxGdb);
|
2013-07-01 14:29:00 +02:00
|
|
|
qDebug() << "Gdb version : " << m_gdbVersion;
|
2013-04-09 00:56:28 -07:00
|
|
|
} else if (m_debuggerEngine == DumpTestCdbEngine) {
|
2013-03-11 15:16:42 -07:00
|
|
|
QByteArray envBat = qgetenv("QTC_MSVC_ENV_BAT");
|
|
|
|
QMap <QString, QString> envPairs;
|
2013-05-14 15:20:45 +02:00
|
|
|
QVERIFY(generateEnvironmentSettings(utilsEnv, QString::fromLatin1(envBat), QString(), envPairs));
|
2013-03-11 15:16:42 -07:00
|
|
|
for (QMap<QString,QString>::const_iterator envIt = envPairs.begin(); envIt!=envPairs.end(); ++envIt)
|
|
|
|
utilsEnv.set(envIt.key(), envIt.value());
|
|
|
|
|
|
|
|
const QByteArray cdbextPath = QByteArray(CDBEXT_PATH) + QByteArray("\\qtcreatorcdbext64");
|
|
|
|
QVERIFY(QFile::exists(QString::fromLatin1(cdbextPath + QByteArray("\\qtcreatorcdbext.dll"))));
|
|
|
|
utilsEnv.appendOrSet(QLatin1String("_NT_DEBUGGER_EXTENSION_PATH"),
|
|
|
|
QString::fromLatin1(cdbextPath),
|
|
|
|
QLatin1String(";"));
|
2013-04-09 00:56:28 -07:00
|
|
|
} else if (m_debuggerEngine == DumpTestLldbEngine) {
|
2013-04-05 15:44:18 +02:00
|
|
|
m_usePython = true;
|
|
|
|
QProcess debugger;
|
2013-05-14 18:02:12 +02:00
|
|
|
QString cmd = QString::fromUtf8(m_debuggerBinary + " -v");
|
|
|
|
debugger.start(cmd);
|
2013-04-05 15:44:18 +02:00
|
|
|
bool ok = debugger.waitForFinished(2000);
|
|
|
|
QVERIFY(ok);
|
|
|
|
QByteArray output = debugger.readAllStandardOutput();
|
|
|
|
output += debugger.readAllStandardError();
|
|
|
|
output = output.trimmed();
|
|
|
|
// Should be something like LLDB-178
|
2013-06-04 10:44:20 +02:00
|
|
|
QByteArray ba = output.mid(output.indexOf('-') + 1);
|
|
|
|
int pos = ba.indexOf('.');
|
|
|
|
if (pos >= 0)
|
|
|
|
ba = ba.left(pos);
|
|
|
|
m_lldbVersion = ba.toInt();
|
|
|
|
qDebug() << "Lldb version " << output << ba << m_lldbVersion;
|
2013-04-05 15:44:18 +02:00
|
|
|
QVERIFY(m_lldbVersion);
|
2013-03-11 15:16:42 -07:00
|
|
|
}
|
|
|
|
m_env = utilsEnv.toProcessEnvironment();
|
2013-02-11 13:54:17 +01:00
|
|
|
}
|
|
|
|
|
2013-03-11 15:15:56 -07:00
|
|
|
void tst_Dumpers::init()
|
2013-02-11 13:54:17 +01:00
|
|
|
{
|
2013-03-11 15:15:56 -07:00
|
|
|
t = new TempStuff();
|
2013-02-11 13:54:17 +01:00
|
|
|
}
|
|
|
|
|
2013-03-11 15:15:56 -07:00
|
|
|
void tst_Dumpers::cleanup()
|
2013-02-11 13:54:17 +01:00
|
|
|
{
|
2013-03-11 15:15:56 -07:00
|
|
|
if (!t->buildTemp.autoRemove()) {
|
|
|
|
QFile logger(t->buildPath + QLatin1String("/input.txt"));
|
2013-02-11 13:54:17 +01:00
|
|
|
logger.open(QIODevice::ReadWrite);
|
2013-03-11 15:15:56 -07:00
|
|
|
logger.write(t->input);
|
2013-02-11 13:54:17 +01:00
|
|
|
}
|
2013-03-11 15:15:56 -07:00
|
|
|
delete t;
|
|
|
|
}
|
2009-04-06 14:07:30 +02:00
|
|
|
|
2013-01-23 12:25:18 +01:00
|
|
|
void tst_Dumpers::dumper()
|
|
|
|
{
|
|
|
|
QFETCH(Data, data);
|
|
|
|
|
2013-04-09 00:56:28 -07:00
|
|
|
if (m_debuggerEngine == DumpTestGdbEngine) {
|
2013-03-11 15:16:42 -07:00
|
|
|
if (data.neededGdbVersion.min > m_gdbVersion)
|
2013-06-04 16:15:56 +02:00
|
|
|
MSKIP_SINGLE("Need minimum GDB version "
|
|
|
|
+ QByteArray::number(data.neededGdbVersion.min));
|
2013-03-11 15:16:42 -07:00
|
|
|
if (data.neededGdbVersion.max < m_gdbVersion)
|
2013-06-04 16:15:56 +02:00
|
|
|
MSKIP_SINGLE("Need maximum GDB version "
|
|
|
|
+ QByteArray::number(data.neededGdbVersion.max));
|
|
|
|
} else {
|
|
|
|
if (data.gdbOnly)
|
|
|
|
MSKIP_SINGLE("Test is GDB specific");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_debuggerEngine == DumpTestLldbEngine) {
|
|
|
|
if (data.neededLldbVersion.min > m_gdbVersion)
|
|
|
|
MSKIP_SINGLE("Need minimum LLDB version "
|
|
|
|
+ QByteArray::number(data.neededLldbVersion.min));
|
|
|
|
if (data.neededLldbVersion.max < m_gdbVersion)
|
|
|
|
MSKIP_SINGLE("Need maximum LLDB version "
|
|
|
|
+ QByteArray::number(data.neededLldbVersion.max));
|
|
|
|
} else {
|
|
|
|
if (data.lldbOnly)
|
|
|
|
MSKIP_SINGLE("Test is LLDB specific");
|
2013-03-11 15:16:42 -07:00
|
|
|
}
|
2013-03-06 12:40:46 +01:00
|
|
|
|
2013-01-23 12:25:18 +01:00
|
|
|
QString cmd;
|
|
|
|
QByteArray output;
|
|
|
|
QByteArray error;
|
|
|
|
|
2013-01-30 13:48:23 +01:00
|
|
|
const char *mainFile = data.forceC ? "main.c" : "main.cpp";
|
|
|
|
|
2013-03-11 15:15:56 -07:00
|
|
|
QFile proFile(t->buildPath + QLatin1String("/doit.pro"));
|
|
|
|
QVERIFY(proFile.open(QIODevice::ReadWrite));
|
2013-01-30 13:48:23 +01:00
|
|
|
proFile.write("SOURCES = ");
|
|
|
|
proFile.write(mainFile);
|
|
|
|
proFile.write("\nTARGET = doit\n");
|
2013-06-04 10:44:20 +02:00
|
|
|
proFile.write("\nCONFIG -= app_bundle\n");
|
2013-02-14 17:03:40 +01:00
|
|
|
proFile.write("\nCONFIG -= release\n");
|
|
|
|
proFile.write("\nCONFIG += debug\n");
|
2013-02-05 01:47:07 +01:00
|
|
|
if (data.useQt)
|
|
|
|
proFile.write("QT -= widgets gui\n");
|
|
|
|
else
|
|
|
|
proFile.write("CONFIG -= QT\n");
|
2013-01-28 17:15:49 +01:00
|
|
|
proFile.write(data.profileExtra);
|
2013-01-23 12:25:18 +01:00
|
|
|
proFile.close();
|
|
|
|
|
2013-03-11 15:15:56 -07:00
|
|
|
QFile source(t->buildPath + QLatin1Char('/') + QLatin1String(mainFile));
|
|
|
|
QVERIFY(source.open(QIODevice::ReadWrite));
|
2013-02-01 17:35:16 +01:00
|
|
|
QByteArray fullCode =
|
2013-02-01 19:01:34 +01:00
|
|
|
"\n\nvoid unused(const void *first,...) { (void) first; }"
|
2013-02-01 17:35:16 +01:00
|
|
|
"\n\nvoid breakHere() {}"
|
2013-02-01 19:01:34 +01:00
|
|
|
"\n\n" + data.includes +
|
2013-01-28 17:47:56 +01:00
|
|
|
"\n\nint main(int argc, char *argv[])"
|
2013-01-23 12:25:18 +01:00
|
|
|
"\n{"
|
2013-02-05 01:47:07 +01:00
|
|
|
"\n int qtversion = " + (data.useQt ? "QT_VERSION" : "0") + ";\n"
|
|
|
|
"\n unused(&argc, &argv, &qtversion);\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"\n" + data.code +
|
|
|
|
"\n breakHere();"
|
2013-01-30 13:48:23 +01:00
|
|
|
"\n return 0;"
|
2013-02-01 17:35:16 +01:00
|
|
|
"\n}\n";
|
|
|
|
source.write(fullCode);
|
2013-01-23 12:25:18 +01:00
|
|
|
source.close();
|
|
|
|
|
|
|
|
QProcess qmake;
|
2013-03-11 15:15:56 -07:00
|
|
|
qmake.setWorkingDirectory(t->buildPath);
|
2013-02-11 13:54:17 +01:00
|
|
|
cmd = QString::fromLatin1(m_qmakeBinary);
|
2013-01-23 12:25:18 +01:00
|
|
|
//qDebug() << "Starting qmake: " << cmd;
|
|
|
|
qmake.start(cmd);
|
2013-03-11 15:15:56 -07:00
|
|
|
QVERIFY(qmake.waitForFinished());
|
2013-01-23 12:25:18 +01:00
|
|
|
output = qmake.readAllStandardOutput();
|
|
|
|
error = qmake.readAllStandardError();
|
|
|
|
//qDebug() << "stdout: " << output;
|
2013-03-11 15:15:56 -07:00
|
|
|
if (!error.isEmpty()) { qDebug() << error; QVERIFY(false); }
|
2013-01-23 12:25:18 +01:00
|
|
|
|
|
|
|
QProcess make;
|
2013-03-11 15:15:56 -07:00
|
|
|
make.setWorkingDirectory(t->buildPath);
|
2013-04-09 00:56:28 -07:00
|
|
|
cmd = m_debuggerEngine == DumpTestCdbEngine ? QString::fromLatin1("nmake")
|
|
|
|
: QString::fromLatin1("make");
|
2013-01-23 12:25:18 +01:00
|
|
|
//qDebug() << "Starting make: " << cmd;
|
|
|
|
make.start(cmd);
|
2013-03-11 15:15:56 -07:00
|
|
|
QVERIFY(make.waitForFinished());
|
2013-01-23 12:25:18 +01:00
|
|
|
output = make.readAllStandardOutput();
|
|
|
|
error = make.readAllStandardError();
|
|
|
|
//qDebug() << "stdout: " << output;
|
2013-03-11 15:16:42 -07:00
|
|
|
if (make.exitCode()) {
|
2013-02-01 17:35:16 +01:00
|
|
|
qDebug() << error;
|
|
|
|
qDebug() << "\n------------------ CODE --------------------";
|
|
|
|
qDebug() << fullCode;
|
|
|
|
qDebug() << "\n------------------ CODE --------------------";
|
|
|
|
qDebug() << ".pro: " << qPrintable(proFile.fileName());
|
|
|
|
}
|
2013-01-23 12:25:18 +01:00
|
|
|
|
|
|
|
QByteArray dumperDir = DUMPERDIR;
|
|
|
|
|
2013-01-24 14:53:46 +01:00
|
|
|
QSet<QByteArray> expandedINames;
|
|
|
|
expandedINames.insert("local");
|
|
|
|
foreach (const Check &check, data.checks) {
|
2013-01-28 17:15:49 +01:00
|
|
|
QByteArray parent = check.iname;
|
|
|
|
while (true) {
|
|
|
|
parent = parentIName(parent);
|
|
|
|
if (parent.isEmpty())
|
|
|
|
break;
|
|
|
|
expandedINames.insert("local." + parent);
|
|
|
|
}
|
2013-01-24 14:53:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray expanded;
|
|
|
|
foreach (const QByteArray &iname, expandedINames) {
|
|
|
|
if (!expanded.isEmpty())
|
|
|
|
expanded.append(',');
|
|
|
|
expanded += iname;
|
|
|
|
}
|
|
|
|
|
2013-05-14 18:02:12 +02:00
|
|
|
QByteArray exe;
|
2013-03-11 15:16:42 -07:00
|
|
|
QStringList args;
|
2013-05-14 18:02:12 +02:00
|
|
|
QByteArray cmds;
|
2013-03-11 15:16:42 -07:00
|
|
|
|
2013-04-09 00:56:28 -07:00
|
|
|
if (m_debuggerEngine == DumpTestGdbEngine) {
|
2013-05-14 18:02:12 +02:00
|
|
|
exe = m_debuggerBinary;
|
2013-03-11 15:16:42 -07:00
|
|
|
args << QLatin1String("-i")
|
|
|
|
<< QLatin1String("mi")
|
|
|
|
<< QLatin1String("-quiet")
|
|
|
|
<< QLatin1String("-nx");
|
|
|
|
QByteArray nograb = "-nograb";
|
|
|
|
|
|
|
|
cmds = "set confirm off\n"
|
|
|
|
"file doit\n"
|
|
|
|
"break breakHere\n"
|
|
|
|
"set print object on\n"
|
|
|
|
"set auto-load python-scripts no\n";
|
|
|
|
|
|
|
|
if (m_usePython) {
|
2013-04-12 15:26:49 +02:00
|
|
|
cmds += "python execfile('" + dumperDir + "/gbridge.py')\n"
|
2013-03-11 15:16:42 -07:00
|
|
|
"run " + nograb + "\n"
|
|
|
|
"up\n"
|
|
|
|
"python print('@%sS@%s@' % ('N', qtNamespace()))\n"
|
2013-06-28 14:04:05 +02:00
|
|
|
"bb options:fancy,autoderef,dyntype,pe vars: expanded:" + expanded + " typeformats:\n";
|
2013-03-11 15:16:42 -07:00
|
|
|
} else {
|
|
|
|
cmds += "run\n";
|
|
|
|
foreach (const Check &check, data.checks) {
|
|
|
|
QByteArray iname = check.iname;
|
|
|
|
//qDebug() << "INAME: " << iname;
|
|
|
|
cmds += "-var-create " + iname + " * "
|
|
|
|
+ check.expectedName.name + "\n";
|
|
|
|
}
|
2013-02-11 13:54:17 +01:00
|
|
|
}
|
2013-03-11 15:16:42 -07:00
|
|
|
cmds += "quit\n";
|
2009-08-05 16:01:33 +02:00
|
|
|
|
2013-04-09 00:56:28 -07:00
|
|
|
} else if (m_debuggerEngine == DumpTestCdbEngine) {
|
2013-05-14 18:02:12 +02:00
|
|
|
exe = m_debuggerBinary;
|
2013-03-11 15:16:42 -07:00
|
|
|
args << QLatin1String("-aqtcreatorcdbext.dll")
|
|
|
|
<< QLatin1String("-lines")
|
|
|
|
<< QLatin1String("-G")
|
|
|
|
<< QLatin1String("-c.idle_cmd")
|
|
|
|
<< QLatin1String("!qtcreatorcdbext.idle")
|
|
|
|
<< QLatin1String("debug\\doit.exe");
|
|
|
|
cmds = "l+t\n"
|
|
|
|
"l+s\n"
|
|
|
|
"bu `doit!" + source.fileName().toLatin1() + ":5`\n"
|
|
|
|
"sxi 0x4000001f\n"
|
|
|
|
"g\n"
|
|
|
|
"gu\n"
|
2013-03-21 15:43:10 -07:00
|
|
|
"!qtcreatorcdbext.expandlocals -t 0 -c 0 " + expanded + "\n";
|
|
|
|
int token = 0;
|
|
|
|
QStringList sortediNames;
|
|
|
|
foreach (QByteArray iName, expandedINames)
|
|
|
|
sortediNames << QString::fromLatin1(iName);
|
|
|
|
sortediNames.sort();
|
|
|
|
foreach (QString iName, sortediNames)
|
2013-06-04 10:44:20 +02:00
|
|
|
cmds += "!qtcreatorcdbext.locals -t " + QByteArray::number(++token)
|
|
|
|
+ " -c 0 " + iName.toLatin1() + "\n";
|
2013-03-21 15:43:10 -07:00
|
|
|
cmds += "q\n";
|
2013-04-09 00:56:28 -07:00
|
|
|
} else if (m_debuggerEngine == DumpTestLldbEngine) {
|
2013-05-14 18:02:12 +02:00
|
|
|
exe = "python";
|
2013-05-16 17:37:41 +02:00
|
|
|
args << QLatin1String(dumperDir + "/lbridge.py")
|
|
|
|
<< QString::fromUtf8(m_debuggerBinary)
|
2013-06-04 10:44:20 +02:00
|
|
|
<< t->buildPath + QLatin1String("/doit")
|
|
|
|
<< QString::fromUtf8(expanded);
|
|
|
|
//qDebug() << exe.constData() << ' ' << qPrintable(args.join(QLatin1Char(' ')));
|
2013-03-11 15:16:42 -07:00
|
|
|
}
|
2013-02-11 13:54:17 +01:00
|
|
|
|
2013-03-11 15:15:56 -07:00
|
|
|
t->input = cmds;
|
2013-02-11 13:54:17 +01:00
|
|
|
|
2013-01-23 12:25:18 +01:00
|
|
|
QProcess debugger;
|
2013-03-11 15:16:42 -07:00
|
|
|
debugger.setProcessEnvironment(m_env);
|
2013-03-11 15:15:56 -07:00
|
|
|
debugger.setWorkingDirectory(t->buildPath);
|
2013-05-14 18:02:12 +02:00
|
|
|
debugger.start(QString::fromLatin1(exe), args);
|
2013-03-11 15:15:56 -07:00
|
|
|
QVERIFY(debugger.waitForStarted());
|
2013-01-23 12:25:18 +01:00
|
|
|
debugger.write(cmds);
|
2013-03-11 15:15:56 -07:00
|
|
|
QVERIFY(debugger.waitForFinished());
|
2013-01-23 12:25:18 +01:00
|
|
|
output = debugger.readAllStandardOutput();
|
|
|
|
//qDebug() << "stdout: " << output;
|
|
|
|
error = debugger.readAllStandardError();
|
|
|
|
if (!error.isEmpty()) { qDebug() << error; }
|
|
|
|
|
2013-02-11 13:54:17 +01:00
|
|
|
if (m_keepTemp) {
|
2013-03-11 15:15:56 -07:00
|
|
|
QFile logger(t->buildPath + QLatin1String("/output.txt"));
|
|
|
|
logger.open(QIODevice::ReadWrite);
|
2013-01-23 12:25:18 +01:00
|
|
|
logger.write("=== STDOUT ===\n");
|
|
|
|
logger.write(output);
|
|
|
|
logger.write("\n=== STDERR ===\n");
|
|
|
|
logger.write(error);
|
2009-08-05 16:01:33 +02:00
|
|
|
}
|
|
|
|
|
2013-02-05 01:47:07 +01:00
|
|
|
Context context;
|
2013-03-11 15:16:42 -07:00
|
|
|
QByteArray contents;
|
2013-04-09 00:56:28 -07:00
|
|
|
if (m_debuggerEngine == DumpTestGdbEngine) {
|
2013-03-11 15:16:42 -07:00
|
|
|
int posDataStart = output.indexOf("data=");
|
|
|
|
QVERIFY(posDataStart != -1);
|
|
|
|
int posDataEnd = output.indexOf(",typeinfo", posDataStart);
|
|
|
|
QVERIFY(posDataEnd != -1);
|
|
|
|
contents = output.mid(posDataStart, posDataEnd - posDataStart);
|
|
|
|
|
|
|
|
int posNameSpaceStart = output.indexOf("@NS@");
|
|
|
|
QVERIFY(posNameSpaceStart != -1);
|
|
|
|
posNameSpaceStart += sizeof("@NS@") - 1;
|
|
|
|
int posNameSpaceEnd = output.indexOf("@", posNameSpaceStart);
|
|
|
|
QVERIFY(posNameSpaceEnd != -1);
|
|
|
|
context.nameSpace = output.mid(posNameSpaceStart, posNameSpaceEnd - posNameSpaceStart);
|
|
|
|
//qDebug() << "FOUND NS: " << context.nameSpace;
|
|
|
|
if (context.nameSpace == "::")
|
|
|
|
context.nameSpace.clear();
|
|
|
|
contents.replace("\\\"", "\"");
|
2013-06-04 10:44:20 +02:00
|
|
|
} else if (m_debuggerEngine == DumpTestLldbEngine) {
|
|
|
|
//qDebug() << "GOT OUTPUT: " << output;
|
|
|
|
QVERIFY(output.startsWith("data="));
|
|
|
|
contents = output;
|
|
|
|
|
|
|
|
//int posNameSpaceStart = output.indexOf("@NS@");
|
|
|
|
//QVERIFY(posNameSpaceStart != -1);
|
|
|
|
//posNameSpaceStart += sizeof("@NS@") - 1;
|
|
|
|
//int posNameSpaceEnd = output.indexOf("@", posNameSpaceStart);
|
|
|
|
//QVERIFY(posNameSpaceEnd != -1);
|
|
|
|
//context.nameSpace = output.mid(posNameSpaceStart, posNameSpaceEnd - posNameSpaceStart);
|
|
|
|
//qDebug() << "FOUND NS: " << context.nameSpace;
|
|
|
|
if (context.nameSpace == "::")
|
|
|
|
context.nameSpace.clear();
|
|
|
|
contents.replace("\\\"", "\"");
|
2013-03-11 15:16:42 -07:00
|
|
|
} else {
|
|
|
|
const QByteArray locals = "|locals|";
|
|
|
|
int pos1 = output.indexOf(locals);
|
|
|
|
QVERIFY(pos1 != -1);
|
|
|
|
do {
|
2013-03-21 15:43:10 -07:00
|
|
|
pos1 += locals.length();
|
|
|
|
if (output.at(pos1) == '[')
|
|
|
|
++pos1;
|
2013-03-11 15:16:42 -07:00
|
|
|
int pos2 = output.indexOf("\n", pos1);
|
|
|
|
QVERIFY(pos2 != -1);
|
2013-03-21 15:43:10 -07:00
|
|
|
if (output.at(pos2 - 1) == ']')
|
|
|
|
--pos2;
|
2013-03-11 15:16:42 -07:00
|
|
|
contents += output.mid(pos1, pos2 - pos1);
|
|
|
|
pos1 = output.indexOf(locals, pos2);
|
|
|
|
} while (pos1 != -1);
|
|
|
|
}
|
2013-01-23 12:25:18 +01:00
|
|
|
|
|
|
|
GdbMi actual;
|
2013-05-14 12:31:11 +02:00
|
|
|
actual.fromString(contents);
|
2013-01-24 14:53:46 +01:00
|
|
|
WatchData local;
|
|
|
|
local.iname = "local";
|
|
|
|
|
|
|
|
QList<WatchData> list;
|
2013-01-23 12:25:18 +01:00
|
|
|
foreach (const GdbMi &child, actual.children()) {
|
2013-01-24 14:53:46 +01:00
|
|
|
WatchData dummy;
|
2013-05-08 09:03:45 +02:00
|
|
|
dummy.iname = child["iname"].data();
|
|
|
|
dummy.name = QLatin1String(child["name"].data());
|
2013-02-05 01:47:07 +01:00
|
|
|
if (dummy.iname == "local.qtversion")
|
2013-05-08 09:03:45 +02:00
|
|
|
context.qtVersion = child["value"].toInt();
|
2013-02-05 01:47:07 +01:00
|
|
|
else
|
|
|
|
parseWatchData(expandedINames, dummy, child, &list);
|
2013-01-24 14:53:46 +01:00
|
|
|
}
|
|
|
|
|
2013-02-05 01:47:07 +01:00
|
|
|
//qDebug() << "QT VERSION " << QByteArray::number(context.qtVersion, 16);
|
2013-02-04 16:44:09 +01:00
|
|
|
QSet<QByteArray> seenINames;
|
2013-03-11 15:15:56 -07:00
|
|
|
bool ok = true;
|
2013-01-24 14:53:46 +01:00
|
|
|
foreach (const WatchData &item, list) {
|
2013-02-04 16:44:09 +01:00
|
|
|
seenINames.insert(item.iname);
|
2013-01-24 14:53:46 +01:00
|
|
|
if (data.checks.contains(item.iname)) {
|
|
|
|
Check check = data.checks.take(item.iname);
|
2013-02-05 01:47:07 +01:00
|
|
|
if (!check.expectedName.matches(item.name.toLatin1(), context)) {
|
2013-01-28 17:15:49 +01:00
|
|
|
qDebug() << "INAME : " << item.iname;
|
2013-02-01 17:35:16 +01:00
|
|
|
qDebug() << "NAME ACTUAL : " << item.name.toLatin1();
|
|
|
|
qDebug() << "NAME EXPECTED: " << check.expectedName.name;
|
2013-03-11 15:15:56 -07:00
|
|
|
ok = false;
|
2009-08-05 16:01:33 +02:00
|
|
|
}
|
2013-02-05 01:47:07 +01:00
|
|
|
if (!check.expectedValue.matches(item.value, context)) {
|
2013-01-28 17:15:49 +01:00
|
|
|
qDebug() << "INAME : " << item.iname;
|
2013-02-11 17:58:52 +01:00
|
|
|
qDebug() << "VALUE ACTUAL : " << item.value << toHex(item.value);
|
2013-05-22 08:55:19 +02:00
|
|
|
qDebug() << "VALUE EXPECTED: "
|
|
|
|
<< check.expectedValue.value << toHex(check.expectedValue.value);
|
2013-03-11 15:15:56 -07:00
|
|
|
ok = false;
|
2009-08-05 16:01:33 +02:00
|
|
|
}
|
2013-02-05 01:47:07 +01:00
|
|
|
if (!check.expectedType.matches(item.type, context)) {
|
2013-01-28 17:15:49 +01:00
|
|
|
qDebug() << "INAME : " << item.iname;
|
2013-01-24 14:53:46 +01:00
|
|
|
qDebug() << "TYPE ACTUAL : " << item.type;
|
2013-01-30 13:48:23 +01:00
|
|
|
qDebug() << "TYPE EXPECTED: " << check.expectedType.type;
|
2013-03-11 15:15:56 -07:00
|
|
|
ok = false;
|
2009-08-17 11:50:09 +02:00
|
|
|
}
|
2009-07-24 11:53:32 +02:00
|
|
|
}
|
|
|
|
}
|
2013-01-24 14:53:46 +01:00
|
|
|
|
|
|
|
if (!data.checks.isEmpty()) {
|
2013-02-05 01:47:07 +01:00
|
|
|
bool fail = false;
|
2013-01-24 14:53:46 +01:00
|
|
|
qDebug() << "SOME TESTS NOT EXECUTED: ";
|
2013-02-05 01:47:07 +01:00
|
|
|
foreach (const Check &check, data.checks) {
|
2013-01-24 14:53:46 +01:00
|
|
|
qDebug() << " TEST NOT FOUND FOR INAME: " << check.iname;
|
2013-02-05 01:47:07 +01:00
|
|
|
if (!fail && check.expectedValue.version != 0)
|
|
|
|
fail = true;
|
|
|
|
}
|
2013-02-04 16:44:09 +01:00
|
|
|
qDebug() << "SEEN INAMES " << seenINames;
|
2013-01-28 17:15:49 +01:00
|
|
|
qDebug() << "EXPANDED : " << expanded;
|
2013-03-11 15:15:56 -07:00
|
|
|
ok = false;
|
2013-01-24 14:53:46 +01:00
|
|
|
}
|
2013-05-22 08:55:19 +02:00
|
|
|
if (!ok) {
|
2013-03-11 15:16:42 -07:00
|
|
|
qDebug() << "CONTENTS : " << contents;
|
2013-05-22 08:55:19 +02:00
|
|
|
qDebug() << "Qt VERSION : "
|
|
|
|
<< qPrintable(QString::number(context.qtVersion, 16));
|
|
|
|
}
|
2013-03-11 15:15:56 -07:00
|
|
|
QVERIFY(ok);
|
|
|
|
t->buildTemp.setAutoRemove(m_keepTemp);
|
2009-07-24 11:53:32 +02:00
|
|
|
}
|
|
|
|
|
2013-01-23 12:25:18 +01:00
|
|
|
void tst_Dumpers::dumper_data()
|
2009-07-24 11:53:32 +02:00
|
|
|
{
|
2013-01-23 12:25:18 +01:00
|
|
|
QTest::addColumn<Data>("data");
|
2009-07-24 11:53:32 +02:00
|
|
|
|
2013-01-28 17:15:49 +01:00
|
|
|
QByteArray fooData =
|
2013-01-28 17:47:56 +01:00
|
|
|
"#include <QHash>\n"
|
2013-01-28 17:15:49 +01:00
|
|
|
"#include <QMap>\n"
|
2013-01-28 17:47:56 +01:00
|
|
|
"#include <QObject>\n"
|
|
|
|
"#include <QString>\n"
|
2013-01-28 17:15:49 +01:00
|
|
|
"class Foo\n"
|
|
|
|
"{\n"
|
|
|
|
"public:\n"
|
|
|
|
" Foo(int i = 0)\n"
|
|
|
|
" : a(i), b(2)\n"
|
|
|
|
" {}\n"
|
|
|
|
" virtual ~Foo()\n"
|
|
|
|
" {\n"
|
|
|
|
" a = 5;\n"
|
|
|
|
" }\n"
|
|
|
|
" void doit()\n"
|
|
|
|
" {\n"
|
|
|
|
" static QObject ob;\n"
|
|
|
|
" m[\"1\"] = \"2\";\n"
|
|
|
|
" h[&ob] = m.begin();\n"
|
|
|
|
" --b;\n"
|
|
|
|
" }\n"
|
|
|
|
"public:\n"
|
|
|
|
" int a, b;\n"
|
|
|
|
" char x[6];\n"
|
|
|
|
"private:\n"
|
|
|
|
" typedef QMap<QString, QString> Map;\n"
|
|
|
|
" Map m;\n"
|
|
|
|
" QHash<QObject *, Map::iterator> h;\n"
|
2013-01-30 11:25:19 +01:00
|
|
|
"};\n";
|
|
|
|
|
|
|
|
QByteArray nsData =
|
|
|
|
"namespace nsA {\n"
|
|
|
|
"namespace nsB {\n"
|
|
|
|
" struct SomeType\n"
|
|
|
|
" {\n"
|
|
|
|
" SomeType(int a) : a(a) {}\n"
|
|
|
|
" int a;\n"
|
|
|
|
" };\n"
|
|
|
|
" } // namespace nsB\n"
|
|
|
|
" } // namespace nsA\n";
|
2013-01-24 14:53:46 +01:00
|
|
|
|
|
|
|
QTest::newRow("AnonymousStruct")
|
2013-01-25 19:11:14 +01:00
|
|
|
<< Data("union {\n"
|
|
|
|
" struct { int i; int b; };\n"
|
|
|
|
" struct { float f; };\n"
|
|
|
|
" double d;\n"
|
|
|
|
" } a = { { 42, 43 } };\n (void)a;")
|
|
|
|
% CheckType("a", "a", "union {...}")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("a.b", "43", "int")
|
|
|
|
% Check("a.d", "9.1245819032257467e-313", "double")
|
|
|
|
% Check("a.f", "5.88545355e-44", "float")
|
|
|
|
% Check("a.i", "42", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QByteArray0")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QByteArray>\n",
|
|
|
|
"QByteArray ba;")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("ba", "ba", "\"\"", "@QByteArray");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QByteArray1")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QByteArray>\n",
|
|
|
|
"QByteArray ba = \"Hello\\\"World\";\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"ba += char(0);\n"
|
|
|
|
"ba += 1;\n"
|
|
|
|
"ba += 2;\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-12 13:17:11 +01:00
|
|
|
% Check("ba", QByteArray("\"Hello\"World")
|
|
|
|
+ char(0) + char(1) + char(2) + '"', "@QByteArray")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("ba.0", "[0]", "72", "char")
|
|
|
|
% Check("ba.11", "[11]", "0", "char")
|
|
|
|
% Check("ba.12", "[12]", "1", "char")
|
|
|
|
% Check("ba.13", "[13]", "2", "char");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QByteArray2")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <QByteArray>\n"
|
|
|
|
"#include <QString>\n"
|
|
|
|
"#include <string>\n",
|
2013-01-28 17:47:56 +01:00
|
|
|
"QByteArray ba;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"for (int i = 256; --i >= 0; )\n"
|
|
|
|
" ba.append(char(i));\n"
|
|
|
|
"QString s(10000, 'x');\n"
|
2013-01-30 11:25:19 +01:00
|
|
|
"std::string ss(10000, 'c');\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&ba, &s, &ss);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% CheckType("ba", "@QByteArray")
|
|
|
|
% Check("s", '"' + QByteArray(10000, 'x') + '"', "@QString")
|
|
|
|
% Check("ss", '"' + QByteArray(10000, 'c') + '"', "std::string");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QByteArray3")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QByteArray>\n",
|
2013-06-20 12:14:30 +02:00
|
|
|
"const char *str1 = \"\\356\";\n"
|
|
|
|
"const char *str2 = \"\\xee\";\n"
|
2013-06-07 08:37:41 +02:00
|
|
|
"const char *str3 = \"\\\\ee\";\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QByteArray buf1(str1);\n"
|
|
|
|
"QByteArray buf2(str2);\n"
|
2013-01-30 11:25:19 +01:00
|
|
|
"QByteArray buf3(str3);\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&buf1, &buf2, &buf3);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-03-27 16:02:40 +02:00
|
|
|
% Check("buf1", "\"" + QByteArray(1, (char)0xee) + "\"", "@QByteArray")
|
|
|
|
% Check("buf2", "\"" + QByteArray(1, (char)0xee) + "\"", "@QByteArray")
|
|
|
|
% Check("buf3", "\"\\ee\"", "@QByteArray")
|
2013-01-28 17:15:49 +01:00
|
|
|
% CheckType("str1", "char *");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QByteArray4")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QByteArray>\n",
|
|
|
|
"char data[] = { 'H', 'e', 'l', 'l', 'o' };\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QByteArray ba1 = QByteArray::fromRawData(data, 4);\n"
|
|
|
|
"QByteArray ba2 = QByteArray::fromRawData(data + 1, 4);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("ba1", "\"Hell\"", "@QByteArray")
|
|
|
|
% Check("ba2", "\"ello\"", "@QByteArray");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QDate0")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QDate>\n",
|
2013-01-30 11:25:19 +01:00
|
|
|
"QDate date;\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&date);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
|
|
|
% Check("date", Value4("(invalid)"), "@QDate")
|
|
|
|
% Check("date", Value5(""), "@QDate");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QDate1")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QDate>\n",
|
|
|
|
"QDate date;\n"
|
2013-01-30 11:25:19 +01:00
|
|
|
"date.setDate(1980, 1, 1);\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&date);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-01 12:31:36 +01:00
|
|
|
% Check("date", "Tue Jan 1 1980", "@QDate")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("date.(ISO)", "\"1980-01-01\"", "@QString")
|
|
|
|
% CheckType("date.(Locale)", "@QString")
|
|
|
|
% CheckType("date.(SystemLocale)", "@QString")
|
|
|
|
% Check("date.toString", "\"Tue Jan 1 1980\"", "@QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QTime0")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <QTime>\n",
|
|
|
|
"QTime time;\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-01 12:31:36 +01:00
|
|
|
% Check("time", "(invalid)", "@QTime");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QTime1")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <QTime>\n",
|
|
|
|
"QTime time(13, 15, 32);")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("time", "13:15:32", "@QTime")
|
|
|
|
% Check("time.(ISO)", "\"13:15:32\"", "@QString")
|
|
|
|
% CheckType("time.(Locale)", "@QString")
|
|
|
|
% CheckType("time.(SystemLocale)", "@QString")
|
|
|
|
% Check("time.toString", "\"13:15:32\"", "@QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
2013-02-01 15:03:39 +01:00
|
|
|
QTest::newRow("QDateTime0")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <QDateTime>\n",
|
2013-07-01 14:29:00 +02:00
|
|
|
"QDateTime date;\n"
|
|
|
|
"unused(&date);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-01 15:03:39 +01:00
|
|
|
% Check("date", "(invalid)", "@QDateTime");
|
|
|
|
|
|
|
|
QTest::newRow("QDateTime1")
|
|
|
|
<< Data("#include <QDateTime>\n",
|
2013-07-01 14:29:00 +02:00
|
|
|
"QDateTime date(QDate(1980, 1, 1), QTime(13, 15, 32), Qt::UTC);\n"
|
|
|
|
"unused(&date);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-01 15:03:39 +01:00
|
|
|
% Check("date", "Tue Jan 1 13:15:32 1980", "@QDateTime")
|
2013-07-02 15:43:29 +02:00
|
|
|
% Check("date.(ISO)", "\"1980-01-01T13:15:32Z\"", "@QString")
|
|
|
|
% CheckType("date.(Locale)", "@QString")
|
|
|
|
% CheckType("date.(SystemLocale)", "@QString")
|
|
|
|
% Check("date.toString", "\"Tue Jan 1 13:15:32 1980\"", "@QString")
|
|
|
|
% Check("date.toUTC", "Tue Jan 1 13:15:32 1980", "@QDateTime");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
#ifdef Q_OS_WIN
|
2013-02-04 22:59:39 +01:00
|
|
|
QByteArray tempDir = "\"C:/Program Files\"";
|
2013-01-25 19:11:14 +01:00
|
|
|
#else
|
2013-02-04 22:59:39 +01:00
|
|
|
QByteArray tempDir = "\"/tmp\"";
|
2013-01-25 19:11:14 +01:00
|
|
|
#endif
|
2013-02-04 22:59:39 +01:00
|
|
|
QTest::newRow("QDir")
|
|
|
|
<< Data("#include <QDir>\n",
|
|
|
|
"QDir dir(" + tempDir + ");\n"
|
|
|
|
"QString s = dir.absolutePath();\n"
|
2013-07-02 15:43:29 +02:00
|
|
|
"QFileInfoList fi = dir.entryInfoList();\n"
|
|
|
|
"unused(&dir, &s, &fi);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-04 22:59:39 +01:00
|
|
|
% Check("dir", tempDir, "@QDir")
|
2013-07-02 11:42:05 +02:00
|
|
|
% Check("dir.absolutePath", tempDir, "@QString");
|
|
|
|
// % Check("dir.canonicalPath", tempDir, "@QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QFileInfo")
|
|
|
|
#ifdef Q_OS_WIN
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <QFile>\n"
|
|
|
|
"#include <QFileInfo>\n",
|
|
|
|
"QFile file(\"C:\\\\Program Files\\t\");\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"file.setObjectName(\"A QFile instance\");\n"
|
|
|
|
"QFileInfo fi(\"C:\\Program Files\\tt\");\n"
|
|
|
|
"QString s = fi.absoluteFilePath();\n")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("fi", "\"C:/Program Files/tt\"", "QFileInfo")
|
2013-03-27 16:02:40 +02:00
|
|
|
% Check("file", "\"C:\\Program Files\\t\"", "QFile")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("s", "\"C:/Program Files/tt\"", "QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
#else
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <QFile>\n"
|
|
|
|
"#include <QFileInfo>\n",
|
|
|
|
"QFile file(\"/tmp/t\");\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"file.setObjectName(\"A QFile instance\");\n"
|
|
|
|
"QFileInfo fi(\"/tmp/tt\");\n"
|
|
|
|
"QString s = fi.absoluteFilePath();\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("fi", "\"/tmp/tt\"", "@QFileInfo")
|
|
|
|
% Check("file", "\"/tmp/t\"", "@QFile")
|
|
|
|
% Check("s", "\"/tmp/tt\"", "@QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
QTest::newRow("QHash1")
|
2013-02-05 01:47:07 +01:00
|
|
|
<< Data("#include <QHash>\n"
|
|
|
|
"#include <QString>\n"
|
|
|
|
"#include <QList>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"QHash<QString, QList<int> > hash;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"hash.insert(\"Hallo\", QList<int>());\n"
|
|
|
|
"hash.insert(\"Welt\", QList<int>() << 1);\n"
|
|
|
|
"hash.insert(\"!\", QList<int>() << 1 << 2);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("hash", "<3 items>", "@QHash<@QString, @QList<int> >")
|
|
|
|
% Check("hash.0", "[0]", "", "@QHashNode<@QString, @QList<int>>")
|
2013-02-05 01:47:07 +01:00
|
|
|
% Check("hash.0.key", Value4("\"Hallo\""), "@QString")
|
|
|
|
% Check("hash.0.key", Value5("\"Welt\""), "@QString")
|
|
|
|
% Check("hash.0.value", Value4("<0 items>"), "@QList<int>")
|
|
|
|
% Check("hash.0.value", Value5("<1 items>"), "@QList<int>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("hash.1", "[1]", "", "@QHashNode<@QString, @QList<int>>")
|
2013-02-05 01:47:07 +01:00
|
|
|
% Check("hash.1.key", "key", Value4("\"Welt\""), "@QString")
|
|
|
|
% Check("hash.1.key", "key", Value5("\"Hallo\""), "@QString")
|
|
|
|
% Check("hash.1.value", "value", Value4("<1 items>"), "@QList<int>")
|
|
|
|
% Check("hash.1.value", "value", Value5("<0 items>"), "@QList<int>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("hash.2", "[2]", "", "@QHashNode<@QString, @QList<int>>")
|
|
|
|
% Check("hash.2.key", "key", "\"!\"", "@QString")
|
|
|
|
% Check("hash.2.value", "value", "<2 items>", "@QList<int>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("hash.2.value.0", "[0]", "1", "int")
|
|
|
|
% Check("hash.2.value.1", "[1]", "2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QHash2")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <QHash>\n",
|
|
|
|
"QHash<int, float> hash;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"hash[11] = 11.0;\n"
|
|
|
|
"hash[22] = 22.0;\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("hash", "hash", "<2 items>", "@QHash<int, float>")
|
|
|
|
% Check("hash.22", "[22]", "22", "float")
|
|
|
|
% Check("hash.11", "[11]", "11", "float");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QHash3")
|
2013-02-05 01:47:07 +01:00
|
|
|
<< Data("#include <QString>\n"
|
|
|
|
"#include <QHash>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"QHash<QString, int> hash;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"hash[\"22.0\"] = 22.0;\n"
|
|
|
|
"hash[\"123.0\"] = 22.0;\n"
|
|
|
|
"hash[\"111111ss111128.0\"] = 28.0;\n"
|
|
|
|
"hash[\"11124.0\"] = 22.0;\n"
|
|
|
|
"hash[\"1111125.0\"] = 22.0;\n"
|
|
|
|
"hash[\"11111126.0\"] = 22.0;\n"
|
|
|
|
"hash[\"111111127.0\"] = 27.0;\n"
|
|
|
|
"hash[\"111111111128.0\"] = 28.0;\n"
|
|
|
|
"hash[\"111111111111111111129.0\"] = 29.0;\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("hash", "hash", "<9 items>", "@QHash<@QString, int>")
|
|
|
|
% Check("hash.0", "[0]", "", "@QHashNode<@QString, int>")
|
2013-02-05 01:47:07 +01:00
|
|
|
% Check("hash.0.key", "key", Value4("\"123.0\""), "@QString")
|
|
|
|
% Check("hash.0.key", "key", Value5("\"111111111128.0\""), "@QString")
|
|
|
|
% Check("hash.0.value", Value4("22"), "int")
|
|
|
|
% Check("hash.0.value", Value5("28"), "int")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("hash.8", "[8]", "", "@QHashNode<@QString, int>")
|
2013-02-05 01:47:07 +01:00
|
|
|
% Check("hash.8.key", "key", Value4("\"11124.0\""), "@QString")
|
|
|
|
% Check("hash.8.key", "key", Value5("\"123.0\""), "@QString")
|
|
|
|
% Check("hash.8.value", "value", Value4("22"), "int")
|
|
|
|
% Check("hash.8.value", "value", Value5("22"), "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QHash4")
|
2013-02-05 01:47:07 +01:00
|
|
|
<< Data("#include <QByteArray>\n"
|
|
|
|
"#include <QHash>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"QHash<QByteArray, float> hash;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"hash[\"22.0\"] = 22.0;\n"
|
|
|
|
"hash[\"123.0\"] = 22.0;\n"
|
|
|
|
"hash[\"111111ss111128.0\"] = 28.0;\n"
|
|
|
|
"hash[\"11124.0\"] = 22.0;\n"
|
|
|
|
"hash[\"1111125.0\"] = 22.0;\n"
|
|
|
|
"hash[\"11111126.0\"] = 22.0;\n"
|
|
|
|
"hash[\"111111127.0\"] = 27.0;\n"
|
|
|
|
"hash[\"111111111128.0\"] = 28.0;\n"
|
|
|
|
"hash[\"111111111111111111129.0\"] = 29.0;\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("hash", "<9 items>", "@QHash<@QByteArray, float>")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("hash.0", "[0]", "", "@QHashNode<@QByteArray, float>")
|
2013-02-05 01:47:07 +01:00
|
|
|
% Check("hash.0.key", Value4("\"123.0\""), "@QByteArray")
|
|
|
|
% Check("hash.0.key", Value5("\"111111111128.0\""), "@QByteArray")
|
|
|
|
% Check("hash.0.value", Value4("22"), "float")
|
|
|
|
% Check("hash.0.value", Value5("28"), "float")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("hash.8", "[8]", "", "@QHashNode<@QByteArray, float>")
|
2013-02-05 01:47:07 +01:00
|
|
|
% Check("hash.8.key", Value4("\"11124.0\""), "@QByteArray")
|
|
|
|
% Check("hash.8.key", Value5("\"123.0\""), "@QByteArray")
|
|
|
|
% Check("hash.8.value", Value4("22"), "float")
|
|
|
|
% Check("hash.8.value", Value5("22"), "float");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QHash5")
|
2013-02-05 01:47:07 +01:00
|
|
|
<< Data("#include <QString>\n"
|
|
|
|
"#include <QHash>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"QHash<int, QString> hash;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"hash[22] = \"22.0\";\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("hash", "<1 items>", "@QHash<int, @QString>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("hash.0", "[0]", "", "@QHashNode<int, @QString>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("hash.0.key", "22", "int")
|
|
|
|
% Check("hash.0.value", "\"22.0\"", "@QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QHash6")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <QHash>\n" + fooData,
|
|
|
|
"QHash<QString, Foo> hash;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"hash[\"22.0\"] = Foo(22);\n"
|
|
|
|
"hash[\"33.0\"] = Foo(33);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("hash", "<2 items>", "@QHash<@QString, Foo>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("hash.0", "[0]", "", "@QHashNode<@QString, Foo>")
|
2013-02-05 01:47:07 +01:00
|
|
|
% Check("hash.0.key", Value4("\"22.0\""), "@QString")
|
|
|
|
% Check("hash.0.key", Value5("\"33.0\""), "@QString")
|
2013-01-28 17:15:49 +01:00
|
|
|
% CheckType("hash.0.value", "Foo")
|
2013-02-05 01:47:07 +01:00
|
|
|
% Check("hash.0.value.a", Value4("22"), "int")
|
|
|
|
% Check("hash.0.value.a", Value5("33"), "int")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("hash.1", "[1]", "", "@QHashNode<@QString, Foo>")
|
2013-02-05 01:47:07 +01:00
|
|
|
% Check("hash.1.key", Value4("\"33.0\""), "@QString")
|
2013-02-11 16:33:13 +01:00
|
|
|
% Check("hash.1.key", Value5("\"22.0\""), "@QString")
|
2013-01-28 17:15:49 +01:00
|
|
|
% CheckType("hash.1.value", "Foo");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QHash7")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QHash>\n"
|
|
|
|
"#include <QPointer>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"QObject ob;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QHash<QString, QPointer<QObject> > hash;\n"
|
|
|
|
"hash.insert(\"Hallo\", QPointer<QObject>(&ob));\n"
|
|
|
|
"hash.insert(\"Welt\", QPointer<QObject>(&ob));\n"
|
|
|
|
"hash.insert(\".\", QPointer<QObject>(&ob));\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("hash", "<3 items>", "@QHash<@QString, @QPointer<@QObject>>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("hash.0", "[0]", "", "@QHashNode<@QString, @QPointer<@QObject>>")
|
2013-02-05 01:47:07 +01:00
|
|
|
% Check("hash.0.key", Value4("\"Hallo\""), "@QString")
|
2013-02-11 16:33:13 +01:00
|
|
|
% Check("hash.0.key", Value5("\"Welt\""), "@QString")
|
2013-01-28 17:47:56 +01:00
|
|
|
% CheckType("hash.0.value", "@QPointer<@QObject>")
|
2013-02-05 01:47:07 +01:00
|
|
|
//% CheckType("hash.0.value.o", "@QObject")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("hash.2", "[2]", "", "@QHashNode<@QString, @QPointer<@QObject>>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("hash.2.key", "\".\"", "@QString")
|
|
|
|
% CheckType("hash.2.value", "@QPointer<@QObject>");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QHashIntFloatIterator")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <QHash>\n",
|
|
|
|
"typedef QHash<int, float> Hash;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"Hash hash;\n"
|
|
|
|
"hash[11] = 11.0;\n"
|
|
|
|
"hash[22] = 22.0;\n"
|
|
|
|
"hash[33] = 33.0;\n"
|
|
|
|
"hash[44] = 44.0;\n"
|
|
|
|
"hash[55] = 55.0;\n"
|
|
|
|
"hash[66] = 66.0;\n"
|
|
|
|
"Hash::iterator it1 = hash.begin();\n"
|
|
|
|
"Hash::iterator it2 = it1; ++it2;\n"
|
|
|
|
"Hash::iterator it3 = it2; ++it3;\n"
|
|
|
|
"Hash::iterator it4 = it3; ++it4;\n"
|
|
|
|
"Hash::iterator it5 = it4; ++it5;\n"
|
|
|
|
"Hash::iterator it6 = it5; ++it6;\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("hash", "<6 items>", "Hash")
|
|
|
|
% Check("hash.11", "[11]", "11", "float")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("it1.key", "55", "int")
|
|
|
|
% Check("it1.value", "55", "float")
|
|
|
|
% Check("it6.key", "33", "int")
|
|
|
|
% Check("it6.value", "33", "float");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QHostAddress")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <QHostAddress>\n",
|
|
|
|
"QHostAddress ha1(129u * 256u * 256u * 256u + 130u);\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QHostAddress ha2(\"127.0.0.1\");\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Profile("QT += network\n")
|
|
|
|
% Check("ha1", "129.0.0.130", "@QHostAddress")
|
|
|
|
% Check("ha2", "\"127.0.0.1\"", "@QHostAddress");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QImage")
|
|
|
|
<< Data("#include <QImage>\n"
|
2013-02-13 00:51:05 +01:00
|
|
|
"#include <QApplication>\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"#include <QPainter>\n",
|
2013-02-13 00:51:05 +01:00
|
|
|
"QApplication app(argc, argv);\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QImage im(QSize(200, 200), QImage::Format_RGB32);\n"
|
|
|
|
"im.fill(QColor(200, 100, 130).rgba());\n"
|
|
|
|
"QPainter pain;\n"
|
2013-02-05 01:47:07 +01:00
|
|
|
"pain.begin(&im);\n"
|
|
|
|
"unused(&pain, &im);\n")
|
2013-01-28 17:47:56 +01:00
|
|
|
% GuiProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("im", "(200x200)", "@QImage")
|
|
|
|
% CheckType("pain", "@QPainter");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QPixmap")
|
|
|
|
<< Data("#include <QImage>\n"
|
|
|
|
"#include <QPainter>\n"
|
2013-01-28 17:47:56 +01:00
|
|
|
"#include <QApplication>\n",
|
|
|
|
"QApplication app(argc, argv);\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QImage im(QSize(200, 200), QImage::Format_RGB32);\n"
|
|
|
|
"im.fill(QColor(200, 100, 130).rgba());\n"
|
|
|
|
"QPainter pain;\n"
|
|
|
|
"pain.begin(&im);\n"
|
|
|
|
"pain.drawLine(2, 2, 130, 130);\n"
|
|
|
|
"pain.end();\n"
|
2013-01-28 17:47:56 +01:00
|
|
|
"QPixmap pm = QPixmap::fromImage(im);\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&pm);\n")
|
2013-01-28 17:47:56 +01:00
|
|
|
% GuiProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("im", "(200x200)", "@QImage")
|
|
|
|
% CheckType("pain", "@QPainter")
|
|
|
|
% Check("pm", "(200x200)", "@QPixmap");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QLinkedListInt")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QLinkedList>\n",
|
|
|
|
"QLinkedList<int> list;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"list.append(101);\n"
|
|
|
|
"list.append(102);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("list", "<2 items>", "@QLinkedList<int>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("list.0", "[0]", "101", "int")
|
|
|
|
% Check("list.1", "[1]", "102", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QLinkedListUInt")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QLinkedList>\n",
|
|
|
|
"QLinkedList<uint> list;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"list.append(103);\n"
|
|
|
|
"list.append(104);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("list", "<2 items>", "@QLinkedList<unsigned int>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("list.0", "[0]", "103", "unsigned int")
|
|
|
|
% Check("list.1", "[1]", "104", "unsigned int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QLinkedListFooStar")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <QLinkedList>\n" + fooData,
|
|
|
|
"QLinkedList<Foo *> list;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"list.append(new Foo(1));\n"
|
|
|
|
"list.append(0);\n"
|
|
|
|
"list.append(new Foo(3));\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("list", "<3 items>", "@QLinkedList<Foo*>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% CheckType("list.0", "[0]", "Foo")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("list.0.a", "1", "int")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("list.1", "[1]", "0x0", "Foo *")
|
|
|
|
% CheckType("list.2", "[2]", "Foo")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("list.2.a", "3", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QLinkedListULongLong")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QLinkedList>\n",
|
|
|
|
"QLinkedList<qulonglong> list;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"list.append(42);\n"
|
|
|
|
"list.append(43);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("list", "<2 items>", "@QLinkedList<unsigned long long>")
|
|
|
|
% Check("list.0", "[0]", "42", "unsigned long long")
|
|
|
|
% Check("list.1", "[1]", "43", "unsigned long long");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QLinkedListFoo")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <QLinkedList>\n" + fooData,
|
|
|
|
"QLinkedList<Foo> list;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"list.append(Foo(1));\n"
|
|
|
|
"list.append(Foo(2));\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("list", "<2 items>", "@QLinkedList<Foo>")
|
|
|
|
% CheckType("list.0", "[0]", "Foo")
|
|
|
|
% Check("list.0.a", "1", "int")
|
|
|
|
% CheckType("list.1", "[1]", "Foo")
|
|
|
|
% Check("list.1.a", "2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QLinkedListStdString")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QLinkedList>\n"
|
|
|
|
"#include <string>\n",
|
|
|
|
"QLinkedList<std::string> list;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"list.push_back(\"aa\");\n"
|
|
|
|
"list.push_back(\"bb\");\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("list", "<2 items>", "@QLinkedList<std::string>")
|
|
|
|
% Check("list.0", "[0]", "\"aa\"", "std::string")
|
|
|
|
% Check("list.1", "[1]", "\"bb\"", "std::string");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QListInt")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QList>\n",
|
|
|
|
"QList<int> big;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"for (int i = 0; i < 10000; ++i)\n"
|
|
|
|
" big.push_back(i);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("big", "<10000 items>", "@QList<int>")
|
|
|
|
% Check("big.0", "[0]", "0", "int")
|
|
|
|
% Check("big.1999", "[1999]", "1999", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QListIntTakeFirst")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QList>\n",
|
|
|
|
"QList<int> l;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"l.append(0);\n"
|
|
|
|
"l.append(1);\n"
|
|
|
|
"l.append(2);\n"
|
|
|
|
"l.takeFirst();\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("l", "<2 items>", "@QList<int>")
|
|
|
|
% Check("l.0", "[0]", "1", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QListStringTakeFirst")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QList>\n"
|
|
|
|
"#include <QString>\n",
|
|
|
|
"QList<QString> l;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"l.append(\"0\");\n"
|
|
|
|
"l.append(\"1\");\n"
|
|
|
|
"l.append(\"2\");\n"
|
|
|
|
"l.takeFirst();\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("l", "<2 items>", "@QList<@QString>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("l.0", "[0]", "\"1\"", "@QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QStringListTakeFirst")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QStringList>\n",
|
|
|
|
"QStringList l;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"l.append(\"0\");\n"
|
|
|
|
"l.append(\"1\");\n"
|
|
|
|
"l.append(\"2\");\n"
|
|
|
|
"l.takeFirst();\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("l", "<2 items>", "@QStringList")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("l.0", "[0]", "\"1\"", "@QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QListIntStar")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QList>\n",
|
|
|
|
"QList<int *> l0, l;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"l.append(new int(1));\n"
|
|
|
|
"l.append(new int(2));\n"
|
|
|
|
"l.append(new int(3));\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("l0", "<0 items>", "@QList<int*>")
|
|
|
|
% Check("l", "<3 items>", "@QList<int*>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% CheckType("l.0", "[0]", "int")
|
|
|
|
% CheckType("l.2", "[2]", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QListUInt")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QList>\n",
|
|
|
|
"QList<uint> l0,l;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"l.append(101);\n"
|
|
|
|
"l.append(102);\n"
|
|
|
|
"l.append(102);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("l0", "<0 items>", "@QList<unsigned int>")
|
|
|
|
% Check("l", "<3 items>", "@QList<unsigned int>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("l.0", "[0]", "101", "unsigned int")
|
|
|
|
% Check("l.2", "[2]", "102", "unsigned int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QListUShort")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QList>\n",
|
|
|
|
"QList<ushort> l0,l;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"l.append(101);\n"
|
|
|
|
"l.append(102);\n"
|
|
|
|
"l.append(102);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("l0", "<0 items>", "@QList<unsigned short>")
|
|
|
|
% Check("l", "<3 items>", "@QList<unsigned short>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("l.0", "[0]", "101", "unsigned short")
|
|
|
|
% Check("l.2", "[2]", "102", "unsigned short");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QListQChar")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QList>\n"
|
|
|
|
"#include <QChar>\n",
|
|
|
|
"QList<QChar> l0, l;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"l.append(QChar('a'));\n"
|
|
|
|
"l.append(QChar('b'));\n"
|
|
|
|
"l.append(QChar('c'));\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("l0", "<0 items>", "@QList<@QChar>")
|
|
|
|
% Check("l", "<3 items>", "@QList<@QChar>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("l.0", "[0]", "'a' (97)", "@QChar")
|
|
|
|
% Check("l.2", "[2]", "'c' (99)", "@QChar");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QListQULongLong")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QList>\n",
|
|
|
|
"QList<qulonglong> l0, l;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"l.append(101);\n"
|
|
|
|
"l.append(102);\n"
|
|
|
|
"l.append(102);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("l0", "<0 items>", "@QList<unsigned long long>")
|
|
|
|
% Check("l", "<3 items>", "@QList<unsigned long long>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("l.0", "[0]", "101", "unsigned long long")
|
|
|
|
% Check("l.2", "[2]", "102", "unsigned long long");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QListStdString")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QList>\n"
|
|
|
|
"#include <string>\n",
|
|
|
|
"QList<std::string> l0, l;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"l.push_back(\"aa\");\n"
|
|
|
|
"l.push_back(\"bb\");\n"
|
|
|
|
"l.push_back(\"cc\");\n"
|
|
|
|
"l.push_back(\"dd\");")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("l0", "<0 items>", "@QList<std::string>")
|
|
|
|
% Check("l", "<4 items>", "@QList<std::string>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% CheckType("l.0", "[0]", "std::string")
|
|
|
|
% Check("l.3", "[3]" ,"\"dd\"", "std::string");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QListFoo")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <QList>\n" + fooData,
|
|
|
|
"QList<Foo> l0, l;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"for (int i = 0; i < 100; ++i)\n"
|
|
|
|
" l.push_back(i + 15);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("l0", "<0 items>", "@QList<Foo>")
|
|
|
|
% Check("l", "<100 items>", "@QList<Foo>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("l.0", "[0]", "", "Foo")
|
|
|
|
% Check("l.99", "[99]", "", "Foo");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QListReverse")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QList>\n",
|
|
|
|
"QList<int> l = QList<int>() << 1 << 2 << 3;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"typedef std::reverse_iterator<QList<int>::iterator> Reverse;\n"
|
|
|
|
"Reverse rit(l.end());\n"
|
|
|
|
"Reverse rend(l.begin());\n"
|
|
|
|
"QList<int> r;\n"
|
|
|
|
"while (rit != rend)\n"
|
|
|
|
" r.append(*rit++);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("l", "<3 items>", "@QList<int>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("l.0", "[0]", "1", "int")
|
|
|
|
% Check("l.1", "[1]", "2", "int")
|
|
|
|
% Check("l.2", "[2]", "3", "int")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("r", "<3 items>", "@QList<int>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("r.0", "[0]", "3", "int")
|
|
|
|
% Check("r.1", "[1]", "2", "int")
|
|
|
|
% Check("r.2", "[2]", "1", "int")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("rend", "", "Reverse")
|
|
|
|
% Check("rit", "", "Reverse");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QLocale")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QLocale>\n",
|
2013-02-11 17:06:39 +01:00
|
|
|
"QLocale loc0;\n"
|
2013-01-28 17:47:56 +01:00
|
|
|
"QLocale loc = QLocale::system();\n"
|
|
|
|
"QLocale::MeasurementSystem m = loc.measurementSystem();\n"
|
2013-02-11 17:06:39 +01:00
|
|
|
"QLocale loc1(\"en_US\");\n"
|
|
|
|
"QLocale::MeasurementSystem m1 = loc1.measurementSystem();\n"
|
|
|
|
"unused(&loc0, &loc, &m, &loc1, &m1);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-11 17:06:39 +01:00
|
|
|
% Check("loc0", "\"en_US\"", "@QLocale")
|
|
|
|
% CheckType("loc", "@QLocale")
|
|
|
|
% CheckType("m", "@QLocale::MeasurementSystem")
|
|
|
|
% Check("loc1", "\"en_US\"", "@QLocale")
|
|
|
|
% Check("m1", Value5("@QLocale::ImperialUSSystem (1)"), "@QLocale::MeasurementSystem")
|
|
|
|
% Check("m1", Value4("@QLocale::ImperialSystem (1)"), "@QLocale::MeasurementSystem");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QMapUIntStringList")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QMap>\n"
|
|
|
|
"#include <QStringList>\n",
|
|
|
|
"QMap<uint, QStringList> map;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"map[11] = QStringList() << \"11\";\n"
|
|
|
|
"map[22] = QStringList() << \"22\";\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map", "<2 items>", "@QMap<unsigned int, @QStringList>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("map.0", "[0]", "", "@QMapNode<unsigned int, @QStringList>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.0.key", "11", "unsigned int")
|
|
|
|
% Check("map.0.value", "<1 items>", "@QStringList")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("map.0.value.0", "[0]", "\"11\"", "@QString")
|
|
|
|
% Check("map.1", "[1]", "", "@QMapNode<unsigned int, @QStringList>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.1.key", "22", "unsigned int")
|
|
|
|
% Check("map.1.value", "<1 items>", "@QStringList")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("map.1.value.0", "[0]", "\"22\"", "@QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QMapUIntStringListTypedef")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QMap>\n"
|
|
|
|
"#include <QStringList>\n",
|
|
|
|
"typedef QMap<uint, QStringList> T;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"T map;\n"
|
|
|
|
"map[11] = QStringList() << \"11\";\n"
|
|
|
|
"map[22] = QStringList() << \"22\";\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("map", "<2 items>", "T")
|
|
|
|
% Check("map.0", "[0]", "", "@QMapNode<unsigned int, @QStringList>");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QMapUIntFloat")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QMap>\n",
|
|
|
|
"QMap<uint, float> map;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"map[11] = 11.0;\n"
|
|
|
|
"map[22] = 22.0;\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map", "<2 items>", "@QMap<unsigned int, float>")
|
2013-02-13 14:54:37 +01:00
|
|
|
% Check("map.0", "[11]", "11", "float")
|
|
|
|
% Check("map.1", "[22]", "22", "float");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QMapStringFloat")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <QMap>\n"
|
|
|
|
"#include <QString>\n",
|
2013-01-28 17:47:56 +01:00
|
|
|
"QMap<QString, float> map;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"map[\"22.0\"] = 22.0;\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map", "<1 items>", "@QMap<@QString, float>")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("map.0", "[0]", "", "@QMapNode<@QString, float>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.0.key", "\"22.0\"", "@QString")
|
|
|
|
% Check("map.0.value", "22", "float");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QMapIntString")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <QMap>\n"
|
|
|
|
"#include <QString>\n",
|
2013-01-28 17:47:56 +01:00
|
|
|
"QMap<int, QString> map;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"map[22] = \"22.0\";\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map", "<1 items>", "@QMap<int, @QString>")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("map.0", "[0]", "", "@QMapNode<int, @QString>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.0.key", "22", "int")
|
|
|
|
% Check("map.0.value", "\"22.0\"", "@QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QMapStringFoo")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <QMap>\n" + fooData +
|
|
|
|
"#include <QString>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"QMap<QString, Foo> map;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"map[\"22.0\"] = Foo(22);\n"
|
|
|
|
"map[\"33.0\"] = Foo(33);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map", "<2 items>", "@QMap<@QString, Foo>")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("map.0", "[0]", "", "@QMapNode<@QString, Foo>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.0.key", "\"22.0\"", "@QString")
|
|
|
|
% Check("map.0.value", "", "Foo")
|
|
|
|
% Check("map.0.value.a", "22", "int")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("map.1", "[1]", "", "@QMapNode<@QString, Foo>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.1.key", "\"33.0\"", "@QString")
|
|
|
|
% Check("map.1.value", "", "Foo")
|
|
|
|
% Check("map.1.value.a", "33", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QMapStringPointer")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <QMap>\n"
|
|
|
|
"#include <QObject>\n"
|
|
|
|
"#include <QPointer>\n"
|
|
|
|
"#include <QString>\n",
|
2013-01-28 17:47:56 +01:00
|
|
|
"QObject ob;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QMap<QString, QPointer<QObject> > map;\n"
|
|
|
|
"map.insert(\"Hallo\", QPointer<QObject>(&ob));\n"
|
|
|
|
"map.insert(\"Welt\", QPointer<QObject>(&ob));\n"
|
|
|
|
"map.insert(\".\", QPointer<QObject>(&ob));\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map", "<3 items>", "@QMap<@QString, @QPointer<@QObject>>")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("map.0", "[0]", "", "@QMapNode<@QString, @QPointer<@QObject>>")
|
2013-02-12 12:05:05 +01:00
|
|
|
% Check("map.0.key", Value4("\".\""), "@QString")
|
|
|
|
% Check("map.0.key", Value5("\"Hallo\""), "@QString")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.0.value", "", "@QPointer<@QObject>")
|
2013-02-12 12:05:05 +01:00
|
|
|
//% Check("map.0.value.o", Pointer(), "@QObject")
|
|
|
|
// FIXME: it's '.wp' in Qt 5
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("map.1", "[1]", "", "@QMapNode<@QString, @QPointer<@QObject>>")
|
2013-02-12 12:05:05 +01:00
|
|
|
% Check("map.1.key", Value4("\"Hallo\""), "@QString")
|
|
|
|
% Check("map.1.key", Value5("\".\""), "@QString")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("map.2", "[2]", "", "@QMapNode<@QString, @QPointer<@QObject>>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.2.key", "\"Welt\"", "@QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QMapStringList")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <QMap>\n"
|
|
|
|
"#include <QList>\n"
|
|
|
|
"#include <QString>\n" + nsData,
|
2013-01-28 17:47:56 +01:00
|
|
|
"QList<nsA::nsB::SomeType *> x;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"x.append(new nsA::nsB::SomeType(1));\n"
|
|
|
|
"x.append(new nsA::nsB::SomeType(2));\n"
|
|
|
|
"x.append(new nsA::nsB::SomeType(3));\n"
|
|
|
|
"QMap<QString, QList<nsA::nsB::SomeType *> > map;\n"
|
|
|
|
"map[\"foo\"] = x;\n"
|
|
|
|
"map[\"bar\"] = x;\n"
|
|
|
|
"map[\"1\"] = x;\n"
|
|
|
|
"map[\"2\"] = x;\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map", "<4 items>", "@QMap<@QString, @QList<nsA::nsB::SomeType*>>")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("map.0", "[0]", "", "@QMapNode<@QString, @QList<nsA::nsB::SomeType*>>")
|
2013-02-13 00:51:05 +01:00
|
|
|
% Check("map.0.key", Value4("\"1\""), "@QString")
|
|
|
|
% Check("map.0.key", Value5("\"bar\""), "@QString")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.0.value", "<3 items>", "@QList<nsA::nsB::SomeType*>")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("map.0.value.0", "[0]", "", "nsA::nsB::SomeType")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.0.value.0.a", "1", "int")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("map.0.value.1", "[1]", "", "nsA::nsB::SomeType")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.0.value.1.a", "2", "int")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("map.0.value.2", "[2]", "", "nsA::nsB::SomeType")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.0.value.2.a", "3", "int")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("map.3", "[3]", "", "@QMapNode<@QString, @QList<nsA::nsB::SomeType*>>")
|
2013-02-13 00:51:05 +01:00
|
|
|
% Check("map.3.key", Value4("\"foo\""), "@QString")
|
|
|
|
% Check("map.3.key", Value5("\"2\""), "@QString")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.3.value", "<3 items>", "@QList<nsA::nsB::SomeType*>")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("map.3.value.2", "[2]", "", "nsA::nsB::SomeType")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.3.value.2.a", "3", "int")
|
|
|
|
% Check("x", "<3 items>", "@QList<nsA::nsB::SomeType*>");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
2013-02-13 14:54:37 +01:00
|
|
|
// QTest::newRow("QMultiMapUintFloat")
|
|
|
|
// << Data("#include <QMap>\n",
|
|
|
|
// "QMultiMap<uint, float> map;\n"
|
|
|
|
// "map.insert(11, 11.0);\n"
|
|
|
|
// "map.insert(22, 22.0);\n"
|
|
|
|
// "map.insert(22, 33.0);\n"
|
|
|
|
// "map.insert(22, 34.0);\n"
|
|
|
|
// "map.insert(22, 35.0);\n"
|
|
|
|
// "map.insert(22, 36.0);\n")
|
|
|
|
// // FIXME: Wrong behaviour.
|
|
|
|
// % Check("map", "<6 items>", "@QMultiMap<unsigned int, float>")
|
|
|
|
// // % Check("map.[0] 11", "[0] 11", "11", "float")
|
|
|
|
// % Check("map.5", Value4("A"), "float")
|
|
|
|
// % Check("map.5", Value5("B"), "float");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QMultiMapStringFloat")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <QMap>\n"
|
|
|
|
"#include <QString>\n",
|
2013-01-28 17:47:56 +01:00
|
|
|
"QMultiMap<QString, float> map;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"map.insert(\"22.0\", 22.0);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map", "<1 items>", "@QMultiMap<@QString, float>")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("map.0", "[0]", "", "@QMapNode<@QString, float>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.0.key", "\"22.0\"", "@QString")
|
|
|
|
% Check("map.0.value", "22", "float");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QMultiMapIntString")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <QMap>\n"
|
|
|
|
"#include <QString>\n",
|
2013-01-28 17:47:56 +01:00
|
|
|
"QMultiMap<int, QString> map;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"map.insert(22, \"22.0\");\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map", "<1 items>", "@QMultiMap<int, @QString>")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("map.0", "[0]", "", "@QMapNode<int, @QString>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.0.key", "22", "int")
|
|
|
|
% Check("map.0.value", "\"22.0\"", "@QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QMultiMapStringFoo")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <QMultiMap>\n" + fooData,
|
|
|
|
"QMultiMap<QString, Foo> map;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"map.insert(\"22.0\", Foo(22));\n"
|
|
|
|
"map.insert(\"33.0\", Foo(33));\n"
|
|
|
|
"map.insert(\"22.0\", Foo(22));\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map", "<3 items>", "@QMultiMap<@QString, Foo>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("map.0", "[0]", "", "@QMapNode<@QString, Foo>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.0.key", "\"22.0\"", "@QString")
|
|
|
|
% Check("map.0.value", "", "Foo")
|
|
|
|
% Check("map.0.value.a", "22", "int")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("map.2", "[2]", "", "@QMapNode<@QString, Foo>");
|
2013-01-28 17:15:49 +01:00
|
|
|
|
|
|
|
QTest::newRow("QMultiMapStringPointer")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QMap>\n"
|
|
|
|
"#include <QObject>\n"
|
|
|
|
"#include <QPointer>\n"
|
|
|
|
"#include <QString>\n",
|
|
|
|
"QObject ob;\n"
|
2013-01-28 17:15:49 +01:00
|
|
|
"QMultiMap<QString, QPointer<QObject> > map;\n"
|
|
|
|
"map.insert(\"Hallo\", QPointer<QObject>(&ob));\n"
|
|
|
|
"map.insert(\"Welt\", QPointer<QObject>(&ob));\n"
|
|
|
|
"map.insert(\".\", QPointer<QObject>(&ob));\n"
|
|
|
|
"map.insert(\".\", QPointer<QObject>(&ob));\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map", "<4 items>", "@QMultiMap<@QString, @QPointer<@QObject>>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("map.0", "[0]", "", "@QMapNode<@QString, @QPointer<@QObject>>")
|
2013-02-13 00:51:05 +01:00
|
|
|
% Check("map.0.key", Value4("\".\""), "@QString")
|
|
|
|
% Check("map.0.key", Value5("\"Hallo\""), "@QString")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.0.value", "", "@QPointer<@QObject>")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("map.1", "[1]", "", "@QMapNode<@QString, @QPointer<@QObject>>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.1.key", "\".\"", "@QString")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("map.2", "[2]", "", "@QMapNode<@QString, @QPointer<@QObject>>")
|
2013-02-13 00:51:05 +01:00
|
|
|
% Check("map.2.key", Value4("\"Hallo\""), "@QString")
|
|
|
|
% Check("map.2.key", Value5("\"Welt\""), "@QString")
|
2013-01-28 17:47:56 +01:00
|
|
|
% Check("map.3", "[3]", "", "@QMapNode<@QString, @QPointer<@QObject>>")
|
2013-02-13 00:51:05 +01:00
|
|
|
% Check("map.3.key", Value4("\"Welt\""), "@QString")
|
|
|
|
% Check("map.3.key", Value5("\".\""), "@QString");
|
2013-01-28 17:15:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
QTest::newRow("QObject1")
|
2013-01-28 17:47:56 +01:00
|
|
|
<< Data("#include <QObject>\n",
|
|
|
|
"QObject parent;\n"
|
2013-01-28 17:15:49 +01:00
|
|
|
"parent.setObjectName(\"A Parent\");\n"
|
|
|
|
"QObject child(&parent);\n"
|
|
|
|
"child.setObjectName(\"A Child\");\n"
|
|
|
|
"QObject::connect(&child, SIGNAL(destroyed()), &parent, SLOT(deleteLater()));\n"
|
|
|
|
"QObject::disconnect(&child, SIGNAL(destroyed()), &parent, SLOT(deleteLater()));\n"
|
|
|
|
"child.setObjectName(\"A renamed Child\");\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("child", "\"A renamed Child\"", "@QObject")
|
|
|
|
% Check("parent", "\"A Parent\"", "@QObject");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QObject2")
|
2013-02-04 16:44:09 +01:00
|
|
|
<< Data("#include <QWidget>\n"
|
|
|
|
"#include <QApplication>\n"
|
|
|
|
"namespace Names {\n"
|
|
|
|
"namespace Bar {\n"
|
|
|
|
" struct Ui { Ui() { w = 0; } QWidget *w; };\n"
|
|
|
|
" class TestObject : public QObject\n"
|
|
|
|
" {\n"
|
|
|
|
" Q_OBJECT\n"
|
|
|
|
" public:\n"
|
|
|
|
" TestObject(QObject *parent = 0)\n"
|
|
|
|
" : QObject(parent)\n"
|
|
|
|
" {\n"
|
|
|
|
" m_ui = new Ui;\n"
|
|
|
|
" m_ui->w = new QWidget;\n"
|
|
|
|
" }\n"
|
|
|
|
" Q_PROPERTY(QString myProp1 READ myProp1 WRITE setMyProp1)\n"
|
|
|
|
" QString myProp1() const { return m_myProp1; }\n"
|
|
|
|
" Q_SLOT void setMyProp1(const QString&mt) { m_myProp1 = mt; }\n"
|
|
|
|
" Q_PROPERTY(QString myProp2 READ myProp2 WRITE setMyProp2)\n"
|
|
|
|
" QString myProp2() const { return m_myProp2; }\n"
|
|
|
|
" Q_SLOT void setMyProp2(const QString&mt) { m_myProp2 = mt; }\n"
|
|
|
|
" public:\n"
|
|
|
|
" Ui *m_ui;\n"
|
|
|
|
" QString m_myProp1;\n"
|
|
|
|
" QString m_myProp2;\n"
|
|
|
|
" };\n"
|
|
|
|
"} // namespace Bar\n"
|
|
|
|
"} // namespace Names\n"
|
|
|
|
"#include <main.moc>\n",
|
|
|
|
""
|
|
|
|
"QApplication app(argc, argv);\n"
|
|
|
|
"Q_UNUSED(app)\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"Names::Bar::TestObject test;\n"
|
|
|
|
"test.setMyProp1(\"HELLO\");\n"
|
|
|
|
"test.setMyProp2(\"WORLD\");\n"
|
|
|
|
"QString s = test.myProp1();\n"
|
|
|
|
"s += test.myProp2();\n")
|
2013-02-04 16:44:09 +01:00
|
|
|
% GuiProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("s", "\"HELLOWORLD\"", "@QString")
|
|
|
|
% Check("test", "", "Names::Bar::TestObject");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
2013-02-04 16:44:09 +01:00
|
|
|
QTest::newRow("QObject3")
|
|
|
|
<< Data("#include <QWidget>\n"
|
|
|
|
"#include <QList>\n"
|
|
|
|
"#include <QStringList>\n"
|
|
|
|
"#include <QVariant>\n"
|
|
|
|
"#include <QApplication>\n",
|
|
|
|
"QApplication app(argc, argv);\n"
|
|
|
|
"QWidget ob;\n"
|
|
|
|
"ob.setObjectName(\"An Object\");\n"
|
|
|
|
"ob.setProperty(\"USER DEFINED 1\", 44);\n"
|
|
|
|
"ob.setProperty(\"USER DEFINED 2\", QStringList() << \"FOO\" << \"BAR\");\n"
|
|
|
|
""
|
2013-02-12 12:05:05 +01:00
|
|
|
"QObject ob1, ob2;\n"
|
2013-02-04 16:44:09 +01:00
|
|
|
"ob1.setObjectName(\"Another Object\");\n"
|
|
|
|
"QObject::connect(&ob, SIGNAL(destroyed()), &ob1, SLOT(deleteLater()));\n"
|
|
|
|
"QObject::connect(&ob, SIGNAL(destroyed()), &ob1, SLOT(deleteLater()));\n"
|
|
|
|
"//QObject::connect(&app, SIGNAL(lastWindowClosed()), &ob, SLOT(deleteLater()));\n"
|
|
|
|
""
|
|
|
|
"QList<QObject *> obs;\n"
|
|
|
|
"obs.append(&ob);\n"
|
|
|
|
"obs.append(&ob1);\n"
|
|
|
|
"obs.append(0);\n"
|
|
|
|
"obs.append(&app);\n"
|
2013-02-12 12:05:05 +01:00
|
|
|
"ob2.setObjectName(\"A Subobject\");\n"
|
|
|
|
"unused(&ob, &ob1, &ob2);\n")
|
2013-01-30 11:25:19 +01:00
|
|
|
% GuiProfile()
|
2013-02-12 12:05:05 +01:00
|
|
|
% Check("ob", "\"An Object\"", "@QWidget")
|
|
|
|
% Check("ob1", "\"Another Object\"", "@QObject")
|
|
|
|
% Check("ob2", "\"A Subobject\"", "@QObject");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QByteArray senderData =
|
|
|
|
" class Sender : public QObject\n"
|
|
|
|
" {\n"
|
|
|
|
" Q_OBJECT\n"
|
|
|
|
" public:\n"
|
|
|
|
" Sender() { setObjectName(\"Sender\"); }\n"
|
|
|
|
" void doEmit() { emit aSignal(); }\n"
|
|
|
|
" signals:\n"
|
|
|
|
" void aSignal();\n"
|
|
|
|
" };\n"
|
|
|
|
"\n"
|
|
|
|
" class Receiver : public QObject\n"
|
|
|
|
" {\n"
|
|
|
|
" Q_OBJECT\n"
|
|
|
|
" public:\n"
|
|
|
|
" Receiver() { setObjectName(\"Receiver\"); }\n"
|
|
|
|
" public slots:\n"
|
|
|
|
" void aSlot() {\n"
|
|
|
|
" QObject *s = sender();\n"
|
|
|
|
" if (s) {\n"
|
|
|
|
" qDebug() << \"SENDER: \" << s;\n"
|
|
|
|
" } else {\n"
|
|
|
|
" qDebug() << \"NO SENDER\";\n"
|
|
|
|
" }\n"
|
|
|
|
" }\n"
|
|
|
|
" };\n";
|
|
|
|
|
|
|
|
QTest::newRow("QObjectData")
|
2013-02-04 16:44:09 +01:00
|
|
|
<< Data("#include <QObject>\n"
|
|
|
|
"#include <QStringList>\n"
|
|
|
|
"#include <private/qobject_p.h>\n"
|
|
|
|
" class DerivedObjectPrivate : public QObjectPrivate\n"
|
|
|
|
" {\n"
|
|
|
|
" public:\n"
|
|
|
|
" DerivedObjectPrivate() {\n"
|
|
|
|
" m_extraX = 43;\n"
|
|
|
|
" m_extraY.append(\"xxx\");\n"
|
|
|
|
" m_extraZ = 1;\n"
|
|
|
|
" }\n"
|
|
|
|
" int m_extraX;\n"
|
|
|
|
" QStringList m_extraY;\n"
|
|
|
|
" uint m_extraZ : 1;\n"
|
|
|
|
" bool m_extraA : 1;\n"
|
|
|
|
" bool m_extraB;\n"
|
|
|
|
" };\n"
|
|
|
|
"\n"
|
|
|
|
" class DerivedObject : public QObject\n"
|
|
|
|
" {\n"
|
|
|
|
" Q_OBJECT\n"
|
|
|
|
"\n"
|
|
|
|
" public:\n"
|
|
|
|
" DerivedObject() : QObject(*new DerivedObjectPrivate, 0) {}\n"
|
|
|
|
"\n"
|
|
|
|
" Q_PROPERTY(int x READ x WRITE setX)\n"
|
|
|
|
" Q_PROPERTY(QStringList y READ y WRITE setY)\n"
|
|
|
|
" Q_PROPERTY(uint z READ z WRITE setZ)\n"
|
|
|
|
"\n"
|
|
|
|
" int x() const;\n"
|
|
|
|
" void setX(int x);\n"
|
|
|
|
" QStringList y() const;\n"
|
|
|
|
" void setY(QStringList y);\n"
|
|
|
|
" uint z() const;\n"
|
|
|
|
" void setZ(uint z);\n"
|
|
|
|
"\n"
|
|
|
|
" private:\n"
|
|
|
|
" Q_DECLARE_PRIVATE(DerivedObject)\n"
|
|
|
|
" };\n"
|
|
|
|
"\n"
|
|
|
|
" int DerivedObject::x() const\n"
|
|
|
|
" {\n"
|
|
|
|
" Q_D(const DerivedObject);\n"
|
|
|
|
" return d->m_extraX;\n"
|
|
|
|
" }\n"
|
|
|
|
"\n"
|
|
|
|
" void DerivedObject::setX(int x)\n"
|
|
|
|
" {\n"
|
|
|
|
" Q_D(DerivedObject);\n"
|
|
|
|
" d->m_extraX = x;\n"
|
|
|
|
" d->m_extraA = !d->m_extraA;\n"
|
|
|
|
" d->m_extraB = !d->m_extraB;\n"
|
|
|
|
" }\n"
|
|
|
|
"\n"
|
|
|
|
" QStringList DerivedObject::y() const\n"
|
|
|
|
" {\n"
|
|
|
|
" Q_D(const DerivedObject);\n"
|
|
|
|
" return d->m_extraY;\n"
|
|
|
|
" }\n"
|
|
|
|
"\n"
|
|
|
|
" void DerivedObject::setY(QStringList y)\n"
|
|
|
|
" {\n"
|
|
|
|
" Q_D(DerivedObject);\n"
|
|
|
|
" d->m_extraY = y;\n"
|
|
|
|
" }\n"
|
|
|
|
"\n"
|
|
|
|
" uint DerivedObject::z() const\n"
|
|
|
|
" {\n"
|
|
|
|
" Q_D(const DerivedObject);\n"
|
|
|
|
" return d->m_extraZ;\n"
|
|
|
|
" }\n"
|
|
|
|
"\n"
|
|
|
|
" void DerivedObject::setZ(uint z)\n"
|
|
|
|
" {\n"
|
|
|
|
" Q_D(DerivedObject);\n"
|
|
|
|
" d->m_extraZ = z;\n"
|
|
|
|
" }\n"
|
|
|
|
"#include \"main.moc\"\n",
|
2013-01-25 19:11:14 +01:00
|
|
|
"DerivedObject ob;\n"
|
|
|
|
"ob.setX(26);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-13 14:54:37 +01:00
|
|
|
% CorePrivateProfile();
|
|
|
|
// FIXME:
|
|
|
|
// % Check("ob.properties.x", "26", "@QVariant (int)");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
QTest::newRow("QRegExp")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <QRegExp>\n",
|
|
|
|
"QRegExp re(QString(\"a(.*)b(.*)c\"));\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QString str1 = \"a1121b344c\";\n"
|
|
|
|
"QString str2 = \"Xa1121b344c\";\n"
|
|
|
|
"int pos2 = re.indexIn(str2);\n"
|
2013-02-04 16:44:09 +01:00
|
|
|
"int pos1 = re.indexIn(str1);\n"
|
|
|
|
"unused(&pos1, &pos2);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("re", "\"a(.*)b(.*)c\"", "@QRegExp")
|
|
|
|
% Check("str1", "\"a1121b344c\"", "@QString")
|
|
|
|
% Check("str2", "\"Xa1121b344c\"", "@QString")
|
|
|
|
% Check("pos1", "0", "int")
|
|
|
|
% Check("pos2", "1", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QPoint")
|
2013-02-01 16:30:15 +01:00
|
|
|
<< Data("#include <QPoint>\n"
|
|
|
|
"#include <QString> // Dummy for namespace\n",
|
|
|
|
"QString dummy;\n"
|
2013-01-30 11:25:19 +01:00
|
|
|
"QPoint s0, s;\n"
|
2013-02-01 16:30:15 +01:00
|
|
|
"s = QPoint(100, 200);\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&s0, &s);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("s0", "(0, 0)", "@QPoint")
|
|
|
|
% Check("s", "(100, 200)", "@QPoint");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QPointF")
|
2013-02-01 16:30:15 +01:00
|
|
|
<< Data("#include <QPointF>\n"
|
|
|
|
"#include <QString> // Dummy for namespace\n",
|
|
|
|
"QString dummy;\n"
|
2013-01-30 11:25:19 +01:00
|
|
|
"QPointF s0, s;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"s = QPointF(100, 200);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-06-04 10:44:20 +02:00
|
|
|
% Check("s0", "(0.0, 0.0)", "@QPointF")
|
|
|
|
% Check("s", "(100.0, 200.0)", "@QPointF");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QRect")
|
2013-02-01 16:30:15 +01:00
|
|
|
<< Data("#include <QRect>\n"
|
|
|
|
"#include <QString> // Dummy for namespace\n",
|
|
|
|
"QString dummy;\n"
|
2013-01-30 11:25:19 +01:00
|
|
|
"QRect rect0, rect;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"rect = QRect(100, 100, 200, 200);\n")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("rect", "0x0+0+0", "@QRect")
|
|
|
|
% Check("rect", "200x200+100+100", "@QRect");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QRectF")
|
2013-02-01 16:30:15 +01:00
|
|
|
<< Data("#include <QRectF>\n"
|
|
|
|
"#include <QString> // Dummy for namespace\n",
|
|
|
|
"QString dummy;\n"
|
2013-01-30 11:25:19 +01:00
|
|
|
"QRectF rect0, rect;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"rect = QRectF(100, 100, 200, 200);\n")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("rect", "0x0+0+0", "@QRectF")
|
|
|
|
% Check("rect", "200x200+100+100", "@QRectF");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QSize")
|
2013-02-01 16:30:15 +01:00
|
|
|
<< Data("#include <QSize>\n"
|
|
|
|
"#include <QString> // Dummy for namespace\n",
|
|
|
|
"QString dummy;\n"
|
2013-01-30 11:25:19 +01:00
|
|
|
"QSize s0, s;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"s = QSize(100, 200);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("s0", "(-1, -1)", "@QSize")
|
|
|
|
% Check("s", "(100, 200)", "@QSize");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QSizeF")
|
2013-02-01 16:30:15 +01:00
|
|
|
<< Data("#include <QSizeF>\n"
|
|
|
|
"#include <QString> // Dummy for namespace\n",
|
|
|
|
"QString dummy;\n"
|
2013-01-30 11:25:19 +01:00
|
|
|
"QSizeF s0, s;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"s = QSizeF(100, 200);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("s0", "(-1, -1)", "@QSizeF")
|
|
|
|
% Check("s", "(100, 200)", "@QSizeF");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QRegion")
|
2013-02-01 16:30:15 +01:00
|
|
|
<< Data("#include <QRegion>\n"
|
|
|
|
"#include <QString> // Dummy for namespace\n",
|
|
|
|
"QString dummy;\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"QRegion region, region0, region1, region2;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"region0 = region;\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"region += QRect(100, 100, 200, 200);\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"region1 = region;\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"region += QRect(300, 300, 400, 500);\n"
|
|
|
|
"region2 = region;\n"
|
|
|
|
"unused(®ion0, ®ion1, ®ion2);\n")
|
2013-02-04 23:36:32 +01:00
|
|
|
% GuiProfile()
|
2013-02-05 01:47:07 +01:00
|
|
|
% Check("region0", Value4("<empty>"), "@QRegion")
|
|
|
|
% Check("region0", Value5("<0 items>"), "@QRegion")
|
2013-02-01 17:35:16 +01:00
|
|
|
% Check("region1", "<1 items>", "@QRegion")
|
|
|
|
% Check("region1.extents", "200x200+100+100", "@QRect")
|
|
|
|
% Check("region1.innerArea", "40000", "int")
|
|
|
|
% Check("region1.innerRect", "200x200+100+100", "@QRect")
|
|
|
|
% Check("region1.numRects", "1", "int")
|
|
|
|
% Check("region1.rects", "<0 items>", "@QVector<@QRect>")
|
|
|
|
% Check("region2", "<2 items>", "@QRegion")
|
|
|
|
% Check("region2.extents", "600x700+100+100", "@QRect")
|
|
|
|
% Check("region2.innerArea", "200000", "int")
|
|
|
|
% Check("region2.innerRect", "400x500+300+300", "@QRect")
|
|
|
|
% Check("region2.numRects", "2", "int")
|
|
|
|
% Check("region2.rects", "<2 items>", "@QVector<@QRect>");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QSettings")
|
2013-02-04 16:44:09 +01:00
|
|
|
<< Data("#include <QSettings>\n"
|
|
|
|
"#include <QCoreApplication>\n"
|
|
|
|
"#include <QVariant>\n",
|
2013-01-30 11:25:19 +01:00
|
|
|
"QCoreApplication app(argc, argv);\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QSettings settings(\"/tmp/test.ini\", QSettings::IniFormat);\n"
|
|
|
|
"QVariant value = settings.value(\"item1\", \"\").toString();\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("settings", "", "@QSettings")
|
2013-02-04 16:44:09 +01:00
|
|
|
// FIXME
|
|
|
|
//% Check("settings.[@QObject]", "", "@QObject")
|
|
|
|
// FIXME
|
|
|
|
% Check("value", "\"\"", "@QVariant (QString)");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QSet1")
|
2013-02-04 16:44:09 +01:00
|
|
|
<< Data("#include <QSet>\n",
|
2013-01-30 11:25:19 +01:00
|
|
|
"QSet<int> s;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"s.insert(11);\n"
|
|
|
|
"s.insert(22);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("s", "<2 items>", "@QSet<int>")
|
2013-02-04 16:44:09 +01:00
|
|
|
% Check("s.22", "[22]", "22", "int")
|
|
|
|
% Check("s.11", "[11]", "11", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QSet2")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <QSet>\n"
|
|
|
|
"#include <QString>\n",
|
|
|
|
"QSet<QString> s;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"s.insert(\"11.0\");\n"
|
|
|
|
"s.insert(\"22.0\");\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("s", "<2 items>", "@QSet<@QString>")
|
2013-02-13 14:54:37 +01:00
|
|
|
% Check("s.0", "[0]", Value4("\"11.0\""), "@QString")
|
|
|
|
% Check("s.0", "[0]", Value5("\"22.0\""), "@QString")
|
|
|
|
% Check("s.1", "[1]", Value4("\"22.0\""), "@QString")
|
|
|
|
% Check("s.1", "[1]", Value5("\"11.0\""), "@QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QSet3")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <QObject>\n"
|
|
|
|
"#include <QPointer>\n"
|
2013-02-04 16:44:09 +01:00
|
|
|
"#include <QSet>\n"
|
|
|
|
"QT_BEGIN_NAMESPACE\n"
|
|
|
|
"uint qHash(const QMap<int, int> &) { return 0; }\n"
|
|
|
|
"uint qHash(const double & f) { return int(f); }\n"
|
|
|
|
"uint qHash(const QPointer<QObject> &p) { return (ulong)p.data(); }\n"
|
|
|
|
"QT_END_NAMESPACE\n",
|
2013-01-30 11:25:19 +01:00
|
|
|
"QObject ob;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QSet<QPointer<QObject> > s;\n"
|
|
|
|
"QPointer<QObject> ptr(&ob);\n"
|
|
|
|
"s.insert(ptr);\n"
|
|
|
|
"s.insert(ptr);\n"
|
|
|
|
"s.insert(ptr);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("s", "<1 items>", "@QSet<@QPointer<@QObject>>")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("s.0", "[0]", "", "@QPointer<@QObject>");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QByteArray sharedData =
|
|
|
|
" class EmployeeData : public QSharedData\n"
|
|
|
|
" {\n"
|
|
|
|
" public:\n"
|
|
|
|
" EmployeeData() : id(-1) { name.clear(); }\n"
|
|
|
|
" EmployeeData(const EmployeeData &other)\n"
|
|
|
|
" : QSharedData(other), id(other.id), name(other.name) { }\n"
|
|
|
|
" ~EmployeeData() { }\n"
|
|
|
|
"\n"
|
|
|
|
" int id;\n"
|
|
|
|
" QString name;\n"
|
|
|
|
" };\n"
|
|
|
|
"\n"
|
|
|
|
" class Employee\n"
|
|
|
|
" {\n"
|
|
|
|
" public:\n"
|
|
|
|
" Employee() { d = new EmployeeData; }\n"
|
|
|
|
" Employee(int id, QString name) {\n"
|
|
|
|
" d = new EmployeeData;\n"
|
|
|
|
" setId(id);\n"
|
|
|
|
" setName(name);\n"
|
|
|
|
" }\n"
|
|
|
|
" Employee(const Employee &other)\n"
|
|
|
|
" : d (other.d)\n"
|
|
|
|
" {\n"
|
|
|
|
" }\n"
|
|
|
|
" void setId(int id) { d->id = id; }\n"
|
|
|
|
" void setName(QString name) { d->name = name; }\n"
|
|
|
|
"\n"
|
|
|
|
" int id() const { return d->id; }\n"
|
|
|
|
" QString name() const { return d->name; }\n"
|
|
|
|
"\n"
|
|
|
|
" private:\n"
|
|
|
|
" QSharedDataPointer<EmployeeData> d;\n"
|
|
|
|
" };\n";
|
|
|
|
|
|
|
|
|
|
|
|
QTest::newRow("QSharedPointer1")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <QSharedPointer>\n",
|
2013-02-01 16:30:15 +01:00
|
|
|
"QSharedPointer<int> ptr;\n"
|
2013-01-30 11:25:19 +01:00
|
|
|
"QSharedPointer<int> ptr2 = ptr;\n"
|
2013-02-01 16:30:15 +01:00
|
|
|
"QSharedPointer<int> ptr3 = ptr;\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&ptr, &ptr2, &ptr3);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-01 17:35:16 +01:00
|
|
|
% Check("ptr", "(null)", "@QSharedPointer<int>")
|
|
|
|
% Check("ptr2", "(null)", "@QSharedPointer<int>")
|
|
|
|
% Check("ptr3", "(null)", "@QSharedPointer<int>");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QSharedPointer2")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <QSharedPointer>\n",
|
|
|
|
"QSharedPointer<QString> ptr(new QString(\"hallo\"));\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QSharedPointer<QString> ptr2 = ptr;\n"
|
2013-02-01 16:30:15 +01:00
|
|
|
"QSharedPointer<QString> ptr3 = ptr;\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&ptr, &ptr2, &ptr3);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-01 17:35:16 +01:00
|
|
|
% Check("ptr", "", "@QSharedPointer<@QString>")
|
|
|
|
% Check("ptr.data", "\"hallo\"", "@QString")
|
|
|
|
% Check("ptr.weakref", "3", "int")
|
|
|
|
% Check("ptr.strongref", "3", "int")
|
|
|
|
% Check("ptr2.data", "\"hallo\"", "@QString")
|
|
|
|
% Check("ptr3.data", "\"hallo\"", "@QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QSharedPointer3")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <QSharedPointer>\n",
|
|
|
|
"QSharedPointer<int> iptr(new int(43));\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QWeakPointer<int> ptr(iptr);\n"
|
|
|
|
"QWeakPointer<int> ptr2 = ptr;\n"
|
2013-02-01 16:30:15 +01:00
|
|
|
"QWeakPointer<int> ptr3 = ptr;\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&ptr, &ptr2, &ptr3);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-01 17:35:16 +01:00
|
|
|
% Check("iptr", "", "@QSharedPointer<int>")
|
|
|
|
% Check("iptr.data", "43", "int")
|
|
|
|
% Check("iptr.weakref", "4", "int")
|
|
|
|
% Check("iptr.strongref", "1", "int")
|
|
|
|
% Check("ptr3", "43", "int")
|
|
|
|
% Check("ptr3.data", "43", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QSharedPointer4")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <QSharedPointer>\n"
|
|
|
|
"#include <QString>\n",
|
|
|
|
"QSharedPointer<QString> sptr(new QString(\"hallo\"));\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QWeakPointer<QString> ptr(sptr);\n"
|
|
|
|
"QWeakPointer<QString> ptr2 = ptr;\n"
|
2013-02-01 16:30:15 +01:00
|
|
|
"QWeakPointer<QString> ptr3 = ptr;\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&ptr, &ptr2, &ptr3);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-01 17:35:16 +01:00
|
|
|
% Check("sptr", "", "@QSharedPointer<@QString>")
|
|
|
|
% Check("sptr.data", "\"hallo\"", "@QString")
|
|
|
|
% Check("ptr3", "", "@QWeakPointer<@QString>");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QSharedPointer5")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <QSharedPointer>\n" + fooData,
|
|
|
|
"QSharedPointer<Foo> fptr(new Foo(1));\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QWeakPointer<Foo> ptr(fptr);\n"
|
|
|
|
"QWeakPointer<Foo> ptr2 = ptr;\n"
|
2013-02-01 16:30:15 +01:00
|
|
|
"QWeakPointer<Foo> ptr3 = ptr;\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&ptr, &ptr2, &ptr3);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-01 17:35:16 +01:00
|
|
|
% Check("fptr", "", "@QSharedPointer<Foo>")
|
|
|
|
% Check("fptr.data", "", "Foo")
|
|
|
|
% Check("ptr3", "", "@QWeakPointer<Foo>");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QXmlAttributes")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <QXmlAttributes>\n",
|
|
|
|
"QXmlAttributes atts;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"atts.append(\"name1\", \"uri1\", \"localPart1\", \"value1\");\n"
|
|
|
|
"atts.append(\"name2\", \"uri2\", \"localPart2\", \"value2\");\n"
|
|
|
|
"atts.append(\"name3\", \"uri3\", \"localPart3\", \"value3\");\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-01 17:35:16 +01:00
|
|
|
% Profile("QT += xml\n")
|
|
|
|
% Check("atts", "", "@QXmlAttributes")
|
2013-01-28 17:15:49 +01:00
|
|
|
% CheckType("atts.[vptr]", "")
|
|
|
|
% Check("atts.attList", "<3 items>", "@QXmlAttributes::AttributeList")
|
2013-02-01 17:35:16 +01:00
|
|
|
% Check("atts.attList.0", "[0]", "", "@QXmlAttributes::Attribute")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("atts.attList.0.localname", "\"localPart1\"", "@QString")
|
|
|
|
% Check("atts.attList.0.qname", "\"name1\"", "@QString")
|
|
|
|
% Check("atts.attList.0.uri", "\"uri1\"", "@QString")
|
|
|
|
% Check("atts.attList.0.value", "\"value1\"", "@QString")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("atts.attList.1", "[1]", "", "@QXmlAttributes::Attribute")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("atts.attList.1.localname", "\"localPart2\"", "@QString")
|
|
|
|
% Check("atts.attList.1.qname", "\"name2\"", "@QString")
|
|
|
|
% Check("atts.attList.1.uri", "\"uri2\"", "@QString")
|
|
|
|
% Check("atts.attList.1.value", "\"value2\"", "@QString")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("atts.attList.2", "[2]", "", "@QXmlAttributes::Attribute")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("atts.attList.2.localname", "\"localPart3\"", "@QString")
|
|
|
|
% Check("atts.attList.2.qname", "\"name3\"", "@QString")
|
|
|
|
% Check("atts.attList.2.uri", "\"uri3\"", "@QString")
|
|
|
|
% Check("atts.attList.2.value", "\"value3\"", "@QString")
|
|
|
|
% Check("atts.d", "", "@QXmlAttributesPrivate");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdArray")
|
2013-02-04 16:44:09 +01:00
|
|
|
<< Data("#include <array>\n"
|
2013-01-30 11:25:19 +01:00
|
|
|
"#include <QString>\n",
|
|
|
|
"std::array<int, 4> a = { { 1, 2, 3, 4} };\n"
|
2013-02-04 16:44:09 +01:00
|
|
|
"std::array<QString, 4> b = { { \"1\", \"2\", \"3\", \"4\"} };\n"
|
|
|
|
"unused(&a, &b);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-04 16:44:09 +01:00
|
|
|
% Cxx11Profile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("a", "<4 items>", "std::array<int, 4u>")
|
2013-02-04 16:44:09 +01:00
|
|
|
% Check("b", "<4 items>", "std::array<@QString, 4u>");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdComplex")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <complex>\n",
|
|
|
|
"std::complex<double> c(1, 2);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("c", "(1.000000, 2.000000)", "std::complex<double>");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
2013-01-30 13:48:23 +01:00
|
|
|
QTest::newRow("CComplex")
|
|
|
|
<< Data("#include <complex.h>\n",
|
|
|
|
"// Doesn't work when compiled as C++.\n"
|
|
|
|
"double complex a = 0;\n"
|
|
|
|
"double _Complex b = 0;\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&a, &b);\n")
|
2013-01-30 13:48:23 +01:00
|
|
|
% ForceC()
|
|
|
|
% Check("a", "0 + 0 * I", "complex double")
|
|
|
|
% Check("b", "0 + 0 * I", "complex double");
|
|
|
|
|
2013-01-25 19:11:14 +01:00
|
|
|
QTest::newRow("StdDequeInt")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <deque>\n",
|
|
|
|
"std::deque<int> deque;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"deque.push_back(1);\n"
|
|
|
|
"deque.push_back(2);\n")
|
2013-02-01 17:35:16 +01:00
|
|
|
% Check("deque", "<2 items>", "std::deque<int>")
|
2013-01-30 13:48:23 +01:00
|
|
|
% Check("deque.0", "[0]", "1", "int")
|
|
|
|
% Check("deque.1", "[1]", "2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdDequeIntStar")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <deque>\n",
|
|
|
|
"std::deque<int *> deque;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"deque.push_back(new int(1));\n"
|
|
|
|
"deque.push_back(0);\n"
|
|
|
|
"deque.push_back(new int(2));\n"
|
2013-01-30 13:48:23 +01:00
|
|
|
"deque.push_back(new int(3));\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"deque.pop_back();\n"
|
|
|
|
"deque.pop_front();\n")
|
2013-02-01 17:35:16 +01:00
|
|
|
% Check("deque", "<2 items>", "std::deque<int *>")
|
2013-01-30 13:48:23 +01:00
|
|
|
% Check("deque.0", "[0]", "0x0", "int *")
|
|
|
|
% Check("deque.1", "[1]", "2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdDequeFoo")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <deque>\n" + fooData,
|
|
|
|
"std::deque<Foo> deque;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"deque.push_back(1);\n"
|
|
|
|
"deque.push_front(2);\n")
|
2013-02-01 17:35:16 +01:00
|
|
|
% Check("deque", "<2 items>", "std::deque<Foo>")
|
2013-01-30 13:48:23 +01:00
|
|
|
% Check("deque.0", "[0]", "", "Foo")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("deque.0.a", "2", "int")
|
2013-01-30 13:48:23 +01:00
|
|
|
% Check("deque.1", "[1]", "", "Foo")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("deque.1.a", "1", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdDequeFooStar")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <deque>\n" + fooData,
|
|
|
|
"std::deque<Foo *> deque;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"deque.push_back(new Foo(1));\n"
|
|
|
|
"deque.push_back(new Foo(2));\n")
|
2013-02-01 17:35:16 +01:00
|
|
|
% Check("deque", "<2 items>", "std::deque<Foo*>")
|
2013-01-30 13:48:23 +01:00
|
|
|
% Check("deque.0", "[0]", "", "Foo")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("deque.0.a", "1", "int")
|
2013-01-30 13:48:23 +01:00
|
|
|
% Check("deque.1", "[1]", "", "Foo")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("deque.1.a", "2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdHashSet")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <hash_set>\n"
|
2013-01-30 11:25:19 +01:00
|
|
|
"using namespace __gnu_cxx;\n",
|
2013-01-25 19:11:14 +01:00
|
|
|
"hash_set<int> h;\n"
|
|
|
|
"h.insert(1);\n"
|
|
|
|
"h.insert(194);\n"
|
|
|
|
"h.insert(2);\n"
|
|
|
|
"h.insert(3);\n")
|
2013-02-04 16:44:09 +01:00
|
|
|
% Profile("QMAKE_CXXFLAGS += -Wno-deprecated")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("h", "<4 items>", "__gnu__cxx::hash_set<int>")
|
2013-02-04 16:44:09 +01:00
|
|
|
% Check("h.0", "[0]", "194", "int")
|
|
|
|
% Check("h.1", "[1]", "1", "int")
|
|
|
|
% Check("h.2", "[2]", "2", "int")
|
|
|
|
% Check("h.3", "[3]", "3", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdListInt")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <list>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"std::list<int> list;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"list.push_back(1);\n"
|
|
|
|
"list.push_back(2);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("list", "<2 items>", "std::list<int>")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("list.0", "[0]", "1", "int")
|
|
|
|
% Check("list.1", "[1]", "2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdListIntStar")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <list>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"std::list<int *> list;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"list.push_back(new int(1));\n"
|
|
|
|
"list.push_back(0);\n"
|
|
|
|
"list.push_back(new int(2));\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("list", "<3 items>", "std::list<int*>")
|
2013-02-04 16:44:09 +01:00
|
|
|
% Check("list.0", "[0]", "1", "int")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("list.1", "[1]", "0x0", "int *")
|
2013-02-04 16:44:09 +01:00
|
|
|
% Check("list.2", "[2]", "2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdListIntBig")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <list>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"std::list<int> list;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"for (int i = 0; i < 10000; ++i)\n"
|
|
|
|
" list.push_back(i);\n")
|
2013-02-04 16:44:09 +01:00
|
|
|
% Check("list", "<>1000 items>", "std::list<int>")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("list.0", "[0]", "0", "int")
|
|
|
|
% Check("list.999", "[999]", "999", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdListFoo")
|
2013-02-01 19:01:34 +01:00
|
|
|
<< Data("#include <list>\n" + fooData,
|
2013-01-28 17:15:49 +01:00
|
|
|
"std::list<Foo> list;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"list.push_back(15);\n"
|
|
|
|
"list.push_back(16);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("list", "<2 items>", "std::list<Foo>")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("list.0", "[0]", "", "Foo")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("list.0.a", "15", "int")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("list.1", "[1]", "", "Foo")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("list.1.a", "16", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdListFooStar")
|
2013-02-01 19:01:34 +01:00
|
|
|
<< Data("#include <list>\n" + fooData,
|
2013-01-28 17:15:49 +01:00
|
|
|
"std::list<Foo *> list;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"list.push_back(new Foo(1));\n"
|
|
|
|
"list.push_back(0);\n"
|
|
|
|
"list.push_back(new Foo(2));\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("list", "<3 items>", "std::list<Foo*>")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("list.0", "[0]", "", "Foo")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("list.0.a", "1", "int")
|
2013-02-01 19:01:34 +01:00
|
|
|
% Check("list.1", "[1]", "0x0", "Foo *")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("list.2", "[2]", "", "Foo")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("list.2.a", "2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdListBool")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <list>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"std::list<bool> list;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"list.push_back(true);\n"
|
|
|
|
"list.push_back(false);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("list", "<2 items>", "std::list<bool>")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("list.0", "[0]", "true", "bool")
|
|
|
|
% Check("list.1", "[1]", "false", "bool");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdMapStringFoo")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <map>\n"
|
2013-02-04 16:44:09 +01:00
|
|
|
"#include <QString>\n" + fooData,
|
2013-01-28 17:15:49 +01:00
|
|
|
"std::map<QString, Foo> map;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"map[\"22.0\"] = Foo(22);\n"
|
|
|
|
"map[\"33.0\"] = Foo(33);\n"
|
|
|
|
"map[\"44.0\"] = Foo(44);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map", "<3 items>", "std::map<@QString, Foo>")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("map.0", "[0]", "", "std::pair<@QString const, Foo>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.0.first", "\"22.0\"", "@QString")
|
|
|
|
% Check("map.0.second", "", "Foo")
|
|
|
|
% Check("map.0.second.a", "22", "int")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("map.1", "[1]", "", "std::pair<@QString const, Foo>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.2.first", "\"44.0\"", "@QString")
|
|
|
|
% Check("map.2.second", "", "Foo")
|
|
|
|
% Check("map.2.second.a", "44", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdMapCharStarFoo")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <map>\n" + fooData,
|
2013-01-28 17:15:49 +01:00
|
|
|
"std::map<const char *, Foo> map;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"map[\"22.0\"] = Foo(22);\n"
|
|
|
|
"map[\"33.0\"] = Foo(33);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map", "<2 items>", "std::map<char const*, Foo>")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("map.0", "[0]", "", "std::pair<char const* const, Foo>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% CheckType("map.0.first", "char *")
|
2013-02-04 16:44:09 +01:00
|
|
|
// FIXME
|
|
|
|
//% Check("map.0.first.0", "50", "char")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.0.second", "", "Foo")
|
|
|
|
% Check("map.0.second.a", "22", "int")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("map.1", "[1]", "", "std::pair<char const* const, Foo>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% CheckType("map.1.first", "char *")
|
2013-02-04 16:44:09 +01:00
|
|
|
//% Check("map.1.first.*first", "51 '3'", "char")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.1.second", "", "Foo")
|
|
|
|
% Check("map.1.second.a", "33", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdMapUIntUInt")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <map>\n",
|
2013-02-01 19:01:34 +01:00
|
|
|
"std::map<unsigned int, unsigned int> map;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"map[11] = 1;\n"
|
|
|
|
"map[22] = 2;\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map", "<2 items>", "std::map<unsigned int, unsigned int>")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("map.11", "[11]", "1", "unsigned int")
|
|
|
|
% Check("map.22", "[22]", "2", "unsigned int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdMapUIntStringList")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <map>\n"
|
|
|
|
"#include <QStringList>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"std::map<uint, QStringList> map;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"map[11] = QStringList() << \"11\";\n"
|
|
|
|
"map[22] = QStringList() << \"22\";\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map", "<2 items>", "std::map<unsigned int, @QStringList>")
|
2013-02-01 17:35:16 +01:00
|
|
|
% Check("map.0", "[0]", "", "std::pair<unsigned int const, @QStringList>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.0.first", "11", "unsigned int")
|
|
|
|
% Check("map.0.second", "<1 items>", "@QStringList")
|
2013-02-01 17:35:16 +01:00
|
|
|
% Check("map.0.second.0", "[0]", "\"11\"", "@QString")
|
|
|
|
% Check("map.1", "[1]", "", "std::pair<unsigned int const, @QStringList>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.1.first", "22", "unsigned int")
|
|
|
|
% Check("map.1.second", "<1 items>", "@QStringList")
|
2013-02-01 17:35:16 +01:00
|
|
|
% Check("map.1.second.0", "[0]", "\"22\"", "@QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdMapUIntStringListTypedef")
|
2013-02-01 17:35:16 +01:00
|
|
|
<< Data("#include <map>\n"
|
|
|
|
"#include <QStringList>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"typedef std::map<uint, QStringList> T;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"T map;\n"
|
|
|
|
"map[11] = QStringList() << \"11\";\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"map[22] = QStringList() << \"22\";\n")
|
|
|
|
% Check("map.1.second.0", "[0]", "\"22\"", "@QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdMapUIntFloat")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <map>\n",
|
2013-02-01 17:35:16 +01:00
|
|
|
"std::map<unsigned int, float> map;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"map[11] = 11.0;\n"
|
|
|
|
"map[22] = 22.0;\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map", "<2 items>", "std::map<unsigned int, float>")
|
|
|
|
% Check("map.11", "[11]", "11", "float")
|
|
|
|
% Check("map.22", "[22]", "22", "float");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdMapUIntFloatIterator")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <map>\n",
|
|
|
|
"typedef std::map<int, float> Map;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"Map map;\n"
|
|
|
|
"map[11] = 11.0;\n"
|
|
|
|
"map[22] = 22.0;\n"
|
|
|
|
"map[33] = 33.0;\n"
|
|
|
|
"map[44] = 44.0;\n"
|
|
|
|
"map[55] = 55.0;\n"
|
|
|
|
"map[66] = 66.0;\n"
|
|
|
|
"Map::iterator it1 = map.begin();\n"
|
|
|
|
"Map::iterator it2 = it1; ++it2;\n"
|
|
|
|
"Map::iterator it3 = it2; ++it3;\n"
|
|
|
|
"Map::iterator it4 = it3; ++it4;\n"
|
|
|
|
"Map::iterator it5 = it4; ++it5;\n"
|
|
|
|
"Map::iterator it6 = it5; ++it6;\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map", "<6 items>", "Map")
|
|
|
|
% Check("map.11", "[11]", "11", "float")
|
|
|
|
% Check("it1.first", "11", "int")
|
|
|
|
% Check("it1.second", "11", "float")
|
|
|
|
% Check("it6.first", "66", "int")
|
|
|
|
% Check("it6.second", "66", "float");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdMapStringFloat")
|
2013-02-01 17:35:16 +01:00
|
|
|
<< Data("#include <map>\n"
|
|
|
|
"#include <QString>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"std::map<QString, float> map;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"map[\"11.0\"] = 11.0;\n"
|
|
|
|
"map[\"22.0\"] = 22.0;\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map", "<2 items>", "std::map<@QString, float>")
|
|
|
|
% Check("map.0", "[0]", "", "std::pair<@QString const, float>")
|
|
|
|
% Check("map.0.first", "\"11.0\"", "@QString")
|
|
|
|
% Check("map.0.second", "11", "float")
|
|
|
|
% Check("map.1", "[1]", "", "std::pair<@QString const, float>")
|
|
|
|
% Check("map.1.first", "\"22.0\"", "@QString")
|
|
|
|
% Check("map.1.second", "22", "float");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdMapIntString")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <map>\n"
|
|
|
|
"#include <QString>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"std::map<int, QString> map;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"map[11] = \"11.0\";\n"
|
|
|
|
"map[22] = \"22.0\";\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map", "<2 items>", "std::map<int, @QString>")
|
|
|
|
% Check("map.0", "[0]", "", "std::pair<int const, @QString>")
|
|
|
|
% Check("map.0.first", "11", "int")
|
|
|
|
% Check("map.0.second", "\"11.0\"", "@QString")
|
|
|
|
% Check("map.1", "[1]", "", "std::pair<int const, @QString>")
|
|
|
|
% Check("map.1.first", "22", "int")
|
|
|
|
% Check("map.1.second", "\"22.0\"", "@QString");
|
|
|
|
|
|
|
|
QTest::newRow("StdMapStringPointer")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <QPointer>\n"
|
|
|
|
"#include <QObject>\n"
|
|
|
|
"#include <QString>\n"
|
|
|
|
"#include <map>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"QObject ob;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"std::map<QString, QPointer<QObject> > map;\n"
|
|
|
|
"map[\"Hallo\"] = QPointer<QObject>(&ob);\n"
|
|
|
|
"map[\"Welt\"] = QPointer<QObject>(&ob);\n"
|
|
|
|
"map[\".\"] = QPointer<QObject>(&ob);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map", "<3 items>", "std::map<@QString, @QPointer<@QObject>>")
|
|
|
|
% Check("map.0", "[0]", "", "std::pair<@QString const, @QPointer<@QObject>>")
|
2013-02-01 19:01:34 +01:00
|
|
|
% Check("map.0.first", "\".\"", "@QString")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("map.0.second", "", "@QPointer<@QObject>")
|
|
|
|
% Check("map.2", "[2]", "", "std::pair<@QString const, @QPointer<@QObject>>")
|
|
|
|
% Check("map.2.first", "\"Welt\"", "@QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdUniquePtr")
|
2013-01-30 12:52:12 +01:00
|
|
|
<< Data("#include <memory>\n" + fooData,
|
2013-01-30 11:25:19 +01:00
|
|
|
"std::unique_ptr<int> pi(new int(32));\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"std::unique_ptr<Foo> pf(new Foo);\n")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Cxx11Profile()
|
2013-01-30 12:52:12 +01:00
|
|
|
% Check("pi", Pointer("32"), "std::unique_ptr<int, std::default_delete<int> >")
|
|
|
|
% Check("pf", Pointer(), "std::unique_ptr<Foo, std::default_delete<Foo> >");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdSharedPtr")
|
2013-01-30 12:52:12 +01:00
|
|
|
<< Data("#include <memory>\n" + fooData,
|
2013-01-30 11:25:19 +01:00
|
|
|
"std::shared_ptr<int> pi(new int(32));\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"std::shared_ptr<Foo> pf(new Foo);\n")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Cxx11Profile()
|
2013-02-04 16:44:09 +01:00
|
|
|
% Check("pi", Pointer("32"), "std::shared_ptr<int>")
|
|
|
|
% Check("pf", Pointer(), "std::shared_ptr<Foo>");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdSetInt")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <set>\n",
|
|
|
|
"std::set<int> set;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"set.insert(11);\n"
|
|
|
|
"set.insert(22);\n"
|
|
|
|
"set.insert(33);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("set", "<3 items>", "std::set<int>");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdSetIntIterator")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <set>\n",
|
|
|
|
"typedef std::set<int> Set;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"Set set;\n"
|
|
|
|
"set.insert(11.0);\n"
|
|
|
|
"set.insert(22.0);\n"
|
|
|
|
"set.insert(33.0);\n"
|
|
|
|
"set.insert(44.0);\n"
|
|
|
|
"set.insert(55.0);\n"
|
|
|
|
"set.insert(66.0);\n"
|
|
|
|
"Set::iterator it1 = set.begin();\n"
|
|
|
|
"Set::iterator it2 = it1; ++it2;\n"
|
|
|
|
"Set::iterator it3 = it2; ++it3;\n"
|
|
|
|
"Set::iterator it4 = it3; ++it4;\n"
|
|
|
|
"Set::iterator it5 = it4; ++it5;\n"
|
|
|
|
"Set::iterator it6 = it5; ++it6;\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("set", "<6 items>", "Set")
|
|
|
|
% Check("it1.value", "11", "int")
|
|
|
|
% Check("it6.value", "66", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdSetString")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <set>\n"
|
|
|
|
"#include <QString>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"std::set<QString> set;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"set.insert(\"22.0\");\n")
|
2013-02-01 19:01:34 +01:00
|
|
|
% Check("set", "<1 items>", "std::set<@QString>")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("set.0", "[0]", "\"22.0\"", "@QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdSetPointer")
|
2013-02-01 19:01:34 +01:00
|
|
|
<< Data("#include <set>\n"
|
2013-01-30 11:25:19 +01:00
|
|
|
"#include <QPointer>\n"
|
2013-02-01 19:01:34 +01:00
|
|
|
"#include <QObject>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"QObject ob;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"std::set<QPointer<QObject> > hash;\n"
|
|
|
|
"QPointer<QObject> ptr(&ob);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("hash", "<0 items>", "std::set<@QPointer<@QObject>, std::less<@QPointer<@QObject>>, std::allocator<@QPointer<@QObject>>>")
|
2013-02-12 12:05:05 +01:00
|
|
|
% Check("ob", "", "@QObject")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("ptr", "", "@QPointer<@QObject>");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdStack1")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <stack>\n",
|
|
|
|
"std::stack<int *> s0, s;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"s.push(new int(1));\n"
|
|
|
|
"s.push(0);\n"
|
|
|
|
"s.push(new int(2));\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("s0", "<0 items>", "std::stack<int*>")
|
|
|
|
% Check("s", "<3 items>", "std::stack<int*>")
|
2013-02-01 19:01:34 +01:00
|
|
|
% Check("s.0", "[0]", "1", "int")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("s.1", "[1]", "0x0", "int *")
|
2013-02-01 19:01:34 +01:00
|
|
|
% Check("s.2", "[2]", "2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdStack2")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <stack>\n",
|
|
|
|
"std::stack<int> s0, s;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"s.push(1);\n"
|
|
|
|
"s.push(2);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("s0", "<0 items>", "std::stack<int>")
|
|
|
|
% Check("s", "<2 items>", "std::stack<int>")
|
2013-02-01 19:01:34 +01:00
|
|
|
% Check("s.0", "[0]", "1", "int")
|
|
|
|
% Check("s.1", "[1]", "2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdStack3")
|
2013-02-01 19:01:34 +01:00
|
|
|
<< Data("#include <stack>\n" + fooData,
|
2013-01-28 17:15:49 +01:00
|
|
|
"std::stack<Foo *> s, s0;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"s.push(new Foo(1));\n"
|
|
|
|
"s.push(new Foo(2));\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("s", "<2 items>", "std::stack<Foo*>")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("s.0", "[0]", "", "Foo")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("s.0.a", "1", "int")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("s.1", "[1]", "", "Foo")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("s.1.a", "2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdStack4")
|
2013-02-01 19:01:34 +01:00
|
|
|
<< Data("#include <stack>\n" + fooData,
|
2013-01-28 17:15:49 +01:00
|
|
|
"std::stack<Foo> s0, s;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"s.push(1);\n"
|
|
|
|
"s.push(2);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("s0", "<0 items>", "std::stack<Foo>")
|
|
|
|
% Check("s", "<2 items>", "std::stack<Foo>")
|
|
|
|
% Check("s.0", "[0]", "", "Foo")
|
|
|
|
% Check("s.0.a", "1", "int")
|
|
|
|
% Check("s.1", "[1]", "", "Foo")
|
|
|
|
% Check("s.1.a", "2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdString1")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <string>\n",
|
|
|
|
"std::string str0, str;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"std::wstring wstr0, wstr;\n"
|
|
|
|
"str += \"b\";\n"
|
|
|
|
"wstr += wchar_t('e');\n"
|
|
|
|
"str += \"d\";\n"
|
|
|
|
"wstr += wchar_t('e');\n"
|
|
|
|
"str += \"e\";\n"
|
|
|
|
"str += \"b\";\n"
|
|
|
|
"str += \"d\";\n"
|
|
|
|
"str += \"e\";\n"
|
|
|
|
"wstr += wchar_t('e');\n"
|
|
|
|
"wstr += wchar_t('e');\n"
|
2013-02-11 16:02:57 +01:00
|
|
|
"str += \"e\";\n"
|
|
|
|
"unused(&str0, &str, &wstr0, &wstr);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("str0", "\"\"", "std::string")
|
|
|
|
% Check("wstr0", "\"\"", "std::wstring")
|
|
|
|
% Check("str", "\"bdebdee\"", "std::string")
|
|
|
|
% Check("wstr", "\"eeee\"", "std::wstring");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdString2")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <string>\n"
|
|
|
|
"#include <vector>\n"
|
|
|
|
"#include <QList>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"std::string str = \"foo\";\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"std::vector<std::string> v;\n"
|
|
|
|
"QList<std::string> l0, l;\n"
|
|
|
|
"v.push_back(str);\n"
|
|
|
|
"v.push_back(str);\n"
|
|
|
|
"l.push_back(str);\n"
|
|
|
|
"l.push_back(str);\n")
|
2013-07-02 15:43:29 +02:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("l0", "<0 items>", "@QList<std::string>")
|
|
|
|
% Check("l", "<2 items>", "@QList<std::string>")
|
|
|
|
% Check("str", "\"foo\"", "std::string")
|
|
|
|
% Check("v", "<2 items>", "std::vector<std::string>")
|
|
|
|
% Check("v.0", "[0]", "\"foo\"", "std::string");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
2013-06-05 11:26:46 +02:00
|
|
|
QTest::newRow("StdVector0")
|
|
|
|
<< Data("#include <vector>\n",
|
|
|
|
"std::vector<double> v0, v;\n"
|
|
|
|
"v.push_back(1);\n"
|
|
|
|
"v.push_back(0);\n"
|
|
|
|
"v.push_back(2);\n")
|
|
|
|
% Check("v0", "<0 items>", "std::vector<double>")
|
|
|
|
% Check("v", "<3 items>", "std::vector<double>")
|
|
|
|
% Check("v.0", "[0]", "1", "double")
|
|
|
|
% Check("v.1", "[1]", "0", "double")
|
|
|
|
% Check("v.2", "[2]", "2", "double");
|
|
|
|
|
2013-01-25 19:11:14 +01:00
|
|
|
QTest::newRow("StdVector1")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <vector>\n",
|
|
|
|
"std::vector<int *> v0, v;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"v.push_back(new int(1));\n"
|
|
|
|
"v.push_back(0);\n"
|
|
|
|
"v.push_back(new int(2));\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("v0", "<0 items>", "std::vector<int*>")
|
|
|
|
% Check("v", "<3 items>", "std::vector<int*>")
|
2013-02-01 19:01:34 +01:00
|
|
|
% Check("v.0", "[0]", "1", "int")
|
|
|
|
% Check("v.1", "[1]", "0x0", "int *")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("v.2", "[2]", "2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdVector2")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <vector>\n",
|
|
|
|
"std::vector<int> v;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"v.push_back(1);\n"
|
|
|
|
"v.push_back(2);\n"
|
|
|
|
"v.push_back(3);\n"
|
|
|
|
"v.push_back(4);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("v", "<4 items>", "std::vector<int>")
|
|
|
|
% Check("v.0", "[0]", "1", "int")
|
|
|
|
% Check("v.3", "[3]", "4", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdVector3")
|
2013-02-01 19:01:34 +01:00
|
|
|
<< Data("#include <vector>\n" + fooData,
|
2013-01-28 17:15:49 +01:00
|
|
|
"std::vector<Foo *> v;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"v.push_back(new Foo(1));\n"
|
|
|
|
"v.push_back(0);\n"
|
|
|
|
"v.push_back(new Foo(2));\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("v", "<3 items>", "std::vector<Foo*>")
|
|
|
|
% Check("v.0", "[0]", "", "Foo")
|
|
|
|
% Check("v.0.a", "1", "int")
|
|
|
|
% Check("v.1", "[1]", "0x0", "Foo *")
|
|
|
|
% Check("v.2", "[2]", "", "Foo")
|
|
|
|
% Check("v.2.a", "2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdVector4")
|
2013-02-01 19:01:34 +01:00
|
|
|
<< Data("#include <vector>\n" + fooData,
|
2013-01-28 17:15:49 +01:00
|
|
|
"std::vector<Foo> v;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"v.push_back(1);\n"
|
|
|
|
"v.push_back(2);\n"
|
|
|
|
"v.push_back(3);\n"
|
|
|
|
"v.push_back(4);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("v", "<4 items>", "std::vector<Foo>")
|
|
|
|
% Check("v.0", "[0]", "", "Foo")
|
|
|
|
% Check("v.1.a", "2", "int")
|
|
|
|
% Check("v.3", "[3]", "", "Foo");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdVectorBool1")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <vector>\n",
|
|
|
|
"std::vector<bool> v;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"v.push_back(true);\n"
|
|
|
|
"v.push_back(false);\n"
|
|
|
|
"v.push_back(false);\n"
|
|
|
|
"v.push_back(true);\n"
|
|
|
|
"v.push_back(false);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("v", "<5 items>", "std::vector<bool>")
|
2013-02-04 16:44:09 +01:00
|
|
|
% Check("v.0", "[0]", "1", "bool")
|
|
|
|
% Check("v.1", "[1]", "0", "bool")
|
|
|
|
% Check("v.2", "[2]", "0", "bool")
|
|
|
|
% Check("v.3", "[3]", "1", "bool")
|
|
|
|
% Check("v.4", "[4]", "0", "bool");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdVectorBool2")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <vector>\n",
|
|
|
|
"std::vector<bool> v1(65, true);\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"std::vector<bool> v2(65);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("v1", "<65 items>", "std::vector<bool>")
|
2013-02-04 16:44:09 +01:00
|
|
|
% Check("v1.0", "[0]", "1", "bool")
|
|
|
|
% Check("v1.64", "[64]", "1", "bool")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("v2", "<65 items>", "std::vector<bool>")
|
2013-02-04 16:44:09 +01:00
|
|
|
% Check("v2.0", "[0]", "0", "bool")
|
|
|
|
% Check("v2.64", "[64]", "0", "bool");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdVector6")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <vector>\n"
|
|
|
|
"#include <list>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"std::vector<std::list<int> *> vector;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"std::list<int> list;\n"
|
|
|
|
"vector.push_back(new std::list<int>(list));\n"
|
|
|
|
"vector.push_back(0);\n"
|
|
|
|
"list.push_back(45);\n"
|
|
|
|
"vector.push_back(new std::list<int>(list));\n"
|
|
|
|
"vector.push_back(0);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("list", "<1 items>", "std::list<int>")
|
|
|
|
% Check("list.0", "[0]", "45", "int")
|
|
|
|
% Check("vector", "<4 items>", "std::vector<std::list<int>*>")
|
|
|
|
% Check("vector.0", "[0]", "<0 items>", "std::list<int>")
|
|
|
|
% Check("vector.2", "[2]", "<1 items>", "std::list<int>")
|
2013-02-01 19:01:34 +01:00
|
|
|
% Check("vector.2.0", "[0]", "45", "int")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("vector.3", "[3]", "0x0", "std::list<int> *");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("StdStream")
|
2013-02-01 17:35:16 +01:00
|
|
|
<< Data("#include <istream>\n"
|
|
|
|
"#include <fstream>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"using namespace std;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"ifstream is0, is;\n"
|
|
|
|
"#ifdef Q_OS_WIN\n"
|
|
|
|
" is.open(\"C:\\\\Program Files\\\\Windows NT\\\\Accessories\\\\wordpad.exe\");\n"
|
|
|
|
"#else\n"
|
|
|
|
" is.open(\"/etc/passwd\");\n"
|
|
|
|
"#endif\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"bool ok = is.good();\n"
|
|
|
|
"unused(&ok, &is, &is0);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("is", "", "std::ifstream")
|
|
|
|
% Check("ok", "true", "bool");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("ItemModel")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <QStandardItemModel>\n",
|
|
|
|
"QStandardItemModel m;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QStandardItem *i1, *i2, *i11;\n"
|
|
|
|
"m.appendRow(QList<QStandardItem *>()\n"
|
2013-02-04 23:36:32 +01:00
|
|
|
" << (i1 = new QStandardItem(\"1\")) "
|
|
|
|
" << (new QStandardItem(\"a\")) "
|
|
|
|
" << (new QStandardItem(\"a2\")));\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QModelIndex mi = i1->index();\n"
|
|
|
|
"m.appendRow(QList<QStandardItem *>()\n"
|
2013-02-04 23:36:32 +01:00
|
|
|
" << (i2 = new QStandardItem(\"2\")) "
|
|
|
|
" << (new QStandardItem(\"b\")));\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"i1->appendRow(QList<QStandardItem *>()\n"
|
2013-02-04 23:36:32 +01:00
|
|
|
" << (i11 = new QStandardItem(\"11\")) "
|
|
|
|
" << (new QStandardItem(\"aa\")));\n"
|
|
|
|
"unused(&i1, &i2, &i11, &m, &mi);\n")
|
|
|
|
% GuiProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("i1", "", "@QStandardItem")
|
|
|
|
% Check("i11", "", "@QStandardItem")
|
|
|
|
% Check("i2", "", "@QStandardItem")
|
|
|
|
% Check("m", "", "@QStandardItemModel")
|
|
|
|
% Check("mi", "\"1\"", "@QModelIndex");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QStackInt")
|
2013-02-01 19:01:34 +01:00
|
|
|
<< Data("#include <QStack>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"QStack<int> s;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"s.append(1);\n"
|
|
|
|
"s.append(2);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("s", "<2 items>", "@QStack<int>")
|
|
|
|
% Check("s.0", "[0]", "1", "int")
|
|
|
|
% Check("s.1", "[1]", "2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QStackBig")
|
2013-02-01 19:01:34 +01:00
|
|
|
<< Data("#include <QStack>\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"QStack<int> s;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"for (int i = 0; i != 10000; ++i)\n"
|
|
|
|
" s.append(i);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("s", "<10000 items>", "@QStack<int>")
|
|
|
|
% Check("s.0", "[0]", "0", "int")
|
|
|
|
% Check("s.1999", "[1999]", "1999", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QStackFooPointer")
|
2013-02-01 19:01:34 +01:00
|
|
|
<< Data("#include <QStack>\n" + fooData,
|
2013-01-28 17:15:49 +01:00
|
|
|
"QStack<Foo *> s;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"s.append(new Foo(1));\n"
|
|
|
|
"s.append(0);\n"
|
|
|
|
"s.append(new Foo(2));\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("s", "<3 items>", "@QStack<Foo*>")
|
|
|
|
% Check("s.0", "[0]", "", "Foo")
|
|
|
|
% Check("s.0.a", "1", "int")
|
|
|
|
% Check("s.1", "[1]", "0x0", "Foo *")
|
|
|
|
% Check("s.2", "[2]", "", "Foo")
|
|
|
|
% Check("s.2.a", "2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QStackFoo")
|
2013-02-01 19:01:34 +01:00
|
|
|
<< Data("#include <QStack>\n" + fooData,
|
2013-01-28 17:15:49 +01:00
|
|
|
"QStack<Foo> s;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"s.append(1);\n"
|
|
|
|
"s.append(2);\n"
|
|
|
|
"s.append(3);\n"
|
|
|
|
"s.append(4);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("s", "<4 items>", "@QStack<Foo>")
|
|
|
|
% Check("s.0", "[0]", "", "Foo")
|
|
|
|
% Check("s.0.a", "1", "int")
|
|
|
|
% Check("s.3", "[3]", "", "Foo")
|
|
|
|
% Check("s.3.a", "4", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QStackBool")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <QStack>",
|
|
|
|
"QStack<bool> s;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"s.append(true);\n"
|
|
|
|
"s.append(false);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("s", "<2 items>", "@QStack<bool>")
|
2013-02-01 19:01:34 +01:00
|
|
|
% Check("s.0", "[0]", "1", "bool") // 1 -> true is done on display
|
|
|
|
% Check("s.1", "[1]", "0", "bool");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QUrl")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <QUrl>",
|
2013-02-13 14:54:37 +01:00
|
|
|
"QUrl url = QUrl::fromEncoded(\"http://qt-project.org/have_fun\");\n"
|
2013-02-13 00:51:05 +01:00
|
|
|
"unused(&url);\n")
|
2013-02-13 14:54:37 +01:00
|
|
|
% CoreProfile()
|
|
|
|
% Check("url", "\"http://qt-project.org/have_fun\"", "@QUrl");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QStringQuotes")
|
2013-02-01 19:01:34 +01:00
|
|
|
<< Data("#include <QString>\n",
|
|
|
|
"QString str1(\"Hello Qt\");\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
// --> Value: \"Hello Qt\"
|
|
|
|
"QString str2(\"Hello\\nQt\");\n"
|
|
|
|
// --> Value: \\"\"Hello\nQt"" (double quote not expected)
|
|
|
|
"QString str3(\"Hello\\rQt\");\n"
|
|
|
|
// --> Value: ""HelloQt"" (double quote and missing \r not expected)
|
2013-02-01 19:01:34 +01:00
|
|
|
"QString str4(\"Hello\\tQt\");\n"
|
|
|
|
"unused(&str1, &str2, &str3, &str3);\n")
|
2013-01-25 19:11:14 +01:00
|
|
|
// --> Value: "Hello\9Qt" (expected \t instead of \9)
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("str1", "\"Hello Qt\"", "@QString")
|
|
|
|
% Check("str2", "\"Hello\nQt\"", "@QString")
|
|
|
|
% Check("str3", "\"Hello\rQt\"", "@QString")
|
|
|
|
% Check("str4", "\"Hello\tQt\"", "@QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
2013-02-11 17:58:52 +01:00
|
|
|
QTest::newRow("QString0")
|
|
|
|
<< Data("#include <QByteArray>\n",
|
|
|
|
"QByteArray str = \"Hello\";\n"
|
|
|
|
"str.prepend(\"Prefix: \");\n"
|
|
|
|
"unused(&str);\n")
|
|
|
|
% CoreProfile()
|
|
|
|
% Check("str", "\"Prefix: Hello\"", "@QByteArray");
|
|
|
|
|
|
|
|
QByteArray expected1 = "\"AAA";
|
|
|
|
expected1.append(char('\t'));
|
|
|
|
expected1.append(char('\r'));
|
|
|
|
expected1.append(char('\n'));
|
|
|
|
expected1.append(char(0));
|
|
|
|
expected1.append(char(1));
|
|
|
|
expected1.append("BBB\"");
|
|
|
|
|
2013-02-01 19:01:34 +01:00
|
|
|
QTest::newRow("QString1")
|
|
|
|
<< Data("#include <QByteArray>\n",
|
2013-02-11 17:58:52 +01:00
|
|
|
"QByteArray str = \"AAA\";\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"str += '\\t';\n"
|
|
|
|
"str += '\\r';\n"
|
|
|
|
"str += '\\n';\n"
|
2013-02-01 19:01:34 +01:00
|
|
|
"str += char(0);\n"
|
|
|
|
"str += char(1);\n"
|
2013-02-11 17:58:52 +01:00
|
|
|
"str += \"BBB\";\n"
|
2013-02-01 19:01:34 +01:00
|
|
|
"unused(&str);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-11 17:58:52 +01:00
|
|
|
% Check("str", expected1, "@QByteArray");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QString2")
|
2013-02-01 19:01:34 +01:00
|
|
|
<< Data("#include <QString>\n",
|
|
|
|
"QChar data[] = { 'H', 'e', 'l', 'l', 'o' };\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QString str1 = QString::fromRawData(data, 4);\n"
|
2013-02-01 19:01:34 +01:00
|
|
|
"QString str2 = QString::fromRawData(data + 1, 4);\n"
|
|
|
|
"unused(&data, &str1, &str2);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("str1", "\"Hell\"", "@QString")
|
|
|
|
% Check("str2", "\"ello\"", "@QString");
|
|
|
|
|
|
|
|
QTest::newRow("QString3")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <QString>\n"
|
2013-02-01 19:01:34 +01:00
|
|
|
"void stringRefTest(const QString &refstring) { breakHere(); unused(&refstring); }\n",
|
2013-01-30 11:25:19 +01:00
|
|
|
"stringRefTest(QString(\"Ref String Test\"));\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("refstring", "\"Ref String Test\"", "@QString &");
|
|
|
|
|
|
|
|
QTest::newRow("QString4")
|
2013-02-01 19:01:34 +01:00
|
|
|
<< Data("#include <QString>\n",
|
2013-01-30 11:25:19 +01:00
|
|
|
"QString str = \"Hello \";\n"
|
|
|
|
"QString string(\"String Test\");\n"
|
|
|
|
"QString *pstring = new QString(\"Pointer String Test\");\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&str, &string, &pstring);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("pstring", "\"Pointer String Test\"", "@QString")
|
|
|
|
% Check("str", "\"Hello \"", "@QString")
|
|
|
|
% Check("string", "\"String Test\"", "@QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
2013-01-28 17:15:49 +01:00
|
|
|
QTest::newRow("QStringRef1")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <QStringRef>\n",
|
|
|
|
"QString str = \"Hello\";\n"
|
2013-01-28 17:15:49 +01:00
|
|
|
"QStringRef ref(&str, 1, 2);")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("ref", "\"el\"", "@QStringRef");
|
|
|
|
|
|
|
|
QTest::newRow("QStringList")
|
|
|
|
<< Data("#include <QStringList>\n",
|
|
|
|
"QStringList l;\n"
|
|
|
|
"l << \"Hello \";\n"
|
|
|
|
"l << \" big, \";\n"
|
|
|
|
"l.takeFirst();\n"
|
|
|
|
"l << \" World \";\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("l", "<2 items>", "@QStringList")
|
2013-02-01 19:01:34 +01:00
|
|
|
% Check("l.0", "[0]", "\" big, \"", "@QString")
|
|
|
|
% Check("l.1", "[1]", "\" World \"", "@QString");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
2013-03-27 16:02:40 +02:00
|
|
|
QChar oUmlaut = QLatin1Char((char)0xf6);
|
2013-01-25 19:11:14 +01:00
|
|
|
QTest::newRow("String")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <QString>",
|
|
|
|
"const wchar_t *w = L\"aöa\";\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QString u;\n"
|
|
|
|
"if (sizeof(wchar_t) == 4)\n"
|
|
|
|
" u = QString::fromUcs4((uint *)w);\n"
|
|
|
|
"else\n"
|
2013-02-01 19:01:34 +01:00
|
|
|
" u = QString::fromUtf16((ushort *)w);\n"
|
|
|
|
"unused(&w, &u);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-11 17:58:52 +01:00
|
|
|
% Check("u", QString::fromLatin1("\"a%1a\"").arg(oUmlaut), "@QString")
|
2013-02-01 19:01:34 +01:00
|
|
|
% CheckType("w", "w", "wchar_t *");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
// All: Select UTF-8 in "Change Format for Type" in L&W context menu");
|
|
|
|
// Windows: Select UTF-16 in "Change Format for Type" in L&W context menu");
|
|
|
|
// Other: Select UCS-6 in "Change Format for Type" in L&W context menu");
|
|
|
|
|
|
|
|
|
|
|
|
// These tests should result in properly displayed umlauts in the
|
|
|
|
// Locals&Watchers view. It is only support on gdb with Python");
|
|
|
|
QTest::newRow("CharPointers")
|
|
|
|
<< Data("const char *s = \"aöa\";\n"
|
|
|
|
"const char *t = \"a\\xc3\\xb6\";\n"
|
|
|
|
"const unsigned char uu[] = { 'a', 153 /* ö Latin1 */, 'a' };\n"
|
|
|
|
"const unsigned char *u = uu;\n"
|
2013-02-01 19:01:34 +01:00
|
|
|
"const wchar_t *w = L\"aöa\";\n"
|
|
|
|
"unused(&s, &t, &uu, &u, &w);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% CheckType("u", "unsigned char *")
|
|
|
|
% CheckType("uu", "unsigned char [3]")
|
|
|
|
% CheckType("s", "char *")
|
|
|
|
% CheckType("t", "char *")
|
|
|
|
% CheckType("w", "wchar_t *");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
// All: Select UTF-8 in "Change Format for Type" in L&W context menu");
|
|
|
|
// Windows: Select UTF-16 in "Change Format for Type" in L&W context menu");
|
|
|
|
// Other: Select UCS-6 in "Change Format for Type" in L&W context menu");
|
|
|
|
|
|
|
|
QTest::newRow("CharArrays")
|
|
|
|
<< Data("const char s[] = \"aöa\";\n"
|
|
|
|
"const char t[] = \"aöax\";\n"
|
2013-02-01 19:01:34 +01:00
|
|
|
"const wchar_t w[] = L\"aöa\";\n"
|
|
|
|
"unused(&s, &t, &w);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% CheckType("s", "char [5]")
|
|
|
|
% CheckType("t", "char [6]")
|
|
|
|
% CheckType("w", "wchar_t [4]");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("Text")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <QApplication>\n"
|
|
|
|
"#include <QTextCursor>\n"
|
|
|
|
"#include <QTextDocument>\n",
|
2013-02-01 17:35:16 +01:00
|
|
|
"QApplication app(argc, argv);\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QTextDocument doc;\n"
|
|
|
|
"doc.setPlainText(\"Hallo\\nWorld\");\n"
|
|
|
|
"QTextCursor tc;\n"
|
|
|
|
"tc = doc.find(\"all\");\n"
|
|
|
|
"int pos = tc.position();\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"int anc = tc.anchor();\n"
|
|
|
|
"unused(&pos, &anc);\n")
|
2013-02-04 23:36:32 +01:00
|
|
|
% GuiProfile()
|
2013-02-01 17:35:16 +01:00
|
|
|
% CheckType("doc", "@QTextDocument")
|
|
|
|
% Check("tc", "4", "@QTextCursor")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("pos", "4", "int")
|
|
|
|
% Check("anc", "1", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
2013-02-01 17:35:16 +01:00
|
|
|
QTest::newRow("QThread1")
|
2013-07-01 14:29:00 +02:00
|
|
|
<< Data("#include <QThread>\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"struct Thread : QThread\n"
|
|
|
|
"{\n"
|
|
|
|
" void run()\n"
|
|
|
|
" {\n"
|
|
|
|
" if (m_id == 3)\n"
|
|
|
|
" breakHere();\n"
|
|
|
|
" }\n"
|
|
|
|
" int m_id;\n"
|
2013-07-01 14:29:00 +02:00
|
|
|
"};\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"const int N = 14;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"Thread thread[N];\n"
|
|
|
|
"for (int i = 0; i != N; ++i) {\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
" thread[i].m_id = i;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
" thread[i].setObjectName(\"This is thread #\" + QString::number(i));\n"
|
|
|
|
" thread[i].start();\n"
|
|
|
|
"}\n")
|
2013-07-01 14:29:00 +02:00
|
|
|
% CoreProfile()
|
|
|
|
% CheckType("this", "Thread")
|
|
|
|
% Check("this.@1", "[@QThread]", "\"This is thread #3\"", "@QThread")
|
|
|
|
% Check("this.@1.@1", "[@QObject]", "\"This is thread #3\"", "@QObject");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QVariant1")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("#include <QVariant>\n",
|
|
|
|
"QVariant value;\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QVariant::Type t = QVariant::String;\n"
|
|
|
|
"value = QVariant(t, (void*)0);\n"
|
2013-02-01 16:30:15 +01:00
|
|
|
"*(QString*)value.data() = QString(\"Some string\");\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-01 16:30:15 +01:00
|
|
|
% Check("t", "@QVariant::String (10)", "@QVariant::Type")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("value", "\"Some string\"", "@QVariant (QString)");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("QVariant2")
|
2013-02-01 16:30:15 +01:00
|
|
|
<< Data("#include <QVariant>\n"
|
|
|
|
"#include <QRect>\n"
|
|
|
|
"#include <QRectF>\n"
|
|
|
|
"#include <QStringList>\n"
|
|
|
|
"#include <QString>\n",
|
2013-01-25 19:11:14 +01:00
|
|
|
"QVariant var; // Type 0, invalid\n"
|
|
|
|
"QVariant var1(true); // 1, bool\n"
|
|
|
|
"QVariant var2(2); // 2, int\n"
|
|
|
|
"QVariant var3(3u); // 3, uint\n"
|
|
|
|
"QVariant var4(qlonglong(4)); // 4, qlonglong\n"
|
|
|
|
"QVariant var5(qulonglong(5)); // 5, qulonglong\n"
|
|
|
|
"QVariant var6(double(6)); // 6, double\n"
|
|
|
|
"QVariant var7(QChar(7)); // 7, QChar\n"
|
|
|
|
//None, # 8, QVariantMap
|
|
|
|
// None, # 9, QVariantList
|
|
|
|
"QVariant var10(QString(\"Hello 10\")); // 10, QString\n"
|
2013-02-01 16:30:15 +01:00
|
|
|
"QVariant var11(QStringList() << \"Hello\" << \"World\"); // 11, QStringList\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
"QVariant var19(QRect(100, 200, 300, 400)); // 19 QRect\n"
|
|
|
|
"QVariant var20(QRectF(100, 200, 300, 400)); // 20 QRectF\n"
|
|
|
|
)
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("var", "(invalid)", "@QVariant (invalid)")
|
|
|
|
% Check("var1", "true", "@QVariant (bool)")
|
|
|
|
% Check("var2", "2", "@QVariant (int)")
|
|
|
|
% Check("var3", "3", "@QVariant (uint)")
|
|
|
|
% Check("var4", "4", "@QVariant (qlonglong)")
|
|
|
|
% Check("var5", "5", "@QVariant (qulonglong)")
|
|
|
|
% Check("var6", "6", "@QVariant (double)")
|
|
|
|
% Check("var7", "'?' (7)", "@QVariant (QChar)")
|
|
|
|
% Check("var10", "\"Hello 10\"", "@QVariant (QString)")
|
2013-02-01 16:30:15 +01:00
|
|
|
% Check("var11", "<2 items>", "@QVariant (QStringList)")
|
|
|
|
% Check("var11.1", "[1]", "\"World\"", "@QString")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("var19", "300x400+100+200", "@QVariant (QRect)")
|
|
|
|
% Check("var20", "300x400+100+200", "@QVariant (QRectF)");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
"QByteArray", # 12
|
|
|
|
"QBitArray", # 13
|
|
|
|
"QDate", # 14
|
|
|
|
"QTime", # 15
|
|
|
|
"QDateTime", # 16
|
|
|
|
"QUrl", # 17
|
|
|
|
"QLocale", # 18
|
|
|
|
"QRect", # 19
|
|
|
|
"QRectF", # 20
|
|
|
|
"QSize", # 21
|
|
|
|
"QSizeF", # 22
|
|
|
|
"QLine", # 23
|
|
|
|
"QLineF", # 24
|
|
|
|
"QPoint", # 25
|
|
|
|
"QPointF", # 26
|
|
|
|
"QRegExp", # 27
|
|
|
|
*/
|
|
|
|
|
2013-02-01 16:30:15 +01:00
|
|
|
QTest::newRow("QVariant3")
|
|
|
|
<< Data("#include <QVariant>\n",
|
|
|
|
"QVariant var;\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&var);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-01 16:30:15 +01:00
|
|
|
% Check("var", "(invalid)", "@QVariant (invalid)");
|
|
|
|
|
2013-01-28 17:15:49 +01:00
|
|
|
QTest::newRow("QVariant4")
|
|
|
|
<< Data("#include <QHostAddress>\n"
|
2013-02-01 16:30:15 +01:00
|
|
|
"#include <QVariant>\n"
|
|
|
|
"Q_DECLARE_METATYPE(QHostAddress)\n",
|
2013-01-28 17:15:49 +01:00
|
|
|
"QVariant var;\n"
|
|
|
|
"QHostAddress ha(\"127.0.0.1\");\n"
|
|
|
|
"var.setValue(ha);\n"
|
|
|
|
"QHostAddress ha1 = var.value<QHostAddress>();\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-01 16:30:15 +01:00
|
|
|
% Profile("QT += network\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("ha", "\"127.0.0.1\"", "@QHostAddress")
|
2013-02-01 16:30:15 +01:00
|
|
|
% Check("ha.a", "0", "@quint32")
|
|
|
|
% Check("ha.a6", "", "@Q_IPV6ADDR")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("ha.ipString", "\"127.0.0.1\"", "@QString")
|
|
|
|
% Check("ha.isParsed", "false", "bool")
|
2013-02-01 16:30:15 +01:00
|
|
|
% Check("ha.protocol", "@QAbstractSocket::UnknownNetworkLayerProtocol (-1)",
|
2013-01-28 17:15:49 +01:00
|
|
|
"@QAbstractSocket::NetworkLayerProtocol")
|
2013-02-01 16:30:15 +01:00
|
|
|
% Check("ha.scopeId", "\"\"", "@QString")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("ha1", "\"127.0.0.1\"", "@QHostAddress")
|
2013-02-01 16:30:15 +01:00
|
|
|
% Check("ha1.a", "0", "@quint32")
|
|
|
|
% Check("ha1.a6", "", "@Q_IPV6ADDR")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("ha1.ipString", "\"127.0.0.1\"", "@QString")
|
|
|
|
% Check("ha1.isParsed", "false", "bool")
|
2013-02-01 16:30:15 +01:00
|
|
|
% Check("ha1.protocol", "@QAbstractSocket::UnknownNetworkLayerProtocol (-1)",
|
2013-01-28 17:15:49 +01:00
|
|
|
"@QAbstractSocket::NetworkLayerProtocol")
|
2013-02-01 16:30:15 +01:00
|
|
|
% Check("ha1.scopeId", "\"\"", "@QString")
|
|
|
|
% Check("var", "", "@QVariant (@QHostAddress)")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("var.data", "\"127.0.0.1\"", "@QHostAddress");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
2013-02-01 16:30:15 +01:00
|
|
|
QTest::newRow("QVariant5")
|
|
|
|
<< Data("#include <QMap>\n"
|
|
|
|
"#include <QStringList>\n"
|
|
|
|
"#include <QVariant>\n"
|
|
|
|
// This checks user defined types in QVariants\n";
|
|
|
|
"typedef QMap<uint, QStringList> MyType;\n"
|
|
|
|
"Q_DECLARE_METATYPE(QList<int>)\n"
|
|
|
|
"Q_DECLARE_METATYPE(QStringList)\n"
|
|
|
|
"#define COMMA ,\n"
|
|
|
|
"Q_DECLARE_METATYPE(QMap<uint COMMA QStringList>)\n",
|
|
|
|
"MyType my;\n"
|
|
|
|
"my[1] = (QStringList() << \"Hello\");\n"
|
|
|
|
"my[3] = (QStringList() << \"World\");\n"
|
|
|
|
"QVariant var;\n"
|
|
|
|
"var.setValue(my);\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"breakHere();\n")
|
2013-07-01 14:29:00 +02:00
|
|
|
% CoreProfile()
|
2013-02-01 16:30:15 +01:00
|
|
|
% Check("my", "<2 items>", "MyType")
|
|
|
|
% Check("my.0", "[0]", "", "@QMapNode<unsigned int, @QStringList>")
|
|
|
|
% Check("my.0.key", "1", "unsigned int")
|
|
|
|
% Check("my.0.value", "<1 items>", "@QStringList")
|
|
|
|
% Check("my.0.value.0", "[0]", "\"Hello\"", "@QString")
|
|
|
|
% Check("my.1", "[1]", "", "@QMapNode<unsigned int, @QStringList>")
|
|
|
|
% Check("my.1.key", "3", "unsigned int")
|
|
|
|
% Check("my.1.value", "<1 items>", "@QStringList")
|
|
|
|
% Check("my.1.value.0", "[0]", "\"World\"", "@QString")
|
|
|
|
% CheckType("var", "@QVariant (@QMap<unsigned int, @QStringList>)")
|
|
|
|
% Check("var.data", "<2 items>", "@QMap<unsigned int, @QStringList>")
|
|
|
|
% Check("var.data.0", "[0]", "", "@QMapNode<unsigned int, @QStringList>")
|
|
|
|
% Check("var.data.0.key", "1", "unsigned int")
|
|
|
|
% Check("var.data.0.value", "<1 items>", "@QStringList")
|
|
|
|
% Check("var.data.0.value.0", "[0]", "\"Hello\"", "@QString")
|
|
|
|
% Check("var.data.1", "[1]", "", "@QMapNode<unsigned int, @QStringList>")
|
|
|
|
% Check("var.data.1.key", "3", "unsigned int")
|
|
|
|
% Check("var.data.1.value", "<1 items>", "@QStringList")
|
|
|
|
% Check("var.data.1.value.0", "[0]", "\"World\"", "@QString");
|
|
|
|
|
|
|
|
QTest::newRow("QVariant6")
|
|
|
|
<< Data("#include <QList>\n"
|
|
|
|
"#include <QVariant>\n"
|
|
|
|
"Q_DECLARE_METATYPE(QList<int>)\n",
|
|
|
|
"QList<int> list;\n"
|
|
|
|
"list << 1 << 2 << 3;\n"
|
|
|
|
"QVariant variant = qVariantFromValue(list);\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&list, &variant);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-01 16:30:15 +01:00
|
|
|
% Check("list", "<3 items>", "@QList<int>")
|
|
|
|
% Check("list.0", "[0]", "1", "int")
|
|
|
|
% Check("list.1", "[1]", "2", "int")
|
|
|
|
% Check("list.2", "[2]", "3", "int")
|
|
|
|
% Check("variant", "", "@QVariant (@QList<int>)")
|
|
|
|
% Check("variant.data", "<3 items>", "@QList<int>")
|
|
|
|
% Check("variant.data.0", "[0]", "1", "int")
|
|
|
|
% Check("variant.data.1", "[1]", "2", "int")
|
|
|
|
% Check("variant.data.2", "[2]", "3", "int");
|
|
|
|
|
2013-06-18 15:09:10 +02:00
|
|
|
QTest::newRow("QVariantList")
|
|
|
|
<< Data("#include <QVariantList>\n",
|
|
|
|
"QVariantList vl;\n"
|
|
|
|
"vl.append(QVariant(1));\n"
|
|
|
|
"vl.append(QVariant(2));\n"
|
|
|
|
"vl.append(QVariant(\"Some String\"));\n"
|
|
|
|
"vl.append(QVariant(21));\n"
|
|
|
|
"vl.append(QVariant(22));\n"
|
|
|
|
"vl.append(QVariant(\"2Some String\"));\n")
|
2013-07-01 14:29:00 +02:00
|
|
|
% CoreProfile()
|
2013-06-18 15:09:10 +02:00
|
|
|
% Check("vl", "<6 items>", "@QVariantList")
|
|
|
|
% CheckType("vl.0", "[0]", "@QVariant (int)")
|
|
|
|
% CheckType("vl.2", "[2]", "@QVariant (QString)");
|
|
|
|
|
|
|
|
QTest::newRow("QVariantMap")
|
|
|
|
<< Data("#include <QVariantMap>\n",
|
|
|
|
"QVariantMap vm;\n"
|
|
|
|
"vm[\"a\"] = QVariant(1);\n"
|
|
|
|
"vm[\"b\"] = QVariant(2);\n"
|
|
|
|
"vm[\"c\"] = QVariant(\"Some String\");\n"
|
|
|
|
"vm[\"d\"] = QVariant(21);\n"
|
|
|
|
"vm[\"e\"] = QVariant(22);\n"
|
|
|
|
"vm[\"f\"] = QVariant(\"2Some String\");\n")
|
2013-07-01 14:29:00 +02:00
|
|
|
% CoreProfile()
|
2013-06-18 15:09:10 +02:00
|
|
|
% Check("vm", "<6 items>", "@QVariantMap")
|
|
|
|
% Check("vm.0", "[0]", "", "@QMapNode<@QString, @QVariant>")
|
|
|
|
% Check("vm.0.key", Value4("\"a\""), "@QString")
|
|
|
|
% Check("vm.0.value", Value4("1"), "@QVariant (int)")
|
|
|
|
% Check("vm.0.key", Value5("\"b\""), "@QString")
|
|
|
|
% Check("vm.0.value", Value5("2"), "@QVariant (int)")
|
|
|
|
% Check("vm.5", "[5]", "", "@QMapNode<@QString, @QVariant>")
|
|
|
|
% Check("vm.5.key", Value4("\"f\""), "@QString")
|
2013-07-01 14:29:00 +02:00
|
|
|
% Check("vm.5.value", Value4("\"2Some String\""), "@QVariant (QString)")
|
2013-06-18 15:09:10 +02:00
|
|
|
% Check("vm.5.key", Value5("\"f\""), "@QString")
|
2013-07-01 14:29:00 +02:00
|
|
|
% Check("vm.5.value", Value5("\"2Some String\""), "@QVariant (QString)");
|
2013-06-18 15:09:10 +02:00
|
|
|
|
|
|
|
QTest::newRow("QVectorIntBig")
|
|
|
|
<< Data("#include <QVector>\n",
|
|
|
|
"QVector<int> vec(10000);\n"
|
|
|
|
"for (int i = 0; i != vec.size(); ++i)\n"
|
2013-06-20 12:24:37 +02:00
|
|
|
" vec[i] = i * i;\n")
|
2013-07-01 14:29:00 +02:00
|
|
|
% CoreProfile()
|
2013-06-18 15:09:10 +02:00
|
|
|
% Check("vec", "<10000 items>", "@QVector<int>")
|
|
|
|
% Check("vec.0", "[0]", "0", "int")
|
|
|
|
% Check("vec.1999", "[1999]", "3996001", "int");
|
|
|
|
|
|
|
|
QTest::newRow("QVectorFoo")
|
|
|
|
<< Data("#include <QVector>\n" + fooData,
|
|
|
|
"QVector<Foo> vec;\n"
|
|
|
|
"vec.append(1);\n"
|
|
|
|
"vec.append(2);\n")
|
2013-07-01 14:29:00 +02:00
|
|
|
% CoreProfile()
|
2013-06-18 15:09:10 +02:00
|
|
|
% Check("vec", "<2 items>", "@QVector<Foo>")
|
|
|
|
% Check("vec.0", "[0]", "", "Foo")
|
|
|
|
% Check("vec.0.a", "1", "int")
|
|
|
|
% Check("vec.1", "[1]", "", "Foo")
|
|
|
|
% Check("vec.1.a", "2", "int");
|
|
|
|
|
|
|
|
QTest::newRow("QVectorFooTypedef")
|
|
|
|
<< Data("#include <QVector>\n" + fooData +
|
|
|
|
"typedef QVector<Foo> FooVector;\n",
|
|
|
|
"FooVector vec;\n"
|
|
|
|
"vec.append(1);\n"
|
|
|
|
"vec.append(2);\n")
|
2013-07-01 14:29:00 +02:00
|
|
|
% CoreProfile()
|
|
|
|
% Check("vec", "<2 items>", "FooVector")
|
2013-06-18 15:09:10 +02:00
|
|
|
% Check("vec.0", "[0]", "", "Foo")
|
|
|
|
% Check("vec.0.a", "1", "int")
|
|
|
|
% Check("vec.1", "[1]", "", "Foo")
|
|
|
|
% Check("vec.1.a", "2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
// QTest::newRow("QVectorFooStar")
|
|
|
|
// << Data(
|
|
|
|
// {
|
|
|
|
// // This tests the display of a vector of pointers to custom structs");
|
|
|
|
// "QVector<Foo *> vec;\n"
|
|
|
|
// % Check("vec <0 items> QVector<Foo*>");
|
|
|
|
// // Continue");\n"
|
|
|
|
// // step over\n"
|
|
|
|
// // check that the display is ok");\n"
|
|
|
|
// "vec.append(new Foo(1));\n"
|
|
|
|
// "vec.append(0);\n"
|
|
|
|
// "vec.append(new Foo(2));\n"
|
|
|
|
// "vec.append(new Fooooo(3));\n"
|
|
|
|
// // switch "Auto derefencing pointers" in Locals context menu\n"
|
|
|
|
// // off and on again, and check result looks sane");\n"
|
|
|
|
// % Check("vec <4 items> QVector<Foo*>");
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("vec.0", "Foo");
|
|
|
|
// % Check("vec.0.a", "1", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
// % Check("vec.1 0x0 Foo *");
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("vec.2", "Foo");
|
|
|
|
// % Check("vec.2.a", "2", "int");
|
|
|
|
// % Check("vec.3", "Fooooo");
|
|
|
|
// % Check("vec.3.a", "5", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
// QTest::newRow("QVectorBool")
|
|
|
|
// << Data(
|
|
|
|
// QVector<bool> vec;
|
|
|
|
// % Check("vec <0 items> QVector<bool>");
|
|
|
|
// // Continue");
|
|
|
|
// // step over
|
|
|
|
// // check that the display is ok");
|
|
|
|
// vec.append(true);
|
|
|
|
// vec.append(false);
|
|
|
|
// % Check("vec <2 items> QVector<bool>");
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("vec.0", "true", "bool");
|
|
|
|
// % Check("vec.1", "false", "bool");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
// QTest::newRow("QVectorListInt")
|
|
|
|
// << Data(
|
|
|
|
// "QVector<QList<int> > vec;
|
|
|
|
// "QVector<QList<int> > *pv = &vec;
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("pv", "QVector<QList<int>>");
|
2013-01-25 19:11:14 +01:00
|
|
|
// % Check("vec <0 items> QVector<QList<int>>");
|
|
|
|
// // Continue");
|
|
|
|
// "vec.append(QList<int>() << 1);
|
|
|
|
// "vec.append(QList<int>() << 2 << 3);
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("pv", "QVector<QList<int>>");
|
2013-01-25 19:11:14 +01:00
|
|
|
// % Check("pv.0 <1 items> QList<int>");
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("pv.0.0", "1", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
// % Check("pv.1 <2 items> QList<int>");
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("pv.1.0", "2", "int");
|
|
|
|
// % Check("pv.1.1", "3", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
// % Check("vec <2 items> QVector<QList<int>>");
|
|
|
|
// % Check("vec.0 <1 items> QList<int>");
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("vec.0.0", "1", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
// % Check("vec.1 <2 items> QList<int>");
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("vec.1.0", "2", "int");
|
|
|
|
// % Check("vec.1.1", "3", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
//namespace noargs {
|
|
|
|
|
|
|
|
// class Goo
|
|
|
|
// {
|
|
|
|
// public:
|
|
|
|
// Goo(const QString &str, const int n) : str_(str), n_(n) {}
|
|
|
|
// private:
|
|
|
|
// QString str_;
|
|
|
|
// int n_;
|
|
|
|
// };
|
|
|
|
|
|
|
|
// typedef QList<Goo> GooList;
|
|
|
|
|
|
|
|
// QTest::newRow("NoArgumentName(int i, int, int k)
|
|
|
|
// {
|
|
|
|
// // This is not supposed to work with the compiled dumpers");
|
|
|
|
// "GooList list;
|
|
|
|
// "list.append(Goo("Hello", 1));
|
|
|
|
// "list.append(Goo("World", 2));
|
|
|
|
|
|
|
|
// "QList<Goo> list2;
|
|
|
|
// "list2.append(Goo("Hello", 1));
|
|
|
|
// "list2.append(Goo("World", 2));
|
|
|
|
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("i", "1", "int");
|
|
|
|
// % Check("k", "3", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
// % Check("list <2 items> noargs::GooList");
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("list.0", "noargs::Goo");
|
|
|
|
// % Check("list.0.n_", "1", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
// % Check("list.0.str_ "Hello" QString");
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("list.1", "noargs::Goo");
|
|
|
|
// % Check("list.1.n_", "2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
// % Check("list.1.str_ "World" QString");
|
|
|
|
// % Check("list2 <2 items> QList<noargs::Goo>");
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("list2.0", "noargs::Goo");
|
|
|
|
// % Check("list2.0.n_", "1", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
// % Check("list2.0.str_ "Hello" QString");
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("list2.1", "noargs::Goo");
|
|
|
|
// % Check("list2.1.n_", "2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
// % Check("list2.1.str_ "World" QString");
|
|
|
|
|
|
|
|
|
|
|
|
//"void foo() {}\n"
|
|
|
|
//"void foo(int) {}\n"
|
|
|
|
//"void foo(QList<int>) {}\n"
|
|
|
|
//"void foo(QList<QVector<int> >) {}\n"
|
|
|
|
//"void foo(QList<QVector<int> *>) {}\n"
|
|
|
|
//"void foo(QList<QVector<int *> *>) {}\n"
|
|
|
|
//"\n"
|
|
|
|
//"template <class T>\n"
|
|
|
|
//"void foo(QList<QVector<T> *>) {}\n"
|
|
|
|
//"\n"
|
|
|
|
//"\n"
|
|
|
|
//"namespace namespc {\n"
|
|
|
|
//"\n"
|
|
|
|
//" class MyBase : public QObject\n"
|
|
|
|
//" {\n"
|
|
|
|
//" public:\n"
|
|
|
|
//" MyBase() {}\n"
|
|
|
|
//" virtual void doit(int i)\n"
|
|
|
|
//" {\n"
|
|
|
|
//" n = i;\n"
|
|
|
|
//" }\n"
|
|
|
|
//" protected:\n"
|
|
|
|
//" int n;\n"
|
|
|
|
//" };\n"
|
|
|
|
//"\n"
|
|
|
|
//" namespace nested {\n"
|
|
|
|
//"\n"
|
|
|
|
//" class MyFoo : public MyBase\n"
|
|
|
|
//" {\n"
|
|
|
|
//" public:\n"
|
|
|
|
//" MyFoo() {}\n"
|
|
|
|
//" virtual void doit(int i)\n"
|
|
|
|
//" {\n"
|
|
|
|
//" // Note there's a local 'n' and one in the base class");\n"
|
|
|
|
//" n = i;\n"
|
|
|
|
//" }\n"
|
|
|
|
//" protected:\n"
|
|
|
|
//" int n;\n"
|
|
|
|
//" };\n"
|
|
|
|
//"\n"
|
|
|
|
//" class MyBar : public MyFoo\n"
|
|
|
|
//" {\n"
|
|
|
|
//" public:\n"
|
|
|
|
//" virtual void doit(int i)\n"
|
|
|
|
//" {\n"
|
|
|
|
//" n = i + 1;\n"
|
|
|
|
//" }\n"
|
|
|
|
//" };\n"
|
|
|
|
//"\n"
|
|
|
|
//" namespace {\n"
|
|
|
|
//"\n"
|
|
|
|
//" class MyAnon : public MyBar\n"
|
|
|
|
//" {\n"
|
|
|
|
//" public:\n"
|
|
|
|
//" virtual void doit(int i)\n"
|
|
|
|
//" {\n"
|
|
|
|
//" n = i + 3;\n"
|
|
|
|
//" }\n"
|
|
|
|
//" };\n"
|
|
|
|
//"\n"
|
|
|
|
//" namespace baz {\n"
|
|
|
|
//"\n"
|
|
|
|
//" class MyBaz : public MyAnon\n"
|
|
|
|
//" {\n"
|
|
|
|
//" public:\n"
|
|
|
|
//" virtual void doit(int i)\n"
|
|
|
|
//" {\n"
|
|
|
|
//" n = i + 5;\n"
|
|
|
|
//" }\n"
|
|
|
|
//" };\n"
|
|
|
|
//"\n"
|
|
|
|
//" } // namespace baz\n"
|
|
|
|
//"\n"
|
|
|
|
//" } // namespace anon\n"
|
|
|
|
//"\n"
|
|
|
|
//" } // namespace nested\n"
|
|
|
|
//"\n"
|
|
|
|
// QTest::newRow("Namespace()
|
|
|
|
// {
|
|
|
|
// // This checks whether classes with "special" names are
|
|
|
|
// // properly displayed");
|
|
|
|
// "using namespace nested;\n"
|
|
|
|
// "MyFoo foo;\n"
|
|
|
|
// "MyBar bar;\n"
|
|
|
|
// "MyAnon anon;\n"
|
|
|
|
// "baz::MyBaz baz;\n"
|
|
|
|
// % CheckType("anon namespc::nested::(anonymous namespace)::MyAnon");
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("bar", "namespc::nested::MyBar");
|
2013-01-25 19:11:14 +01:00
|
|
|
// % CheckType("baz namespc::nested::(anonymous namespace)::baz::MyBaz");
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("foo", "namespc::nested::MyFoo");
|
2013-01-25 19:11:14 +01:00
|
|
|
// // Continue");
|
|
|
|
// // step into the doit() functions
|
|
|
|
|
|
|
|
// baz.doit(1);\n"
|
|
|
|
// anon.doit(1);\n"
|
|
|
|
// foo.doit(1);\n"
|
|
|
|
// bar.doit(1);\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
// unused();\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
// }
|
|
|
|
|
|
|
|
|
2013-02-01 17:35:16 +01:00
|
|
|
QTest::newRow("GccExtensions")
|
|
|
|
<< Data(
|
2013-02-05 01:47:07 +01:00
|
|
|
"char v[8] = { 1, 2 };\n"
|
|
|
|
"char w __attribute__ ((vector_size (8))) = { 1, 2 };\n"
|
|
|
|
"int y[2] = { 1, 2 };\n"
|
|
|
|
"int z __attribute__ ((vector_size (8))) = { 1, 2 };\n"
|
|
|
|
"unused(&v, &w, &y, &z);\n")
|
|
|
|
% Check("v.0", "[0]", "1", "char")
|
|
|
|
% Check("v.1", "[1]", "2", "char")
|
|
|
|
% Check("w.0", "[0]", "1", "char")
|
|
|
|
% Check("w.1", "[1]", "2", "char")
|
|
|
|
% Check("y.0", "[0]", "1", "int")
|
|
|
|
% Check("y.1", "[1]", "2", "int")
|
|
|
|
% Check("z.0", "[0]", "1", "int")
|
|
|
|
% Check("z.1", "[1]", "2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
|
2013-01-30 11:25:19 +01:00
|
|
|
QTest::newRow("Int")
|
|
|
|
<< Data("#include <qglobal.h>\n"
|
|
|
|
"#include <limits.h>\n"
|
|
|
|
"#include <QString>\n",
|
|
|
|
"quint64 u64 = ULLONG_MAX;\n"
|
|
|
|
"qint64 s64 = LLONG_MAX;\n"
|
|
|
|
"quint32 u32 = ULONG_MAX;\n"
|
|
|
|
"qint32 s32 = LONG_MAX;\n"
|
|
|
|
"quint64 u64s = 0;\n"
|
|
|
|
"qint64 s64s = LLONG_MIN;\n"
|
|
|
|
"quint32 u32s = 0;\n"
|
|
|
|
"qint32 s32s = LONG_MIN;\n"
|
|
|
|
"QString dummy; // needed to get namespace\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&u64, &s64, &u32, &s32, &u64s, &s64s, &u32s, &s32s, &dummy);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("u64", "18446744073709551615", "@quint64")
|
|
|
|
% Check("s64", "9223372036854775807", "@qint64")
|
|
|
|
% Check("u32", "4294967295", "@quint32")
|
|
|
|
% Check("s32", "2147483647", "@qint32")
|
|
|
|
% Check("u64s", "0", "@quint64")
|
|
|
|
% Check("s64s", "-9223372036854775808", "@qint64")
|
|
|
|
% Check("u32s", "0", "@quint32")
|
|
|
|
% Check("s32s", "-2147483648", "@qint32");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
2013-02-01 17:35:16 +01:00
|
|
|
QTest::newRow("Array1")
|
|
|
|
<< Data("double d[3][3];\n"
|
|
|
|
"for (int i = 0; i != 3; ++i)\n"
|
|
|
|
" for (int j = 0; j != 3; ++j)\n"
|
|
|
|
" d[i][j] = i + j;\n"
|
|
|
|
"unused(&d);\n")
|
|
|
|
% Check("d", Pointer(), "double [3][3]")
|
|
|
|
% Check("d.0", "[0]", Pointer(), "double [3]")
|
|
|
|
% Check("d.0.0", "[0]", "0", "double")
|
|
|
|
% Check("d.0.2", "[2]", "2", "double")
|
|
|
|
% Check("d.2", "[2]", Pointer(), "double [3]");
|
|
|
|
|
|
|
|
QTest::newRow("Array2")
|
2013-02-13 00:51:05 +01:00
|
|
|
<< Data("char c[20] = { 0 };\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"c[0] = 'a';\n"
|
|
|
|
"c[1] = 'b';\n"
|
|
|
|
"c[2] = 'c';\n"
|
|
|
|
"c[3] = 'd';\n"
|
|
|
|
"c[4] = 0;\n"
|
|
|
|
"unused(&c);\n")
|
2013-02-13 00:51:05 +01:00
|
|
|
% Check("c", "\"abcd" + QByteArray(16, 0) + '"', "char [20]")
|
2013-02-01 17:35:16 +01:00
|
|
|
% Check("c.0", "[0]", "97", "char")
|
|
|
|
% Check("c.3", "[3]", "100", "char");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
2013-02-01 16:30:15 +01:00
|
|
|
QTest::newRow("Array3")
|
|
|
|
<< Data("#include <QString>\n",
|
|
|
|
"QString b[20];\n"
|
|
|
|
"b[0] = \"a\";\n"
|
|
|
|
"b[1] = \"b\";\n"
|
|
|
|
"b[2] = \"c\";\n"
|
|
|
|
"b[3] = \"d\";\n")
|
|
|
|
% CheckType("b", "@QString [20]")
|
|
|
|
% Check("b.0", "[0]", "\"a\"", "@QString")
|
|
|
|
% Check("b.3", "[3]", "\"d\"", "@QString")
|
|
|
|
% Check("b.4", "[4]", "\"\"", "@QString")
|
|
|
|
% Check("b.19", "[19]", "\"\"", "@QString");
|
|
|
|
|
|
|
|
QTest::newRow("Array4")
|
|
|
|
<< Data("#include <QByteArray>\n",
|
|
|
|
"QByteArray b[20];\n"
|
|
|
|
"b[0] = \"a\";\n"
|
|
|
|
"b[1] = \"b\";\n"
|
|
|
|
"b[2] = \"c\";\n"
|
|
|
|
"b[3] = \"d\";\n")
|
|
|
|
% CheckType("b", "@QByteArray [20]")
|
|
|
|
% Check("b.0", "[0]", "\"a\"", "@QByteArray")
|
|
|
|
% Check("b.3", "[3]", "\"d\"", "@QByteArray")
|
|
|
|
% Check("b.4", "[4]", "\"\"", "@QByteArray")
|
|
|
|
% Check("b.19", "[19]", "\"\"", "@QByteArray");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
2013-01-30 11:25:19 +01:00
|
|
|
QTest::newRow("Array5")
|
|
|
|
<< Data(fooData,
|
|
|
|
"Foo foo[10];\n"
|
|
|
|
"for (int i = 0; i < 5; ++i)\n"
|
|
|
|
" foo[i].a = i;\n")
|
|
|
|
% CheckType("foo", "Foo [10]")
|
|
|
|
% Check("foo.0", "[0]", "", "Foo")
|
|
|
|
% Check("foo.9", "[9]", "", "Foo");
|
2013-01-28 17:15:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
QTest::newRow("Bitfields")
|
|
|
|
<< Data("struct S\n"
|
|
|
|
"{\n"
|
2013-01-30 11:25:19 +01:00
|
|
|
" S() : x(0), y(0), c(0), b(0), f(0), d(0), i(0) {}\n"
|
|
|
|
" unsigned int x : 1;\n"
|
|
|
|
" unsigned int y : 1;\n"
|
2013-01-28 17:15:49 +01:00
|
|
|
" bool c : 1;\n"
|
|
|
|
" bool b;\n"
|
|
|
|
" float f;\n"
|
|
|
|
" double d;\n"
|
|
|
|
" int i;\n"
|
2013-01-30 11:25:19 +01:00
|
|
|
"} s;\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&s);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("s", "", "S")
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("s.b", "false", "bool")
|
|
|
|
% Check("s.c", "false", "bool")
|
|
|
|
% Check("s.d", "0", "double")
|
|
|
|
% Check("s.f", "0", "float")
|
|
|
|
% Check("s.i", "0", "int")
|
|
|
|
% Check("s.x", "0", "unsigned int")
|
|
|
|
% Check("s.y", "0", "unsigned int");
|
2013-01-28 17:15:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
QTest::newRow("Function")
|
2013-01-30 11:25:19 +01:00
|
|
|
<< Data("#include <QByteArray>\n"
|
|
|
|
"struct Function\n"
|
|
|
|
"{\n"
|
|
|
|
" Function(QByteArray var, QByteArray f, double min, double max)\n"
|
|
|
|
" : var(var), f(f), min(min), max(max) {}\n"
|
|
|
|
" QByteArray var;\n"
|
|
|
|
" QByteArray f;\n"
|
|
|
|
" double min;\n"
|
|
|
|
" double max;\n"
|
|
|
|
"};\n",
|
|
|
|
"// In order to use this, switch on the 'qDump__Function' in dumper.py\n"
|
|
|
|
"Function func(\"x\", \"sin(x)\", 0, 1);\n"
|
|
|
|
"func.max = 10;\n"
|
|
|
|
"func.f = \"cos(x)\";\n"
|
|
|
|
"func.max = 4;\n"
|
|
|
|
"func.max = 5;\n"
|
|
|
|
"func.max = 6;\n"
|
|
|
|
"func.max = 7;\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-01-30 11:25:19 +01:00
|
|
|
% Check("func", "", "Function")
|
|
|
|
% Check("func.f", "sin(x)", "@QByteArray")
|
|
|
|
% Check("func.max", "1", "double")
|
|
|
|
% Check("func.min", "0", "double")
|
|
|
|
% Check("func.var", "\"x\"", "@QByteArray")
|
|
|
|
% Check("func", "", "Function")
|
|
|
|
% Check("func.f", "\"cos(x)\"", "@QByteArray")
|
|
|
|
% Check("func.max", "7", "double");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
// QTest::newRow("AlphabeticSorting")
|
|
|
|
// << Data(
|
|
|
|
// "// This checks whether alphabetic sorting of structure\n"
|
|
|
|
// "// members work");\n"
|
|
|
|
// "struct Color\n"
|
|
|
|
// "{\n"
|
|
|
|
// " int r,g,b,a;\n"
|
|
|
|
// " Color() { r = 1, g = 2, b = 3, a = 4; }\n"
|
|
|
|
// "};\n"
|
|
|
|
// " Color c;\n"
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("c", "basic::Color");
|
|
|
|
// % Check("c.a", "4", "int");
|
|
|
|
// % Check("c.b", "3", "int");
|
|
|
|
// % Check("c.g", "2", "int");
|
|
|
|
// % Check("c.r", "1", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
// // Manual: Toogle "Sort Member Alphabetically" in context menu
|
|
|
|
// // Manual: of "Locals and Expressions" view");
|
|
|
|
// // Manual: Check that order of displayed members changes");
|
|
|
|
|
|
|
|
// QTest::newRow("Typedef")
|
|
|
|
// << Data(
|
|
|
|
// "namespace ns {\n"
|
|
|
|
// " typedef unsigned long long vl;\n"
|
|
|
|
// " typedef vl verylong;\n"
|
|
|
|
// "}\n"
|
|
|
|
|
|
|
|
// "typedef quint32 myType1;\n"
|
|
|
|
// "typedef unsigned int myType2;\n"
|
|
|
|
// "myType1 t1 = 0;\n"
|
|
|
|
// "myType2 t2 = 0;\n"
|
|
|
|
// "ns::vl j = 1000;\n"
|
|
|
|
// "ns::verylong k = 1000;\n"
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("j", "1000", "basic::ns::vl");
|
|
|
|
// % Check("k", "1000", "basic::ns::verylong");
|
|
|
|
// % Check("t1", "0", "basic::myType1");
|
|
|
|
// % Check("t2", "0", "basic::myType2");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
2013-06-18 15:09:10 +02:00
|
|
|
QTest::newRow("Struct")
|
2013-06-20 12:24:37 +02:00
|
|
|
<< Data(fooData, "Foo f(3);\n")
|
2013-06-18 15:09:10 +02:00
|
|
|
% Check("f", "", "Foo")
|
2013-06-20 12:24:37 +02:00
|
|
|
% Check("f.a", "3", "int")
|
|
|
|
% Check("f.b", "2", "int");
|
2013-06-18 15:09:10 +02:00
|
|
|
|
|
|
|
QTest::newRow("Union")
|
|
|
|
<< Data("union U { int a; int b; };", "U u;")
|
|
|
|
% Check("u", "", "U")
|
|
|
|
% CheckType("u.a", "int")
|
|
|
|
% CheckType("u.b", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
// QTest::newRow("TypeFormats")
|
|
|
|
// << Data(
|
|
|
|
// "// These tests should result in properly displayed umlauts in the\n"
|
|
|
|
// "// Locals and Expressions view. It is only support on gdb with Python");\n"
|
|
|
|
// "const char *s = "aöa";\n"
|
|
|
|
// "const wchar_t *w = L"aöa";\n"
|
|
|
|
// "QString u;\n"
|
|
|
|
// "// All: Select UTF-8 in "Change Format for Type" in L&W context menu");\n"
|
|
|
|
// "// Windows: Select UTF-16 in "Change Format for Type" in L&W context menu");\n"
|
|
|
|
// "// Other: Select UCS-6 in "Change Format for Type" in L&W context menu");\n"
|
|
|
|
// "if (sizeof(wchar_t) == 4)\n"
|
|
|
|
// " u = QString::fromUcs4((uint *)w);\n"
|
|
|
|
// "else\n"
|
|
|
|
// " u = QString::fromUtf16((ushort *)w);\n"
|
|
|
|
// % CheckType("s char *");
|
|
|
|
// % Check("u "" QString");
|
|
|
|
// % CheckType("w wchar_t *");
|
|
|
|
|
|
|
|
|
2013-02-01 16:30:15 +01:00
|
|
|
QTest::newRow("Pointer")
|
|
|
|
<< Data(fooData,
|
|
|
|
"Foo *f = new Foo();\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&f);\n")
|
2013-02-01 16:30:15 +01:00
|
|
|
% Check("f", Pointer(), "Foo")
|
|
|
|
% Check("f.a", "0", "int")
|
|
|
|
% Check("f.b", "2", "int");
|
|
|
|
|
|
|
|
QTest::newRow("PointerTypedef")
|
|
|
|
<< Data("typedef void *VoidPtr;\n"
|
|
|
|
"typedef const void *CVoidPtr;\n"
|
|
|
|
"struct A {};\n",
|
|
|
|
"A a;\n"
|
|
|
|
"VoidPtr p = &a;\n"
|
|
|
|
"CVoidPtr cp = &a;\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&a, &p, &cp);\n")
|
2013-02-01 16:30:15 +01:00
|
|
|
% Check("a", "", "A")
|
|
|
|
% Check("cp", Pointer(), "CVoidPtr")
|
|
|
|
% Check("p", Pointer(), "VoidPtr");
|
|
|
|
|
|
|
|
QTest::newRow("Reference1")
|
|
|
|
<< Data("int a = 43;\n"
|
|
|
|
"const int &b = a;\n"
|
|
|
|
"typedef int &Ref;\n"
|
|
|
|
"const int c = 44;\n"
|
|
|
|
"const Ref d = a;\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&a, &b, &c, &d);\n")
|
2013-02-01 16:30:15 +01:00
|
|
|
% Check("a", "43", "int")
|
|
|
|
% Check("b", "43", "int &")
|
|
|
|
% Check("c", "44", "int")
|
|
|
|
% Check("d", "43", "Ref");
|
|
|
|
|
|
|
|
QTest::newRow("Reference2")
|
|
|
|
<< Data("#include <QString>\n"
|
|
|
|
"QString fooxx() { return \"bababa\"; }\n",
|
|
|
|
"QString a = \"hello\";\n"
|
|
|
|
"const QString &b = fooxx();\n"
|
|
|
|
"typedef QString &Ref;\n"
|
|
|
|
"const QString c = \"world\";\n"
|
|
|
|
"const Ref d = a;\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&a, &b, &c, &d);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-01 16:30:15 +01:00
|
|
|
% Check("a", "\"hello\"", "@QString")
|
|
|
|
% Check("b", "\"bababa\"", "@QString &")
|
|
|
|
% Check("c", "\"world\"", "@QString")
|
|
|
|
% Check("d", "\"hello\"", "Ref");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
2013-01-28 17:15:49 +01:00
|
|
|
QTest::newRow("Reference3")
|
|
|
|
<< Data("#include <QString>\n",
|
2013-02-01 16:30:15 +01:00
|
|
|
"QString a = QLatin1String(\"hello\");\n"
|
2013-01-28 17:15:49 +01:00
|
|
|
"const QString &b = a;\n"
|
|
|
|
"typedef QString &Ref;\n"
|
2013-02-01 16:30:15 +01:00
|
|
|
"const Ref d = const_cast<Ref>(a);\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&a, &b, &d);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-01 16:30:15 +01:00
|
|
|
% Check("a", "\"hello\"", "@QString")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("b", "\"hello\"", "@QString &")
|
|
|
|
% Check("d", "\"hello\"", "Ref");
|
|
|
|
|
|
|
|
QTest::newRow("DynamicReference")
|
2013-02-01 16:30:15 +01:00
|
|
|
<< Data("struct BaseClass { virtual ~BaseClass() {} };\n"
|
2013-02-12 18:15:21 +01:00
|
|
|
"struct DerivedClass : BaseClass {};\n",
|
2013-02-01 16:30:15 +01:00
|
|
|
"DerivedClass d;\n"
|
2013-01-28 17:15:49 +01:00
|
|
|
"BaseClass *b1 = &d;\n"
|
2013-01-30 11:25:19 +01:00
|
|
|
"BaseClass &b2 = d;\n"
|
2013-02-12 18:15:21 +01:00
|
|
|
"unused(&d, &b1, &b2);\n")
|
|
|
|
% CheckType("b1", "DerivedClass") // autoderef
|
2013-01-28 17:15:49 +01:00
|
|
|
% CheckType("b2", "DerivedClass &");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
2013-06-18 15:09:10 +02:00
|
|
|
QTest::newRow("LongEvaluation1")
|
|
|
|
<< Data("#include <QDateTime>",
|
|
|
|
"QDateTime time = QDateTime::currentDateTime();\n"
|
|
|
|
"const int N = 10000;\n"
|
|
|
|
"QDateTime bigv[N];\n"
|
|
|
|
"for (int i = 0; i < 10000; ++i) {\n"
|
|
|
|
" bigv[i] = time;\n"
|
|
|
|
" time = time.addDays(1);\n"
|
|
|
|
"}\n")
|
|
|
|
% Check("N", "10000", "int")
|
|
|
|
% CheckType("bigv", "@QDateTime [10000]")
|
|
|
|
% CheckType("bigv.0", "[0]", "@QDateTime")
|
|
|
|
% CheckType("bigv.9999", "[9999]", "@QDateTime");
|
|
|
|
|
|
|
|
QTest::newRow("LongEvaluation2")
|
|
|
|
<< Data("const int N = 10000;\n"
|
|
|
|
"int bigv[N];\n"
|
|
|
|
"for (int i = 0; i < 10000; ++i)\n"
|
|
|
|
" bigv[i] = i;\n")
|
|
|
|
% Check("N", "10000", "int")
|
|
|
|
% CheckType("bigv", "int [10000]")
|
|
|
|
% Check("bigv.0", "[0]", "0", "int")
|
|
|
|
% Check("bigv.9999", "[9999]", "9999", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
// QTest::newRow("Fork")
|
|
|
|
// << Data(
|
|
|
|
// "QProcess proc;\n"
|
|
|
|
// "proc.start("/bin/ls");\n"
|
|
|
|
// "proc.waitForFinished();\n"
|
|
|
|
// "QByteArray ba = proc.readAllStandardError();\n"
|
|
|
|
// "ba.append('x');\n"
|
|
|
|
// % Check("ba "x" QByteArray");
|
|
|
|
// % Check("proc QProcess");
|
|
|
|
|
|
|
|
|
2013-06-18 15:09:10 +02:00
|
|
|
QTest::newRow("FunctionPointer")
|
|
|
|
<< Data("int testFunctionPointerHelper(int x) { return x; }\n"
|
|
|
|
"typedef int (*func_t)(int);\n",
|
|
|
|
"func_t f = testFunctionPointerHelper;\n"
|
|
|
|
"int a = f(43);\n")
|
|
|
|
% CheckType("f", "func_t");
|
|
|
|
|
|
|
|
|
|
|
|
QByteArray dataClass = "struct Class\n"
|
|
|
|
"{\n"
|
|
|
|
" Class() : a(34) {}\n"
|
|
|
|
" int testFunctionPointerHelper(int x) { return x; }\n"
|
|
|
|
" int a;\n"
|
|
|
|
"};\n";
|
|
|
|
|
|
|
|
QTest::newRow("MemberFunctionPointer")
|
|
|
|
<< Data(dataClass + "Class x;\n"
|
|
|
|
"typedef int (Class::*func_t)(int);\n",
|
|
|
|
"func_t f = &Class::testFunctionPointerHelper;\n"
|
|
|
|
"int a = (x.*f)(43);\n")
|
|
|
|
% CheckType("f", "func_t");
|
|
|
|
|
|
|
|
|
|
|
|
QTest::newRow("MemberPointer")
|
|
|
|
<< Data(dataClass + "Class x;\n"
|
|
|
|
"typedef int (Class::*member_t);\n",
|
|
|
|
"member_t m = &Class::a;\n"
|
|
|
|
"int a = x.*m;\n")
|
|
|
|
% CheckType("m", "member_t");
|
|
|
|
|
|
|
|
// QTest::newRow("PassByReferenceHelper")
|
|
|
|
// << Data(fooData
|
|
|
|
// (Foo &f)
|
|
|
|
// % CheckType("f Foo &");\n"
|
|
|
|
// % Check("f.a", "12", "int");\n"
|
|
|
|
// // Continue");\n"
|
|
|
|
// ++f.a;\n"
|
|
|
|
// % CheckType("f Foo &");\n"
|
|
|
|
// % Check("f.a", "13", "int");\n"
|
|
|
|
|
|
|
|
// QTest::newRow("PassByReference")
|
|
|
|
// << Data(
|
|
|
|
// "Foo f(12);\n"
|
|
|
|
// "testPassByReferenceHelper(f);\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
|
2013-02-01 17:35:16 +01:00
|
|
|
QTest::newRow("BigInt")
|
|
|
|
<< Data("#include <QString>\n"
|
|
|
|
"#include <limits>\n",
|
|
|
|
"qint64 a = Q_INT64_C(0xF020304050607080);\n"
|
|
|
|
"quint64 b = Q_UINT64_C(0xF020304050607080);\n"
|
|
|
|
"quint64 c = std::numeric_limits<quint64>::max() - quint64(1);\n"
|
|
|
|
"qint64 d = c;\n"
|
|
|
|
"QString dummy;\n"
|
|
|
|
"unused(&a, &b, &c, &d, &dummy);\n")
|
|
|
|
% Check("a", "-1143861252567568256", "@qint64")
|
|
|
|
% Check("b", "17302882821141983360", "@quint64")
|
|
|
|
% Check("c", "18446744073709551614", "@quint64")
|
|
|
|
% Check("d", "-2", "@qint64");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
2013-02-01 17:35:16 +01:00
|
|
|
QTest::newRow("Hidden")
|
|
|
|
<< Data("#include <QString>\n",
|
|
|
|
"int n = 1;\n"
|
|
|
|
"{\n"
|
|
|
|
" QString n = \"2\";\n"
|
|
|
|
" {\n"
|
|
|
|
" double n = 3.5;\n"
|
|
|
|
" breakHere();\n"
|
|
|
|
" unused(&n);\n"
|
|
|
|
" }\n"
|
|
|
|
" unused(&n);\n"
|
|
|
|
"}\n"
|
|
|
|
"unused(&n);\n")
|
2013-02-05 01:47:07 +01:00
|
|
|
% CoreProfile()
|
2013-02-01 17:35:16 +01:00
|
|
|
% Check("n", "3.5", "double")
|
|
|
|
% Check("n@1", "\"2\"", "@QString")
|
|
|
|
% Check("n@2", "1", "int");
|
|
|
|
|
|
|
|
|
2013-06-04 16:15:56 +02:00
|
|
|
const Data rvalueData = Data(
|
|
|
|
"#include <utility>\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"struct X { X() : a(2), b(3) {} int a, b; };\n"
|
|
|
|
"X testRValueReferenceHelper1() { return X(); }\n"
|
|
|
|
"X testRValueReferenceHelper2(X &&x) { return x; }\n",
|
|
|
|
"X &&x1 = testRValueReferenceHelper1();\n"
|
|
|
|
"X &&x2 = testRValueReferenceHelper2(std::move(x1));\n"
|
|
|
|
"X &&x3 = testRValueReferenceHelper2(testRValueReferenceHelper1());\n"
|
|
|
|
"X y1 = testRValueReferenceHelper1();\n"
|
|
|
|
"X y2 = testRValueReferenceHelper2(std::move(y1));\n"
|
|
|
|
"X y3 = testRValueReferenceHelper2(testRValueReferenceHelper1());\n"
|
|
|
|
"unused(&x1, &x2, &x3, &y1, &y2, &y3);\n")
|
|
|
|
% Cxx11Profile()
|
|
|
|
% Check("y1", "", "X")
|
|
|
|
% Check("y2", "", "X")
|
|
|
|
% Check("y3", "", "X");
|
|
|
|
|
2013-06-04 16:15:56 +02:00
|
|
|
QTest::newRow("RValueReferenceGdb")
|
|
|
|
<< Data(rvalueData)
|
|
|
|
% GdbOnly()
|
|
|
|
% Check("x1", "", "X &")
|
|
|
|
% Check("x2", "", "X &")
|
|
|
|
% Check("x3", "", "X &");
|
|
|
|
|
|
|
|
QTest::newRow("RValueReferenceLldb")
|
|
|
|
<< Data(rvalueData)
|
|
|
|
% LldbOnly()
|
|
|
|
% Check("x1", "", "X &&")
|
|
|
|
% Check("x2", "", "X &&")
|
|
|
|
% Check("x3", "", "X &&");
|
|
|
|
|
2013-02-01 17:35:16 +01:00
|
|
|
QTest::newRow("SSE")
|
|
|
|
<< Data("#include <xmmintrin.h>\n"
|
|
|
|
"#include <stddef.h>\n",
|
|
|
|
"float a[4];\n"
|
|
|
|
"float b[4];\n"
|
|
|
|
"int i;\n"
|
|
|
|
"for (i = 0; i < 4; i++) {\n"
|
|
|
|
" a[i] = 2 * i;\n"
|
|
|
|
" b[i] = 2 * i;\n"
|
|
|
|
"}\n"
|
|
|
|
"__m128 sseA, sseB;\n"
|
|
|
|
"sseA = _mm_loadu_ps(a);\n"
|
|
|
|
"sseB = _mm_loadu_ps(b);\n"
|
|
|
|
"unused(&i, &sseA, &sseB);\n")
|
|
|
|
% Profile("QMAKE_CXXFLAGS += -msse2")
|
|
|
|
% Check("sseA", "", "__m128")
|
|
|
|
% Check("sseB", "", "__m128");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
|
2013-06-18 15:09:10 +02:00
|
|
|
QTest::newRow("BoostOptional1")
|
|
|
|
<< Data("#include <boost/optional.hpp>\n",
|
|
|
|
"boost::optional<int> i0, i1;\n"
|
2013-06-20 15:42:58 +02:00
|
|
|
"i1 = 1;\n"
|
|
|
|
"unused(&i0, &i1);\n")
|
2013-06-18 15:09:10 +02:00
|
|
|
% Check("i0", "<uninitialized>", "boost::optional<int>")
|
|
|
|
% Check("i1", "1", "boost::optional<int>");
|
|
|
|
|
|
|
|
QTest::newRow("BoostOptional2")
|
|
|
|
<< Data("#include <QStringList>\n"
|
|
|
|
"#include <boost/optional.hpp>\n",
|
|
|
|
"boost::optional<QStringList> sl0, sl;\n"
|
|
|
|
"sl = (QStringList() << \"xxx\" << \"yyy\");\n"
|
|
|
|
"sl.get().append(\"zzz\");\n")
|
2013-07-01 14:29:00 +02:00
|
|
|
% Check("sl", "<3 items>", "boost::optional<@QStringList>");
|
2013-06-18 15:09:10 +02:00
|
|
|
|
|
|
|
QTest::newRow("BoostSharedPtr")
|
|
|
|
<< Data("#include <QStringList>\n"
|
|
|
|
"#include <boost/shared_ptr.hpp>\n",
|
|
|
|
"boost::shared_ptr<int> s;\n"
|
|
|
|
"boost::shared_ptr<int> i(new int(43));\n"
|
|
|
|
"boost::shared_ptr<int> j = i;\n"
|
|
|
|
"boost::shared_ptr<QStringList> sl(new QStringList(QStringList() << \"HUH!\"));\n")
|
|
|
|
% Check("s", "(null)", "boost::shared_ptr<int>")
|
|
|
|
% Check("i", "43", "boost::shared_ptr<int>")
|
|
|
|
% Check("j", "43", "boost::shared_ptr<int>")
|
|
|
|
% Check("sl", "", " boost::shared_ptr<@QStringList>")
|
|
|
|
% Check("sl.data", "<1 items>", "@QStringList");
|
|
|
|
|
|
|
|
QTest::newRow("BoostGregorianDate")
|
|
|
|
<< Data("#include <boost/date_time.hpp>\n"
|
|
|
|
"#include <boost/date_time/gregorian/gregorian.hpp>\n",
|
|
|
|
"using namespace boost;\n"
|
|
|
|
"using namespace gregorian;\n"
|
|
|
|
"date d(2005, Nov, 29);\n"
|
|
|
|
"date d0 = d;\n"
|
|
|
|
"date d1 = d += months(1);\n"
|
|
|
|
"date d2 = d += months(1);\n"
|
|
|
|
"// snap-to-end-of-month behavior kicks in:\n"
|
|
|
|
"date d3 = d += months(1);\n"
|
|
|
|
"// Also end of the month (expected in boost)\n"
|
|
|
|
"date d4 = d += months(1);\n"
|
|
|
|
"// Not where we started (expected in boost)\n"
|
|
|
|
"date d5 = d -= months(4);\n")
|
|
|
|
% Check("d0", "Tue Nov 29 2005", "boost::gregorian::date")
|
|
|
|
% Check("d1", "Thu Dec 29 2005", "boost::gregorian::date")
|
|
|
|
% Check("d2", "Sun Jan 29 2006", "boost::gregorian::date")
|
|
|
|
% Check("d3", "Tue Feb 28 2006", "boost::gregorian::date")
|
|
|
|
% Check("d4", "Fri Mar 31 2006", "boost::gregorian::date")
|
|
|
|
% Check("d5", "Wed Nov 30 2005", "boost::gregorian::date");
|
|
|
|
|
|
|
|
QTest::newRow("BoostPosixTimeTimeDuration")
|
|
|
|
<< Data("#include <boost/date_time.hpp>\n"
|
|
|
|
"#include <boost/date_time/gregorian/gregorian.hpp>\n"
|
|
|
|
"#include <boost/date_time/posix_time/posix_time.hpp>\n",
|
|
|
|
"using namespace boost;\n"
|
|
|
|
"using namespace posix_time;\n"
|
|
|
|
"time_duration d1(1, 0, 0);\n"
|
|
|
|
"time_duration d2(0, 1, 0);\n"
|
|
|
|
"time_duration d3(0, 0, 1);\n")
|
|
|
|
% Check("d1", "01:00:00", "boost::posix_time::time_duration")
|
|
|
|
% Check("d2", "00:01:00", "boost::posix_time::time_duration")
|
|
|
|
% Check("d3", "00:00:01", "boost::posix_time::time_duration");
|
|
|
|
|
|
|
|
QTest::newRow("BoostBimap")
|
|
|
|
<< Data("#include <boost/bimap.hpp>\n",
|
|
|
|
"typedef boost::bimap<int, int> B;\n"
|
|
|
|
"B b;\n"
|
|
|
|
"b.left.insert(B::left_value_type(1, 2));\n"
|
|
|
|
"B::left_const_iterator it = b.left.begin();\n"
|
|
|
|
"int l = it->first;\n"
|
|
|
|
"int r = it->second;\n")
|
|
|
|
% Check("b", "<1 items>", "B");
|
|
|
|
|
|
|
|
QTest::newRow("BoostPosixTimePtime")
|
|
|
|
<< Data("#include <boost/date_time.hpp>\n"
|
|
|
|
"#include <boost/date_time/gregorian/gregorian.hpp>\n"
|
|
|
|
"#include <boost/date_time/posix_time/posix_time.hpp>\n"
|
|
|
|
"using namespace boost;\n"
|
|
|
|
"using namespace gregorian;\n"
|
|
|
|
"using namespace posix_time;\n",
|
|
|
|
"ptime p1(date(2002, 1, 10), time_duration(1, 0, 0));\n"
|
|
|
|
"ptime p2(date(2002, 1, 10), time_duration(0, 0, 0));\n"
|
|
|
|
"ptime p3(date(1970, 1, 1), time_duration(0, 0, 0));\n")
|
|
|
|
% Check("p1", "Thu Jan 10 01:00:00 2002", "boost::posix_time::ptime")
|
|
|
|
% Check("p2", "Thu Jan 10 00:00:00 2002", "boost::posix_time::ptime")
|
|
|
|
% Check("p3", "Thu Jan 1 00:00:00 1970", "boost::posix_time::ptime");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // This tests qdump__KRBase in dumpers/qttypes.py which uses
|
|
|
|
// // a static typeflag to dispatch to subclasses");
|
|
|
|
|
|
|
|
// QTest::newRow("KR")
|
|
|
|
// << Data(
|
|
|
|
// "namespace kr {\n"
|
|
|
|
//\n"
|
|
|
|
// " // FIXME: put in namespace kr, adjust qdump__KRBase in dumpers/qttypes.py\n"
|
|
|
|
// " struct KRBase\n"
|
|
|
|
// " {\n"
|
|
|
|
// " enum Type { TYPE_A, TYPE_B } type;\n"
|
|
|
|
// " KRBase(Type _type) : type(_type) {}\n"
|
|
|
|
// " };\n"
|
|
|
|
//\n"
|
|
|
|
// " struct KRA : KRBase { int x; int y; KRA():KRBase(TYPE_A), x(1), y(32) {} };\n"
|
|
|
|
// " struct KRB : KRBase { KRB():KRBase(TYPE_B) {} };\n"
|
|
|
|
|
|
|
|
// "/} // namespace kr\n"
|
|
|
|
|
|
|
|
// "KRBase *ptr1 = new KRA;\n"
|
|
|
|
// "KRBase *ptr2 = new KRB;\n"
|
|
|
|
// "ptr2 = new KRB;\n"
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("ptr1", "KRBase");
|
2013-01-25 19:11:14 +01:00
|
|
|
// % Check("ptr1.type KRBase::TYPE_A (0) KRBase::Type");
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("ptr2", "KRBase");
|
2013-01-25 19:11:14 +01:00
|
|
|
// % Check("ptr2.type KRBase::TYPE_B (1) KRBase::Type");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// QTest::newRow("Eigen")
|
|
|
|
// << Data(
|
|
|
|
// "using namespace Eigen;\n"
|
|
|
|
|
|
|
|
// "Vector3d test = Vector3d::Zero();\n"
|
|
|
|
|
|
|
|
// "Matrix3d myMatrix = Matrix3d::Constant(5);\n"
|
|
|
|
// "MatrixXd myDynamicMatrix(30, 10);\n"
|
|
|
|
|
|
|
|
// "myDynamicMatrix(0, 0) = 0;\n"
|
|
|
|
// "myDynamicMatrix(1, 0) = 1;\n"
|
|
|
|
// "myDynamicMatrix(2, 0) = 2;\n"
|
|
|
|
|
|
|
|
// "Matrix<double, 12, 15, ColMajor> colMajorMatrix;\n"
|
|
|
|
// "Matrix<double, 12, 15, RowMajor> rowMajorMatrix;\n"
|
|
|
|
|
|
|
|
// "int k = 0;\n"
|
|
|
|
// "for (int i = 0; i != 12; ++i) {\n"
|
|
|
|
// " for (int j = 0; j != 15; ++j) {\n"
|
|
|
|
// " colMajorMatrix(i, j) = k;\n"
|
|
|
|
// " rowMajorMatrix(i, j) = k;\n"
|
|
|
|
// " ++k;\n"
|
|
|
|
// " }\n"
|
|
|
|
// "}\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// QTest::newRow("https://bugreports.qt-project.org/browse/QTCREATORBUG-3611")
|
|
|
|
// "typedef unsigned char byte;\n"
|
|
|
|
// "byte f = '2';\n"
|
|
|
|
// "int *x = (int*)&f;\n"
|
|
|
|
// % Check("f 50 '2' bug3611::byte");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// QTest::newRow("https://bugreports.qt-project.org/browse/QTCREATORBUG-4904")
|
|
|
|
// << Data(
|
|
|
|
|
|
|
|
// "struct CustomStruct {\n"
|
|
|
|
// " int id;\n"
|
|
|
|
// " double dvalue;\n"
|
|
|
|
// "};",
|
|
|
|
// "QMap<int, CustomStruct> map;\n"
|
|
|
|
// "CustomStruct cs1;\n"
|
|
|
|
// "cs1.id = 1;\n"
|
|
|
|
// "cs1.dvalue = 3.14;\n"
|
|
|
|
// "CustomStruct cs2 = cs1;\n"
|
|
|
|
// "cs2.id = -1;\n"
|
|
|
|
// "map.insert(cs1.id, cs1);\n"
|
|
|
|
// "map.insert(cs2.id, cs2);\n"
|
|
|
|
// "QMap<int, CustomStruct>::iterator it = map.begin();\n"
|
|
|
|
// % Check("map <2 items> QMap<int, bug4904::CustomStruct>");
|
|
|
|
// % Check("map.0 QMapNode<int, bug4904::CustomStruct>");
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("map.0.key", "-1", "int");
|
|
|
|
// % Check("map.0.value", "bug4904::CustomStruct");
|
|
|
|
// % Check("map.0.value.dvalue", "3.1400000000000001", "double");
|
|
|
|
// % Check("map.0.value.id", "-1", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
// QTest::newRow("// https://bugreports.qt-project.org/browse/QTCREATORBUG-5106")
|
|
|
|
// << Data(
|
|
|
|
// "class A5106\n"
|
|
|
|
// "{\n"
|
|
|
|
// "public:\n"
|
|
|
|
// " A5106(int a, int b) : m_a(a), m_b(b) {}\n"
|
|
|
|
// " virtual int test() { return 5; }\n"
|
|
|
|
// "private:\n"
|
|
|
|
// " int m_a, m_b;\n"
|
|
|
|
// "};\n"
|
|
|
|
|
|
|
|
// "class B5106 : public A5106\n"
|
|
|
|
// "{\n"
|
|
|
|
// "public:\n"
|
|
|
|
// " B5106(int c, int a, int b) : A5106(a, b), m_c(c) {}\n"
|
|
|
|
// " virtual int test() { return 4; BREAK_HERE; }\n"
|
|
|
|
// "private:\n"
|
|
|
|
// " int m_c;\n"
|
|
|
|
// "};\n"
|
|
|
|
// ,
|
|
|
|
// " B5106 b(1,2,3);\n"
|
|
|
|
// " b.test();\n"
|
|
|
|
// " b.A5106::test();\n"
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// // https://bugreports.qt-project.org/browse/QTCREATORBUG-5184
|
|
|
|
|
|
|
|
// // Note: The report there shows type field "QUrl &" instead of QUrl");
|
|
|
|
// // It's unclear how this can happen. It should never have been like
|
|
|
|
// // that with a stock 7.2 and any version of Creator");
|
|
|
|
|
|
|
|
// void helper(const QUrl &url)\n"
|
|
|
|
// {\n"
|
|
|
|
// QNetworkRequest request(url);\n"
|
|
|
|
// QList<QByteArray> raw = request.rawHeaderList();\n"
|
|
|
|
// % Check("raw <0 items> QList<QByteArray>");
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("request", "QNetworkRequest");
|
2013-01-25 19:11:14 +01:00
|
|
|
// % Check("url "http://127.0.0.1/" QUrl &");
|
|
|
|
// }
|
|
|
|
|
|
|
|
// QTest::newRow("5184()
|
|
|
|
// {
|
|
|
|
// QUrl url(QString("http://127.0.0.1/"));\n"
|
|
|
|
// helper(url);\n"
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
//namespace qc42170 {
|
|
|
|
|
|
|
|
// // http://www.qtcentre.org/threads/42170-How-to-watch-data-of-actual-type-in-debugger
|
|
|
|
|
|
|
|
// struct Object
|
|
|
|
// {
|
|
|
|
// Object(int id_) : id(id_) {}
|
|
|
|
// virtual ~Object() {}
|
|
|
|
// int id;
|
|
|
|
// };
|
|
|
|
|
|
|
|
// struct Point : Object
|
|
|
|
// {
|
|
|
|
// Point(double x_, double y_) : Object(1), x(x_), y(y_) {}
|
|
|
|
// double x, y;
|
|
|
|
// };
|
|
|
|
|
|
|
|
// struct Circle : Point
|
|
|
|
// {
|
|
|
|
// Circle(double x_, double y_, double r_) : Point(x_, y_), r(r_) { id = 2; }
|
|
|
|
// double r;
|
|
|
|
// };
|
|
|
|
|
|
|
|
// void helper(Object *obj)
|
|
|
|
// {
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("obj", "qc42170::Circle");
|
2013-01-25 19:11:14 +01:00
|
|
|
// // Continue");
|
|
|
|
|
|
|
|
// % Check("that obj is shown as a 'Circle' object");
|
2013-02-01 17:35:16 +01:00
|
|
|
// unused(obj);
|
2013-01-25 19:11:14 +01:00
|
|
|
// }
|
|
|
|
|
|
|
|
// QTest::newRow("42170")
|
|
|
|
// << Data(
|
|
|
|
// {
|
|
|
|
// Circle *circle = new Circle(1.5, -2.5, 3.0);
|
|
|
|
// Object *obj = circle;
|
|
|
|
// helper(circle);
|
|
|
|
// helper(obj);
|
|
|
|
// }
|
|
|
|
|
|
|
|
//} // namespace qc42170
|
|
|
|
|
|
|
|
|
|
|
|
//namespace bug5799 {
|
|
|
|
|
|
|
|
// // https://bugreports.qt-project.org/browse/QTCREATORBUG-5799
|
|
|
|
|
|
|
|
// QTest::newRow("5799()
|
|
|
|
// "typedef struct { int m1; int m2; } S1;\n"
|
|
|
|
// "struct S2 : S1 { };\n"
|
|
|
|
// "typedef struct S3 { int m1; int m2; } S3;\n"
|
|
|
|
// "struct S4 : S3 { };\n"
|
|
|
|
|
|
|
|
// "S2 s2;\n"
|
|
|
|
// "s2.m1 = 5;\n"
|
|
|
|
// "S4 s4;\n"
|
|
|
|
// "s4.m1 = 5;\n"
|
|
|
|
// "S1 a1[10];\n"
|
|
|
|
// "typedef S1 Array[10];\n"
|
|
|
|
// "Array a2;\n"
|
|
|
|
// % CheckType("a1 bug5799::S1 [10]");
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("a2", "bug5799::Array");
|
|
|
|
// % Check("s2", "bug5799::S2");
|
|
|
|
// % Check("s2.@1", "bug5799::S1");
|
|
|
|
// % Check("s2.@1.m1", "5", "int");
|
|
|
|
// % Check("s2.@1.m2", "int");
|
|
|
|
// % Check("s4", "bug5799::S4");
|
|
|
|
// % Check("s4.@1", "bug5799::S3");
|
|
|
|
// % Check("s4.@1.m1", "5", "int");
|
|
|
|
// % Check("s4.@1.m2", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
// // http://www.qtcentre.org/threads/41700-How-to-watch-STL-containers-iterators-during-debugging
|
|
|
|
|
|
|
|
// QTest::newRow("41700")
|
|
|
|
// << Data(
|
|
|
|
// {
|
|
|
|
// "using namespace std;\n"
|
|
|
|
// "typedef map<string, list<string> > map_t;\n"
|
|
|
|
// "map_t m;\n"
|
|
|
|
// "m["one"].push_back("a");\n"
|
|
|
|
// "m["one"].push_back("b");\n"
|
|
|
|
// "m["one"].push_back("c");\n"
|
|
|
|
// "m["two"].push_back("1");\n"
|
|
|
|
// "m["two"].push_back("2");\n"
|
|
|
|
// "m["two"].push_back("3");\n"
|
|
|
|
// "map_t::const_iterator it = m.begin();
|
|
|
|
// % Check("m <2 items> qc41700::map_t");
|
|
|
|
// % Check("m.0 std::pair<std::string const, std::list<std::string>>");
|
|
|
|
// % Check("m.0.first "one" std::string");
|
|
|
|
// % Check("m.0.second <3 items> std::list<std::string>");
|
|
|
|
// % Check("m.0.second.0 "a" std::string");
|
|
|
|
// % Check("m.0.second.1 "b" std::string");
|
|
|
|
// % Check("m.0.second.2 "c" std::string");
|
|
|
|
// % Check("m.1 std::pair<std::string const, std::list<std::string>>");
|
|
|
|
// % Check("m.1.first "two" std::string");
|
|
|
|
// % Check("m.1.second <3 items> std::list<std::string>");
|
|
|
|
// % Check("m.1.second.0 "1" std::string");
|
|
|
|
// % Check("m.1.second.1 "2" std::string");
|
|
|
|
// % Check("m.1.second.2 "3" std::string");
|
|
|
|
|
|
|
|
|
|
|
|
// QTest::newRow("42895()
|
|
|
|
// "void g(int c, int d)\n"
|
|
|
|
// "{\n"
|
|
|
|
// "qDebug() << c << d;\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
// "breakHere()"\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
//\n"
|
|
|
|
// "void f(int a, int b)\n"
|
|
|
|
// "{\n"
|
|
|
|
// " g(a, b);\n"
|
|
|
|
// "}\n"
|
|
|
|
|
|
|
|
// " f(3, 4);\n"
|
|
|
|
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("c", "3", "int");
|
|
|
|
// % Check("d", "4", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
// % Check("there are frames for g and f in the stack view");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // https://bugreports.qt-project.org/browse/QTCREATORBUG-6465
|
|
|
|
|
|
|
|
// QTest::newRow("6465()\n"
|
|
|
|
// {\n"
|
|
|
|
// typedef char Foo[20];\n"
|
|
|
|
// Foo foo = "foo";\n"
|
|
|
|
// char bar[20] = "baz";
|
|
|
|
|
|
|
|
//namespace bug6857 {
|
|
|
|
|
|
|
|
// class MyFile : public QFile
|
|
|
|
// {
|
|
|
|
// public:
|
|
|
|
// MyFile(const QString &fileName)
|
|
|
|
// : QFile(fileName) {}
|
|
|
|
// };
|
|
|
|
|
|
|
|
// QTest::newRow("6857")
|
|
|
|
// << Data(
|
|
|
|
// MyFile file("/tmp/tt");
|
|
|
|
// file.setObjectName("A file");
|
|
|
|
// % Check("file bug6857::MyFile");
|
|
|
|
// % Check("file.@1 "/tmp/tt" QFile");
|
|
|
|
// % Check("file.@1.@1.@1 "A file" QObject");
|
|
|
|
|
|
|
|
|
2013-06-18 15:09:10 +02:00
|
|
|
#if 0
|
|
|
|
QTest::newRow("bug6858")
|
|
|
|
<< Data("#include <QFile>\n"
|
|
|
|
"#include <QString>\n"
|
|
|
|
"class MyFile : public QFile\n"
|
|
|
|
"{\n"
|
|
|
|
"public:\n"
|
|
|
|
" MyFile(const QString &fileName)\n"
|
|
|
|
" : QFile(fileName) {}\n"
|
|
|
|
"};\n",
|
|
|
|
"MyFile file(\"/tmp/tt\");\n"
|
|
|
|
"file.setObjectName(\"Another file\");\n"
|
|
|
|
"QFile *pfile = &file;\n")
|
|
|
|
% Check("pfile", "\"Another file\"", "MyFile")
|
|
|
|
% Check("pfile.@1", "\"/tmp/tt\"", "@QFile")
|
|
|
|
% Check("pfile.@1.@1", "\"Another file\"", "@QObject");
|
|
|
|
#endif
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
//namespace bug6863 {
|
|
|
|
|
|
|
|
// class MyObject : public QObject\n"
|
|
|
|
// {\n"
|
|
|
|
// Q_OBJECT\n"
|
|
|
|
// public:\n"
|
|
|
|
// MyObject() {}\n"
|
|
|
|
// };\n"
|
|
|
|
//\n"
|
|
|
|
// void setProp(QObject *obj)\n"
|
|
|
|
// {\n"
|
|
|
|
// obj->setProperty("foo", "bar");
|
2013-01-28 17:15:49 +01:00
|
|
|
// % Check("obj.[QObject].properties", "<2", "items>");
|
2013-01-25 19:11:14 +01:00
|
|
|
// // Continue");
|
2013-02-01 17:35:16 +01:00
|
|
|
// unused(&obj);
|
2013-01-25 19:11:14 +01:00
|
|
|
// }
|
|
|
|
|
|
|
|
// QTest::newRow("6863")
|
|
|
|
// << Data(
|
|
|
|
// {
|
|
|
|
// QFile file("/tmp/tt");\n"
|
|
|
|
// setProp(&file);\n"
|
|
|
|
// MyObject obj;\n"
|
|
|
|
// setProp(&obj);\n"
|
|
|
|
// }\n"
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
2013-02-01 17:35:16 +01:00
|
|
|
QTest::newRow("bug6933")
|
|
|
|
<< Data("struct Base\n"
|
|
|
|
"{\n"
|
|
|
|
" Base() : a(21) {}\n"
|
|
|
|
" virtual ~Base() {}\n"
|
|
|
|
" int a;\n"
|
|
|
|
"};\n"
|
|
|
|
"struct Derived : public Base\n"
|
|
|
|
"{\n"
|
|
|
|
" Derived() : b(42) {}\n"
|
|
|
|
" int b;\n"
|
2013-02-12 18:15:21 +01:00
|
|
|
"};\n",
|
2013-02-01 17:35:16 +01:00
|
|
|
"Derived d;\n"
|
|
|
|
"Base *b = &d;\n"
|
|
|
|
"unused(&d, &b);\n")
|
2013-02-12 18:15:21 +01:00
|
|
|
% Check("b.@1.a", "a", "21", "int")
|
|
|
|
% Check("b.b", "b", "42", "int");
|
2013-01-28 17:15:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
QTest::newRow("valist")
|
|
|
|
<< Data("#include <stdarg.h>\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"void breakHere();\n"
|
2013-01-28 17:15:49 +01:00
|
|
|
"void test(const char *format, ...)\n"
|
|
|
|
"{\n"
|
|
|
|
" va_list arg;\n"
|
|
|
|
" va_start(arg, format);\n"
|
|
|
|
" int i = va_arg(arg, int);\n"
|
|
|
|
" double f = va_arg(arg, double);\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
" unused(&i, &f);\n"
|
2013-01-28 17:15:49 +01:00
|
|
|
" va_end(arg);\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
" breakHere();\n"
|
2013-01-28 17:15:49 +01:00
|
|
|
"}\n",
|
|
|
|
"test(\"abc\", 1, 2.0);\n")
|
|
|
|
% Check("i", "1", "int")
|
|
|
|
% Check("f", "2", "double");
|
|
|
|
|
|
|
|
|
2013-04-05 14:14:44 +02:00
|
|
|
QByteArray inheritanceData =
|
|
|
|
"struct Empty {};\n"
|
|
|
|
"struct Data { Data() : a(42) {} int a; };\n"
|
|
|
|
"struct VEmpty {};\n"
|
|
|
|
"struct VData { VData() : v(42) {} int v; };\n"
|
|
|
|
"struct S1 : Empty, Data, virtual VEmpty, virtual VData\n"
|
|
|
|
" { S1() : i1(1) {} int i1; };\n"
|
|
|
|
"struct S2 : Empty, Data, virtual VEmpty, virtual VData\n"
|
|
|
|
" { S2() : i2(1) {} int i2; };\n"
|
|
|
|
"struct Combined : S1, S2 { Combined() : c(1) {} int c; };\n";
|
|
|
|
|
|
|
|
QTest::newRow("inheritance")
|
|
|
|
<< Data(inheritanceData,
|
|
|
|
"Combined c;\n"
|
|
|
|
"c.S1::a = 42;\n"
|
|
|
|
"c.S2::a = 43;\n"
|
|
|
|
"c.S1::v = 44;\n"
|
|
|
|
"c.S2::v = 45;\n")
|
|
|
|
% Check("c.c", "1", "int")
|
|
|
|
% Check("c.@1.@2.a", "42", "int")
|
|
|
|
% Check("c.@1.@4.v", "45", "int")
|
|
|
|
% Check("c.@2.@2.a", "43", "int")
|
|
|
|
% Check("c.@2.@4.v", "45", "int");
|
|
|
|
|
|
|
|
|
2013-01-28 17:15:49 +01:00
|
|
|
QTest::newRow("gdb13393")
|
|
|
|
<< Data(
|
|
|
|
"struct Base {\n"
|
|
|
|
" Base() : a(1) {}\n"
|
|
|
|
" virtual ~Base() {} // Enforce type to have RTTI\n"
|
|
|
|
" int a;\n"
|
|
|
|
"};\n"
|
|
|
|
"struct Derived : public Base {\n"
|
|
|
|
" Derived() : b(2) {}\n"
|
|
|
|
" int b;\n"
|
|
|
|
"};\n"
|
|
|
|
"struct S\n"
|
|
|
|
"{\n"
|
|
|
|
" Base *ptr;\n"
|
|
|
|
" const Base *ptrConst;\n"
|
|
|
|
" Base &ref;\n"
|
|
|
|
" const Base &refConst;\n"
|
|
|
|
" S(Derived &d)\n"
|
|
|
|
" : ptr(&d), ptrConst(&d), ref(d), refConst(d)\n"
|
|
|
|
" {}\n"
|
|
|
|
" };\n"
|
|
|
|
,
|
|
|
|
"Derived d;\n"
|
|
|
|
"S s(d);\n"
|
|
|
|
"Base *ptr = &d;\n"
|
|
|
|
"const Base *ptrConst = &d;\n"
|
|
|
|
"Base &ref = d;\n"
|
|
|
|
"const Base &refConst = d;\n"
|
|
|
|
"Base **ptrToPtr = &ptr;\n"
|
|
|
|
"#if USE_BOOST\n"
|
|
|
|
"boost::shared_ptr<Base> sharedPtr(new Derived());\n"
|
|
|
|
"#else\n"
|
|
|
|
"int sharedPtr = 1;\n"
|
|
|
|
"#endif\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&ptrConst, &ref, &refConst, &ptrToPtr, &sharedPtr);\n")
|
2013-03-06 12:40:46 +01:00
|
|
|
% GdbVersion(70500)
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("d", "", "Derived")
|
|
|
|
% Check("d.@1", "[Base]", "", "Base")
|
|
|
|
% Check("d.b", "2", "int")
|
|
|
|
% Check("ptr", "", "Derived")
|
|
|
|
% Check("ptr.@1", "[Base]", "", "Base")
|
|
|
|
% Check("ptr.@1.a", "1", "int")
|
|
|
|
% Check("ptrConst", "", "Derived")
|
|
|
|
% Check("ptrConst.@1", "[Base]", "", "Base")
|
|
|
|
% Check("ptrConst.b", "2", "int")
|
|
|
|
% Check("ptrToPtr", "", "Derived")
|
|
|
|
//% CheckType("ptrToPtr.[vptr]", " ")
|
|
|
|
% Check("ptrToPtr.@1.a", "1", "int")
|
|
|
|
% Check("ref", "", "Derived &")
|
|
|
|
//% CheckType("ref.[vptr]", "")
|
|
|
|
% Check("ref.@1.a", "1", "int")
|
|
|
|
% Check("refConst", "", "Derived &")
|
|
|
|
//% CheckType("refConst.[vptr]", "")
|
|
|
|
% Check("refConst.@1.a", "1", "int")
|
|
|
|
% Check("s", "", "S")
|
|
|
|
% Check("s.ptr", "", "Derived")
|
|
|
|
% Check("s.ptrConst", "", "Derived")
|
|
|
|
% Check("s.ref", "", "Derived &")
|
|
|
|
% Check("s.refConst", "", "Derived &")
|
|
|
|
% Check("sharedPtr", "1", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
// http://sourceware.org/bugzilla/show_bug.cgi?id=10586. fsf/MI errors out
|
|
|
|
// on -var-list-children on an anonymous union. mac/MI was fixed in 2006");
|
|
|
|
// The proposed fix has been reported to crash gdb steered from eclipse");
|
|
|
|
// http://sourceware.org/ml/gdb-patches/2011-12/msg00420.html
|
|
|
|
QTest::newRow("gdb10586mi")
|
2013-01-28 17:15:49 +01:00
|
|
|
<< Data("struct Test {\n"
|
2013-01-25 19:11:14 +01:00
|
|
|
" struct { int a; float b; };\n"
|
|
|
|
" struct { int c; float d; };\n"
|
2013-01-28 17:15:49 +01:00
|
|
|
"} v = {{1, 2}, {3, 4}};\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&v);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("v", "", "Test")
|
|
|
|
% Check("v.a", "1", "int");
|
2013-01-25 19:11:14 +01:00
|
|
|
|
|
|
|
QTest::newRow("gdb10586eclipse")
|
|
|
|
<< Data("struct { int x; struct { int a; }; struct { int b; }; } v = {1, {2}, {3}};\n"
|
2013-01-28 17:15:49 +01:00
|
|
|
"struct S { int x, y; } n = {10, 20};\n"
|
2013-02-01 17:35:16 +01:00
|
|
|
"unused(&v, &n);\n")
|
2013-01-28 17:15:49 +01:00
|
|
|
% Check("v", "", "{...}")
|
|
|
|
% Check("n", "", "S")
|
|
|
|
% Check("v.a", "2", "int")
|
|
|
|
% Check("v.b", "3", "int")
|
|
|
|
% Check("v.x", "1", "int")
|
|
|
|
% Check("n.x", "10", "int")
|
|
|
|
% Check("n.y", "20", "int");
|
2009-07-20 16:10:37 +02:00
|
|
|
}
|
2009-04-06 16:30:11 +02:00
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2009-08-26 08:56:33 +02:00
|
|
|
QApplication app(argc, argv);
|
2010-09-02 15:32:04 +10:00
|
|
|
tst_Dumpers test;
|
2009-04-06 16:30:11 +02:00
|
|
|
return QTest::qExec(&test, argc, argv);
|
|
|
|
}
|
2009-04-06 14:07:30 +02:00
|
|
|
|
2009-08-26 08:56:33 +02:00
|
|
|
#include "tst_dumpers.moc"
|