Detecting foreground color

2 posts, 0 answers
  1. Travis Acton
    Travis Acton avatar
    13 posts
    Member since:
    Jan 2010

    Posted 23 Jun 2010 Link to this post

    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?
  2. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 23 Jun 2010 Link to this post

    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
Back to Top