This is a migrated thread and some comments may be shown as answers.

Detecting foreground color

1 Answer 69 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Travis Acton
Top achievements
Rank 1
Travis Acton asked on 23 Jun 2010, 06:25 PM
I may have overlooked this but I cannot find a way to detect forground color of text. ANyone care to point me in the correct direction?

My problem in more detail.

I am using a coded test with the telerik framework. I am at a spot to where I have the test quering data from a db, looping through the items and verifying that they are contained within a specified combobox and everything is running great. A new development task was made to change the text color depending on a variable so I will now need to not only do a check on if the items exists but also the foreground color of the textblock. Any ideas?

1 Answer, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 23 Jun 2010, 09:35 PM
Hello Travis Acton,

Using the Developer Edition you can craft and record a verification step that verifies the computed color matches a particular value. Follow these steps:

  1. Navigate to the page containing the text you want to verify the color of.
  2. Turn on highlighting.
  3. Hover over the text to be verified and wait for the blue nub to appear.
  4. Click on the blue nub to open the Element Menu.
  5. Click the Build Verification button. The Sentence Verification Builder will open.
  6. Create a verification like the one shown in the verifycolor.png screenshot. This screenshot is for verifying the foreground color is Blue. Your color will probably be different.
  7. Click OK to save the verification as a step to your test.

Now you also mention about using a coded test. If you convert this verification step to code it will come out something like this:

[CodedStep(@"Verify 'ColorAndBackground:Color' style 'Exact' '#0000FF' on 'Text2Span'")]
public void IpsumLoremDolor_CodedStep()
{
    //Verify 'ColorAndBackground:Color' style 'Exact' '#0000FF' on 'Text2Span'
    Pages.LoremIpsumDolorSitAmet.Text2Span.AssertStyle().ColorAndBackground(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.HtmlStyleColorAndBackground.Color, "#0000FF", ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.HtmlStyleType.Computed, ArtOfTest.Common.StringCompareType.Exact);
}

Greetings,
Cody
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Travis Acton
Top achievements
Rank 1
Answers by
Cody
Telerik team
Share this question
or