From 8a1e6f48f5df0f62de8361a0e577550101ac6da2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boris=20Du=C5=A1ek?= Date: Thu, 1 Jan 2015 20:44:29 +0100 Subject: [PATCH] Fix qaccessibilitymac test (title vs. description) We tested button's AXDescription, which is however used only for non-textual buttons (e.g. buttons with an icon and without a visible text). On the other hand, button's visible text (which is our case) is exposed in AXTitle (and not in AXDescription). Change-Id: Ie89c758cf94b72ade3a440561c5f3df61a4c4612 Reviewed-by: Frederik Gladhorn --- .../qaccessibilitymac/tst_qaccessibilitymac_helpers.mm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm index a0dfe5446e..4c57e4d42a 100644 --- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm +++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm @@ -80,11 +80,13 @@ bool trusted() { AXUIElementRef reference; NSString *_role; + NSString *_title; NSString *_description; NSString *_value; CGRect _rect; } @property (readonly) NSString *role; + @property (readonly) NSString *title; @property (readonly) NSString *description; @property (readonly) NSString *value; @property (readonly) CGRect rect; @@ -93,6 +95,7 @@ bool trusted() @implementation TestAXObject @synthesize role = _role; + @synthesize title = _title; @synthesize description = _description; @synthesize value = _value; @synthesize rect = _rect; @@ -102,6 +105,7 @@ bool trusted() if ( self = [super init] ) { reference = ref; AXUIElementCopyAttributeValue(ref, kAXRoleAttribute, (CFTypeRef*)&_role); + AXUIElementCopyAttributeValue(ref, kAXTitleAttribute, (CFTypeRef*)&_title); AXUIElementCopyAttributeValue(ref, kAXDescriptionAttribute, (CFTypeRef*)&_description); AXUIElementCopyAttributeValue(ref, kAXValueAttribute, (CFTypeRef*)&_value); AXValueRef sizeValue; @@ -116,7 +120,7 @@ bool trusted() - (AXUIElementRef) ref { return reference; } - (void) print { - NSLog(@"Accessible Object role: '%@', description: '%@', value: '%@', rect: '%@'", self.role, self.description, self.value, NSStringFromRect(self.rect)); + NSLog(@"Accessible Object role: '%@', title: '%@', description: '%@', value: '%@', rect: '%@'", self.role, self.title, self.description, self.value, NSStringFromRect(self.rect)); NSLog(@" Children: %ld", [[self childList] count]); } @@ -282,7 +286,7 @@ bool testHierarchy(QWidget *w) TestAXObject *focusButton2 = [[TestAXObject alloc] initWithAXUIElementRef: focussedElement]; EXPECT([[focusButton2 role] isEqualToString: NSAccessibilityButtonRole]); - EXPECT([[focusButton2 description] isEqualToString: @"Button 2"]); + EXPECT([[focusButton2 title] isEqualToString: @"Button 2"]); button1->setFocus(); @@ -292,7 +296,7 @@ bool testHierarchy(QWidget *w) EXPECT(focussedElement); TestAXObject *focusButton1 = [[TestAXObject alloc] initWithAXUIElementRef: focussedElement]; EXPECT([[focusButton1 role] isEqualToString: NSAccessibilityButtonRole]); - EXPECT([[focusButton1 description] isEqualToString: @"I am a button"]); + EXPECT([[focusButton1 title] isEqualToString: @"I am a button"]); return true; }