|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2007, 2012 Innoopract Informationssysteme GmbH and others. |
2 |
* Copyright (c) 2007, 2013 Innoopract Informationssysteme GmbH and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 34-39
Link Here
|
| 34 |
import org.eclipse.rap.rwt.testfixture.Message; |
34 |
import org.eclipse.rap.rwt.testfixture.Message; |
| 35 |
import org.eclipse.rap.rwt.testfixture.Message.CreateOperation; |
35 |
import org.eclipse.rap.rwt.testfixture.Message.CreateOperation; |
| 36 |
import org.eclipse.swt.SWT; |
36 |
import org.eclipse.swt.SWT; |
|
|
37 |
import org.eclipse.swt.events.SelectionAdapter; |
| 37 |
import org.eclipse.swt.events.SelectionEvent; |
38 |
import org.eclipse.swt.events.SelectionEvent; |
| 38 |
import org.eclipse.swt.events.SelectionListener; |
39 |
import org.eclipse.swt.events.SelectionListener; |
| 39 |
import org.eclipse.swt.graphics.Color; |
40 |
import org.eclipse.swt.graphics.Color; |
|
Lines 301-306
Link Here
|
| 301 |
assertSame( item, folder.getSelection()[ 0 ] ); |
302 |
assertSame( item, folder.getSelection()[ 0 ] ); |
| 302 |
} |
303 |
} |
| 303 |
|
304 |
|
|
|
305 |
@Test |
| 306 |
public void testResetSelectionInSelectionEvent() { |
| 307 |
Fixture.markInitialized( display ); |
| 308 |
Fixture.markInitialized( folder ); |
| 309 |
final TabItem item1 = new TabItem( folder, SWT.NONE ); |
| 310 |
TabItem item2 = new TabItem( folder, SWT.NONE ); |
| 311 |
folder.setSelection( item1 ); |
| 312 |
folder.addSelectionListener( new SelectionAdapter() { |
| 313 |
@Override |
| 314 |
public void widgetSelected( SelectionEvent event ) { |
| 315 |
folder.setSelection( item1 ); |
| 316 |
} |
| 317 |
} ); |
| 318 |
|
| 319 |
fakeWidgetSelected( folder, item2 ); |
| 320 |
Fixture.executeLifeCycleFromServerThread(); |
| 321 |
|
| 322 |
Message message = Fixture.getProtocolMessage(); |
| 323 |
assertEquals( WidgetUtil.getId( item1 ), message.findSetProperty( folder, "selection" ) ); |
| 324 |
} |
| 325 |
|
| 304 |
private void fakeWidgetSelected( TabFolder folder, TabItem item ) { |
326 |
private void fakeWidgetSelected( TabFolder folder, TabItem item ) { |
| 305 |
Map<String, Object> parameters = new HashMap<String, Object>(); |
327 |
Map<String, Object> parameters = new HashMap<String, Object>(); |
| 306 |
parameters.put( ClientMessageConst.EVENT_PARAM_ITEM, getId( item ) ); |
328 |
parameters.put( ClientMessageConst.EVENT_PARAM_ITEM, getId( item ) ); |