Text image

Hi,

Im trying to do to use "text image" against a WindowsXP SUT.

First I got "Error generating Text Image. Unabble to write Image info on text image Generator <ip>". So I figured that Im missing a TIG on the SUT. But I cant find any Windows TIG for download.

So, I changed Eggplant preferences to use Native TIG instead. But that did not solve my problem.

I have setup a simple test. Just opened a empty document in WordPad. Wrote the text "Video Server" with font Tahoma, and size 8.
But Eggplant does not recognize the text?

Any suggestion on what Im doing wrong?

Regards
Tommy S
«1

Comments

  • Looks like you are missing the s in downloads in the URL your are using.

    The link on this page is working.

    I think it's also part of the Eggplant.dmg package.
  • thanks.

    I followed a link from another post. I seems as both
    http://www.redstonesoftware.com/download/
    and
    http://www.redstonesoftware.com/downloads/
    exists. But only the later has working links. Mayby someone att redstone software should remove the nonworking page...


    Anyway, I got TIG on windows to work.
    But having some issues with the text recognizion.

    I have opened a wordpad document containing the text "Video Server" with font Tahoma, and size 8.

    Eggplant has trouble finding a text match. Noticed that if I write "Video Server." in Eggplant, the text matches. Some pixels is missing from the last character in the preview window without the extra "period". So by putting the extra period there the whole last character is rendered and the period is missing instead.

    Is this a bug, or is there any settings that must be set so that the whole textimage is rendered correctly?

    regards
    Tommy S
  • JonathanOSXJonathanOSX ForumAdmin admin
    Text Images have a one pixel border around that outside that is only partially used for matching, although it doesn't show up in the display it's still there (you can actually see it if you temporarily switch the search type to Precise)

    So you shouldn't need to append a "." to all your text strings, I wonder if the first time there was something wrong because adding more to the end of your string should never cause Eggplant to match it when the substring was unable to match.
  • But then something else is wrong.

    This does not work:
    DoubleClick (Text:"Video Server", TextPlatform:"WindowsClassic")

    This command works:
    DoubleClick (Text:"Video Server.", TextPlatform:"WindowsClassic")

    I have no "." in my wordpad document. Only the text "Video Server" + an empty line after it.
  • JonathanOSXJonathanOSX ForumAdmin admin
    That's working well here when I try that string on Windows XPsp2, just a few things to check...

    First, is your insertion point located in the string, that can interfere with the image match.
    Second, what is your Font Smoothing set to (this shouldn't be impacting it since the Windows TIG should use the same setting).

    If you would like to post a screen shot we can look and see if it's matching here.
  • The insertion point is on the empty line after "Video Server".

    I have no font smoothing enabled.

    A screenshot is attached.
  • JonathanOSXJonathanOSX ForumAdmin admin
    I was able to match on your screen shot right away.

    First check that you haven't modified your default setting for the WindowsClassic TextPlatform (meaning that the default style is still Tahoma, 8, black on white).

    Assuming that's all in order please look in your suite for the actual generated image (TextImages/WindowsClassic/Tahoma_8_#000000_#FFFFFF/+Video +Server.tiff and post that here also so we can see why your image isn't being generated correctly.
  • I found the error.

    Solved it by renaming directory "TextImages/WindowsClassic" to "TextImages/WindowsClassic_bak".

    I think that my experiment with native TIG generated a set of images. And when I installed the windowsXP TIG the images already existed, so Eggplant did not regenerete them.

    Thanks for the hints!
  • JonathanOSXJonathanOSX ForumAdmin admin
    Glad you got it solved! We are moving away from using the caches by default which should avoid these sorts of difficulties.
  • I followed the steps in this thread and managed to use text images successfully in Eggplant. I've a question: how do we capture the text image for re-use purpose. I'm trying to avoid repeating the same text and its properties all over the place. Can we cache it to somewhere else? My trial to use CaptureTextImage didn't work. Any idea on this?
  • JonathanOSXJonathanOSX ForumAdmin admin
    The idea with Text Images is that if you have a set of text attributes that you will use repeatedly then you should store that in a Text Style using the Preferences -> Text interface. For example:
    MenuStyle => (TextFont:"Helvetica", TextSize:14,Bold:ON)
    
    Then, anytime you need Text to match you insert a simple string in your script:
    click (Text:"File", TextStyle:"MenuStyle")
    
    If you have other references in the same run to (Text:"File", TextStyle:"MenuStyle") Eggplant will continue to use the same image (through an internal caching mechanism).

    If you ever need to redefine your style (because of a change in the interface) now you can just modify your style in the preferences and all your tests will be "converted":
    MenuStyle => (TextFont:"Helvetica", TextSize:14,Bold:OFF)
    
  • Thanks for the pointer, Jonathan.

    This means that if my test is designed to run on different platforms (e.g. Windows, Linux), then I have to define 2 sets of textStyle. For example, I write sth like this in my script, is it?
    if OSType = "Win" then
        click (Text:"File", TextStyle:"WinMenuStyle")
    else
        click (Text:"File", TextStyle:"LinuxMenuStyle")
    endif
    

    How about TIG? I've to run 2 TIGs on Windows and Linux platforms respectively?

    According to Using Eggplant manual (under Text Image Generators), the native TIG platform can support Mac and Windows XP. I have set it to Native and run my application on Windows XP platform (without running TIG server on my run machine), Eggplant failed to detect the text image that I have defined. It only works when I changed to Host and switched my desktop appearance to Window Classic style. I'm just wondering whether there is a way to run the Windows TIG server downloaded from Eggplant to identified text image in Windows XP style. Please advice.

    p/s: My question is kind of long here...I'm a dummy to Eggplant :)

    Thanks for your time.

    Regards
    Ai Choo
  • Hi

    I've another question on text style definition. Eggplant reference states that we can define text style through Text Image Sheet. I can see that it allows us to define some common text properties (e.g. font, size, color, platform etc). However, I find that properties like hot spot, image name, image path, trim etc are not in the dialog. How are we going to include such properties in the text style definition?

    regards
    Ai Choo
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    This means that if my test is designed to run on different platforms (e.g. Windows, Linux), then I have to define 2 sets of textStyle. For example, I write sth like this in my script, is it?
    if OSType = "Win" then
        click (Text:"File", TextStyle:"WinMenuStyle")
    else
        click (Text:"File", TextStyle:"LinuxMenuStyle")
    endif
    
    You could do it that way, but the TextPlatform mechanism is designed to make this much simpler. Basically, you define a text platform for each system and define matching text styles for each platform. So in this case you'd have a "Windows" platform and a "Linux" platform, and define a "Menu" style for each platform.

    To use this approach, somewhere near the beginning of your script you would select the text platform for the system that you're testing:
    if OSType = "Win" then
        set the CurrentTextPlatform to "Windows"
    else
        set the CurrentTextPlatform to "Linux"
    endif
    
    Once the CurrentTextPlatform has been set, any text styles you use will take their definition from that platform (as configured through the Text section of Eggplant's Preferences). So you can simply say:
    click (Text:"File", TextStyle:"Menu")
    
    How about TIG? I've to run 2 TIGs on Windows and Linux platforms respectively?

    According to Using Eggplant manual (under Text Image Generators), the native TIG platform can support Mac and Windows XP. I have set it to Native and run my application on Windows XP platform (without running TIG server on my run machine), Eggplant failed to detect the text image that I have defined. It only works when I changed to Host and switched my desktop appearance to Window Classic style. I'm just wondering whether there is a way to run the Windows TIG server downloaded from Eggplant to identified text image in Windows XP style. Please advice.
    For each text platform that you define in Preferences, you specify the generator that it will use. The Native generator uses the Mac's native text rendering engine, and should be used only when scripting against another Mac. For Windows text you must run the Windows TIG on the SUT. New in Eggplant 4.1 is a Pango generator (available as a separately downloaded bundle) that runs within Eggplant but generates text that can be used with many Linux applications (and some on Windows as well).

    I hope that helps to clarify the situation.
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    I've another question on text style definition. Eggplant reference states that we can define text style through Text Image Sheet. I can see that it allows us to define some common text properties (e.g. font, size, color, platform etc). However, I find that properties like hot spot, image name, image path, trim etc are not in the dialog. How are we going to include such properties in the text style definition?
    Text styles are defined in Eggplant -> Preferences -> Text under each text platform. A style includes text properties like the font name and size, color, bold, etc.

    Generated text images don't have an image name or path. They are identified by their text and style.

    For generated text images, image properties like hot spot and trim must be specified in your script. Typically you would do this directly in your image property list:
    click (text:"Address:", style:"FieldLabel", hotSpot:(100,5) )
    
    It's also possible for a script to add such properties to a style and then use that style, but not very common in practice.
  • Which means with the use of text image, GUI control identification in Eggplant no longer relies on screen resolution, right? I believe this is a great news to all the GUI testers :)
  • I wish to use Pango to test out text rendering on Linux. I hope to get detailed steps on how to activate this TIG.

    If I am not mistaken, we have to run the Pango TIG on Linux machine is it? I did once before for Windows TIG, on my Windows machine. So, I assume the step should be the same? Please advice

    Thanks
    Ai Choo
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    Actually, the Pango TIG works differently than the Windows TIG. The Pango TIG installs on the Mac and gets loaded directly into Eggplant.

    To install it, download the TIG from our downloads page onto your Mac, uncompress the download archive, and install the bundle into your /Library/Frameworks/ directory. Relaunch Eggplant, and it will locate and use that generator when needed.
  • It is mentioned that Pango can work for some of the Windows text also. How much this is supported?
    Does this mean that I no longer require Windows TIG?
    Pango is for Linux, right? How about Linux SUSE etc? Is it still working?How about Solaris?
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    Unfortunately there is no simple answer when it comes to text rendering. Most applications on Windows draw text using the same routines used by the operating system itself, but some use other text engines such as Pango.

    Similarly, on the Linux side, there are many applications that use Pango to render text but there are also other text systems in use. These complications obviously make text image matching more difficult.

    On Windows you'll most likely have the best success using the Windows TIG, but if you are automating a Mozilla product (Firefox or Thunderbird) you'll probably do better using the Pango TIG, because Mozilla uses Pango to draw text.

    If you are testing your own software you can ask your developers what text rendering library they use. For automating software written by others, if one Text Image Generator doesn't work you may have to try another to see if it does a better job of matching the text in question.

    One final note: In some situations, we've seen text that could only be matched at fractional point sizes (e.g. 11.5 point rather than either 11 or 12) so this may also be worth trying if you're dealing with a hard-to-match case.
Sign In or Register to comment.