forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.2'
Conflicts: qbs/modules/qtc/qtc.qbs qtcreator.pri Change-Id: I245212bd45104636b1c9737b36d3db3e4af23092
This commit is contained in:
@@ -1903,9 +1903,9 @@ void tst_Dumpers::dumper_data()
|
||||
+ Check("h1.2.value.1", "[1]", "2", "int")
|
||||
|
||||
+ Check("h2", "<3 items>", "@QHash<int, float>")
|
||||
+ Check("h2.0", "[0] 0", FloatValue("33"), "float")
|
||||
+ Check("h2.1", "[1] 22", FloatValue("22"), "float")
|
||||
+ Check("h2.2", "[2] 11", FloatValue("11"), "float")
|
||||
+ Check("h2.0", "[0] 0", FloatValue("33"), "")
|
||||
+ Check("h2.1", "[1] 22", FloatValue("22"), "")
|
||||
+ Check("h2.2", "[2] 11", FloatValue("11"), "")
|
||||
|
||||
+ Check("h3", "<1 items>", "@QHash<@QString, int>")
|
||||
+ Check("h3.0.key", "key", "\"22.0\"", "@QString")
|
||||
@@ -1934,7 +1934,7 @@ void tst_Dumpers::dumper_data()
|
||||
+ CheckType("h7.2.value", "@QPointer<@QObject>")
|
||||
|
||||
+ Check("h8", "<3 items>", "Hash")
|
||||
+ Check("h8.0", "[0] 22", FloatValue("22"), "float")
|
||||
+ Check("h8.0", "[0] 22", FloatValue("22"), "")
|
||||
+ Check("it1.key", "22", "int")
|
||||
+ Check("it1.value", FloatValue("22"), "float")
|
||||
+ Check("it3.key", "33", "int")
|
||||
@@ -2347,8 +2347,8 @@ void tst_Dumpers::dumper_data()
|
||||
+ Check("m1.1.value.0", "[0]", "\"22\"", "@QString")
|
||||
|
||||
+ Check("m2", "<2 items>", "@QMap<unsigned int, float>")
|
||||
+ Check("m2.0", "[0] 11", FloatValue("31.0"), "float")
|
||||
+ Check("m2.1", "[1] 22", FloatValue("32.0"), "float")
|
||||
+ Check("m2.0", "[0] 11", FloatValue("31.0"), "")
|
||||
+ Check("m2.1", "[1] 22", FloatValue("32.0"), "")
|
||||
|
||||
+ Check("m3", "<2 items>", "T")
|
||||
|
||||
@@ -2432,8 +2432,8 @@ void tst_Dumpers::dumper_data()
|
||||
+ Check("m0", "<0 items>", "@QMultiMap<int, int>")
|
||||
|
||||
+ Check("m1", "<6 items>", "@QMultiMap<unsigned int, float>")
|
||||
+ Check("m1.0", "[0] 11", FloatValue("11"), "float")
|
||||
+ Check("m1.5", "[5] 22", FloatValue("22"), "float")
|
||||
+ Check("m1.0", "[0] 11", FloatValue("11"), "")
|
||||
+ Check("m1.5", "[5] 22", FloatValue("22"), "")
|
||||
|
||||
+ Check("m2", "<1 items>", "@QMultiMap<@QString, float>")
|
||||
+ Check("m2.0.key", "\"22.0\"", "@QString")
|
||||
@@ -4120,23 +4120,23 @@ void tst_Dumpers::dumper_data()
|
||||
"map4.insert(std::pair<unsigned int, float>(22, 25.0));\n")
|
||||
|
||||
+ Check("map1", "<2 items>", "std::map<unsigned int, unsigned int>")
|
||||
+ Check("map1.0", "[0] 11", "1", "unsigned int")
|
||||
+ Check("map1.1", "[1] 22", "2", "unsigned int")
|
||||
+ Check("map1.0", "[0] 11", "1", "")
|
||||
+ Check("map1.1", "[1] 22", "2", "")
|
||||
|
||||
+ Check("map2", "<2 items>", "std::map<unsigned int, float>")
|
||||
+ Check("map2.0", "[0] 11", FloatValue("11"), "float")
|
||||
+ Check("map2.1", "[1] 22", FloatValue("22"), "float")
|
||||
+ Check("map2.0", "[0] 11", FloatValue("11"), "")
|
||||
+ Check("map2.1", "[1] 22", FloatValue("22"), "")
|
||||
|
||||
+ Check("map3", "<6 items>", "Map")
|
||||
+ Check("map3.0", "[0] 11", FloatValue("11"), "float")
|
||||
+ Check("map3.0", "[0] 11", FloatValue("11"), "")
|
||||
+ Check("it1.first", "11", "int")
|
||||
+ Check("it1.second", FloatValue("11"), "float")
|
||||
+ Check("it6.first", "66", "int")
|
||||
+ Check("it6.second", FloatValue("66"), "float")
|
||||
|
||||
+ Check("map4", "<5 items>", "std::multimap<unsigned int, float>")
|
||||
+ Check("map4.0", "[0] 11", FloatValue("11"), "float")
|
||||
+ Check("map4.4", "[4] 22", FloatValue("25"), "float");
|
||||
+ Check("map4.0", "[0] 11", FloatValue("11"), "")
|
||||
+ Check("map4.4", "[4] 22", FloatValue("25"), "");
|
||||
|
||||
|
||||
QTest::newRow("StdMapQt")
|
||||
@@ -4188,33 +4188,33 @@ void tst_Dumpers::dumper_data()
|
||||
+ CoreProfile()
|
||||
|
||||
+ Check("map1", "<3 items>", "std::map<@QString, Foo>")
|
||||
+ Check("map1.0", "[0] \"22.0\"", "", "std::pair<@QString const, Foo>")
|
||||
+ Check("map1.0", "[0] \"22.0\"", "", "")
|
||||
+ Check("map1.0.first", "\"22.0\"", "@QString")
|
||||
+ Check("map1.0.second", "", "Foo")
|
||||
+ Check("map1.0.second.a", "22", "int")
|
||||
+ Check("map1.1", "[1] \"33.0\"", "", "std::pair<@QString const, Foo>")
|
||||
+ Check("map1.1", "[1] \"33.0\"", "", "")
|
||||
+ Check("map1.2.first", "\"44.0\"", "@QString")
|
||||
+ Check("map1.2.second", "", "Foo")
|
||||
+ Check("map1.2.second.a", "44", "int")
|
||||
|
||||
+ Check("map2", "<2 items>", "std::map<char const*, Foo>")
|
||||
+ Check("map2.0", "[0] \"22.0\"", "", "std::pair<char const* const, Foo>")
|
||||
+ Check("map2.0", "[0] \"22.0\"", "", "")
|
||||
+ Check("map2.0.first", "\"22.0\"", "char *")
|
||||
+ Check("map2.0.first.0", "[0]", "50", "char")
|
||||
+ Check("map2.0.second", "", "Foo")
|
||||
+ Check("map2.0.second.a", "22", "int")
|
||||
+ Check("map2.1", "[1] \"33.0\"", "", "std::pair<char const* const, Foo>")
|
||||
+ Check("map2.1", "[1] \"33.0\"", "", "")
|
||||
+ Check("map2.1.first", "\"33.0\"", "char *")
|
||||
+ Check("map2.1.first.0", "[0]", "51", "char")
|
||||
+ Check("map2.1.second", "", "Foo")
|
||||
+ Check("map2.1.second.a", "33", "int")
|
||||
|
||||
+ Check("map3", "<2 items>", "std::map<unsigned int, @QStringList>")
|
||||
+ Check("map3.0", "[0] 11", "<1 items>", "std::pair<unsigned int const, @QStringList>")
|
||||
+ Check("map3.0", "[0] 11", "<1 items>", "")
|
||||
+ Check("map3.0.first", "11", "unsigned int")
|
||||
+ Check("map3.0.second", "<1 items>", "@QStringList")
|
||||
+ Check("map3.0.second.0", "[0]", "\"11\"", "@QString")
|
||||
+ Check("map3.1", "[1] 22", "<1 items>", "std::pair<unsigned int const, @QStringList>")
|
||||
+ Check("map3.1", "[1] 22", "<1 items>", "")
|
||||
+ Check("map3.1.first", "22", "unsigned int")
|
||||
+ Check("map3.1.second", "<1 items>", "@QStringList")
|
||||
+ Check("map3.1.second.0", "[0]", "\"22\"", "@QString")
|
||||
@@ -4222,26 +4222,25 @@ void tst_Dumpers::dumper_data()
|
||||
+ Check("map4.1.second.0", "[0]", "\"22\"", "@QString")
|
||||
|
||||
+ Check("map5", "<2 items>", "std::map<@QString, float>")
|
||||
+ Check("map5.0", "[0] \"11.0\"", FloatValue("11"), "std::pair<@QString const, float>")
|
||||
+ Check("map5.0", "[0] \"11.0\"", FloatValue("11"), "")
|
||||
+ Check("map5.0.first", "\"11.0\"", "@QString")
|
||||
+ Check("map5.0.second", FloatValue("11"), "float")
|
||||
+ Check("map5.1", "[1] \"22.0\"", FloatValue("22"), "std::pair<@QString const, float>")
|
||||
+ Check("map5.1", "[1] \"22.0\"", FloatValue("22"), "")
|
||||
+ Check("map5.1.first", "\"22.0\"", "@QString")
|
||||
+ Check("map5.1.second", FloatValue("22"), "float")
|
||||
|
||||
+ Check("map6", "<2 items>", "std::map<int, @QString>")
|
||||
+ Check("map6.0", "[0] 11", "\"11.0\"", "std::pair<int const, @QString>")
|
||||
+ Check("map6.0", "[0] 11", "\"11.0\"", "")
|
||||
+ Check("map6.0.first", "11", "int")
|
||||
+ Check("map6.0.second", "\"11.0\"", "@QString")
|
||||
+ Check("map6.1", "[1] 22", "\"22.0\"", "std::pair<int const, @QString>")
|
||||
+ Check("map6.1", "[1] 22", "\"22.0\"", "")
|
||||
+ Check("map6.1.first", "22", "int")
|
||||
+ Check("map6.1.second", "\"22.0\"", "@QString")
|
||||
|
||||
+ Check("map7", "<3 items>", "std::map<@QString, @QPointer<@QObject>>")
|
||||
+ Check("map7.0", "[0] \".\"", "", "std::pair<@QString const, @QPointer<@QObject>>")
|
||||
+ Check("map7.0", "[0] \".\"", "", "")
|
||||
+ Check("map7.0.first", "\".\"", "@QString")
|
||||
+ Check("map7.0.second", "", "@QPointer<@QObject>")
|
||||
+ Check("map7.2", "[2] \"Welt\"", "", "std::pair<@QString const, @QPointer<@QObject>>")
|
||||
+ Check("map7.2.first", "\"Welt\"", "@QString");
|
||||
|
||||
|
||||
@@ -4672,8 +4671,8 @@ void tst_Dumpers::dumper_data()
|
||||
+ Cxx11Profile()
|
||||
|
||||
+ Check("map1", "<2 items>", "std::unordered_map<unsigned int, unsigned int>")
|
||||
+ Check("map1.0", "[0] 22", "2", "unsigned int")
|
||||
+ Check("map1.1", "[1] 11", "1", "unsigned int")
|
||||
+ Check("map1.0", "[0] 22", "2", "")
|
||||
+ Check("map1.1", "[1] 11", "1", "")
|
||||
|
||||
+ Check("map2", "<2 items>", "std::unordered_map<std::string, float>")
|
||||
+ Check("map2.0", "[0] \"22.0\"", FloatValue("22.0"), "")
|
||||
@@ -5382,17 +5381,8 @@ void tst_Dumpers::dumper_data()
|
||||
+ Check("y2", "", "X")
|
||||
+ Check("y3", "", "X");
|
||||
|
||||
QTest::newRow("RValueReferenceLldb")
|
||||
QTest::newRow("RValueReference")
|
||||
<< Data(rvalueData)
|
||||
+ LldbEngine
|
||||
+ Check("x1", "", "X &&")
|
||||
+ Check("x2", "", "X &&")
|
||||
+ Check("x3", "", "X &&");
|
||||
|
||||
QTest::newRow("RValueReferenceGdb")
|
||||
<< Data(rvalueData)
|
||||
+ GdbEngine
|
||||
+ GccVersion(0, 40704)
|
||||
+ Check("x1", "", "X &")
|
||||
+ Check("x2", "", "X &")
|
||||
+ Check("x3", "", "X &");
|
||||
@@ -6231,6 +6221,7 @@ void tst_Dumpers::dumper_data()
|
||||
+ Check("v15", "\"utf16\"", "@QJSValue (QString)")
|
||||
+ Check("v15.1", "[1]", "116", "@QChar");
|
||||
|
||||
#if 0
|
||||
#ifdef Q_OS_LINUX
|
||||
// Hint: To open a failing test in Creator, do:
|
||||
// touch qt_tst_dumpers_Nim_.../dummy.nimproject
|
||||
@@ -6239,6 +6230,7 @@ void tst_Dumpers::dumper_data()
|
||||
nimData.configTest = "which nim";
|
||||
nimData.allProfile =
|
||||
"CONFIG -= qt\n"
|
||||
"SOURCES += main.nim\n"
|
||||
"# Prevents linking\n"
|
||||
"TARGET=\n"
|
||||
"# Overwrites qmake-generated 'all' target.\n"
|
||||
@@ -6253,8 +6245,10 @@ void tst_Dumpers::dumper_data()
|
||||
"proc mainProc =\n"
|
||||
" var name: string = \"Hello World\"\n"
|
||||
" var i: int = 43\n"
|
||||
" var j: int\n"
|
||||
" var x: seq[int]\n"
|
||||
" x = @[1, 2, 3, 4, 5, 6]\n\n"
|
||||
" j = i + name.len()\n"
|
||||
" # Crash it.\n"
|
||||
" var m1 = Mirror(tag:1)\n"
|
||||
" var m2 = Mirror(tag:2)\n"
|
||||
@@ -6278,6 +6272,7 @@ void tst_Dumpers::dumper_data()
|
||||
+ Check("x", "<6 items>", Pattern("TY.*NI.6..")) // Something like "TY95019 (NI[6])"
|
||||
+ Check("x.2", "[2]", "3", "NI");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
||||
@@ -44,6 +44,7 @@ private slots:
|
||||
void threadPriority();
|
||||
void runAsyncNoFutureInterface();
|
||||
void crefFunction();
|
||||
void onResultReady();
|
||||
};
|
||||
|
||||
void report3(QFutureInterface<int> &fi)
|
||||
@@ -557,6 +558,64 @@ void tst_RunExtensions::crefFunction()
|
||||
QCOMPARE(value, true);
|
||||
}
|
||||
|
||||
class ObjWithProperty : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public slots:
|
||||
void setValue(const QString &s)
|
||||
{
|
||||
value = s;
|
||||
}
|
||||
|
||||
public:
|
||||
QString value;
|
||||
};
|
||||
|
||||
void tst_RunExtensions::onResultReady()
|
||||
{
|
||||
{ // lambda
|
||||
QFuture<QString> f = Utils::runAsync([](QFutureInterface<QString> &fi) {
|
||||
fi.reportResult("Hi");
|
||||
fi.reportResult("there");
|
||||
});
|
||||
int count = 0;
|
||||
QString res;
|
||||
Utils::onResultReady(f, [&count, &res](const QString &s) {
|
||||
++count;
|
||||
res = s;
|
||||
});
|
||||
f.waitForFinished();
|
||||
QCoreApplication::processEvents();
|
||||
QCOMPARE(count, 2);
|
||||
QCOMPARE(res, QString("there"));
|
||||
}
|
||||
{ // lambda with guard
|
||||
QFuture<QString> f = Utils::runAsync([](QFutureInterface<QString> &fi) {
|
||||
fi.reportResult("Hi");
|
||||
fi.reportResult("there");
|
||||
});
|
||||
int count = 0;
|
||||
ObjWithProperty obj;
|
||||
Utils::onResultReady(f, &obj, [&count, &obj](const QString &s) {
|
||||
++count;
|
||||
obj.setValue(s);
|
||||
});
|
||||
f.waitForFinished();
|
||||
QCoreApplication::processEvents();
|
||||
QCOMPARE(count, 2);
|
||||
QCOMPARE(obj.value, QString("there"));
|
||||
}
|
||||
{ // member
|
||||
QFuture<QString> f = Utils::runAsync([]() { return QString("Hi"); });
|
||||
ObjWithProperty obj;
|
||||
Utils::onResultReady(f, &obj, &ObjWithProperty::setValue);
|
||||
f.waitForFinished();
|
||||
QCoreApplication::processEvents();
|
||||
QCOMPARE(obj.value, QString("Hi"));
|
||||
}
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_RunExtensions)
|
||||
|
||||
#include "tst_runextensions.moc"
|
||||
|
||||
Reference in New Issue
Block a user