Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 320777 - SWTBotHyperlink.click() fails to notify listeners
Summary: SWTBotHyperlink.click() fails to notify listeners
Status: NEW
Alias: None
Product: SWTBot
Classification: Technology
Component: SWTBot (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 320778
Blocks:
  Show dependency tree
 
Reported: 2010-07-23 18:28 EDT by Elias Volanakis CLA
Modified: 2010-07-23 20:20 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Elias Volanakis CLA 2010-07-23 18:28:40 EDT
SWTBotHyperlink.click() does not use the same events as a user-activated click. 

Issue: IHyperlinkListeners attached to the widget are not notified. 
Expected result: click() should fire entered / activated / exited events.

PS: Ketan: I'm working on a patch already (via github)
Comment 2 Ketan Padegaonkar CLA 2010-07-23 20:20:58 EDT
I like your neat stub listener.

Since the listener is notified in another thread, this test may at times generate false failures when the assertion runs on the mock but the UI thread has not notified it yet.

A better alternative IMHO might be something like.

assertWaitForTrue(new DefaultCondition(){
  public boolean test(){
    return listener.whatever;
  }
});


public assertWaitForTrue(condition){
  // throws TimeoutException if the condition fails!
  try{
    bot.waitUntil(condition);
  } catch(TimeoutException e){
    fail("Timed out waiting for listener to be notified!");
  }
}