Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 320777

Summary: SWTBotHyperlink.click() fails to notify listeners
Product: [Technology] SWTBot Reporter: Elias Volanakis <elias>
Component: SWTBotAssignee: Project Inbox <swtbot-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: KetanPadegaonkar
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Bug Depends on: 320778    
Bug Blocks:    

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!");
  }
}