Logo QF-Test

Finding valuable answers
in the Mailing List Archive.

 

Free Trial  Download  Buy

Thomas Max, QF-Test training and support

Use the full-text search on our web site to find helpful tips on the mailing list.

Thomas Max, 
Sr. Software Engineer & Trainer, QFS

2017 up to now  | 2016 | 2015 | 2014 | 2013 | 2012 | 2011 | 2010 | 2009 | 2008 | 2007

(older archive entries before 2007 are not shown here, but included in the onsite-search)

Mailing List - Entries of 2007


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [QF-Test] tree and SUT script


  • Subject: Re: [QF-Test] tree and SUT script
  • From: "Robert Lahmer, QFS support" <support@?.de>
  • Date: Tue, 17 Jul 2007 17:39:03 +0200


Hello Huawei,

you can use the following SUT script to expand an SWT tree item:


from org.eclipse.swt import SWT

str = "$(node)"
array = None
treeId = None

if(str.find("@/") != -1):
	array = str.split("@/")
elif(str.find("%/") != -1):
	array = str.split("%/")
elif(str.find("&/") != -1):
	array = str.split("&/")
if array != None:
	treeId =array[0]

if treeId != None:
	tree = rc.getComponent(treeId)
	Event =
tree.__class__.getClassLoader().loadClass("org.eclipse.swt.widgets.Event")

	selectedItem = tree.getSelection()[0]
	if selectedItem != None:
		event = Event()
		event.item = selectedItem;
		tree.sendEvent (SWT.Expand, event);
		selectedItem.setExpanded(true)
else:
	raise UserException("Cannot find tree-id!")


For example, if you like to expand the root of the tree component "myTree",
you can do this as follows:

Set variable [node=>myTree&/0]
MPRC(1,1) [$(node)=>$(client)]
SUT script: Expand node [$(client)]


Best regards,
   Robert


--On Dienstag, Juli 17, 2007 07:16:52 -0700 Huawei Luo <hluo@?.com>
wrote:

Hi, Greg:



I have a tree, which have 12 dirrect children, each children has its own
children. And this tree, then, is a tree of depth of 2. so I would like
to count the total number of this tree's leaves.



Now the problem I encountered is : the initial state of the tree is
collapsed, look like this :



+A

+B

+C



Here is my simplified script:



Tree = rc.getComponent("myTree")



itemA = tree.getItem(0)



count = itemA.getItemCount()



the problem is count is always 1 until I expand A. After A is expanded,
even with it being collapsed again, the "count" gets the right number of
children.



Can you help with this?



Thanks

Huawei







--
Robert Lahmer
Quality First Software GmbH                http://www.qfs.de
Tulpenstr. 41                           Tel: +49 8171 919874
DE-82538 Geretsried                     Fax: +49 8171 919876
GF: Gregor Schmid, Karlheinz Kellerer     HRB München 140833




Videos Downloads Documentation Buy Free Trial