From 5f1619487002a8c75a35a6472c75999f56d3cd82 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 20 Mar 2014 16:00:04 +0100 Subject: [PATCH] Debugger: Add test for dynamic QObject property dumper Change-Id: I3216a8f891b76a5e9d342aa97540fcb73c590531 Reviewed-by: Christian Stenger --- share/qtcreator/debugger/dumper.py | 2 +- tests/auto/debugger/tst_dumpers.cpp | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py index 1799d2c9f13..1d9ba5302f5 100644 --- a/share/qtcreator/debugger/dumper.py +++ b/share/qtcreator/debugger/dumper.py @@ -1059,7 +1059,7 @@ class DumperBase: # Static properties. for i in range(propertyCount): name = propertyNames[i] - self.putCallItem(name, qobject, "property", '"' + name + '"') + self.putCallItem(str(name), qobject, "property", '"' + name + '"') # Dynamic properties. if extraData: diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index aa43df291a2..b57195281a0 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -2175,6 +2175,7 @@ void tst_Dumpers::dumper_data() QTest::newRow("QObject2") << Data("#include \n" "#include \n" + "#include \n" "namespace Bar {\n" " struct Ui { Ui() { w = 0; } QWidget *w; };\n" " class TestObject : public QObject\n" @@ -2209,17 +2210,25 @@ void tst_Dumpers::dumper_data() "Bar::TestObject test;\n" "test.setMyProp1(\"Hello\");\n" "test.setMyProp2(\"World\");\n" + "test.setProperty(\"New\", QVariant(QByteArray(\"Stuff\")));\n" + "test.setProperty(\"Old\", QVariant(QString(\"Cruft\")));\n" "QString s = test.myProp1();\n" "s += QString::fromLatin1(test.myProp2());\n" "unused(&app, &test, &s);\n") + GuiProfile() + Check("s", "\"HelloWorld\"", "@QString") + Check("test", "", "Bar::TestObject") - + Check("test.[properties]", "<4 items>", "") - + Check("test.[properties].myProp1", "\"Hello\"", "@QVariant (QString)") - + Check("test.[properties].myProp2", "\"World\"", "@QVariant (QByteArray)") + + Check("test.[properties]", "<6 items>", "") + + Check("test.[properties].myProp1", + "\"Hello\"", "@QVariant (QString)") + + Check("test.[properties].myProp2", + "\"World\"", "@QVariant (QByteArray)") + Check("test.[properties].myProp3", "54", "@QVariant (long)") - + Check("test.[properties].myProp4", "44", "@QVariant (int)"); + + Check("test.[properties].myProp4", "44", "@QVariant (int)") + + Check("test.[properties].4", "\"New\"", + "\"Stuff\"", "@QVariant (QByteArray)") + + Check("test.[properties].5", "\"Old\"", + "\"Cruft\"", "@QVariant (QString)"); QTest::newRow("QObject3") << Data("#include \n"