Functional Tester には SubItem の事前定義セットがあり、プロキシーは記録の際にそれを使用することができます。 記録時にプロキシーは SubItem をあるポイントで判別し、SubItem の詳細を TestObject のユーザー・アクション・メソッドとともに送ります。 再生時にプロキシーは再び SubItem の座標を判別して、ユーザー・アクションが再生されます。
listBox.click(atText("Item1"));
この例では、クリックがイベントです。 atText("Item1") パラメーターは、プロキシーがポイントで検出する subItem です。 .Net の場合、GetActionArgs() API はコントロールの SubItem を 1 つ以上戻します。 どの SubItem を使用するかの判別は、コントロールごとに決まります。
以下の例は、SubItem を使用してメソッドを記録する Java 実装を示しています。
{ . . Vector args = new Vector(20); SubItem subItem = null; IMouseEventInfo event0 = action.getEventInfo(0); Point firstPoint = new Point ( event0.getX(), event0.getY() ); Point firstPointToList = new Point ( firstPoint.x, firstPoint.y ); int itemIndex = locationToIndex(firstPointToList); String itemText = ((java.awt.List)theTestObject).getItem(itemIndex); if (itemText!= null && ! itemText.equals("") ) subItem = new Text(item); else subItem = new Index(atIndex); . . args.addElement(subItem); . . }
以下の例は、SubItem を使用してメソッドを記録する .Net 実装を示しています。
protected override System.Collections.ArrayList GetActionArgs(System.Drawing.Point point) { System.Collections.ArrayList args = new System.Collections.ArrayList() ; Subitem subitem = null ; System.Drawing.Point clientPoint = ((Control)theTestObject).PointToClient(point) ; int itemIndex = ((ListBox)theTestObject).IndexFromPoint(clientPoint) ; string itemText = ((ListBox)theTestObject).GetItemText(item); if (itemText == null || itemText.Length == 0) { // item has no text so generate an index subitem = new Rational.Test.Ft.Script.Index(itemIndex) ; } if ( subitem != null ) { args.Add(subitem) ; } return args ; }
以下の例は、SubItem を使用してメソッドを再生する Java 実装を示しています。
public void click(MouseModifiers modifiers, Subitem subitem) { . . Point pt = this.getScreenPoint(subitem); new Screen().click( modifiers, pt); . . } public java.awt.Rectangle getScreenPoint (Subitem subitem) { int index = getItemIndex(subitem); if ( index == -1 ) return null; java.awt.Rectangle rectCell = getCellBounds(index); java.awt.Rectangle rectScreen = this.getScreenRectangle(); return new java.awt.Rectangle ( rectScreen.x + rectCell.x, rectScreen.y + rectCell.y, rectCell.width, rectCell.height ); }
以下の例は、SubItem を使用してメソッドを記録する .Net 実装を示しています。
protected override System.Drawing.Rectangle GetSubitemRect(Rational.Test.Ft.Script.Subitem subitem) { int index = GetItemIndex(subitem) ; return ((ListBox)theTestObject).GetItemRectangle(index) ; }