Text image

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.

How about Solaris? I dont find any TIG for Solaris in the website for download. Can Solaris share the same TIG as Linux one?

regards
Ai Choo

If the applications you are automating on Solaris are using the Pango text rendering engine, then our Pango TIG should work well. If not, you can give it a try anyway, and perhaps the rendering will be close enough to work. We don’t have a TIG specifically for Solaris at this time.

Sorry for the delay in replying.

Although the PangoTIG will work for SOME apps running on Windows (particularly cross platform apps that use Pango to render the text) you will probably still want to use the native Windows TIG for native Windows applications most of the time.

I’m using Windows TIG server to try out dynamic text image. I notice that Eggplant has some default text styles for Windows classic display format. I’m wondering whether it has similar default styles for Windows XP display format? This will definitely ease our work to use the default predefined text styles without having us to define the XP text styles on our own…

The text styles you see are the only ones that are supplied with Eggplant. We provide just a few styles to get you started, because there are many possible variations. For your testing, it’s very helpful to standardize on a default initial state for your SUT, including standard appearance settings.

Then we recommend that you create a set of text styles for the various interface elements that you’ll be working with in both the host operating system and in your own application. Name each text style for the interface element (MenuItem, FieldLabel, WindowTitle, and so forth) so that you can easily create corresponding sets of styles for different environments. That is, you may eventually have WindowsClassic, WindowsXP, and WindowsVista text platforms, each containing the same style names. This will allow you to easily adapt your tests to work with any platform.

We encourage you to share information here in the forums about styles that are useful to you, that may be helpful to other people. We recognize that it could be helpful to have more styles pre-defined in Eggplant, and we may be able to provide more styles in the future if there is a consensus on what those styles should be.

I have a situation that I suspect is somewhat different from most.

First of all, using the code

			RightClick { text:OrgName, 
				textPlatform:"WindowsClassic", 
				font:"Tahoma", 
				Size:"8"}

I’m getting this error:

Selection Failed in 0:00:00 Text Image Server Unable to write Image Info to Text Image Generator 192.168.0.71:5899

Now, here’s where the fun begins: I have no direct access to the actual SUT. That belongs to the actual software developers, who do not permit me access to the logical host upon which the application resides.

Thus, I cannot install a VNC or TIG on that box. That is dictated to me by the developers, who are a third party to whom I’m working for. Apart from actually installing the apps, there are firewall issues that preclude the installation of the VNC on that system.

Instead, I am able to access that system via a Remote Desktop connection. To get Eggplant testing to work, I have a Windows XP VM set up internally, and that VM runs VNC. That’s at 192.168.0.71.

I then connect Eggplant through VNC to that internal box, and use that box to connect to the external SUT.

Almost everything is working fine so far, but I’m now starting to develop more advanced scripts that will be using elements on the screen of the external SUT that will need to have content derived from data already fed into the system, thus the need to use the TIG to look for the current derived data elements.

Any thoughts on how to achieve this?

Yes. When I said “For Windows text you must run the Windows TIG on the SUT” I was simplifying somewhat. The TIG doesn’t actually have to be run on the SUT, although that is by far the most common (and usually desirable) setup.

In fact, though, the Windows TIG can be running on any Windows machine that Eggplant has access to. In your case, it could be running on your XP “bridge” machine (which is the SUT, as far as Eggplant is concerned), or it could be on a different Windows machine. If the TIG is running anyplace other than the current SUT, just specify the host where it’s running in the Text Image Generator section of the Text pane in the Eggplant Preferences panel. (This can also be specified within your script if you need to choose the TIG dynamically, but it’s simpler to do it in your Preferences.)

Once you have it set up, Eggplant will ask the TIG machine to generate text images whenever they are needed, and then search for those images on the SUT. So it’s important that the TIG and SUT be configured similarly (for any settings that may affect text rendering), but they don’t have to be the same machine.

Your setup is somewhat challenging, but you should be able to make it work.

Purrr-fect.

Many thanx.

Early on we mentioned that we just need to set text platform at the beginning of the script before using it.

if OSType = "Win" then 
    set the CurrentTextPlatform to "Windows" 
else 
    set the CurrentTextPlatform to "Linux" 
endif

In my case, I have modularized Eggplant scripts into different test suites. My test is executed from A.suite, which in turn will use some functions define in B.suite and C.suite. Some of the GUI controls in B.suite and C.suite are activated with dynamic text image.

How should I set the text platform in this case?
Option 1: Should I set it in every test suite (A.suite, B.suite and C.suite)? Or,
Option 2: Can I assume I just need to set the text platform once in A.suite? Subsequence calling of the functions from B.suite and C.suite will automatically know which text platform to use for text image…

My preference is to use option 2. Is there any other better way to do this? Please advice.

Thanks
Ai Choo

regards
Ai Choo

Yup, approach #2 should work just fine.

set the currentTextPlatform to "ChosenPlatform"

That should affect all subsequent text generations (that don’t explicitly override the textPlatform)

Hi.

I would like to use text image to click an OK button on Windows Vista from Mac through Eggplant. I have connected to Windows machine using VNC.

I got an error when I run script
MoveTo (Text:“OK”,TextStyle:“Button”)
–Unable to find the Text String ‘OK’ on screen.

But it works when I run
MoveTo (Text:“K”, TextStyle:“Button”)

May i know how to solve it?

The most likely thing that this suggests is that the spacing between the letters on the screen is different than the image that is being generated by the TIG. One idea is to experiment with fractional text sizes (such as 9.5, or even 9.25) and see if that matches better. That may render the characters the same, but change the spacing slightly. We’ve seen this sort of thing on some platforms (I don’t have access to Vista right now to try it).

Let us know if that helps.

It does not solve it.

Besides, when i try to use text image in another text “Text File” and “Block Symbol File”, it outputs “Unable to find the Text String” for Text:“File”, Text:“Block” and Text:“Symbol”. But it can recognize Text:“Text”.

It sounds like the TIG-generated image is close, but not quite right. Assuming the TIG is running on the SUT, it’s probably not a configuration issue. So either the font or size is wrong, or the application is rendering the text differently than the TIG. Is the application written using standard Windows methods to draw text, or something else? What application is it?

In Vista’s display personalization settings, if you choose Vista Basic, then click on Advanced button, you can see a list of font/color settings for different items (e.g. active title bar, tooltip, menu etc).
I notice that the property of button (like the OK button shown by moon) is not there. The nearest property that is similar to button will be menu. If we try to use the menu property for button, Eggplant is unable to recognize text image correctly. Is there a quick way to setup the exact property for button?

Since Vista is also another popular testing platform, just want to know whether Redstone has the plan to setup the Vista control properties for us (just like the Window Classic properties are available by default in Eggplant). Such availability will definitely help us to fully utilize Eggplant for our testing work.

regards
Ai Choo

Thanks for the tip on Vista’s personalization settings. This may be helpful to people in creating text styles that match their SUT configuration. The best way to determine an unknown font and size is to use a small script that cycles through the most likely fonts and sizes while searching for some known text that is visible on the SUT. See this topic for an example script.

We will consider adding additional text platforms to those that ship with Eggplant. In the meantime, if you discover some text attributes that you find useful, we encourage you to share them here so other people can benefit.