public void TestButtonWithReplayStartsDownload() { bool downloadStarted = false; bool downloadFinished = false; AddStep(@"create button with replay", () => { downloadStarted = false; downloadFinished = false; Child = downloadButton = new TestReplayDownloadButton(getScoreInfo(true)) { Anchor = Anchor.Centre, Origin = Anchor.Centre, }; downloadButton.State.BindValueChanged(state => { switch (state.NewValue) { case DownloadState.Downloading: downloadStarted = true; break; } switch (state.OldValue) { case DownloadState.Downloading: downloadFinished = true; break; } }); }); AddUntilStep("wait for load", () => downloadButton.IsLoaded); AddAssert("state is available", () => downloadButton.State.Value == DownloadState.NotDownloaded); AddStep("click button", () => { InputManager.MoveMouseTo(downloadButton); InputManager.Click(MouseButton.Left); }); AddAssert("state entered downloading", () => downloadStarted); AddUntilStep("state left downloading", () => downloadFinished); }
public void TestDisplayStates() { AddStep(@"create button with replay", () => { Child = downloadButton = new TestReplayDownloadButton(getScoreInfo(true)) { Anchor = Anchor.Centre, Origin = Anchor.Centre, }; }); AddUntilStep("wait for load", () => downloadButton.IsLoaded); AddStep(@"downloading state", () => downloadButton.SetDownloadState(DownloadState.Downloading)); AddStep(@"locally available state", () => downloadButton.SetDownloadState(DownloadState.LocallyAvailable)); AddStep(@"not downloaded state", () => downloadButton.SetDownloadState(DownloadState.NotDownloaded)); }