@@ -365,10 +365,10 @@ public void MouseClick_Right_Left_Arrows_ChangesTab_With_Border ()
365
365
}
366
366
367
367
[ Fact ]
368
- [ AutoInitShutdown ]
369
- public void ProcessKey_Down_Up_Right_Left_Home_End_PageDown_PageUp ( )
368
+ [ SetupFakeDriver ]
369
+ public void ProcessKey_Down_Up_Right_Left_Home_End_PageDown_PageUp_F6 ( )
370
370
{
371
- TabView tv = GetTabView ( out Tab tab1 , out Tab tab2 , false ) ;
371
+ TabView tv = GetTabView ( out Tab tab1 , out Tab tab2 ) ;
372
372
373
373
tv . Width = 7 ;
374
374
tv . Height = 5 ;
@@ -393,7 +393,7 @@ public void ProcessKey_Down_Up_Right_Left_Home_End_PageDown_PageUp ()
393
393
Assert . Equal ( tv . SelectedTab . View , top . Focused . MostFocused ) ;
394
394
395
395
// Press the cursor up key to focus the selected tab
396
- Application . RaiseKeyDownEvent ( Key . CursorUp ) ;
396
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorUp ) ) ;
397
397
Application . LayoutAndDraw ( ) ;
398
398
399
399
// Is the selected tab focused
@@ -411,7 +411,7 @@ public void ProcessKey_Down_Up_Right_Left_Home_End_PageDown_PageUp ()
411
411
} ;
412
412
413
413
// Press the cursor right key to select the next tab
414
- Application . RaiseKeyDownEvent ( Key . CursorRight ) ;
414
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorRight ) ) ;
415
415
Application . LayoutAndDraw ( ) ;
416
416
Assert . Equal ( tab1 , oldChanged ) ;
417
417
Assert . Equal ( tab2 , newChanged ) ;
@@ -420,7 +420,7 @@ public void ProcessKey_Down_Up_Right_Left_Home_End_PageDown_PageUp ()
420
420
Assert . Equal ( tv . MostFocused , top . Focused . MostFocused ) ;
421
421
422
422
// Press the cursor down key. Since the selected tab has no focusable views, the focus should move to the next view in the toplevel
423
- Application . RaiseKeyDownEvent ( Key . CursorDown ) ;
423
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorDown ) ) ;
424
424
Assert . Equal ( tab2 , tv . SelectedTab ) ;
425
425
Assert . Equal ( btn , top . MostFocused ) ;
426
426
@@ -436,40 +436,55 @@ public void ProcessKey_Down_Up_Right_Left_Home_End_PageDown_PageUp ()
436
436
Assert . False ( tv . SelectedTab . View . CanFocus ) ;
437
437
438
438
// Press cursor up. Should focus the subview in the selected tab.
439
- Application . RaiseKeyDownEvent ( Key . CursorUp ) ;
439
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorUp ) ) ;
440
440
Assert . Equal ( tab2 , tv . SelectedTab ) ;
441
441
Assert . NotEqual ( btnSubView , top . MostFocused ) ;
442
442
Assert . Equal ( tab2 , top . MostFocused ) ;
443
443
444
444
tv . SelectedTab . View . CanFocus = true ;
445
- Application . RaiseKeyDownEvent ( Key . CursorDown ) ;
445
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorDown ) ) ;
446
446
Assert . Equal ( tab2 , tv . SelectedTab ) ;
447
447
Assert . Equal ( btnSubView , top . MostFocused ) ;
448
448
449
- Application . RaiseKeyDownEvent ( Key . CursorUp ) ;
449
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorUp ) ) ;
450
+ // TabRowView now has TabGroup which only F6 is allowed
451
+ Assert . NotEqual ( tab2 , top . MostFocused ) ;
452
+ Assert . Equal ( btn , top . MostFocused ) ;
453
+
454
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorUp ) ) ;
455
+ Assert . Equal ( btnSubView , top . MostFocused ) ;
456
+
457
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . F6 ) ) ;
450
458
Assert . Equal ( tab2 , top . MostFocused ) ;
451
459
452
460
// Press the cursor down key twice.
453
- Application . RaiseKeyDownEvent ( Key . CursorDown ) ;
454
- Application . RaiseKeyDownEvent ( Key . CursorDown ) ;
461
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorDown ) ) ;
462
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorDown ) ) ;
455
463
Assert . Equal ( btn , top . MostFocused ) ;
456
464
457
465
// Press the cursor down key again will focus next view in the toplevel, which is the TabView
458
- Application . RaiseKeyDownEvent ( Key . CursorDown ) ;
466
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorDown ) ) ;
459
467
Assert . Equal ( tab2 , tv . SelectedTab ) ;
460
468
Assert . Equal ( tv , top . Focused ) ;
461
469
// Due to the RestoreFocus method prioritize the _previouslyFocused, so btnSubView will be focused again
462
470
Assert . Equal ( btnSubView , tv . MostFocused ) ;
463
471
464
472
// Press the cursor up key to focus the selected tab which it's the only way to do that
465
- Application . RaiseKeyDownEvent ( Key . CursorUp ) ;
473
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorUp ) ) ;
466
474
Assert . Equal ( tab2 , tv . SelectedTab ) ;
475
+ Assert . Equal ( btn , top . Focused ) ;
476
+
477
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorUp ) ) ;
478
+ Assert . Equal ( tv , top . Focused ) ;
479
+ Assert . Equal ( btnSubView , top . MostFocused ) ;
480
+
481
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . F6 ) ) ;
467
482
Assert . Equal ( tv , top . Focused ) ;
468
483
Assert . Equal ( tab2 , top . Focused . MostFocused ) ;
469
484
Assert . Equal ( tv . MostFocused , top . Focused . MostFocused ) ;
470
485
471
486
// Press the cursor left key to select the previous tab
472
- Application . RaiseKeyDownEvent ( Key . CursorLeft ) ;
487
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorLeft ) ) ;
473
488
Application . LayoutAndDraw ( ) ;
474
489
Assert . Equal ( tab2 , oldChanged ) ;
475
490
Assert . Equal ( tab1 , newChanged ) ;
@@ -479,7 +494,7 @@ public void ProcessKey_Down_Up_Right_Left_Home_End_PageDown_PageUp ()
479
494
Assert . Equal ( tab1 , top . Focused . MostFocused ) ;
480
495
481
496
// Press the end key to select the last tab
482
- Application . RaiseKeyDownEvent ( Key . End ) ;
497
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . End ) ) ;
483
498
Application . LayoutAndDraw ( ) ;
484
499
Assert . Equal ( tab1 , oldChanged ) ;
485
500
Assert . Equal ( tab2 , newChanged ) ;
@@ -488,7 +503,7 @@ public void ProcessKey_Down_Up_Right_Left_Home_End_PageDown_PageUp ()
488
503
Assert . Equal ( tv . MostFocused , top . Focused . MostFocused ) ;
489
504
490
505
// Press the home key to select the first tab
491
- Application . RaiseKeyDownEvent ( Key . Home ) ;
506
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . Home ) ) ;
492
507
Application . LayoutAndDraw ( ) ;
493
508
Assert . Equal ( tab2 , oldChanged ) ;
494
509
Assert . Equal ( tab1 , newChanged ) ;
@@ -497,7 +512,7 @@ public void ProcessKey_Down_Up_Right_Left_Home_End_PageDown_PageUp ()
497
512
Assert . Equal ( tv . MostFocused , top . Focused . MostFocused ) ;
498
513
499
514
// Press the page down key to select the next set of tabs
500
- Application . RaiseKeyDownEvent ( Key . PageDown ) ;
515
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . PageDown ) ) ;
501
516
Application . LayoutAndDraw ( ) ;
502
517
Assert . Equal ( tab1 , oldChanged ) ;
503
518
Assert . Equal ( tab2 , newChanged ) ;
@@ -506,7 +521,7 @@ public void ProcessKey_Down_Up_Right_Left_Home_End_PageDown_PageUp ()
506
521
Assert . Equal ( tv . MostFocused , top . Focused . MostFocused ) ;
507
522
508
523
// Press the page up key to select the previous set of tabs
509
- Application . RaiseKeyDownEvent ( Key . PageUp ) ;
524
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . PageUp ) ) ;
510
525
Application . LayoutAndDraw ( ) ;
511
526
Assert . Equal ( tab2 , oldChanged ) ;
512
527
Assert . Equal ( tab1 , newChanged ) ;
@@ -1455,6 +1470,26 @@ public void Add_Three_TabsOnBottom_ChangesTab ()
1455
1470
) ;
1456
1471
}
1457
1472
1473
+ [ Fact ]
1474
+ [ SetupFakeDriver ]
1475
+ public void Tab_Get_Focus_By_Press_F6 ( )
1476
+ {
1477
+ TabView tv = GetTabView ( out Tab tab1 , out Tab tab2 ) ;
1478
+
1479
+ tv . Width = 20 ;
1480
+ tv . Height = 5 ;
1481
+
1482
+ Toplevel top = new ( ) ;
1483
+ top . Add ( tv ) ;
1484
+ Application . Begin ( top ) ;
1485
+
1486
+ Assert . False ( tab1 . HasFocus ) ;
1487
+
1488
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . F6 ) ) ;
1489
+ Assert . True ( tab1 . HasFocus ) ;
1490
+ top . Dispose ( ) ;
1491
+ }
1492
+
1458
1493
private TabView GetTabView ( ) { return GetTabView ( out _ , out _ ) ; }
1459
1494
1460
1495
private TabView GetTabView ( out Tab tab1 , out Tab tab2 , bool initFakeDriver = true )
0 commit comments