|
Lines 38-49
Link Here
|
| 38 |
|
38 |
|
| 39 |
private Display display; |
39 |
private Display display; |
| 40 |
private Shell shell; |
40 |
private Shell shell; |
|
|
41 |
private ShellLCA lca; |
| 41 |
|
42 |
|
| 42 |
@Override |
43 |
@Override |
| 43 |
protected void setUp() throws Exception { |
44 |
protected void setUp() throws Exception { |
| 44 |
Fixture.setUp(); |
45 |
Fixture.setUp(); |
| 45 |
display = new Display(); |
46 |
display = new Display(); |
| 46 |
shell = new Shell( display ); |
47 |
shell = new Shell( display ); |
|
|
48 |
lca = new ShellLCA(); |
| 47 |
Fixture.fakeNewRequest( display ); |
49 |
Fixture.fakeNewRequest( display ); |
| 48 |
} |
50 |
} |
| 49 |
|
51 |
|
|
Lines 350-356
Link Here
|
| 350 |
|
352 |
|
| 351 |
public void testAlpha() throws Exception { |
353 |
public void testAlpha() throws Exception { |
| 352 |
shell.open(); |
354 |
shell.open(); |
| 353 |
ShellLCA lca = new ShellLCA(); |
|
|
| 354 |
|
355 |
|
| 355 |
shell.setAlpha( 23 ); |
356 |
shell.setAlpha( 23 ); |
| 356 |
lca.renderChanges( shell ); |
357 |
lca.renderChanges( shell ); |
|
Lines 361-367
Link Here
|
| 361 |
|
362 |
|
| 362 |
public void testRenderMode() throws Exception { |
363 |
public void testRenderMode() throws Exception { |
| 363 |
shell.open(); |
364 |
shell.open(); |
| 364 |
ShellLCA lca = new ShellLCA(); |
|
|
| 365 |
|
365 |
|
| 366 |
shell.setMaximized( true ); |
366 |
shell.setMaximized( true ); |
| 367 |
lca.renderChanges( shell ); |
367 |
lca.renderChanges( shell ); |
|
Lines 374-380
Link Here
|
| 374 |
Fixture.markInitialized( display ); |
374 |
Fixture.markInitialized( display ); |
| 375 |
Fixture.markInitialized( shell ); |
375 |
Fixture.markInitialized( shell ); |
| 376 |
shell.open(); |
376 |
shell.open(); |
| 377 |
ShellLCA lca = new ShellLCA(); |
|
|
| 378 |
shell.setFullScreen( true ); |
377 |
shell.setFullScreen( true ); |
| 379 |
Fixture.preserveWidgets(); |
378 |
Fixture.preserveWidgets(); |
| 380 |
|
379 |
|
|
Lines 387-393
Link Here
|
| 387 |
|
386 |
|
| 388 |
public void testResetFullscreen() throws Exception { |
387 |
public void testResetFullscreen() throws Exception { |
| 389 |
shell.open(); |
388 |
shell.open(); |
| 390 |
ShellLCA lca = new ShellLCA(); |
|
|
| 391 |
|
389 |
|
| 392 |
shell.setFullScreen( true ); |
390 |
shell.setFullScreen( true ); |
| 393 |
lca.renderChanges( shell ); |
391 |
lca.renderChanges( shell ); |
|
Lines 397-404
Link Here
|
| 397 |
} |
395 |
} |
| 398 |
|
396 |
|
| 399 |
public void testRenderDefaultButtonIntiallyNull() throws IOException { |
397 |
public void testRenderDefaultButtonIntiallyNull() throws IOException { |
| 400 |
ShellLCA lca = new ShellLCA(); |
|
|
| 401 |
|
| 402 |
lca.renderChanges( shell ); |
398 |
lca.renderChanges( shell ); |
| 403 |
|
399 |
|
| 404 |
Message message = Fixture.getProtocolMessage(); |
400 |
Message message = Fixture.getProtocolMessage(); |
|
Lines 406-412
Link Here
|
| 406 |
} |
402 |
} |
| 407 |
|
403 |
|
| 408 |
public void testRenderDefaultButtonInitiallySet() throws Exception { |
404 |
public void testRenderDefaultButtonInitiallySet() throws Exception { |
| 409 |
ShellLCA lca = new ShellLCA(); |
|
|
| 410 |
Button button = new Button( shell, SWT.PUSH ); |
405 |
Button button = new Button( shell, SWT.PUSH ); |
| 411 |
|
406 |
|
| 412 |
shell.setDefaultButton( button ); |
407 |
shell.setDefaultButton( button ); |
|
Lines 419-425
Link Here
|
| 419 |
public void testRenderDefaultButtonUnchanged() throws IOException { |
414 |
public void testRenderDefaultButtonUnchanged() throws IOException { |
| 420 |
Fixture.markInitialized( display ); |
415 |
Fixture.markInitialized( display ); |
| 421 |
Fixture.markInitialized( shell ); |
416 |
Fixture.markInitialized( shell ); |
| 422 |
ShellLCA lca = new ShellLCA(); |
|
|
| 423 |
shell.setDefaultButton( new Button( shell, SWT.PUSH ) ); |
417 |
shell.setDefaultButton( new Button( shell, SWT.PUSH ) ); |
| 424 |
|
418 |
|
| 425 |
Fixture.preserveWidgets(); |
419 |
Fixture.preserveWidgets(); |
|
Lines 432-438
Link Here
|
| 432 |
public void testResetDefaultButton() throws IOException { |
426 |
public void testResetDefaultButton() throws IOException { |
| 433 |
Fixture.markInitialized( display ); |
427 |
Fixture.markInitialized( display ); |
| 434 |
Fixture.markInitialized( shell ); |
428 |
Fixture.markInitialized( shell ); |
| 435 |
ShellLCA lca = new ShellLCA(); |
|
|
| 436 |
Button button = new Button( shell, SWT.PUSH ); |
429 |
Button button = new Button( shell, SWT.PUSH ); |
| 437 |
shell.setDefaultButton( button ); |
430 |
shell.setDefaultButton( button ); |
| 438 |
Fixture.preserveWidgets(); |
431 |
Fixture.preserveWidgets(); |
|
Lines 445-452
Link Here
|
| 445 |
} |
438 |
} |
| 446 |
|
439 |
|
| 447 |
public void testRenderActiveControlIntiallyNull() throws IOException { |
440 |
public void testRenderActiveControlIntiallyNull() throws IOException { |
| 448 |
ShellLCA lca = new ShellLCA(); |
|
|
| 449 |
|
| 450 |
lca.renderChanges( shell ); |
441 |
lca.renderChanges( shell ); |
| 451 |
|
442 |
|
| 452 |
Message message = Fixture.getProtocolMessage(); |
443 |
Message message = Fixture.getProtocolMessage(); |
|
Lines 454-460
Link Here
|
| 454 |
} |
445 |
} |
| 455 |
|
446 |
|
| 456 |
public void testRenderActiveControlInitiallySet() throws Exception { |
447 |
public void testRenderActiveControlInitiallySet() throws Exception { |
| 457 |
ShellLCA lca = new ShellLCA(); |
|
|
| 458 |
Button button = new Button( shell, SWT.PUSH ); |
448 |
Button button = new Button( shell, SWT.PUSH ); |
| 459 |
IShellAdapter adapter = shell.getAdapter( IShellAdapter.class ); |
449 |
IShellAdapter adapter = shell.getAdapter( IShellAdapter.class ); |
| 460 |
|
450 |
|
|
Lines 471-477
Link Here
|
| 471 |
Button button = new Button( shell, SWT.PUSH ); |
461 |
Button button = new Button( shell, SWT.PUSH ); |
| 472 |
IShellAdapter adapter = shell.getAdapter( IShellAdapter.class ); |
462 |
IShellAdapter adapter = shell.getAdapter( IShellAdapter.class ); |
| 473 |
adapter.setActiveControl( button ); |
463 |
adapter.setActiveControl( button ); |
| 474 |
ShellLCA lca = new ShellLCA(); |
|
|
| 475 |
|
464 |
|
| 476 |
Fixture.preserveWidgets(); |
465 |
Fixture.preserveWidgets(); |
| 477 |
lca.renderChanges( shell ); |
466 |
lca.renderChanges( shell ); |
|
Lines 486-492
Link Here
|
| 486 |
Button button = new Button( shell, SWT.PUSH ); |
475 |
Button button = new Button( shell, SWT.PUSH ); |
| 487 |
IShellAdapter adapter = shell.getAdapter( IShellAdapter.class ); |
476 |
IShellAdapter adapter = shell.getAdapter( IShellAdapter.class ); |
| 488 |
adapter.setActiveControl( button ); |
477 |
adapter.setActiveControl( button ); |
| 489 |
ShellLCA lca = new ShellLCA(); |
|
|
| 490 |
Fixture.preserveWidgets(); |
478 |
Fixture.preserveWidgets(); |
| 491 |
|
479 |
|
| 492 |
adapter.setActiveControl( null ); |
480 |
adapter.setActiveControl( null ); |
|
Lines 509-515
Link Here
|
| 509 |
Fixture.markInitialized( display ); |
497 |
Fixture.markInitialized( display ); |
| 510 |
Fixture.preserveWidgets(); |
498 |
Fixture.preserveWidgets(); |
| 511 |
shell.setMinimumSize( 100, 200 ); |
499 |
shell.setMinimumSize( 100, 200 ); |
| 512 |
ShellLCA lca = new ShellLCA(); |
|
|
| 513 |
|
500 |
|
| 514 |
lca.renderChanges( shell ); |
501 |
lca.renderChanges( shell ); |
| 515 |
|
502 |
|
|
Lines 521-527
Link Here
|
| 521 |
Shell shell = new Shell( display , SWT.NO_TRIM ); |
508 |
Shell shell = new Shell( display , SWT.NO_TRIM ); |
| 522 |
Fixture.markInitialized( display ); |
509 |
Fixture.markInitialized( display ); |
| 523 |
Fixture.preserveWidgets(); |
510 |
Fixture.preserveWidgets(); |
| 524 |
ShellLCA lca = new ShellLCA(); |
|
|
| 525 |
|
511 |
|
| 526 |
lca.renderInitialization( shell ); |
512 |
lca.renderInitialization( shell ); |
| 527 |
|
513 |
|
|
Lines 536-542
Link Here
|
| 536 |
Fixture.markInitialized( display ); |
522 |
Fixture.markInitialized( display ); |
| 537 |
Fixture.markInitialized( shell ); |
523 |
Fixture.markInitialized( shell ); |
| 538 |
Fixture.preserveWidgets(); |
524 |
Fixture.preserveWidgets(); |
| 539 |
ShellLCA lca = new ShellLCA(); |
|
|
| 540 |
|
525 |
|
| 541 |
shell.setText( "foo" ); |
526 |
shell.setText( "foo" ); |
| 542 |
lca.renderChanges( shell ); |
527 |
lca.renderChanges( shell ); |
|
Lines 550-556
Link Here
|
| 550 |
Fixture.markInitialized( display ); |
535 |
Fixture.markInitialized( display ); |
| 551 |
Fixture.markInitialized( shell ); |
536 |
Fixture.markInitialized( shell ); |
| 552 |
Fixture.preserveWidgets(); |
537 |
Fixture.preserveWidgets(); |
| 553 |
ShellLCA lca = new ShellLCA(); |
|
|
| 554 |
|
538 |
|
| 555 |
shell.addShellListener( new ShellAdapter(){ } ); |
539 |
shell.addShellListener( new ShellAdapter(){ } ); |
| 556 |
lca.renderChanges( shell ); |
540 |
lca.renderChanges( shell ); |
|
Lines 564-570
Link Here
|
| 564 |
Fixture.markInitialized( display ); |
548 |
Fixture.markInitialized( display ); |
| 565 |
Fixture.markInitialized( shell ); |
549 |
Fixture.markInitialized( shell ); |
| 566 |
shell.addShellListener( new ShellAdapter(){ } ); |
550 |
shell.addShellListener( new ShellAdapter(){ } ); |
| 567 |
ShellLCA lca = new ShellLCA(); |
|
|
| 568 |
|
551 |
|
| 569 |
Fixture.preserveWidgets(); |
552 |
Fixture.preserveWidgets(); |
| 570 |
lca.renderChanges( shell ); |
553 |
lca.renderChanges( shell ); |
|
Lines 575-581
Link Here
|
| 575 |
|
558 |
|
| 576 |
public void testRenderRemoveShellListener() throws Exception { |
559 |
public void testRenderRemoveShellListener() throws Exception { |
| 577 |
Shell shell = new Shell( display , SWT.SHELL_TRIM ); |
560 |
Shell shell = new Shell( display , SWT.SHELL_TRIM ); |
| 578 |
ShellLCA lca = new ShellLCA(); |
|
|
| 579 |
Fixture.markInitialized( display ); |
561 |
Fixture.markInitialized( display ); |
| 580 |
Fixture.markInitialized( shell ); |
562 |
Fixture.markInitialized( shell ); |
| 581 |
ShellListener listener = new ShellAdapter(){}; |
563 |
ShellListener listener = new ShellAdapter(){}; |
|
Lines 594-600
Link Here
|
| 594 |
shell.open(); |
576 |
shell.open(); |
| 595 |
Fixture.markInitialized( display ); |
577 |
Fixture.markInitialized( display ); |
| 596 |
Fixture.preserveWidgets(); |
578 |
Fixture.preserveWidgets(); |
| 597 |
ShellLCA lca = new ShellLCA(); |
|
|
| 598 |
|
579 |
|
| 599 |
shell.setActive(); |
580 |
shell.setActive(); |
| 600 |
assertTrue( shell.getDisplay().getActiveShell() == shell ); |
581 |
assertTrue( shell.getDisplay().getActiveShell() == shell ); |
|
Lines 610-616
Link Here
|
| 610 |
Fixture.markInitialized( display ); |
591 |
Fixture.markInitialized( display ); |
| 611 |
Fixture.markInitialized( parentShell ); |
592 |
Fixture.markInitialized( parentShell ); |
| 612 |
Fixture.preserveWidgets(); |
593 |
Fixture.preserveWidgets(); |
| 613 |
ShellLCA lca = new ShellLCA(); |
|
|
| 614 |
|
594 |
|
| 615 |
lca.renderInitialization( dialogShell ); |
595 |
lca.renderInitialization( dialogShell ); |
| 616 |
|
596 |
|
|
Lines 624-630
Link Here
|
| 624 |
Fixture.markInitialized( display ); |
604 |
Fixture.markInitialized( display ); |
| 625 |
Fixture.markInitialized( shell ); |
605 |
Fixture.markInitialized( shell ); |
| 626 |
Fixture.preserveWidgets(); |
606 |
Fixture.preserveWidgets(); |
| 627 |
ShellLCA lca = new ShellLCA(); |
|
|
| 628 |
|
607 |
|
| 629 |
shell.setImage( Graphics.getImage( Fixture.IMAGE1 ) ); |
608 |
shell.setImage( Graphics.getImage( Fixture.IMAGE1 ) ); |
| 630 |
lca.renderChanges( shell ); |
609 |
lca.renderChanges( shell ); |
|
Lines 639-645
Link Here
|
| 639 |
Fixture.markInitialized( display ); |
618 |
Fixture.markInitialized( display ); |
| 640 |
Fixture.markInitialized( shell ); |
619 |
Fixture.markInitialized( shell ); |
| 641 |
Fixture.preserveWidgets(); |
620 |
Fixture.preserveWidgets(); |
| 642 |
ShellLCA lca = new ShellLCA(); |
|
|
| 643 |
|
621 |
|
| 644 |
shell.setImage( Graphics.getImage( Fixture.IMAGE1 ) ); |
622 |
shell.setImage( Graphics.getImage( Fixture.IMAGE1 ) ); |
| 645 |
lca.renderChanges( shell ); |
623 |
lca.renderChanges( shell ); |
|
Lines 653-659
Link Here
|
| 653 |
Fixture.markInitialized( display ); |
631 |
Fixture.markInitialized( display ); |
| 654 |
Fixture.markInitialized( shell ); |
632 |
Fixture.markInitialized( shell ); |
| 655 |
Fixture.preserveWidgets(); |
633 |
Fixture.preserveWidgets(); |
| 656 |
ShellLCA lca = new ShellLCA(); |
|
|
| 657 |
|
634 |
|
| 658 |
shell.setImage( Graphics.getImage( Fixture.IMAGE1 ) ); |
635 |
shell.setImage( Graphics.getImage( Fixture.IMAGE1 ) ); |
| 659 |
lca.renderChanges( shell ); |
636 |
lca.renderChanges( shell ); |
|
Lines 668-674
Link Here
|
| 668 |
Fixture.markInitialized( display ); |
645 |
Fixture.markInitialized( display ); |
| 669 |
Fixture.markInitialized( shell ); |
646 |
Fixture.markInitialized( shell ); |
| 670 |
Fixture.preserveWidgets(); |
647 |
Fixture.preserveWidgets(); |
| 671 |
ShellLCA lca = new ShellLCA(); |
|
|
| 672 |
|
648 |
|
| 673 |
shell.setImages( new Image[] { Graphics.getImage( Fixture.IMAGE1 ) } ); |
649 |
shell.setImages( new Image[] { Graphics.getImage( Fixture.IMAGE1 ) } ); |
| 674 |
lca.renderChanges( shell ); |
650 |
lca.renderChanges( shell ); |
|
Lines 679-686
Link Here
|
| 679 |
} |
655 |
} |
| 680 |
|
656 |
|
| 681 |
public void testRenderVisibilityIntiallyFalse() throws IOException { |
657 |
public void testRenderVisibilityIntiallyFalse() throws IOException { |
| 682 |
ShellLCA lca = new ShellLCA(); |
|
|
| 683 |
|
| 684 |
lca.renderChanges( shell ); |
658 |
lca.renderChanges( shell ); |
| 685 |
|
659 |
|
| 686 |
Message message = Fixture.getProtocolMessage(); |
660 |
Message message = Fixture.getProtocolMessage(); |
|
Lines 689-696
Link Here
|
| 689 |
|
663 |
|
| 690 |
public void testRenderVisibilityInitiallyTrue() throws IOException { |
664 |
public void testRenderVisibilityInitiallyTrue() throws IOException { |
| 691 |
// Client shell is initially visible, SWT shell is not |
665 |
// Client shell is initially visible, SWT shell is not |
| 692 |
ShellLCA lca = new ShellLCA(); |
|
|
| 693 |
|
| 694 |
shell.open(); |
666 |
shell.open(); |
| 695 |
lca.renderChanges( shell ); |
667 |
lca.renderChanges( shell ); |
| 696 |
|
668 |
|
|
Lines 698-703
Link Here
|
| 698 |
assertNull( message.findSetOperation( shell, "visibility" ) ); |
670 |
assertNull( message.findSetOperation( shell, "visibility" ) ); |
| 699 |
} |
671 |
} |
| 700 |
|
672 |
|
|
|
673 |
public void testRenderOpenExpanded() throws IOException { |
| 674 |
lca.render( shell ); |
| 675 |
|
| 676 |
Message message = Fixture.getProtocolMessage(); |
| 677 |
CreateOperation operation = message.findCreateOperation( shell ); |
| 678 |
assertTrue( operation.getPropertyNames().indexOf( "opened" ) == -1 ); |
| 679 |
} |
| 680 |
|
| 681 |
public void testRenderOpen() throws IOException { |
| 682 |
shell.open(); |
| 683 |
lca.renderChanges( shell ); |
| 684 |
|
| 685 |
Message message = Fixture.getProtocolMessage(); |
| 686 |
assertEquals( Boolean.TRUE, message.findSetProperty( shell, "opened" ) ); |
| 687 |
} |
| 688 |
|
| 689 |
public void testRenderOpenUnchanged() throws IOException { |
| 690 |
Fixture.markInitialized( display ); |
| 691 |
Fixture.markInitialized( shell ); |
| 692 |
|
| 693 |
shell.open(); |
| 694 |
Fixture.preserveWidgets(); |
| 695 |
lca.renderChanges( shell ); |
| 696 |
|
| 697 |
Message message = Fixture.getProtocolMessage(); |
| 698 |
assertNull( message.findSetOperation( shell, "opened" ) ); |
| 699 |
} |
| 700 |
|
| 701 |
private static Control getActiveControl( Shell shell ) { |
701 |
private static Control getActiveControl( Shell shell ) { |
| 702 |
Object adapter = shell.getAdapter( IShellAdapter.class ); |
702 |
Object adapter = shell.getAdapter( IShellAdapter.class ); |
| 703 |
IShellAdapter shellAdapter = ( IShellAdapter )adapter; |
703 |
IShellAdapter shellAdapter = ( IShellAdapter )adapter; |