This is a migrated thread and some comments may be shown as answers.
Working with colour data in WPF application
5 Answers 18 Views
This is a migrated thread and some comments may be shown as answers.
Stanislav
Top achievements
Rank 1
Stanislav asked on 11 Apr 2013, 07:00 AM
Hello Telerik,

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

Sort by
0
Velin Koychev
Telerik team
answered on 11 Apr 2013, 01:53 PM
Hi Stanislav,

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.

Greetings,
Velin Koychev
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Stanislav
Top achievements
Rank 1
answered on 16 Apr 2013, 02:50 AM
Hello Velin,

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
0
Accepted
Velin Koychev
Telerik team
answered on 16 Apr 2013, 02:22 PM
Hello Stanislav,

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)
 - performs a compare of two images and returns whether they are the same within a specific tolerance. You can also define the area within the image to compare. It returns a bool value.

You can also use:
ArtOfTest.Common.CompareUtils.ImageExactCompare(Bitmap imageA, Bitmap imageB)
-It validates whether two images are exactly the same. Also returns a bool value.

Unfortunately there is no workaround for the .Source property issue.

All the best,
Velin Koychev
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Stanislav
Top achievements
Rank 1
answered on 17 Apr 2013, 12:53 AM
Hello Velin,

Thank you. It is working as you described.

Kind Regards,
Stanislav Hordiyenko
0
Velin Koychev
Telerik team
answered on 18 Apr 2013, 10:52 AM
Hi Stanislav,

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
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Asked by
Stanislav
Top achievements
Rank 1
Answers by
Velin Koychev
Telerik team
Stanislav
Top achievements
Rank 1
Share this question
or