Search the web
Sign In
New User? Sign Up
uispec4j
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Tooltip on a choice in a combobox?   Message List  
Reply | Forward Message #541 of 610 |
Re: [uispec4j] Tooltip on a choice in a combobox?

Hi Bassam,

As you certainly already know, all UISpec4J component wrappers offer a means to check their associated tooltips.

Now, we didn't anticipated the fact that one could attach tooltips to ComboBox items (and, more generally, to compound components items).
This may be an interesting improvement for the next version... (to be studied!)

Sorry for that... I will try here to suggest a workaround: write a static function, taking a ComboBox wrapper as a parameter.
( Disclaimer: the code hereafter has not been tested ;)

  public static Assertion tooltipEquals(ComboBox comboBox, int index, final String text) {
      JComboBox jComboBox = comboBox.getAwtComponent();
      Object value = jComboBox.getModel().getElementAt(index);
      final JComponent component = (JComponent) jComboBox.getRenderer().getListCellRendererComponent(new JList(), value, index, false, false);
      return new Assertion() {
        public void check() {
          AssertAdapter.assertEquals(text, component.getToolTipText());
        }
      };
  }

I understand that such an API may not be ideal, but let's consider it as a first draft.

Please tell us what you think and how this works: your feedback (ideally along with the final workaround you will have implemented) will drive the possible integration of such an improvement in the library.

I hope this helps,

Regards,

Pascal.

On Jul 13, 2009, at 11:24 PM, Bassam Islam wrote:



Hi,

Thank you so much for the help you've given me. You've been very responsive and helpful. :)
Apologies if this question is simple, but how do I check the contents of a tooltip that is attached to a choice in a combobox that results from clicking in a cell in a table?

E.g.:
assertTrue(mainWindow.getTable().editCell(0, 1).getComboBox().[Get a choice from the combobox].tooltipContains("Tooltip text"));

I know that I can reference the contents of the cell using this method, along with the contents of the combobox, and to select a choice in there, but I don't know how to check the tooltip contents for the different choices in the combobox.

Thanks for your help,
Bassam





Tue Jul 14, 2009 10:17 am

pratmartyp
Offline Offline
Send Email Send Email

Forward
Message #541 of 610 |
Expand Messages Author Sort by Date

Hi, Thank you so much for the help you've given me. You've been very responsive and helpful. [:)] Apologies if this question is simple, but how do I check the...
Bassam Islam
bassamislam78
Offline Send Email
Jul 14, 2009
8:23 am

Hi Bassam, As you certainly already know, all UISpec4J component wrappers offer a means to check their associated tooltips. Now, we didn't anticipated the fact...
Pascal PRATMARTY
pratmartyp
Offline Send Email
Jul 14, 2009
10:17 am

Hi Pascal, Thank you for your help. The code snippet that you included worked as-is, with no need for modifications. I would suggest including a...
Bassam Islam
bassamislam78
Offline Send Email
Jul 28, 2009
9:11 am

Hi Bassam, thanks for the feedback. I'll get a look at how we can elegantly introduce such a service in the existing API. Cheers, Pascal...
Pascal PRATMARTY
pratmartyp
Offline Send Email
Jul 28, 2009
10:39 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help