summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@digia.com>2013-10-22 11:15:50 +0200
committerhjk <hjk121@nokiamail.com>2013-10-22 13:20:03 +0200
commit5686f5fd70ef28b842cc3b37b362fb75d3e8e127 (patch)
tree0fcbc466b7ff1458105d2499a0db69b96fdfc74d
parentd8aadac3231d7d8265ffc6d9a5223286fb136c74 (diff)
downloadqt-creator-5686f5fd70ef28b842cc3b37b362fb75d3e8e127.tar.gz
QUrl dumper: use correct string type name and extend test
Change-Id: I7fe88d11b3d52ba31d3e8564b673a35001e31488 Reviewed-by: hjk <hjk121@nokiamail.com>
-rw-r--r--share/qtcreator/debugger/qttypes.py36
-rw-r--r--tests/auto/debugger/tst_dumpers.cpp23
2 files changed, 41 insertions, 18 deletions
diff --git a/share/qtcreator/debugger/qttypes.py b/share/qtcreator/debugger/qttypes.py
index cd525cfa10..1546ee5ef2 100644
--- a/share/qtcreator/debugger/qttypes.py
+++ b/share/qtcreator/debugger/qttypes.py
@@ -1676,23 +1676,31 @@ def qdump__QUrl(d, value):
path = d.encodeStringHelper(d.dereference(schemeAddr + 4 * d.ptrSize()))
query = d.encodeStringHelper(d.dereference(schemeAddr + 5 * d.ptrSize()))
fragment = d.encodeStringHelper(d.dereference(schemeAddr + 6 * d.ptrSize()))
-
- str = scheme
- str += "3a002f002f00"
- str += host
- str += path
- d.putValue(str, Hex4EncodedLittleEndian)
+ port = d.extractInt(d.dereferenceValue(value) + d.intSize())
+
+ url = scheme
+ url += "3a002f002f00"
+ if len(userName):
+ url += userName
+ url += "4000"
+ url += host
+ if port >= 0:
+ url += "3a00"
+ url += ''.join(["%02x00" % ord(c) for c in str(port)])
+ url += path
+ d.putValue(url, Hex4EncodedLittleEndian)
d.putNumChild(8)
if d.isExpanded():
+ stringType = d.lookupType(d.ns + "QString")
with Children(d):
- d.putIntItem("port", d.extractInt(d.dereferenceValue(value) + d.intSize()))
- d.putGenericItem("scheme", "QString", scheme, Hex4EncodedLittleEndian)
- d.putGenericItem("userName", "QString", userName, Hex4EncodedLittleEndian)
- d.putGenericItem("password", "QString", password, Hex4EncodedLittleEndian)
- d.putGenericItem("host", "QString", host, Hex4EncodedLittleEndian)
- d.putGenericItem("path", "QString", path, Hex4EncodedLittleEndian)
- d.putGenericItem("query", "QString", query, Hex4EncodedLittleEndian)
- d.putGenericItem("fragment", "QString", fragment, Hex4EncodedLittleEndian)
+ d.putIntItem("port", port)
+ d.putGenericItem("scheme", stringType, scheme, Hex4EncodedLittleEndian)
+ d.putGenericItem("userName", stringType, userName, Hex4EncodedLittleEndian)
+ d.putGenericItem("password", stringType, password, Hex4EncodedLittleEndian)
+ d.putGenericItem("host", stringType, host, Hex4EncodedLittleEndian)
+ d.putGenericItem("path", stringType, path, Hex4EncodedLittleEndian)
+ d.putGenericItem("query", stringType, query, Hex4EncodedLittleEndian)
+ d.putGenericItem("fragment", stringType, fragment, Hex4EncodedLittleEndian)
def qdumpHelper_QVariant_0(d, data):
# QVariant::Invalid
diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp
index f57dee2a14..4760aba1d9 100644
--- a/tests/auto/debugger/tst_dumpers.cpp
+++ b/tests/auto/debugger/tst_dumpers.cpp
@@ -196,10 +196,11 @@ static QByteArray parentIName(const QByteArray &iname)
struct ValueBase
{
- ValueBase() : hasPtrSuffix(false), isFloatValue(false), version(0) {}
+ ValueBase() : hasPtrSuffix(false), isFloatValue(false), substituteNamespace(true), version(0) {}
bool hasPtrSuffix;
bool isFloatValue;
+ bool substituteNamespace;
int version;
};
@@ -232,7 +233,8 @@ struct Value : public ValueBase
if (actualValue == QLatin1String(" "))
actualValue.clear(); // FIXME: Remove later.
QString expectedValue = value;
- expectedValue.replace(QLatin1Char('@'), QString::fromLatin1(context.nameSpace));
+ if (substituteNamespace)
+ expectedValue.replace(QLatin1Char('@'), QString::fromLatin1(context.nameSpace));
if (hasPtrSuffix)
return actualValue.startsWith(expectedValue + QLatin1String(" @0x"))
@@ -277,6 +279,11 @@ struct Value5 : Value
Value5(const QByteArray &value) : Value(value) { version = 5; }
};
+struct UnsubstitutedValue : Value
+{
+ UnsubstitutedValue(const QByteArray &value) : Value(value) { substituteNamespace = false; }
+};
+
struct Type
{
Type() {}
@@ -3171,10 +3178,18 @@ void tst_Dumpers::dumper_data()
QTest::newRow("QUrl")
<< Data("#include <QUrl>",
- "QUrl url = QUrl::fromEncoded(\"http://qt-project.org/have_fun\");\n"
+ "QUrl url = QUrl::fromEncoded(\"http://foo@qt-project.org:10/have_fun\");\n"
"unused(&url);\n")
% CoreProfile()
- % Check("url", "\"http://qt-project.org/have_fun\"", "@QUrl");
+ % Check("url", UnsubstitutedValue("\"http://foo@qt-project.org:10/have_fun\""), "@QUrl")
+ % Check("url.port", Value5("10"), "int")
+ % Check("url.scheme", Value5("\"http\""), "@QString")
+ % Check("url.userName", Value5("\"foo\""), "@QString")
+ % Check("url.password", Value5("\"\""), "@QString")
+ % Check("url.host", Value5("\"qt-project.org\""), "@QString")
+ % Check("url.path", Value5("\"/have_fun\""), "@QString")
+ //% Check("url.query", Value5("\"\""), "@QString") That's a QByteArray in Qt 4
+ % Check("url.fragment", Value5("\"\""), "@QString");
QTest::newRow("QStringQuotes")
<< Data("#include <QString>\n",