UI Automation - How to distinguish image being displayed - xamarin.forms

I am very new to UI Automation and using Inspect tool (Inspect.exe Microsoft tool), so please explain.
I have a UWP application showing a list view, each list view item looks like this
The little circle in Image block above is the InteriorColor Image that is a solid color circle (black, gray or brown).
If I use Inspect.exe tool and hover over the little circle InteriorColor Image, it shows AutomationId = InteriorColorIcon which is the name I give it in my XAML:
<Image x:Name="InteriorColorIcon" Source="{Binding InteriorColor, Converter={Static Resource InteriorColorImageConverter}"
Above, bindable property InteriorColor is of string type and I use a converter to convert that string into the image of correct color.
So, if InteriorColor == "black", my converter returns resource image Black.png like:
return new BitmapImage(new Uri("ms-appx:///Black.png"));
I would like to write UI Automation to detect if the little circle InteriorColorIcon image is the image of correct color. If I hover over the image in Inspect.exe tool, it shows its AutomationId = InteriorColorIcon, that is great.
But how do I confirm that the image is Black, or Gray, or Brown?
Is there a way to add somehow a property to the image in XAML that Inspect tool can see and that I can use in my UI test to verify that the image showing is the correct image?
I assume that detecting color would be difficult, but is there a way to add a string property or something along these lines that could be used for this purpose?

Always set the AutomationProperties.Name for an Image. This is necessary for your Image to be read correctly from a screen reader. The Automation Name being "InteriorColorIcon" is an accessibility bug in your app. It should be something more descriptive, such as "Black image" (or whatever a black image indicates). Similarly, you can set the AutomationProperties.AutomationId to something useful to your testing.
See Expose basic accessibility information
<Image x:Name="InteriorColorIcon"
AutomationProperties.Id="{Binding InteriorColor}"
AutomationProperties.Name="{Binding InteriorColor}, Converter={Static Resource InteriorColorDescriptiveNameConverter}"
Source="{Binding InteriorColor, Converter={Static Resource InteriorColorImageConverter}"
If you want to check the actual image then that's more difficult. You'll need to screencapture the Image's location (see UIA_BoundingRectanglePropertyId) and then compare the pixels of the capture with your reference image.

Related

displaying icon image inside content property in IDE

the picture of code, in "content" property, it's value is a shape!
,
as you see in above image, specific part of my code!
I have style sheet in a project (that has been written before by another) that it have some css codes, and inside that, like bellow, have a property that, inside its value, it shows icon image!
i cant understand that, how inserted/created that!
my code:
.o-icon--close:before {
content: "";
}
my problem:
how he/she has written/created that icon shape inside CONTENT property.
it isn't a copy/paste an icon shape.
it isn't a text code!
as here isn't IDE, it shows a vertical rectangle, but in IDE it is shape of icon itself! like a music sign or what ever.
i know that, for CONTENT value, we can use fontawesome codes or other texts, but i can't understand how insert icon itself as a shape!

Verifying the presence of an image inside of a textbox using SmartBear TestComplete with JScript

I am testing a web application using JScript in TestComplete and need to verify that a WordWheel TextBox includes an image of a magnifying glass inside of it. And that when text is entered, a red x appears over the magnifying glass. See the image below. I dont need to know what the image looks like, just need to maybe find a property I can use to verify that it exists. Or maybe more properties to verify that the red X appears, etc.
For design reference, this is how I verify the text font style of that text box below:
if (searchTextBox.currentStyle.fontStyle == "italic" && modulesTextBox.currentStyle.color == "gray")
{
Log.Checkpoint("The text box font is gray and italic");
}
else
{
Log.Error("The text box font is not gray and italic);
}
Is this possible?
EDIT: Well it looks like I need 10 reputations to post images. How do I get reputations? In the meantime, I can email the picture in question.
You could use TestComplete's QuerySelector method to find the needed object by its CSS attributes. For example:
//JScript
CSSSelector = "div#main-nav a[target=blank]";
res=TestedPage.QuerySelector(CSSSelector);
This article contains additional information you may need:
http://smartbear.com/viewarticle/55769/

place image button over the image background on android

in my app i have a background image and need to place an image button at the specified location of the background image.i did by using frame layout with android:layout_gravity,layout_alignBottom and marginLeft and right properties. please refer image no :1
i set it for one emulator and it works but i get wrong when launch other emulator of different size so how to set image view over a background image so that imageview not changes its position for any size of screen.
Is there any possibilities to trigger action find by touching image button on the screen(both background image and image button combined as single image - please refer Image no 2)
For this kind of problem, I would think that the best solution in order not to have problem with the screen sizes/densities would be to have different images for the play phase, stop etc.
Thus having:
microphone with play button: 1 image
microphone with stop button: 1 image
microphone with play selected button: 1 image
Etc. and handling the user events.
Hope this helps!

textinput box with inline image

Is there any way to create a textInput box for flex mobile with inline image without using textflow ?
Basically i need a text input component , so that user can just use it as normal text input box but to it images can also be entered inline with text. To enter images user can select the image from list and that image will get inserted at the current cursor position.
If you look at any platform, there is no user experience (as far as I've seen) that lets you add images in the text input box. It's always been straight text, except for android which replaces certain text with icons (like :-) becomes an android icon). I don't think your users would expect that behaviour. If you really do need it, I would recommend you create a custom skin for your textinput box and add that feature into it, but it won't be easy to do.

Flex Change image color dynamically?

I have a image declared like the following:
[Bindable]
[Embed( source="assets/banana.png" )]
public var iconBANANA : Class;
It is involving into itemRenderer, but I wish to change the color of the image when some event occurs (like clicking above or something).
The rest of the objects used the image shall remain unchanged, only the object on which the event has occurred shall change the color of the image.
But the biggest question is :
How to change the image color mainly - like there is a Blue area on image - to turn it on Green, or Yellow ?
I believe what you're looking for are Filters. What you're explaning (changing one color to another) is not exactly trivial and going into some fairly complex image manipulation but you can get some results using the ColorMatrixFilter.
You're looking for beginBitmapFill.

Resources