Esempio n. 1
0
        public override void Reset()
        {
            base.Reset();
            oldDb = Dependencies.Get <BeatmapDatabase>();
            if (db == null)
            {
                storage = new TestStorage(@"TestCasePlaySongSelect");
                db      = new BeatmapDatabase(storage);
                Dependencies.Cache(db, true);

                var sets = new List <BeatmapSetInfo>();

                for (int i = 0; i < 100; i += 10)
                {
                    sets.Add(createTestBeatmapSet(i));
                }

                db.Import(sets);
            }

            Add(songSelect = new PlaySongSelect());

            AddButton(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; });
            AddButton(@"Sort by Title", delegate { songSelect.FilterControl.Sort = SortMode.Title; });
            AddButton(@"Sort by Author", delegate { songSelect.FilterControl.Sort = SortMode.Author; });
            AddButton(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; });
        }
        public TestCasePlaySongSelect()
        {
            PlaySongSelect songSelect;

            if (manager == null)
            {
                var storage = new TestStorage(@"TestCasePlaySongSelect");

                var backingDatabase = storage.GetDatabase(@"client");
                backingDatabase.CreateTable <StoreVersion>();

                rulesets = new RulesetStore(backingDatabase);
                manager  = new BeatmapManager(storage, null, backingDatabase, rulesets);

                for (int i = 0; i < 100; i += 10)
                {
                    manager.Import(createTestBeatmapSet(i));
                }
            }

            Add(songSelect = new PlaySongSelect());

            AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; });
            AddStep(@"Sort by Title", delegate { songSelect.FilterControl.Sort = SortMode.Title; });
            AddStep(@"Sort by Author", delegate { songSelect.FilterControl.Sort = SortMode.Author; });
            AddStep(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; });
        }
Esempio n. 3
0
        private void load()
        {
            PlaySongSelect songSelect;

            if (manager == null)
            {
                var storage = new TestStorage(@"TestCasePlaySongSelect");

                // this is by no means clean. should be replacing inside of OsuGameBase somehow.
                var context = new OsuDbContext();

                Func <OsuDbContext> contextFactory = () => context;

                dependencies.Cache(rulesets = new RulesetStore(contextFactory));
                dependencies.Cache(manager  = new BeatmapManager(storage, contextFactory, rulesets, null));

                for (int i = 0; i < 100; i += 10)
                {
                    manager.Import(createTestBeatmapSet(i));
                }
            }

            Add(songSelect = new PlaySongSelect());

            AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; });
            AddStep(@"Sort by Title", delegate { songSelect.FilterControl.Sort = SortMode.Title; });
            AddStep(@"Sort by Author", delegate { songSelect.FilterControl.Sort = SortMode.Author; });
            AddStep(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; });
        }
Esempio n. 4
0
        public override void Reset()
        {
            base.Reset();
            if (db == null)
            {
                storage = new TestStorage(@"TestCasePlaySongSelect");

                var backingDatabase = storage.GetDatabase(@"client");

                rulesets = new RulesetDatabase(storage, backingDatabase);
                db       = new BeatmapDatabase(storage, backingDatabase, rulesets);

                var sets = new List <BeatmapSetInfo>();

                for (int i = 0; i < 100; i += 10)
                {
                    sets.Add(createTestBeatmapSet(i));
                }

                db.Import(sets);
            }

            Add(songSelect = new PlaySongSelect());

            AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; });
            AddStep(@"Sort by Title", delegate { songSelect.FilterControl.Sort = SortMode.Title; });
            AddStep(@"Sort by Author", delegate { songSelect.FilterControl.Sort = SortMode.Author; });
            AddStep(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; });
        }
Esempio n. 5
0
        public void TestNewBeatmapSaveThenLoad()
        {
            AddStep("set default beatmap", () => Game.Beatmap.SetDefault());

            PushAndConfirm(() => new EditorLoader());

            AddUntilStep("wait for editor load", () => editor?.IsLoaded == true);

            AddUntilStep("wait for metadata screen load", () => editor.ChildrenOfType <MetadataSection>().FirstOrDefault()?.IsLoaded == true);

            // We intentionally switch away from the metadata screen, else there is a feedback loop with the textbox handling which causes metadata changes below to get overwritten.

            AddStep("Enter compose mode", () => InputManager.Key(Key.F1));
            AddUntilStep("Wait for compose mode load", () => editor.ChildrenOfType <HitObjectComposer>().FirstOrDefault()?.IsLoaded == true);

            AddStep("Set overall difficulty", () => editorBeatmap.Difficulty.OverallDifficulty = 7);
            AddStep("Set artist and title", () =>
            {
                editorBeatmap.BeatmapInfo.Metadata.Artist = "artist";
                editorBeatmap.BeatmapInfo.Metadata.Title  = "title";
            });
            AddStep("Set difficulty name", () => editorBeatmap.BeatmapInfo.DifficultyName = "difficulty");

            AddStep("Add timing point", () => editorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint()));

            AddStep("Change to placement mode", () => InputManager.Key(Key.Number2));
            AddStep("Move to playfield", () => InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.Centre));
            AddStep("Place single hitcircle", () => InputManager.Click(MouseButton.Left));

            checkMutations();

            // After placement these must be non-default as defaults are read-only.
            AddAssert("Placed object has non-default control points", () =>
                      editorBeatmap.HitObjects[0].SampleControlPoint != SampleControlPoint.DEFAULT &&
                      editorBeatmap.HitObjects[0].DifficultyControlPoint != DifficultyControlPoint.DEFAULT);

            AddStep("Save", () => InputManager.Keys(PlatformAction.Save));

            checkMutations();

            AddStep("Exit", () => InputManager.Key(Key.Escape));

            AddUntilStep("Wait for main menu", () => Game.ScreenStack.CurrentScreen is MainMenu);

            Screens.Select.SongSelect songSelect = null;

            PushAndConfirm(() => songSelect = new PlaySongSelect());
            AddUntilStep("wait for carousel load", () => songSelect.BeatmapSetsLoaded);

            AddUntilStep("Wait for beatmap selected", () => !Game.Beatmap.IsDefault);
            AddStep("Open options", () => InputManager.Key(Key.F3));
            AddStep("Enter editor", () => InputManager.Key(Key.Number5));

            AddUntilStep("Wait for editor load", () => editor != null);

            checkMutations();
        }
Esempio n. 6
0
        protected void ReloadEditorToSameBeatmap()
        {
            AddStep("Exit", () => InputManager.Key(Key.Escape));

            AddUntilStep("Wait for main menu", () => Game.ScreenStack.CurrentScreen is MainMenu);

            SongSelect songSelect = null;

            PushAndConfirm(() => songSelect = new PlaySongSelect());
            AddUntilStep("wait for carousel load", () => songSelect.BeatmapSetsLoaded);

            AddUntilStep("Wait for beatmap selected", () => !Game.Beatmap.IsDefault);
            AddStep("Open options", () => InputManager.Key(Key.F3));
            AddStep("Enter editor", () => InputManager.Key(Key.Number5));

            AddUntilStep("Wait for editor load", () => Editor != null);
        }