From 653ef98d1ee34717ab319b34cde577cd2c7d859e Mon Sep 17 00:00:00 2001 From: Diego Torres Milano Date: Sat, 28 Jan 2012 18:55:09 -0500 Subject: Added check for mText property in getText() Sometimes the node's property is not 'text:mText' but just 'mText'. A new test was added to getText() to check for both properties and not throwing unnecessarily the RuntimeException("No text property on node"). This has been tested by monkyrunner tests using EasyMonkeyDevice that runs correctly after this patch is applied. Change-Id: I5399169b906e28eeee0a17ab298a724cc5bb9b51 Signed-off-by: Diego Torres Milano --- .../src/com/android/chimpchat/hierarchyviewer/HierarchyViewer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'chimpchat') diff --git a/chimpchat/src/com/android/chimpchat/hierarchyviewer/HierarchyViewer.java b/chimpchat/src/com/android/chimpchat/hierarchyviewer/HierarchyViewer.java index 6ad98ad..285d922 100644 --- a/chimpchat/src/com/android/chimpchat/hierarchyviewer/HierarchyViewer.java +++ b/chimpchat/src/com/android/chimpchat/hierarchyviewer/HierarchyViewer.java @@ -170,7 +170,11 @@ public class HierarchyViewer { } ViewNode.Property textProperty = node.namedProperties.get("text:mText"); if (textProperty == null) { - throw new RuntimeException("No text property on node"); + // give it another chance, ICS ViewServer returns mText + textProperty = node.namedProperties.get("mText"); + if (textProperty == null) { + throw new RuntimeException("No text property on node"); + } } return textProperty.value; } -- cgit v1.1