Mailingliste - Einträge 2005


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

RE: [qftestJUI] How to record a check image of a Jmenu's submenu


  • Subject: RE: [qftestJUI] How to record a check image of a Jmenu's submenu
  • From: "Robert Slifka" <rslifka@?.COM>
  • Date: Thu, 20 Oct 2005 14:02:55 -0700

Hi Karl,

This is indeed what I ended up doing.  I wrote an SUT that takes a JMenu
componentID as an argument, as well a comma-delimited list of the
getText() values you expect to see in its submenu.  I'm still struggling
a bit with Python, but I see promise in it.  I just wish I didn't have
to resort to it so frequently.

All in all though, I'm enjoying my experience with QFS.  Writing tests
is quick and straightforward, which is very cool.  Great job overall.

What I'd *really* like to do is write a plugin that adds additional
options to the check menu.  It wouldn't have to be insanely flexible,
just enough to keep me out of Python.  Of course, this always seems
easier from my perspective than it will be from Gregor's, who
understands the code inside and out.  But there's already a plugins
directory... ;)

Rob

class MyNewCheck implements Check {
  static {
    // However one would register something like this...?
    CheckRegistry.registerNewCheck(new MyNewCheck());
  }

  public Class getObjectType() {
    return JMenu.class;
  }

  public String getCheckName() {
    return "Submenu Contents";
  }

  /**
   * CheckOption would be some sort of class that represents fields
   * relevant to this check that would appear as options in the
   * detail panel.  This is where the 'gold' data would be recorded,
   * and xferred to this check.  E.g. the "Text" and "As regexp"
   * components in the "Check text" check.
   */
  public CheckOption[] getCheckOptions() {
	return new CheckOption[] {new CheckOption(CheckOption.boolean,
"As regexp"), ...};
  }

  public void performCheck(Component component, CheckOptions[] options)
throws CheckException {
    JMenu l_menu = (JMenu)component;
    // ...whatever the check actuall does...
    if (!checkPasses) {
      throw new CheckException("Expected X, got Y");
    }
  }
}

> -----Original Message-----
> From: Karlheinz Kellerer [mailto:Karlheinz.Kellerer@?.de]
> Sent: Thursday, October 20, 2005 12:17 PM
> To: qftestJUI-list@?.de
> Cc: Robert Slifka
> Subject: Re: [qftestJUI] How to record a check image of a
> Jmenu's submenu
>
> Hi Rob,
>
> unfortunately there is no simple "automated" way to check the
> menu content like it is available for items of complex
> components with the "Check items" node.
>
> The problem with image checks is, that they are very weak and
> will break with the slightest change in of geometry, color or
> font etc. But there should be no problem to record this kind
> of check for your menus.
>
> Your idea to write a SUT script for this task therefore can
> be the solution to go. One problem you may face is how to
> specify the component of the item to check. Here a generic
> menu item component-node under "Windows and Components" can
> do the trick, where your leave all attributes empty except
> the structure information (and the id and class name, of
> course). You may need to do a little bit of experimentation with this.
>
> Best regards,
>     Karl
>
>
>
> "Robert Slifka" <rslifka@?.com> writes:
>
> > Attaching a screenshot to demonstrate what I'm trying to test.  I'm
> > adding things to an MRU menu and I want to verify the menu
> against a
> > 'golden' copy.  I.e. "the menu should look like X after I add some
> > items to it".
> >
> > Rob
> >
> > > -----Original Message-----
> > > From: qftestjui-list-bounces@?.de
> > > [mailto:qftestjui-list-bounces@?.de] On Behalf Of Robert Slifka
> > > Sent: Monday, October 17, 2005 6:00 PM
> > > To: qftestjui-list@?.de
> > > Subject: [qftestJUI] How to record a check image of a Jmenu's
> > > submenu
> > >
> > > Hi all,
> > >
> > > My goal is to verify the contents of a Jmenu (i.e. a pull-right).
> > > However all I can do is screenshot the individual menu items.
> > >  The problem is that paintComponent in Jmenu paints the
> menu item,
> > > so a screenshot of the Jmenu just gives you the single line
> > > pull-right.
> > >
> > > I'm thinking I could write an SUT with a parameterized
> list of the
> > > menu item names, but of course it would be nice if there
> were a more
> > > automated solution :)
> > >
> > > Thanks,
> > >
> > > Rob
> > >
> > > _______________________________________________
> > > qftestJUI-list mailing list
> > > qftestJUI-list@?.de
> > > http://www.qfs.de/mailman/listinfo/qftestjui-list
> > >
> >
> > _______________________________________________
> > qftestJUI-list mailing list
> > qftestJUI-list@?.de
> > http://www.qfs.de/mailman/listinfo/qftestjui-list
>
> --
> Karlheinz Kellerer                     Karlheinz.Kellerer@?.de
> Quality First Software GmbH                    http://www.qfs.de
> Tulpenstr. 41                               Tel: +49 8171 919877
> DE-82538 Geretsried                         Fax: +49 8171 919876
>



Videos Downloads Dokumentation Kaufen Gratis Testen