|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2002-2006 Innoopract Informationssysteme GmbH. |
2 |
* Copyright (c) 2002-2008 Innoopract Informationssysteme GmbH. |
| 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 8-14
Link Here
|
| 8 |
* Contributors: |
8 |
* Contributors: |
| 9 |
* Innoopract Informationssysteme GmbH - initial API and implementation |
9 |
* Innoopract Informationssysteme GmbH - initial API and implementation |
| 10 |
******************************************************************************/ |
10 |
******************************************************************************/ |
| 11 |
|
|
|
| 12 |
package org.eclipse.swt.widgets; |
11 |
package org.eclipse.swt.widgets; |
| 13 |
|
12 |
|
| 14 |
import junit.framework.TestCase; |
13 |
import junit.framework.TestCase; |
|
Lines 424-433
Link Here
|
| 424 |
Object adapter = table.getAdapter( ITableAdapter.class ); |
423 |
Object adapter = table.getAdapter( ITableAdapter.class ); |
| 425 |
ITableAdapter tableAdapter = ( ITableAdapter )adapter; |
424 |
ITableAdapter tableAdapter = ( ITableAdapter )adapter; |
| 426 |
|
425 |
|
| 427 |
// table.setItemCount( 100 ); |
|
|
| 428 |
// table.setSelection( 90 ); |
| 429 |
// table.setSize( 501, 501 ); |
| 430 |
// table.setItemCount( 10 ); |
| 431 |
table.setItemCount( 100 ); |
426 |
table.setItemCount( 100 ); |
| 432 |
table.setSelection( 99 ); |
427 |
table.setSelection( 99 ); |
| 433 |
table.setSize( 501, 501 ); |
428 |
table.setSize( 501, 501 ); |
|
Lines 1447-1452
Link Here
|
| 1447 |
assertNotNull( item ); |
1442 |
assertNotNull( item ); |
| 1448 |
assertEquals( 0, table.indexOf( item ) ); |
1443 |
assertEquals( 0, table.indexOf( item ) ); |
| 1449 |
} |
1444 |
} |
|
|
1445 |
|
| 1446 |
/* |
| 1447 |
* Ensures that checkData calls with an invalid index are silently ignored. |
| 1448 |
* This may happen, when the itemCount is reduced during a SetData event. |
| 1449 |
* Queued SetData events may then have stale (out-of-bounds) indices. |
| 1450 |
* See 235368: [table] [table] ArrayIndexOutOfBoundsException in virtual |
| 1451 |
* TableViewer |
| 1452 |
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=235368 |
| 1453 |
*/ |
| 1454 |
public void testCheckDataWithInvalidIndex() { |
| 1455 |
RWTFixture.fakePhase( PhaseId.PROCESS_ACTION ); |
| 1456 |
Display display = new Display(); |
| 1457 |
Shell shell = new Shell( display ); |
| 1458 |
Table table = new Table( shell, SWT.VIRTUAL ); |
| 1459 |
table.setItemCount( 10 ); |
| 1460 |
ITableAdapter adapter |
| 1461 |
= ( ITableAdapter )table.getAdapter( ITableAdapter.class ); |
| 1462 |
adapter.checkData( 99 ); |
| 1463 |
} |
| 1450 |
|
1464 |
|
| 1451 |
private static void clearColumns( final Table table ) { |
1465 |
private static void clearColumns( final Table table ) { |
| 1452 |
while( table.getColumnCount() > 0 ) { |
1466 |
while( table.getColumnCount() > 0 ) { |