Is there any functionality in Telerik testing framework to work with colour data in WPF application?
I need the following:
1. To be able to get colour information by specifying x and y of mouse coords;
2. Check that the difference between two colours is not more than some value (for example, there is a red color and gray red, and the method returns true or some value).
Thank you.
Kind Regards,
Stanislav Hordiyenko
5 Answers, 1 is accepted
Thank you for contacting Telerik Support.
1) I am afraid, this is still not possible with Telerik Testing Framework.
As you might remember, a few months ago, after your request, we logged a feature request for implementing ElementFromPoint() method for WPF. Unfortunately it is still not implemented.
In order to get color information for WPF application, you need to know the FrameworkElement.
So it gets specific for the actual application that you want to test.
2) In order to do this, you will need to write your own method or search for a method that might work for you. Here you may find useful information and more links.
Please don't hesitate if you have additional questions.
Velin Koychev
the Telerik team
Test Studio Trainings
I was able to implement a workaround. The framework element contains a method: .Capture() which returns the bitmap of the element. Then, I can read color information with .GetPixel() method.
I do remember that in Telerik testing framework there are several methods to compare images (with some threshold) but I can't find them. There is an image, and because of the issue with .Source property I can't read its URI. Can you help me to recall them?
Thank you.
Kind Regards,
Stanislav Hordiyenko
Great that you have managed to find a workaround for this.
Indeed Telerik Testing Framework has several methods for comparing images.
ArtOfTest.Common.CompareUtils.ImageCompare (Bitmap imageA, Bitmap imageB, Rectangle selectionArea, int tolerance)
You can also use:
ArtOfTest.Common.CompareUtils.ImageExactCompare(Bitmap imageA, Bitmap imageB)
Unfortunately there is no workaround for the .Source property issue.
All the best,
Velin Koychev
the Telerik team
Test Studio Trainings
Thank you. It is working as you described.
Kind Regards,
Stanislav Hordiyenko
It is good to hear that I have helped. Let me know if you need further help.
All the best,Velin Koychev
the Telerik team
Test Studio Trainings