Mailing list - Entries of 2005

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

Re: [qftestJUI] NameResolver

  • Subject: Re: [qftestJUI] NameResolver
  • From: Gregor Schmid <Gregor.Schmid@?.de>
  • Date: Tue, 28 Jun 2005 16:12:02 -0000

Hello Martin,

there's no such facility and it would be of limited use. If you set
the name on a component depending on whether the name has already been
used, then which of your buttons would get a name would depend on the
order on which qftestJUI "sees" them and that is undefined so you
might set the name on the first button in one run and on the second
button in the other run which is worse than no name. If you base the
name solely on the label it's not much use anyway, you won't achieve
much more than qftest's recognition mechanism gives you anyway, except
that if the label changes you're worse off than without a name.

If you use translation maps to map language-specific labels to names
that's a different issue. Such a name resolver makes a lot of sense.
In that case, add a special mapping for potentially non-unique labels,
then traverse the component hierarchy yourself to prevent duplicates
and modify these names in some consistent way, e.g. by prepending 1 or
2 depending on geometry. Or try something like

Side-note: On first read I thought you simply wanted to cache the
name. I already started to answer that, perhaps it's of use to

You can simply cache the name yourself by setting a client property on
the component (at least for Swing JComponent and derived classes),
e.g. in Jython:

def getComponentName(self, com):
    name = com.getClientProperty("resolver:name")
    if name is not None:
        return name
    # ... determine name ...
    com.putClientProperty("resolver:name", name)
    return name

Best regards,

"Moser, Martin (Bbn)" <mmoser@?.com> writes:

>    Hi all,
>    I have a question regarding the implementation of a
>    ComponentNameResolver.
>    Can I also check which names are currently set in the current
>    component?
>    I have following problem.
>    On a dialog are two buttons without names, but with the same label. My
>    NameResolver provides the same name for them, so the tests get
>    confused during replay.
>    I am wondering, if the QFS API provides a method, like
>    ResolverRegistry.NameAlreadySet()?
>    If such a method is not implemented, I will try to enhance the
>    button's name via some panel-related data.
>    Thanks in advance!
>    Regards,
>    Martin
>    --
>    Mit freundlichen Gruessen/Best regards
>    Martin Moser
>    PHONE: (+49)-7031-14-3047 (HP TELNET: 777-3047)

Gregor Schmid                                Gregor.Schmid@?.de
Quality First Software GmbH           
Tulpenstr. 41                                Tel: +49 8171 919870
DE-82538 Geretsried                          Fax: +49 8171 919876