TextImages and Office 2007

I am in the process of trying to write some tests for functionality that is in the Office 2007 suite of apps. I would like to use TextImages to identify the main window, say Excel, & then interact with it. However I can’t seem to get Eggplant to recognize it. I type in the code use the color picker to select both the text & background color but the code doesn’t insert or if it does it doesn’t work when I re-run it.

I have tried using both Eggplant & other software to determine the color of both the text & the caption bar, but it still doesn’t work. I have tried changing the Office color scheme to black or silver, but it still fails.

Anyone ever run into this issue? Anyone have any ideas around it? I would like to use TextImage whenever I can rather than actual images.

Thanks.

__Chris

Could be any number of things…do you have font smoothing off? Is it an LCD with sub-pixel alignment on? Did you compare the text with a screen capture in Eggplant per page 14 of “Using Eggplant” to see the cause?

v

viztester:

Yes I have font smoothing off or more correctly I have “smooth edges of screen fonts” off. I have no idea about the sub-pixel alignment but I will look into it. No I have not compared the text w/ a screen cap as per page 14. I will do that tomorrow.

Thanks.

__Chris

You don’t say what font(s) you are specifying – are you sure that you have the correct font face and size? If this is a Windows machine and the font size is 10 pts or smaller, try reducing the specified size by .25 pts (so 8 pt becomes 7.75 pt).

Please also consider that sometimes, even when you’re dealing with text, plain old image capture is the best approach. The TIG was not intended to replace image capture, but rather to provide a mechanism for dealing with situations where image capture was difficult or the sheer number of images that would be required (as in data-driven testing) would be prohibitively large.

I seem to recall that “Segoe UI” at 8.75 worked reliably in the past for identifying window titles.

You may want to ensure that the state of the window is correct, as the background color and text color could change slightly otherwise.

Here’s a link to the default fonts used in Windows Vista (scroll about 1/3 down for a handy list):
http://msdn.microsoft.com/en-us/library/aa974176.aspx

viztester:

I looked at the steps on pg 14 & they seem to be referring to when you have a problem using an image whereas I am using a textimage. There is not source image to compare against the screen error. Capturing an image of the caption works fine.

EggplantMatt:

I was specifying Tahoma 8pt font. This is what the screen ocr app that I was using was telling me the font was. As it turns out that was not the case. Which I found out after reading jruuska’s post. As for using images rather than textimages. I can understand what you are saying. However the UI that I am interacting with is in the process of changing, plus in the future I believe that they will be adding the ability for individual customers to reskin the app, so reducing the number of images I have to re-capture is important. Not to mention that in a lot of cases I am simply trying to navigate somewhere so using a textimage to specify the menu item, which itself could change, is a lot easier.

jruuska:

I did account for the state (i.e. - active or inactive). Turns out that the screen ocr app I was using to get the font was incorrect. Using your link I was able to determine the actual font. Once I specified “Segoe UI” as the font my code worked.

Thanks to you all for your help so far it seems to be working.

__Chris

And for anyone else with this issue I found that the following worked for me when interacting with Microsoft Excel 2007 with the Blue color scheme on a Vista machine whose color scheme was set to Windows Standard.

Font: Segoe UI
Size: 8pt
Text color: 55,109,169 (active); 160,160,160 (inactive)
Background color: 211,230,250 (active); 220,228,237 (inactive)

Yes, there is an image. There’s ALWAYS an image somewhere: go to your-suite/TextImages/ and locate it :-).

Actually, there’s no TextImages folder these days unless the TextCache dwrite has been deliberately set to YES. We originally had the TIG set to cache images, but there are some occasional unwanted side effects with that, and the generation of the text images occurs quickly enough that we determined the caching wasn’t very useful so it’s off by default.

For those of you keeping score at home, thats:

defaults write com.redstonesoftware.Eggplant TextCache -bool YES

and this is useful because your text is stored in your.suite/TextImgaes, which you can drag into images folder and use the image doctor on, while we eagerly await TestPlant to write that font recognition text image doctor :-).

v

Just as a word of caution – we really do not recommend running with the TextCache always on. If you have a particular image that isn’t working for you and you want to image doctor it there is a pretty simple procedure.
[list]Run a script with the line that includes the Text Image
Open the results and highlight the line with the Text Image
Double Click the image to open it in Preview
In Preview choose SaveAs… and save it to your Images folder proper.
[/list:u]

Cool, Jonathan. So my next request is to make this easier!

For now, you can also command click on the suite name in the title bar, open up the suite in Finder, navigate to Images, command-tab back to Eggplant Results, drag the TextImage from the results window (upper right) while command tabbing back to Finder and dropping into Images.

Maybe the Images tab could accept drag, become key, and even let me navigate to sub-folders? :slight_smile:

v