Commit f7fa44d4 authored by Eike Ziller's avatar Eike Ziller Committed by hjk
Browse files

dumpers: Add test for QUrl() and fix it



Change-Id: I84d4963210784dd982e897fd57dc9e5fad086aef
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent f6113276
......@@ -1715,6 +1715,10 @@ def qdump__QTextDocument(d, value):
def qdump__QUrl(d, value):
if d.qtVersion() < 0x050000:
if not d.dereferenceValue(value):
# d == 0 if QUrl was constructed with default constructor
d.putValue("<invalid>")
return
data = value["d"].dereference()
d.putByteArrayValue(data["encodedOriginal"])
d.putPlainChildren(data)
......@@ -1729,7 +1733,12 @@ def qdump__QUrl(d, value):
# - QString path;
# - QString query;
# - QString fragment;
schemeAddr = d.dereferenceValue(value) + 2 * d.intSize()
privAddress = d.dereferenceValue(value)
if not privAddress:
# d == 0 if QUrl was constructed with default constructor
d.putValue("<invalid>")
return
schemeAddr = privAddress + 2 * d.intSize()
scheme = d.encodeStringHelper(d.dereference(schemeAddr))
userName = d.encodeStringHelper(d.dereference(schemeAddr + 1 * d.ptrSize()))
password = d.encodeStringHelper(d.dereference(schemeAddr + 2 * d.ptrSize()))
......
......@@ -3250,7 +3250,14 @@ void tst_Dumpers::dumper_data()
% Check("s.0", "[0]", "1", "bool") // 1 -> true is done on display
% Check("s.1", "[1]", "0", "bool");
QTest::newRow("QUrl")
QTest::newRow("QUrl1")
<< Data("#include <QUrl>",
"QUrl url;\n"
"unused(&url);\n")
% CoreProfile()
% Check("url", "<invalid>", "@QUrl");
QTest::newRow("QUrl2")
<< Data("#include <QUrl>",
"QUrl url = QUrl::fromEncoded(\"http://foo@qt-project.org:10/have_fun\");\n"
"unused(&url);\n")
......
Supports Markdown
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