I am trying to write UIAutomation tests around some core graphics logic. Currently we are using core graphics to draw an image. I'm trying to set the accessibility label/identifier/value on the image so that I can verify its presence via a UIAutomation test, but no matter what I do I'm not getting the accessibility label/identifier/value on the DOM in my test. Here are the things I have tried:
Setting directly on the image.
UIImage *uiImage = [UIImage imageWithData:bfCaseStudy.image];
uiImage.isAccessibilityElement = YES;
uiImage.accessibilityLabel = bfCaseStudy.name;
uiImage.accessibilityValue = bfCaseStudy.name;
uiImage.accessibilityIdentifier = bfCaseStudy.name;
CGContextDrawImage(context, [self rectForAttr:bfCaseStudy], uiImage.CGImage);
Setting on the Core Image
UIImage *uiImage = [UIImage imageWithData:bfCaseStudy.image];
uiImage.CIImage.isAccessibilityElement = YES;
uiImage.CIImage.accessibilityLabel = bfCaseStudy.name;
uiImage.CIImage.accessibilityValue = bfCaseStudy.name;
CGContextDrawImage(context, [self rectForAttr:bfCaseStudy], uiImage.CGImage);
Either way produces the same result. Here is the UIAutomation code trying to access the information.
UIALogger.logDebug(bookTwoHelper.mainWindow.images()[5].label());
UIALogger.logDebug(bookTwoHelper.mainWindow.images()[5].name());
UIALogger.logDebug(bookTwoHelper.mainWindow.images()[5].value());
Debug: (2013-02-25 16:06:33 +0000) - (null)
Debug: (2013-02-25 16:06:33 +0000) - (null)
Debug: (2013-02-25 16:06:33 +0000) - (null)
Here is the relevant portion of the DOM
UIAImage "(null)" {{0, 149}, {316, 55}}
Is there a way to set an accessibility label/identifier/value on an image that is drawn using core graphics?