Changing and verifying column order in an NSTableView

Howdy,

We are about to purchase Eggplant for our next project, and I am curious if I can accomplish the following in Eggplant…

? I am working in Leopard and Tiger in OS X.
? For localization testing reasons I will be working almost exclusively with data driven testing.

My interface will have a table view with say four columns in it, “One”, “Two”, “Three” and “Four”. These columns will be draggable such that their order can change.

I want to be able to record the initial order of these columns, drag a column to a specific location in the column order, and then evaluate that the table view contains the columns in the new order.

Is this feasible in Eggplant, or should we be thinking of a manual test for something of this ilk?

Thanks for any and all assistance.

Steve O’Sullivan

Sure, you can script this. I suggest that you capture images of the column titles (the script below uses the image names “One”, “Two”, “Three”, and “Four”). Then do something like this:

set columnNames to ("One","Two","Three","Four")
set orderedLocations to an empty list -- (this isn't strictly necessary)
repeat with each item of columnNames
  set loc to imageLocation(it) -- find that image
  insert (name:it, location:loc) into orderedLocations
end repeat

sort the items of orderedLocations by each.location.x
put the name of each item of orderedLocations into orderedNames
put orderedNames

This bit of code locates all of the column headings on the screen, creating a list of items containing the name and location of each heading. That list is then sorted by the x coordinates of each location so the list will be in left-to-right order as they were found on the screen. The last line extracts a list containing just their names.

That was beautiful! It took me awhile to get it to work with data driven testing, but it works, clean as a whistle!

Thanks so much!

Steve O’Sullivan

:smiley: