|
26 | 26 | using osuTK.Input; |
27 | 27 | using FooterButtonMods = osu.Game.Screens.SelectV2.FooterButtonMods; |
28 | 28 | using FooterButtonOptions = osu.Game.Screens.SelectV2.FooterButtonOptions; |
| 29 | +using FooterButtonRandom = osu.Game.Screens.SelectV2.FooterButtonRandom; |
29 | 30 |
|
30 | 31 | namespace osu.Game.Tests.Visual.SongSelectV2 |
31 | 32 | { |
@@ -451,71 +452,113 @@ public void TestFooterModOverlay() |
451 | 452 | AddStep("Hide", () => this.ChildrenOfType<ModSelectOverlay>().Single().Hide()); |
452 | 453 | } |
453 | 454 |
|
454 | | - // add these test cases when functionality is implemented. |
455 | | - // [Test] |
456 | | - // public void TestFooterRandom() |
457 | | - // { |
458 | | - // loadSongSelect(); |
459 | | - // |
460 | | - // AddStep("press F2", () => InputManager.Key(Key.F2)); |
461 | | - // AddAssert("next random invoked", () => nextRandomCalled && !previousRandomCalled); |
462 | | - // } |
463 | | - // |
464 | | - // [Test] |
465 | | - // public void TestFooterRandomViaMouse() |
466 | | - // { |
467 | | - // loadSongSelect(); |
468 | | - // |
469 | | - // AddStep("click button", () => |
470 | | - // { |
471 | | - // InputManager.MoveMouseTo(randomButton); |
472 | | - // InputManager.Click(MouseButton.Left); |
473 | | - // }); |
474 | | - // AddAssert("next random invoked", () => nextRandomCalled && !previousRandomCalled); |
475 | | - // } |
476 | | - // |
477 | | - // [Test] |
478 | | - // public void TestFooterRewind() |
479 | | - // { |
480 | | - // loadSongSelect(); |
481 | | - // |
482 | | - // AddStep("press Shift+F2", () => |
483 | | - // { |
484 | | - // InputManager.PressKey(Key.LShift); |
485 | | - // InputManager.PressKey(Key.F2); |
486 | | - // InputManager.ReleaseKey(Key.F2); |
487 | | - // InputManager.ReleaseKey(Key.LShift); |
488 | | - // }); |
489 | | - // AddAssert("previous random invoked", () => previousRandomCalled && !nextRandomCalled); |
490 | | - // } |
491 | | - // |
492 | | - // [Test] |
493 | | - // public void TestFooterRewindViaShiftMouseLeft() |
494 | | - // { |
495 | | - // loadSongSelect(); |
496 | | - // |
497 | | - // AddStep("shift + click button", () => |
498 | | - // { |
499 | | - // InputManager.PressKey(Key.LShift); |
500 | | - // InputManager.MoveMouseTo(randomButton); |
501 | | - // InputManager.Click(MouseButton.Left); |
502 | | - // InputManager.ReleaseKey(Key.LShift); |
503 | | - // }); |
504 | | - // AddAssert("previous random invoked", () => previousRandomCalled && !nextRandomCalled); |
505 | | - // } |
506 | | - // |
507 | | - // [Test] |
508 | | - // public void TestFooterRewindViaMouseRight() |
509 | | - // { |
510 | | - // loadSongSelect(); |
511 | | - // |
512 | | - // AddStep("right click button", () => |
513 | | - // { |
514 | | - // InputManager.MoveMouseTo(randomButton); |
515 | | - // InputManager.Click(MouseButton.Right); |
516 | | - // }); |
517 | | - // AddAssert("previous random invoked", () => previousRandomCalled && !nextRandomCalled); |
518 | | - // } |
| 455 | + [Test] |
| 456 | + public void TestFooterRandom() |
| 457 | + { |
| 458 | + LoadSongSelect(); |
| 459 | + |
| 460 | + bool nextRandomCalled = false; |
| 461 | + bool previousRandomCalled = false; |
| 462 | + AddStep("hook events", () => |
| 463 | + { |
| 464 | + randomButton.NextRandom = () => nextRandomCalled = true; |
| 465 | + randomButton.PreviousRandom = () => previousRandomCalled = true; |
| 466 | + }); |
| 467 | + |
| 468 | + AddStep("press F2", () => InputManager.Key(Key.F2)); |
| 469 | + AddAssert("next random invoked", () => nextRandomCalled && !previousRandomCalled); |
| 470 | + } |
| 471 | + |
| 472 | + [Test] |
| 473 | + public void TestFooterRandomViaMouse() |
| 474 | + { |
| 475 | + LoadSongSelect(); |
| 476 | + |
| 477 | + bool nextRandomCalled = false; |
| 478 | + bool previousRandomCalled = false; |
| 479 | + AddStep("hook events", () => |
| 480 | + { |
| 481 | + randomButton.NextRandom = () => nextRandomCalled = true; |
| 482 | + randomButton.PreviousRandom = () => previousRandomCalled = true; |
| 483 | + }); |
| 484 | + |
| 485 | + AddStep("click button", () => |
| 486 | + { |
| 487 | + InputManager.MoveMouseTo(randomButton); |
| 488 | + InputManager.Click(MouseButton.Left); |
| 489 | + }); |
| 490 | + AddAssert("next random invoked", () => nextRandomCalled && !previousRandomCalled); |
| 491 | + } |
| 492 | + |
| 493 | + [Test] |
| 494 | + public void TestFooterRewind() |
| 495 | + { |
| 496 | + LoadSongSelect(); |
| 497 | + |
| 498 | + bool nextRandomCalled = false; |
| 499 | + bool previousRandomCalled = false; |
| 500 | + AddStep("hook events", () => |
| 501 | + { |
| 502 | + randomButton.NextRandom = () => nextRandomCalled = true; |
| 503 | + randomButton.PreviousRandom = () => previousRandomCalled = true; |
| 504 | + }); |
| 505 | + |
| 506 | + AddStep("press Shift+F2", () => |
| 507 | + { |
| 508 | + InputManager.PressKey(Key.LShift); |
| 509 | + InputManager.PressKey(Key.F2); |
| 510 | + InputManager.ReleaseKey(Key.F2); |
| 511 | + InputManager.ReleaseKey(Key.LShift); |
| 512 | + }); |
| 513 | + |
| 514 | + AddAssert("previous random invoked", () => previousRandomCalled && !nextRandomCalled); |
| 515 | + } |
| 516 | + |
| 517 | + [Test] |
| 518 | + public void TestFooterRewindViaShiftMouseLeft() |
| 519 | + { |
| 520 | + LoadSongSelect(); |
| 521 | + |
| 522 | + bool nextRandomCalled = false; |
| 523 | + bool previousRandomCalled = false; |
| 524 | + AddStep("hook events", () => |
| 525 | + { |
| 526 | + randomButton.NextRandom = () => nextRandomCalled = true; |
| 527 | + randomButton.PreviousRandom = () => previousRandomCalled = true; |
| 528 | + }); |
| 529 | + |
| 530 | + AddStep("shift + click button", () => |
| 531 | + { |
| 532 | + InputManager.PressKey(Key.LShift); |
| 533 | + InputManager.MoveMouseTo(randomButton); |
| 534 | + InputManager.Click(MouseButton.Left); |
| 535 | + InputManager.ReleaseKey(Key.LShift); |
| 536 | + }); |
| 537 | + AddAssert("previous random invoked", () => previousRandomCalled && !nextRandomCalled); |
| 538 | + } |
| 539 | + |
| 540 | + [Test] |
| 541 | + public void TestFooterRewindViaMouseRight() |
| 542 | + { |
| 543 | + LoadSongSelect(); |
| 544 | + |
| 545 | + bool nextRandomCalled = false; |
| 546 | + bool previousRandomCalled = false; |
| 547 | + AddStep("hook events", () => |
| 548 | + { |
| 549 | + randomButton.NextRandom = () => nextRandomCalled = true; |
| 550 | + randomButton.PreviousRandom = () => previousRandomCalled = true; |
| 551 | + }); |
| 552 | + |
| 553 | + AddStep("right click button", () => |
| 554 | + { |
| 555 | + InputManager.MoveMouseTo(randomButton); |
| 556 | + InputManager.Click(MouseButton.Right); |
| 557 | + }); |
| 558 | + AddAssert("previous random invoked", () => previousRandomCalled && !nextRandomCalled); |
| 559 | + } |
| 560 | + |
| 561 | + private FooterButtonRandom randomButton => Footer.ChildrenOfType<FooterButtonRandom>().Single(); |
519 | 562 |
|
520 | 563 | [Test] |
521 | 564 | public void TestFooterOptions() |
|
0 commit comments