Forum Discussion

leandropoblet's avatar
leandropoblet
Frequent Contributor
12 years ago

Test labels' content is displayed properly (WPF)

Hi,



I'm trying to find a way to determine if some labels are showing its content properly (all the content visible).



For example in a grid header I'd like to test if the label is shown completely or if its truncated (shrinked).



Ex:  (correct)

|Status|

|            |

|            |

|            |



as oposed to: (fail to display the whole word)

|Stat|

|       |

|       |

|       |



I tried VisibleOnScreen but it doesn't fail on shrinked labels since they are partially visible.



Cheers,

Leandro



13 Replies

  • Marsha_R's avatar
    Marsha_R
    Icon for Champion Level 3 rankChampion Level 3
    What if you build an Excel sheet with your known values on it in rows with one row for each language?  Store the names of days and months and anything else you need to translate, then call your test with a parameter = testlanguage so you can find the proper row.



    For something like a report title or a field name that doesn't change from test run to test run, you can just compare what's on the screen to the content of the appropriate cell.



    For something like a date that will vary, you can construct it at the beginning of the test and save it in a variable.  Get the day and the year from aqDateTime  and add it to the month from the Excel sheet.  Do your comparison in the test with that variable.  If it's truncated on the screen, it won't match the one in your variable.



  • leandropoblet's avatar
    leandropoblet
    Frequent Contributor
    Marsha, thanks for your reply.

    It's one of the many solutions I understand we can implement but still doesn't do what I need to do.



    I'll give you an example:



    The login screen has a Cancel button which has a fixed width and height.

    In German "Cancel" is spelled "Stornieren" (or whatever google translate says).



    Now the content of the property holding the value is OK every time: it holds either "Cancel" or "Stornieren" depending on the language being used.



    So far so good, now the fixed width and height are playing here because "Cancel" is only 6 chars long whereas "Stornieren" is 10 chars long.



    Now both cancelButton["WPFControlText"] properties will contain the whole word no matter how long it is. But on screen the German word might be truncated

    to lets say 6 chars: "Storni".



    You see why having a spreadsheet wouldn't help to actually compare what's on screen?



    To compare the content itself I've got a few ideas and we even have a spreadsheet containing all the labels and error messages and so on in all different languages to be checked.



    But there's no easy/straight forward way to check the whole content of a label(or any other control) is being displayed complete.


  • Hi Leandro,


     


    You can try playing with the OCR feature. The idea is that you can interpret your button as an image on which TestComplete identifies the written text. Please refer to the "Using Optical Character Recognition - Overview" article for details.


     


    Another idea is to use Region Checkpoints. This approach is more reliable as compared to the previous one. However, it requires much more time to prepare data for the test. You will need to create checkpoints for each button where the entire text is written. During the test, you can compare the actual/displayed image of the button with the stored one. If they are different, the text was truncated.