TIG Limitations?

So here is what I am wondering. I believe that all of these are not supported but not to sure.

Can you use multi line text images with the TIG? Also if you can do this can you set the justification to center, left or right aligned.

Also I was wondering when you use the text image button on the SUT window you get a preview of what the TIG will generate. Is there any way to grab that preview. I was wondering because we normally generate a expected(the actual picture we are looking for) and a actual what is actually on the SUT screen when a image search fails but we can’t grab the image that the TIG generates or don’t know how.

Hi, Jeff,

If you want to try generating multiline TIG images, you can hold down the Option key and press enter to insert a carriage return in your string. There’s currently no control over the line spacing or the alignment, so you may or may not have much luck with that.

You can force Eggplant to save the images by turning on caching of the TIG. One caveat to that is that once the image of a particular string has been generated, it won’t be regenerated – this is occasionally a problem because some changes that you make directly to the code won’t propagate to the image until you delete the cache for that string (I don’t remember the particulars of when this is an actual issue, but I have seen a couple of cases where it mattered). To turn on caching, open a terminal window and enter the following command:

defaults write com.redstonesoftware.eggplant TextCache YES

Note that this command is case sensitive.

Where is the location that they are cached to?

Also isn’t text caching turned on by default. That is what the documentation said.

The documentation is a little out of date as far as that topic goes. We found that caching was generally unnecessary given the speed at which the TIG creates images, and caching has some undesirable side effects as I mentioned, so we have disabled it by default in the latest releases of Eggplant. The images will be saved in a TextImages folder at the top level of the Suite folder.

As mentioned above I have tried with “Option+Enter” for multiline text image but unable to execute the command due to syntax error. Can any one post an example for the same.

If you click the Text Image button and then type something like “This is” then press the Option and Enter keys followed by the string “some text.”, you will get a TIG line that looks something like this:

Click (Text:"This is" & quote & " & return & " & quote & "some text.")

While this works in theory, I doubt that you’ll match anything with it since you have no control over the line spacing.

Actually, further research reveals that while the approach above gives the appearance of working, it’s actually generating an image that looks like:

This is" & return & "some text.

You can really only see this when the caching is on, but regardless it’s not what we’re looking for. I’ll pass this on to the developers because I think the behavior constitutes a bug – if it’s not actually honoring the return, it probably shouldn’t allow it in the field.

Actually, while it might be considered to be a bug in the Text Image Generator panel (that it doesn’t deal properly with text that you enter using Option+Enter to include returns), you can still try this manually in your script like this:

Click (Text:"This is" & return & "some text.")

There is still no guarantee that this will work for you. Fundamentally, the TIG system doesn’t have any special support for multi-line text at this time.

Another approach you might consider (depending on exactly what you need to do) is to look for each line of text individually, something like this:

put ImageLocation(Text:"This is") into firstLineLoc
Click (Text:"some text.", SearchRectangle:((0, firstLineLoc.y), RemoteScreenSize()))

This example uses a SearchRectangle to ensure that the second line appears somewhere below the first line (although it could be anywhere in the lower “half” of the screen). With a little work you could construct a search rectangle that would limit the search to a smaller area directly below the first line. There are some useful SearchRectangle example functions here that may give you ideas on how to go about this.

You may also need to get the location of the second line and use that to calculate some other location, rather than simply clicking on the second line as my simple example does.