Checking WPF style in TestComplete
We have a GUI based desktop application built using WPF.
There are requirements to check the colour change of the GUI controls when they are clicked.
However, the application uses WPF styles and apply the different styles when some controls are clicked/toggled etc.
When I use Object spy in TestComplete, the background and foreground properties do not reflect the real colours displayed and this is most probably due to the styles being applied instead of setting the colour changes directly using the background and foreground properties.
Does someone know a way to Identify these WPF style changes using TestComplete ?
Hi,
I am not knowledgeable in WPF development, so I will try to rephrase my understanding of your question.
I am guessing that 'style' in WPF is something that is similar to the 'style' in the web development. I.e. somewhere there is a defined set of properties and their values (width, color, size, etc.) with the name assigned to it. This name is assigned to the style property of the control when the style is applied to it. Then, during runtime, the engine parses the set of properties that are included in the style and assigns properties' values to the corresponding properties of the object been styled.
For your case, the above effectively means that your tested object must have a property named like 'color' and this property should contain the value of the color that the system must use when rendering this object on screen.
So, I still think that you should talk to your developers and ask them how styling works for WPF applications. What property of the object is used to keep the color to be used which is specified in the style?
For web, every web element has a method with the name like getComputedStyle that can be used to get the actual value of this or that styled property (color, size, visibility, etc.). Maybe something like this exists for WPF as well.