public override void Reset() { base.Reset(); Add(progress = new SongProgress { RelativeSizeAxes = Axes.X, AudioClock = new StopwatchClock(true), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, }); Add(graph = new SongProgressGraph { RelativeSizeAxes = Axes.X, Height = 200, Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, }); AddStep("Toggle Bar", progress.ToggleBar); AddWaitStep(5); AddStep("Toggle Bar", progress.ToggleBar); AddWaitStep(2); AddRepeatStep("New Values", displayNewValues, 5); displayNewValues(); }
public TestCaseSongProgress() { clock = new StopwatchClock(true); Add(progress = new SongProgress { RelativeSizeAxes = Axes.X, AudioClock = new StopwatchClock(true), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, }); Add(graph = new SongProgressGraph { RelativeSizeAxes = Axes.X, Height = 200, Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, }); AddStep("Toggle Bar", () => progress.AllowSeeking = !progress.AllowSeeking); AddWaitStep(5); AddStep("Toggle Bar", () => progress.AllowSeeking = !progress.AllowSeeking); AddWaitStep(2); AddRepeatStep("New Values", displayNewValues, 5); displayNewValues(); }
public void SongProgress_Register() { // Arrange SongPlayer player = new SongPlayer(null, null); player.CurrentSong.AutoGenerate(); player.ToggleSound(); SongProgress prog = new SongProgress(player); // Start "playing" the song player.Start(); Thread.Sleep(800); player.Tick(); // Assert validity of unit test Assert.IsTrue(player.currentNotes.Count > 0); // Play one note correctly Note first = player.currentNotes.First(); prog.Register(new PianoButton( first.Octave, first.Letter + (first.Black ? "#" : "") )); // Assert Assert.AreEqual(1, prog.HitCount); }
public void SongProgress_GetMaximumScore() { // Arrange SongPlayer player = new SongPlayer(null, null); player.CurrentSong.AutoGenerate(); player.ToggleSound(); SongProgress prog = new SongProgress(player); // Act int max = prog.GetMaximumScore(); // Assert Assert.AreEqual( Piano.OCTAVEN * 7, max ); }
public override void Reset() { base.Reset(); Add(progress = new SongProgress { AudioClock = new StopwatchClock(true), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, }); AddStep("Toggle Bar", progress.ToggleBar); AddWaitStep(5); AddStep("Toggle Bar", progress.ToggleBar); AddWaitStep(2); AddRepeatStep("New Values", displayNewValues, 5); displayNewValues(); }
public TestCaseSongProgress() { clock = new StopwatchClock(true); gameplayClock = new GameplayClock(framedClock = new FramedClock(clock)); Add(progress = new SongProgress { RelativeSizeAxes = Axes.X, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, }); Add(graph = new TestSongProgressGraph { RelativeSizeAxes = Axes.X, Height = 200, Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, }); AddWaitStep(5); AddAssert("ensure not created", () => graph.CreationCount == 0); AddStep("display values", displayNewValues); AddWaitStep(5); AddUntilStep(() => graph.CreationCount == 1, "wait for creation count"); AddStep("Toggle Bar", () => progress.AllowSeeking = !progress.AllowSeeking); AddWaitStep(5); AddUntilStep(() => graph.CreationCount == 1, "wait for creation count"); AddStep("Toggle Bar", () => progress.AllowSeeking = !progress.AllowSeeking); AddWaitStep(5); AddUntilStep(() => graph.CreationCount == 1, "wait for creation count"); AddRepeatStep("New Values", displayNewValues, 5); AddWaitStep(5); AddAssert("ensure debounced", () => graph.CreationCount == 2); }
public WindowStudentController(WindowLoginController wlc) { this.windowLeerling = new WindowStudent(this); windowLeerling.Show(); this.parent = wlc; songPlayer = new SongPlayer(this, null); songProgress = new SongProgress(songPlayer); scorePopup = new ScorePopup(); buttons = new Dictionary <int, PianoButton>(); // Voeg alle knoppen voor het 4e octaaf toe buttons[81] = new PianoButton(Piano.BASE_OCTAAF, "C"); buttons[50] = new PianoButton(Piano.BASE_OCTAAF, "C#"); buttons[87] = new PianoButton(Piano.BASE_OCTAAF, "D"); buttons[51] = new PianoButton(Piano.BASE_OCTAAF, "D#"); buttons[69] = new PianoButton(Piano.BASE_OCTAAF, "E"); buttons[82] = new PianoButton(Piano.BASE_OCTAAF, "F"); buttons[53] = new PianoButton(Piano.BASE_OCTAAF, "F#"); buttons[84] = new PianoButton(Piano.BASE_OCTAAF, "G"); buttons[54] = new PianoButton(Piano.BASE_OCTAAF, "G#"); buttons[89] = new PianoButton(Piano.BASE_OCTAAF, "A"); buttons[55] = new PianoButton(Piano.BASE_OCTAAF, "A#"); buttons[85] = new PianoButton(Piano.BASE_OCTAAF, "B"); // Voeg alle knoppen voor het 5e octaaf toe buttons[90] = new PianoButton(Piano.BASE_OCTAAF + 1, "C"); buttons[83] = new PianoButton(Piano.BASE_OCTAAF + 1, "C#"); buttons[88] = new PianoButton(Piano.BASE_OCTAAF + 1, "D"); buttons[68] = new PianoButton(Piano.BASE_OCTAAF + 1, "D#"); buttons[67] = new PianoButton(Piano.BASE_OCTAAF + 1, "E"); buttons[86] = new PianoButton(Piano.BASE_OCTAAF + 1, "F"); buttons[71] = new PianoButton(Piano.BASE_OCTAAF + 1, "F#"); buttons[66] = new PianoButton(Piano.BASE_OCTAAF + 1, "G"); buttons[72] = new PianoButton(Piano.BASE_OCTAAF + 1, "G#"); buttons[78] = new PianoButton(Piano.BASE_OCTAAF + 1, "A"); buttons[74] = new PianoButton(Piano.BASE_OCTAAF + 1, "A#"); buttons[77] = new PianoButton(Piano.BASE_OCTAAF + 1, "B"); }
public void SetupSteps() { AddStep("add new song progress", () => { if (progress != null) { progress.Expire(); progress = null; } progressContainer.Add(progress = new SongProgress { RelativeSizeAxes = Axes.X, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, }); }); AddStep("add new big graph", () => { if (graph != null) { graph.Expire(); graph = null; } Add(graph = new TestSongProgressGraph { RelativeSizeAxes = Axes.X, Height = 200, Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, }); }); AddStep("reset clock", clock.Reset); }
public void SongProgress_GetResultingScore() { // Arrange SongPlayer player = new SongPlayer(null, null); player.CurrentSong.AutoGenerate(); player.ToggleSound(); SongProgress prog = new SongProgress(player); // Start playing player.Start(); Thread.Sleep(800); player.Tick(); // Assert validity of unit test Assert.IsTrue(player.currentNotes.Count > 0); // Play first note correctly Note first = player.currentNotes.First(); prog.Register(new PianoButton( first.Octave, first.Letter + (first.Black ? "#" : "") )); // Act int max = prog.GetMaximumScore(); int score = prog.HitCount; // Expected resulting score is 1 / max Assert.AreEqual( ((double)prog.HitCount) / (double)max, (double)prog.GetResultingScore(), 0.00001d ); }