(older archive entries before 2007 are not shown here, but included in the onsite-search)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [QF-Test] 'Check enabled state' node not working correctly with submenus.
Hi Robert, Thank you for the fast response. Firstly, MarconiMenuItem is a subclass of JMenuItem and MarconiMenu is a subclass of JMenu So they are definitely instances of JMenu and JMenuItem. I tried your suggestion of an SUT script: i.e. from javax.swing import JMenu comp = rc.getComponent("Menu.NRQCircuit.PopupMenu.Circuit.Service",0) if not comp == None: if isinstance(comp, JMenu): print comp.getText(), comp.isEnabled() And it confirms that the menu item for the 'Service' submenu is in fact enabled despite the item visibly being greyed out. So not the fault of QF-Test after all. My apologies for taking up your time. I should have tried the SUT script idea to start with. I'd simply assumed that because the submenu item is greyed out its JMenu component would be in the disabled state! Its been suggested to me that this behaviour is something to do with the fact that the two items under the submenu are themselves disabled (greyed out). This results in this situation where the 'Service' submenu is greyed out but not in the disabled state. i.e. <submenu: 'Service'> - greyed out, but not disabled JMenu. <item in submenu: 'Set In Service'> - greyed out and disabled JMenuItem. <item in submenu: 'Set Out of Service'> - greyed out and disabled JMenuItem. Thank you for your kind help Regards Adrian ________________________________ From: Robert Lahmer, QFS support [mailto:support@?.de] Sent: Fri 27/04/2007 11:35 To: qftest-list@?.de Cc: Adrian Chamberlain (BE/ETL) Subject: Re: [QF-Test] 'Check enabled state' node not working correctly with submenus. Hello Adrian, thank you for providing your run-logs. I can confirm that the 'Check enabled node' does work for submenus when using the genuine Swing components javax.swing.JMenu and javax.swing.JMenuItem. I tested this with the following code: JMenuBar menuBar = new JMenuBar(); JMenu menu = new JMenu("A Menu"); menuBar.add(menu); menu.add(new JMenuItem("MenuItem1")); menu.add(new JMenuItem("MenuItem2")); menu.getItem(1).setEnabled(false); JMenu subMenu = new JMenu("A Submenu"); subMenu.add(new JMenuItem("SubmenuItem1")); subMenu.add(new JMenuItem("SubmenuItem2")); menu.add(subMenu); subMenu.setEnabled(false); frame.setJMenuBar(menuBar); >From your run-logs I can see that your are using other components. Are they derived from JMenuItem? Anyway, could you please check the state of your 'Service' submenu by means of a Jython SUT script, inserted before your check node: # change compID accordingly compID = "<ID-of-Submenu>" c = rc.getComponent(compID) print c.getText(), c.isEnabled() When running the script, you should see its output in the QF-Test Terminal window. Best regards, Robert --On Freitag, April 27, 2007 10:35:20 +0200 "Adrian Chamberlain (BE/ETL)" <adrian.chamberlain@?.com> wrote: > Hi Robert, > Thanks for the feedback. > > I can confirm that the check node was set to throw an exception on error > (i.e. check failed). > For the menu items which are objects of class JMenuItem an exception is > thrown if the meuu item is disabled (greyed out). > > But in the case of a menu item which is a submenu (i.e. JMenu), no > exception is thrown and there is no indication in the run log of any > errors. > > I've attached two run logs. > 1. JMenuItem.qrz > 2. JMenu.qrz > > The popup menu is called 'Circuit' and has various menu items including > 'Secure' and 'Service'. > > Menu 'Circuit' > ------------------- > menu item 'Secure' - JMenuItem > .... > .... > menu item 'Service' - JMenu (i.e. submenu) > .... > .... > > * Both these menu items are greyed out (disabled). > > As the first run log shows, the 'check enabled state' node resulted > in an exception being thrown (i..e 'Secure' item is disabled). > > But the 'check enabled state' for the menu item 'Service' > (which is a submenu) results in no errors and hence no exception. > > Kind Regards > Adrian > > ________________________________ > > From: Robert Lahmer, QFS support [mailto:support@?.de] > Sent: Fri 27/04/2007 08:55 > To: qftest-list@?.de > Cc: Adrian Chamberlain (BE/ETL) > Subject: Re: [QF-Test] 'Check enabled state' node not working correctly > with submenus. > > > > > Hello Adrian, > > you are right, a submenu is also a JMenuItem and hence you can use the > 'Check enabled state' node for it. The problem might be that you expect an > exception to be thrown, in case the JMenuItem is not enabled - but it's > just an error! You should set the option 'Throw exception on failure' in > the check node, if you want to abort the test execution. > > Best regards, > Robert > > > > --On Donnerstag, April 26, 2007 15:17:00 +0200 "Adrian Chamberlain > (BE/ETL)" <adrian.chamberlain@?.com> wrote: > >> 'Check enabled state' node not working correctly with menu items which >> are submenus. A submenu is of course a menu item (i.e. JMenu is >> a subclass of JMenuItem). >> >> If the 'Check enabled state' node is used to determine if a submenu is >> enabled the check node never fails, even when the submenu is >> disabled (greyed out). >> >> For example: >> >> MENU >> --------- >> item 1 >> item 2 >> item 3 >> submenu 1 >> item 4 >> item 5 >> >> Using the 'check enabled state' node to determine if menu item 'submenu >> 1' is disabled never fails (i.e. no CheckFailed exception is thrown). >> >> Given that 'submenu 1' will be a JMenu and given that JMenu is a subclass >> of JMenuItem, why does the 'check enabled state' node not work correctly >> in this case ? >> Any help appreciated. >> >> Regards >> Adrian >> >> _______________________________________________ >> qftest-list mailing list >> qftest-list@?.de >> http://www.qfs.de/mailman/listinfo/qftest-list >> > > > > -- > Robert Lahmer > Quality First Software GmbH http://www.qfs.de <http://www.qfs.de/> > <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 > > > > -- Robert Lahmer Quality First Software GmbH http://www.qfs.de <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