From 4df33ec24c2217ec211be2a287d800aae9b28bf0 Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Tue, 16 Mar 2010 18:39:06 +0100
Subject: [PATCH] debugger: add manual test

---
 src/plugins/debugger/watchhandler.cpp   |  1 +
 tests/manual/gdbdebugger/simple/app.cpp | 41 ++++++++++++++++++++++++-
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index d046c9fcedf..b7169e78098 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -775,6 +775,7 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
     const WatchItem &data = *item;
 
     switch (role) {
+        case Qt::EditRole:
         case Qt::DisplayRole: {
             switch (idx.column()) {
                 case 0:
diff --git a/tests/manual/gdbdebugger/simple/app.cpp b/tests/manual/gdbdebugger/simple/app.cpp
index af088d34235..f334fadbd06 100644
--- a/tests/manual/gdbdebugger/simple/app.cpp
+++ b/tests/manual/gdbdebugger/simple/app.cpp
@@ -221,7 +221,45 @@ struct TestAnonymous
     };
 };
 
-// union { struct { int a; }; struct { int b; }; };
+
+void testPeekAndPoke3()
+{
+    // Anonymous structs
+    {
+        union {
+            struct { int i; int b; };
+            struct { float f; };
+            double d;
+        } a = { 42, 43 };
+        a.i = 1; // Break here. Expand a. Step.
+        a.i = 2; // Change a.i in Locals view to 0. This changes f, d but expectedly not b. Step.
+        a.i = 3; // Continue.
+    }
+
+    // QImage display
+    {
+        QImage im(QSize(200, 200), QImage::Format_RGB32);
+        im.fill(QColor(200, 100, 130).rgba());
+        QPainter pain;
+        pain.begin(&im);
+        pain.drawLine(2, 2, 130, 130); // Break here.
+        // Toggle between "Normal" and "Displayed" in L&W Context Menu, entry "Display of Type QImage". Step.
+        pain.drawLine(4, 2, 130, 140); // Step.
+        pain.drawRect(30, 30, 80, 80);
+        pain.end();
+    }
+
+    // Complex watchers
+    {
+        struct S { int a; double b; } s[10];
+        for (int i = 0; i != 10; ++i) {
+            s[i].a = i;  // Break here. Expand s and s[0]. Step.
+            // Watcher Context: "Add New Watcher".
+            // Type    ['s[%d].a' % i for i in range(5)]
+            // Expand it, continue stepping.
+        }
+    }
+}
 
 void testAnonymous()
 {
@@ -1465,6 +1503,7 @@ int testReference()
 
 int main(int argc, char *argv[])
 {
+    testPeekAndPoke3();
     testFunctionPointer();
     testAnonymous();
     testReference();
-- 
GitLab