|
Lines 2183-2203
Link Here
|
| 2183 |
|
2183 |
|
| 2184 |
public void testShowColumn() { |
2184 |
public void testShowColumn() { |
| 2185 |
Fixture.fakePhase( PhaseId.PROCESS_ACTION ); |
2185 |
Fixture.fakePhase( PhaseId.PROCESS_ACTION ); |
| 2186 |
shell.setSize( 800, 600 ); |
|
|
| 2187 |
Table table = new Table( shell, SWT.NONE ); |
2186 |
Table table = new Table( shell, SWT.NONE ); |
| 2188 |
table.setSize( 300, 100 ); |
2187 |
table.setSize( 325, 100 ); |
| 2189 |
for( int i = 0; i < 10; i++ ) { |
2188 |
for( int i = 0; i < 10; i++ ) { |
| 2190 |
TableColumn column = new TableColumn( table, SWT.NONE ); |
2189 |
TableColumn column = new TableColumn( table, SWT.NONE ); |
| 2191 |
column.setWidth( 50 ); |
2190 |
column.setWidth( 50 ); |
| 2192 |
} |
2191 |
} |
| 2193 |
for( int i = 0; i < 10; i++ ) { |
2192 |
ITableAdapter adapter = ( ITableAdapter )table.getAdapter( ITableAdapter.class ); |
| 2194 |
new TableItem( table, SWT.NONE ); |
|
|
| 2195 |
} |
| 2196 |
ITableAdapter adapter |
| 2197 |
= ( ITableAdapter )table.getAdapter( ITableAdapter.class ); |
| 2198 |
assertEquals( 0, adapter.getLeftOffset() ); |
2193 |
assertEquals( 0, adapter.getLeftOffset() ); |
| 2199 |
table.showColumn( table.getColumn( 8 ) ); |
2194 |
table.showColumn( table.getColumn( 8 ) ); |
| 2200 |
assertEquals( 165, adapter.getLeftOffset() ); |
2195 |
assertEquals( 175, adapter.getLeftOffset() ); |
| 2201 |
table.showColumn( table.getColumn( 1 ) ); |
2196 |
table.showColumn( table.getColumn( 1 ) ); |
| 2202 |
assertEquals( 50, adapter.getLeftOffset() ); |
2197 |
assertEquals( 50, adapter.getLeftOffset() ); |
| 2203 |
table.showColumn( table.getColumn( 3 ) ); |
2198 |
table.showColumn( table.getColumn( 3 ) ); |
|
Lines 2222-2228
Link Here
|
| 2222 |
table.showColumn( table.getColumn( 8 ) ); |
2217 |
table.showColumn( table.getColumn( 8 ) ); |
| 2223 |
assertEquals( 0, adapter.getLeftOffset() ); |
2218 |
assertEquals( 0, adapter.getLeftOffset() ); |
| 2224 |
table.showColumn( table.getColumn( 5 ) ); |
2219 |
table.showColumn( table.getColumn( 5 ) ); |
| 2225 |
assertEquals( 115, adapter.getLeftOffset() ); |
2220 |
assertEquals( 125, adapter.getLeftOffset() ); |
| 2226 |
} |
2221 |
} |
| 2227 |
|
2222 |
|
| 2228 |
public void testShowFixedColumn() { |
2223 |
public void testShowFixedColumn() { |
|
Lines 2243-2266
Link Here
|
| 2243 |
assertEquals( 100, adapter.getLeftOffset() ); |
2238 |
assertEquals( 100, adapter.getLeftOffset() ); |
| 2244 |
} |
2239 |
} |
| 2245 |
|
2240 |
|
| 2246 |
public void testShowColumnBehindFixedColumn() { |
2241 |
public void testShowColumnWithFixedColumns_ScrolledToLeft() { |
| 2247 |
Fixture.fakePhase( PhaseId.PROCESS_ACTION ); |
2242 |
Fixture.fakePhase( PhaseId.PROCESS_ACTION ); |
| 2248 |
shell.setSize( 800, 600 ); |
|
|
| 2249 |
Table table = createFixedColumnsTable(); |
2243 |
Table table = createFixedColumnsTable(); |
| 2250 |
table.setSize( 300, 100 ); |
2244 |
int numColumns = 4; |
| 2251 |
for( int i = 0; i < 10; i++ ) { |
2245 |
int columnWidth = 100; |
|
|
2246 |
table.setSize( columnWidth * ( numColumns - 1 ), 100 ); |
| 2247 |
for( int i = 0; i < numColumns; i++ ) { |
| 2252 |
TableColumn column = new TableColumn( table, SWT.NONE ); |
2248 |
TableColumn column = new TableColumn( table, SWT.NONE ); |
| 2253 |
column.setWidth( 50 ); |
2249 |
column.setWidth( columnWidth ); |
| 2254 |
} |
|
|
| 2255 |
for( int i = 0; i < 10; i++ ) { |
| 2256 |
new TableItem( table, SWT.NONE ); |
| 2257 |
} |
2250 |
} |
| 2258 |
ITableAdapter adapter = ( ITableAdapter )table.getAdapter( ITableAdapter.class ); |
2251 |
ITableAdapter adapter = ( ITableAdapter )table.getAdapter( ITableAdapter.class ); |
| 2259 |
adapter.setLeftOffset( 100 ); |
2252 |
adapter.setLeftOffset( 100 ); |
| 2260 |
table.showColumn( table.getColumn( 1 ) ); |
2253 |
|
|
|
2254 |
table.showColumn( table.getColumn( 2 ) ); |
| 2255 |
|
| 2261 |
assertEquals( 0, adapter.getLeftOffset() ); |
2256 |
assertEquals( 0, adapter.getLeftOffset() ); |
| 2262 |
} |
2257 |
} |
| 2263 |
|
2258 |
|
|
|
2259 |
public void testShowColumnWithFixedColumns_ScrolledToRight() { |
| 2260 |
Fixture.fakePhase( PhaseId.PROCESS_ACTION ); |
| 2261 |
int numColumns = 4; |
| 2262 |
int columnWidth = 100; |
| 2263 |
Table table = createFixedColumnsTable(); |
| 2264 |
table.setSize( columnWidth * ( numColumns - 1 ), 100 ); |
| 2265 |
for( int i = 0; i < numColumns; i++ ) { |
| 2266 |
TableColumn column = new TableColumn( table, SWT.NONE ); |
| 2267 |
column.setWidth( columnWidth ); |
| 2268 |
} |
| 2269 |
|
| 2270 |
table.showColumn( table.getColumn( 3 ) ); |
| 2271 |
|
| 2272 |
ITableAdapter adapter = ( ITableAdapter )table.getAdapter( ITableAdapter.class ); |
| 2273 |
assertEquals( 100, adapter.getLeftOffset() ); |
| 2274 |
} |
| 2275 |
|
| 2264 |
public void testScrollBars() { |
2276 |
public void testScrollBars() { |
| 2265 |
Table table = new Table( shell, SWT.NONE ); |
2277 |
Table table = new Table( shell, SWT.NONE ); |
| 2266 |
assertNotNull( table.getHorizontalBar() ); |
2278 |
assertNotNull( table.getHorizontalBar() ); |
|
Lines 2382-2388
Link Here
|
| 2382 |
|
2394 |
|
| 2383 |
private Table createFixedColumnsTable() { |
2395 |
private Table createFixedColumnsTable() { |
| 2384 |
Table table = new Table( shell, SWT.NONE ); |
2396 |
Table table = new Table( shell, SWT.NONE ); |
| 2385 |
table.setData( "fixedColumns", new Integer( 1 ) ); |
2397 |
table.setData( "fixedColumns", new Integer( 2 ) ); |
| 2386 |
return table; |
2398 |
return table; |
| 2387 |
} |
2399 |
} |
| 2388 |
|
2400 |
|