|
Lines 333-338
Link Here
|
| 333 |
assertNull( shell.getDefaultButton() ); |
333 |
assertNull( shell.getDefaultButton() ); |
| 334 |
} |
334 |
} |
| 335 |
|
335 |
|
|
|
336 |
public void testSetDefaultButtonOnFocus() { |
| 337 |
shell.open(); |
| 338 |
assertNull( shell.getDefaultButton() ); |
| 339 |
Button button = new Button( shell, SWT.PUSH ); |
| 340 |
Combo combo = new Combo( shell, SWT.NONE ); |
| 341 |
button.setFocus(); |
| 342 |
assertSame( button, shell.getDefaultButton() ); |
| 343 |
combo.setFocus(); |
| 344 |
assertNull( shell.getDefaultButton() ); |
| 345 |
} |
| 346 |
|
| 347 |
public void testSetDefaultButtonOnFocus_EventOrder() { |
| 348 |
final ArrayList log = new ArrayList(); |
| 349 |
shell.open(); |
| 350 |
assertNull( shell.getDefaultButton() ); |
| 351 |
Button button = new Button( shell, SWT.PUSH ); |
| 352 |
Combo combo = new Combo( shell, SWT.NONE ); |
| 353 |
button.addFocusListener( new FocusListener() { |
| 354 |
public void focusGained( FocusEvent e ) { |
| 355 |
log.add( shell.getDefaultButton() ); |
| 356 |
} |
| 357 |
public void focusLost( FocusEvent e ) { |
| 358 |
log.add( shell.getDefaultButton() ); |
| 359 |
} |
| 360 |
} ); |
| 361 |
button.setFocus(); |
| 362 |
combo.setFocus(); |
| 363 |
assertEquals( 2, log.size() ); |
| 364 |
assertNull( log.get( 0 ) ); |
| 365 |
assertSame( button, log.get( 1 ) ); |
| 366 |
} |
| 367 |
|
| 336 |
public void testForceActive() { |
368 |
public void testForceActive() { |
| 337 |
Shell secondShell = new Shell( display ); |
369 |
Shell secondShell = new Shell( display ); |
| 338 |
shell.open(); |
370 |
shell.open(); |