|
Lines 339-344
Link Here
|
| 339 |
assertEquals( expected, Fixture.getAllMarkup() ); |
339 |
assertEquals( expected, Fixture.getAllMarkup() ); |
| 340 |
} |
340 |
} |
| 341 |
|
341 |
|
|
|
342 |
// TODO [bm]: test for workaround for bug 286306 |
| 343 |
// we need to count the DROP_DOWN twice for a proper index |
| 344 |
// as it consists of two |
| 345 |
// widgets on the client-side. This needs to be removed once we |
| 346 |
// a single-widget DROP_DOWN ToolItem in place |
| 347 |
public void testIndexOnInitializeWithDropDown() throws Exception { |
| 348 |
Fixture.fakeResponseWriter(); |
| 349 |
Display display = new Display(); |
| 350 |
Shell shell = new Shell( display, SWT.NONE ); |
| 351 |
ToolBar tb = new ToolBar( shell, SWT.NONE ); |
| 352 |
final ToolItem item1 = new ToolItem( tb, SWT.DROP_DOWN ); |
| 353 |
final ToolItem item2 = new ToolItem( tb, SWT.PUSH ); |
| 354 |
final ToolItem item3 = new ToolItem( tb, SWT.DROP_DOWN ); |
| 355 |
final ToolItem item4 = new ToolItem( tb, SWT.PUSH ); |
| 356 |
shell.open(); |
| 357 |
ToolItemLCA itemLCA = new ToolItemLCA(); |
| 358 |
itemLCA.renderInitialization( item1 ); |
| 359 |
itemLCA.renderInitialization( item2 ); |
| 360 |
itemLCA.renderInitialization( item3 ); |
| 361 |
itemLCA.renderInitialization( item4 ); |
| 362 |
String parent = "wm.findWidgetById( \"" + WidgetUtil.getId( tb )+ "\" )"; |
| 363 |
String expected1 = "org.eclipse.swt.ToolItemUtil.createDropDown( \"" |
| 364 |
+ WidgetUtil.getId( item1 ) |
| 365 |
+ "\", " |
| 366 |
+ parent |
| 367 |
+ ", 0, false );"; |
| 368 |
String expected2 = "org.eclipse.swt.ToolItemUtil.createPush( \"" |
| 369 |
+ WidgetUtil.getId( item2 ) |
| 370 |
+ "\", " |
| 371 |
+ parent |
| 372 |
+ ", 2, false );"; |
| 373 |
String expected3 = "org.eclipse.swt.ToolItemUtil.createDropDown( \"" |
| 374 |
+ WidgetUtil.getId( item3 ) |
| 375 |
+ "\", " |
| 376 |
+ parent |
| 377 |
+ ", 3, false );"; |
| 378 |
String expected4 = "org.eclipse.swt.ToolItemUtil.createPush( \"" |
| 379 |
+ WidgetUtil.getId( item4 ) |
| 380 |
+ "\", " |
| 381 |
+ parent |
| 382 |
+ ", 5, false );"; |
| 383 |
assertEquals( expected1 + expected2 + expected3 + expected4, |
| 384 |
Fixture.getAllMarkup() ); |
| 385 |
} |
| 386 |
|
| 342 |
protected void setUp() throws Exception { |
387 |
protected void setUp() throws Exception { |
| 343 |
RWTFixture.setUp(); |
388 |
RWTFixture.setUp(); |
| 344 |
Fixture.fakeResponseWriter(); |
389 |
Fixture.fakeResponseWriter(); |