Commit 8c6fb689 authored by Eike Ziller's avatar Eike Ziller Committed by hjk

dumpers: fix QUrl for Qt4

Change-Id: Ib93bdcd86532fe9313889b70db655a26e1ca7c71
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 623fc1e9
......@@ -1723,13 +1723,27 @@ def qdump__QTextDocument(d, value):
def qdump__QUrl(d, value):
if d.qtVersion() < 0x050000:
if not d.dereferenceValue(value):
privAddress = d.dereferenceValue(value)
if not privAddress:
# d == 0 if QUrl was constructed with default constructor
d.putValue("<invalid>")
return
data = value["d"].dereference()
d.putByteArrayValue(data["encodedOriginal"])
d.putPlainChildren(data)
encodedOriginalAddress = privAddress + 8 * d.ptrSize()
d.putValue(d.encodeByteArrayHelper(d.dereference(encodedOriginalAddress)), Hex2EncodedLatin1)
d.putNumChild(8)
if d.isExpanded():
stringType = d.lookupType(d.qtNamespace() + "QString")
baType = d.lookupType(d.qtNamespace() + "QByteArray")
with Children(d):
# Qt 4 only decodes the original string if some detail is requested
d.putCallItem("scheme", value, "scheme")
d.putCallItem("userName", value, "userName")
d.putCallItem("password", value, "password")
d.putCallItem("host", value, "host")
d.putCallItem("path", value, "path")
d.putCallItem("query", value, "encodedQuery")
d.putCallItem("fragment", value, "fragment")
d.putCallItem("port", value, "port")
else:
# QUrlPrivate:
# - QAtomicInt ref;
......
......@@ -3290,14 +3290,15 @@ void tst_Dumpers::dumper_data()
"unused(&url);\n")
% CoreProfile()
% 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");
% Check("url.port", "10", "int")
% Check("url.scheme", "\"http\"", "@QString")
% Check("url.userName", "\"foo\"", "@QString")
% Check("url.password", "\"\"", "@QString")
% Check("url.host", "\"qt-project.org\"", "@QString")
% Check("url.path", "\"/have_fun\"", "@QString")
% Check("url.query", "\"\"", Type4("@QByteArray"))
% Check("url.query", "\"\"", Type5("@QString"))
% Check("url.fragment", "\"\"", "@QString");
QTest::newRow("QStringQuotes")
<< Data("#include <QString>\n",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment