mirror of
https://github.com/ppy/osu
synced 2025-03-19 17:44:30 +00:00
Merge branch 'master' into summary-timeline-control-point-optimisation
This commit is contained in:
commit
93cd07f7fb
1
.idea/.idea.osu.Android/.idea/.name
generated
Normal file
1
.idea/.idea.osu.Android/.idea/.name
generated
Normal file
@ -0,0 +1 @@
|
||||
osu.Android
|
8
.idea/.idea.osu.Android/.idea/indexLayout.xml
generated
Normal file
8
.idea/.idea.osu.Android/.idea/indexLayout.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
6
.idea/.idea.osu.Android/.idea/misc.xml
generated
Normal file
6
.idea/.idea.osu.Android/.idea/misc.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="com.jetbrains.rider.android.RiderAndroidMiscFileCreationComponent">
|
||||
<option name="ENSURE_MISC_FILE_EXISTS" value="true" />
|
||||
</component>
|
||||
</project>
|
6
.idea/.idea.osu.Android/.idea/projectSettingsUpdater.xml
generated
Normal file
6
.idea/.idea.osu.Android/.idea/projectSettingsUpdater.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RiderProjectSettingsUpdater">
|
||||
<option name="vcsConfiguration" value="2" />
|
||||
</component>
|
||||
</project>
|
6
.idea/.idea.osu.Android/.idea/vcs.xml
generated
Normal file
6
.idea/.idea.osu.Android/.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
6
.idea/.idea.osu/.idea/misc.xml
generated
Normal file
6
.idea/.idea.osu/.idea/misc.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="com.jetbrains.rider.android.RiderAndroidMiscFileCreationComponent">
|
||||
<option name="ENSURE_MISC_FILE_EXISTS" value="true" />
|
||||
</component>
|
||||
</project>
|
8
.idea/.idea.osu/.idea/modules.xml
generated
8
.idea/.idea.osu/.idea/modules.xml
generated
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/.idea.osu/riderModule.iml" filepath="$PROJECT_DIR$/.idea/.idea.osu/riderModule.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
2
.idea/.idea.osu/.idea/projectSettingsUpdater.xml
generated
2
.idea/.idea.osu/.idea/projectSettingsUpdater.xml
generated
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RiderProjectSettingsUpdater">
|
||||
<option name="vcsConfiguration" value="1" />
|
||||
<option name="vcsConfiguration" value="2" />
|
||||
</component>
|
||||
</project>
|
@ -4,7 +4,6 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Tests.Visual;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -13,7 +12,7 @@ namespace osu.Game.Rulesets.EmptyFreeform.Tests
|
||||
public class TestSceneOsuGame : OsuTestScene
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host, OsuGameBase gameBase)
|
||||
private void load()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -4,7 +4,6 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Tests.Visual;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -13,7 +12,7 @@ namespace osu.Game.Rulesets.Pippidon.Tests
|
||||
public class TestSceneOsuGame : OsuTestScene
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host, OsuGameBase gameBase)
|
||||
private void load()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -4,7 +4,6 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Tests.Visual;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -13,7 +12,7 @@ namespace osu.Game.Rulesets.EmptyScrolling.Tests
|
||||
public class TestSceneOsuGame : OsuTestScene
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host, OsuGameBase gameBase)
|
||||
private void load()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -4,7 +4,6 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Tests.Visual;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -13,7 +12,7 @@ namespace osu.Game.Rulesets.Pippidon.Tests
|
||||
public class TestSceneOsuGame : OsuTestScene
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host, OsuGameBase gameBase)
|
||||
private void load()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -7,7 +7,6 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
@ -28,7 +27,7 @@ namespace osu.Game.Rulesets.Pippidon.UI
|
||||
private PippidonCharacter pippidon;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
private void load()
|
||||
{
|
||||
AddRangeInternal(new Drawable[]
|
||||
{
|
||||
|
@ -51,11 +51,11 @@
|
||||
<Reference Include="Java.Interop" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.114.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.111.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.115.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.118.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Transitive Dependencies">
|
||||
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->
|
||||
<PackageReference Include="Realm" Version="10.7.1" />
|
||||
<PackageReference Include="Realm" Version="10.8.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -10,14 +10,11 @@ using System.Runtime.Versioning;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Win32;
|
||||
using osu.Desktop.Security;
|
||||
using osu.Desktop.Overlays;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game;
|
||||
using osu.Desktop.Updater;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osu.Game.Updater;
|
||||
using osu.Desktop.Windows;
|
||||
using osu.Framework.Threading;
|
||||
@ -27,13 +24,9 @@ namespace osu.Desktop
|
||||
{
|
||||
internal class OsuGameDesktop : OsuGame
|
||||
{
|
||||
private readonly bool noVersionOverlay;
|
||||
private VersionManager versionManager;
|
||||
|
||||
public OsuGameDesktop(string[] args = null)
|
||||
: base(args)
|
||||
{
|
||||
noVersionOverlay = args?.Any(a => a == "--no-version-overlay") ?? false;
|
||||
}
|
||||
|
||||
public override StableStorage GetStorageForStableInstall()
|
||||
@ -114,9 +107,6 @@ namespace osu.Desktop
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
if (!noVersionOverlay)
|
||||
LoadComponentAsync(versionManager = new VersionManager { Depth = int.MinValue }, ScreenContainer.Add);
|
||||
|
||||
LoadComponentAsync(new DiscordRichPresence(), Add);
|
||||
|
||||
if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows)
|
||||
@ -125,23 +115,6 @@ namespace osu.Desktop
|
||||
LoadComponentAsync(new ElevatedPrivilegesChecker(), Add);
|
||||
}
|
||||
|
||||
protected override void ScreenChanged(IScreen lastScreen, IScreen newScreen)
|
||||
{
|
||||
base.ScreenChanged(lastScreen, newScreen);
|
||||
|
||||
switch (newScreen)
|
||||
{
|
||||
case IntroScreen _:
|
||||
case MainMenu _:
|
||||
versionManager?.Show();
|
||||
break;
|
||||
|
||||
default:
|
||||
versionManager?.Hide();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetHost(GameHost host)
|
||||
{
|
||||
base.SetHost(host);
|
||||
|
@ -73,7 +73,7 @@ namespace osu.Desktop.Security
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, NotificationOverlay notificationOverlay)
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Icon = FontAwesome.Solid.ShieldAlt;
|
||||
IconBackground.Colour = colours.YellowDark;
|
||||
|
@ -29,7 +29,13 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor
|
||||
|
||||
protected CatchSelectionBlueprintTestScene()
|
||||
{
|
||||
EditorBeatmap = new EditorBeatmap(new CatchBeatmap()) { Difficulty = { CircleSize = 0 } };
|
||||
EditorBeatmap = new EditorBeatmap(new CatchBeatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = new CatchRuleset().RulesetInfo,
|
||||
}
|
||||
}) { Difficulty = { CircleSize = 0 } };
|
||||
EditorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint
|
||||
{
|
||||
BeatLength = 100
|
||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
{
|
||||
BeatmapInfo = new BeatmapInfo
|
||||
{
|
||||
BaseDifficulty = new BeatmapDifficulty { CircleSize = 6, SliderMultiplier = 3 },
|
||||
Difficulty = new BeatmapDifficulty { CircleSize = 6, SliderMultiplier = 3 },
|
||||
Ruleset = ruleset
|
||||
}
|
||||
};
|
||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
{
|
||||
BeatmapInfo = new BeatmapInfo
|
||||
{
|
||||
BaseDifficulty = new BeatmapDifficulty { CircleSize = 6 },
|
||||
Difficulty = new BeatmapDifficulty { CircleSize = 6 },
|
||||
Ruleset = ruleset
|
||||
}
|
||||
};
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
{
|
||||
BeatmapInfo = new BeatmapInfo
|
||||
{
|
||||
BaseDifficulty = new BeatmapDifficulty { CircleSize = 6 },
|
||||
Difficulty = new BeatmapDifficulty { CircleSize = 6 },
|
||||
Ruleset = ruleset
|
||||
}
|
||||
};
|
||||
|
@ -35,12 +35,12 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
HitObjects = new List<HitObject> { new Fruit() },
|
||||
BeatmapInfo = new BeatmapInfo
|
||||
{
|
||||
BaseDifficulty = new BeatmapDifficulty(),
|
||||
Difficulty = new BeatmapDifficulty(),
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
Artist = @"Unknown",
|
||||
Title = @"You're breathtaking",
|
||||
AuthorString = @"Everyone",
|
||||
Author = { Username = @"Everyone" },
|
||||
},
|
||||
Ruleset = new CatchRuleset().RulesetInfo
|
||||
},
|
||||
|
@ -63,7 +63,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = ruleset,
|
||||
BaseDifficulty = new BeatmapDifficulty { CircleSize = 3.6f }
|
||||
Difficulty = new BeatmapDifficulty { CircleSize = 3.6f }
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
{
|
||||
BeatmapInfo = new BeatmapInfo
|
||||
{
|
||||
BaseDifficulty = new BeatmapDifficulty { CircleSize = 5, SliderMultiplier = 2 },
|
||||
Difficulty = new BeatmapDifficulty { CircleSize = 5, SliderMultiplier = 2 },
|
||||
Ruleset = ruleset
|
||||
},
|
||||
HitObjects = new List<HitObject>
|
||||
|
@ -29,7 +29,13 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
|
||||
private ScrollingTestContainer.TestScrollingInfo scrollingInfo = new ScrollingTestContainer.TestScrollingInfo();
|
||||
|
||||
[Cached(typeof(EditorBeatmap))]
|
||||
private EditorBeatmap editorBeatmap = new EditorBeatmap(new ManiaBeatmap(new StageDefinition()));
|
||||
private EditorBeatmap editorBeatmap = new EditorBeatmap(new ManiaBeatmap(new StageDefinition())
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = new ManiaRuleset().RulesetInfo
|
||||
}
|
||||
});
|
||||
|
||||
private readonly ManiaBeatSnapGrid beatSnapGrid;
|
||||
|
||||
|
@ -31,10 +31,10 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
|
||||
{
|
||||
AddStep("setup compose screen", () =>
|
||||
{
|
||||
var editorBeatmap = new EditorBeatmap(new ManiaBeatmap(new StageDefinition { Columns = 4 }))
|
||||
var editorBeatmap = new EditorBeatmap(new ManiaBeatmap(new StageDefinition { Columns = 4 })
|
||||
{
|
||||
BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo },
|
||||
};
|
||||
});
|
||||
|
||||
Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap);
|
||||
|
||||
|
@ -203,10 +203,10 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
EditorBeatmap = new EditorBeatmap(new ManiaBeatmap(new StageDefinition { Columns = 4 }))
|
||||
EditorBeatmap = new EditorBeatmap(new ManiaBeatmap(new StageDefinition { Columns = 4 })
|
||||
{
|
||||
BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo }
|
||||
},
|
||||
}),
|
||||
Composer = new ManiaHitObjectComposer(new ManiaRuleset())
|
||||
};
|
||||
|
||||
|
@ -4,11 +4,14 @@ Version: 2.5
|
||||
[Mania]
|
||||
Keys: 4
|
||||
ColumnLineWidth: 3,1,3,1,1
|
||||
Hit0: mania/hit0
|
||||
Hit50: mania/hit50
|
||||
Hit100: mania/hit100
|
||||
Hit200: mania/hit200
|
||||
Hit300: mania/hit300
|
||||
Hit300g: mania/hit300g
|
||||
// some skins found in the wild had configuration keys where the @2x suffix was included in the values.
|
||||
// the expected compatibility behaviour is that the presence of the @2x suffix shouldn't change anything
|
||||
// if @2x assets are present.
|
||||
Hit0: mania/hit0@2x
|
||||
Hit50: mania/hit50@2x
|
||||
Hit100: mania/hit100@2x
|
||||
Hit200: mania/hit200@2x
|
||||
Hit300: mania/hit300@2x
|
||||
Hit300g: mania/hit300g@2x
|
||||
StageLeft: mania/stage-left
|
||||
StageRight: mania/stage-right
|
@ -5,8 +5,10 @@ using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Mania.Scoring;
|
||||
using osu.Game.Rulesets.Mania.Skinning.Legacy;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
@ -23,15 +25,24 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
|
||||
{
|
||||
if (hitWindows.IsHitResultAllowed(result))
|
||||
{
|
||||
AddStep("Show " + result.GetDescription(), () => SetContents(_ =>
|
||||
new DrawableManiaJudgement(new JudgementResult(new HitObject { StartTime = Time.Current }, new Judgement())
|
||||
{
|
||||
Type = result
|
||||
}, null)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
}));
|
||||
AddStep("Show " + result.GetDescription(), () =>
|
||||
{
|
||||
SetContents(_ =>
|
||||
new DrawableManiaJudgement(new JudgementResult(new HitObject { StartTime = Time.Current }, new Judgement())
|
||||
{
|
||||
Type = result
|
||||
}, null)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
});
|
||||
|
||||
// for test purposes, undo the Y adjustment related to the `ScorePosition` legacy positioning config value
|
||||
// (see `LegacyManiaJudgementPiece.load()`).
|
||||
// this prevents the judgements showing somewhere below or above the bounding box of the judgement.
|
||||
foreach (var legacyPiece in this.ChildrenOfType<LegacyManiaJudgementPiece>())
|
||||
legacyPiece.Y = 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
},
|
||||
BeatmapInfo =
|
||||
{
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
Difficulty = new BeatmapDifficulty
|
||||
{
|
||||
SliderTickRate = 4,
|
||||
OverallDifficulty = 10,
|
||||
@ -306,7 +306,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
},
|
||||
BeatmapInfo =
|
||||
{
|
||||
BaseDifficulty = new BeatmapDifficulty { SliderTickRate = tick_rate },
|
||||
Difficulty = new BeatmapDifficulty { SliderTickRate = tick_rate },
|
||||
Ruleset = new ManiaRuleset().RulesetInfo
|
||||
},
|
||||
};
|
||||
@ -383,7 +383,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
},
|
||||
BeatmapInfo =
|
||||
{
|
||||
BaseDifficulty = new BeatmapDifficulty { SliderTickRate = 4 },
|
||||
Difficulty = new BeatmapDifficulty { SliderTickRate = 4 },
|
||||
Ruleset = new ManiaRuleset().RulesetInfo
|
||||
},
|
||||
};
|
||||
|
@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
||||
|
||||
public static int GetColumnCountForNonConvert(BeatmapInfo beatmapInfo)
|
||||
{
|
||||
double roundedCircleSize = Math.Round(beatmapInfo.BaseDifficulty.CircleSize);
|
||||
double roundedCircleSize = Math.Round(beatmapInfo.Difficulty.CircleSize);
|
||||
return (int)Math.Max(1, roundedCircleSize);
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Mania.Edit.Blueprints.Components;
|
||||
using osu.Game.Rulesets.Mania.Objects;
|
||||
using osu.Game.Rulesets.UI.Scrolling;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
||||
@ -28,7 +27,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IScrollingInfo scrollingInfo)
|
||||
private void load()
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor.Checks
|
||||
var beatmap = new Beatmap<HitObject>
|
||||
{
|
||||
HitObjects = hitObjects,
|
||||
BeatmapInfo = new BeatmapInfo { BaseDifficulty = new BeatmapDifficulty(beatmapDifficulty) }
|
||||
BeatmapInfo = new BeatmapInfo { Difficulty = new BeatmapDifficulty(beatmapDifficulty) }
|
||||
};
|
||||
|
||||
return new BeatmapVerifierContext(beatmap, new TestWorkingBeatmap(beatmap));
|
||||
|
@ -40,7 +40,13 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
||||
|
||||
public TestSceneOsuDistanceSnapGrid()
|
||||
{
|
||||
editorBeatmap = new EditorBeatmap(new OsuBeatmap());
|
||||
editorBeatmap = new EditorBeatmap(new OsuBeatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = new OsuRuleset().RulesetInfo
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
|
||||
{
|
||||
BeatmapInfo = new BeatmapInfo
|
||||
{
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
Difficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 8
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
BeatmapInfo = new BeatmapInfo
|
||||
{
|
||||
BaseDifficulty = new BeatmapDifficulty { CircleSize = 6 },
|
||||
Difficulty = new BeatmapDifficulty { CircleSize = 6 },
|
||||
Ruleset = ruleset
|
||||
}
|
||||
};
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
BeatmapInfo = new BeatmapInfo
|
||||
{
|
||||
BaseDifficulty = new BeatmapDifficulty { OverallDifficulty = 10 },
|
||||
Difficulty = new BeatmapDifficulty { OverallDifficulty = 10 },
|
||||
Ruleset = ruleset
|
||||
}
|
||||
};
|
||||
|
@ -358,7 +358,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
},
|
||||
BeatmapInfo =
|
||||
{
|
||||
BaseDifficulty = new BeatmapDifficulty { SliderTickRate = 3 },
|
||||
Difficulty = new BeatmapDifficulty { SliderTickRate = 3 },
|
||||
Ruleset = new OsuRuleset().RulesetInfo
|
||||
},
|
||||
});
|
||||
|
@ -364,7 +364,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
HitObjects = hitObjects,
|
||||
BeatmapInfo =
|
||||
{
|
||||
BaseDifficulty = new BeatmapDifficulty { SliderTickRate = 3 },
|
||||
Difficulty = new BeatmapDifficulty { SliderTickRate = 3 },
|
||||
Ruleset = new OsuRuleset().RulesetInfo
|
||||
},
|
||||
});
|
||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
private int countMeh;
|
||||
private int countMiss;
|
||||
|
||||
private int effectiveMissCount;
|
||||
private double effectiveMissCount;
|
||||
|
||||
public OsuPerformanceCalculator(Ruleset ruleset, DifficultyAttributes attributes, ScoreInfo score)
|
||||
: base(ruleset, attributes, score)
|
||||
@ -97,7 +97,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
|
||||
// Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.
|
||||
if (effectiveMissCount > 0)
|
||||
aimValue *= 0.97 * Math.Pow(1 - Math.Pow((double)effectiveMissCount / totalHits, 0.775), effectiveMissCount);
|
||||
aimValue *= 0.97 * Math.Pow(1 - Math.Pow(effectiveMissCount / totalHits, 0.775), effectiveMissCount);
|
||||
|
||||
aimValue *= getComboScalingFactor();
|
||||
|
||||
@ -144,7 +144,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
|
||||
// Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.
|
||||
if (effectiveMissCount > 0)
|
||||
speedValue *= 0.97 * Math.Pow(1 - Math.Pow((double)effectiveMissCount / totalHits, 0.775), Math.Pow(effectiveMissCount, .875));
|
||||
speedValue *= 0.97 * Math.Pow(1 - Math.Pow(effectiveMissCount / totalHits, 0.775), Math.Pow(effectiveMissCount, .875));
|
||||
|
||||
speedValue *= getComboScalingFactor();
|
||||
|
||||
@ -228,7 +228,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
|
||||
// Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.
|
||||
if (effectiveMissCount > 0)
|
||||
flashlightValue *= 0.97 * Math.Pow(1 - Math.Pow((double)effectiveMissCount / totalHits, 0.775), Math.Pow(effectiveMissCount, .875));
|
||||
flashlightValue *= 0.97 * Math.Pow(1 - Math.Pow(effectiveMissCount / totalHits, 0.775), Math.Pow(effectiveMissCount, .875));
|
||||
|
||||
flashlightValue *= getComboScalingFactor();
|
||||
|
||||
@ -244,7 +244,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
return flashlightValue;
|
||||
}
|
||||
|
||||
private int calculateEffectiveMissCount()
|
||||
private double calculateEffectiveMissCount()
|
||||
{
|
||||
// Guess the number of misses + slider breaks from combo
|
||||
double comboBasedMissCount = 0.0;
|
||||
@ -256,10 +256,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
comboBasedMissCount = fullComboThreshold / Math.Max(1.0, scoreMaxCombo);
|
||||
}
|
||||
|
||||
// Clamp misscount since it's derived from combo and can be higher than total hits and that breaks some calculations
|
||||
// Clamp miss count since it's derived from combo and can be higher than total hits and that breaks some calculations
|
||||
comboBasedMissCount = Math.Min(comboBasedMissCount, totalHits);
|
||||
|
||||
return Math.Max(countMiss, (int)Math.Floor(comboBasedMissCount));
|
||||
return Math.Max(countMiss, comboBasedMissCount);
|
||||
}
|
||||
|
||||
private double getComboScalingFactor() => Attributes.MaxCombo <= 0 ? 1.0 : Math.Min(Math.Pow(scoreMaxCombo, 0.8) / Math.Pow(Attributes.MaxCombo, 0.8), 1.0);
|
||||
|
@ -9,7 +9,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
@ -50,7 +49,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load()
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
|
@ -10,7 +10,6 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
@ -69,7 +68,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load()
|
||||
{
|
||||
Origin = Anchor.Centre;
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
@ -65,8 +65,8 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
double startTime = StartTime + (float)(i + 1) / totalSpins * Duration;
|
||||
|
||||
AddNested(i < SpinsRequired
|
||||
? new SpinnerTick { StartTime = startTime }
|
||||
: new SpinnerBonusTick { StartTime = startTime });
|
||||
? new SpinnerTick { StartTime = startTime, Position = Position }
|
||||
: new SpinnerBonusTick { StartTime = startTime, Position = Position });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,15 +3,13 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Skinning.Default
|
||||
{
|
||||
public class SpinnerBackgroundLayer : SpinnerFill
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, DrawableHitObject drawableHitObject)
|
||||
private void load()
|
||||
{
|
||||
Disc.Alpha = 0;
|
||||
Anchor = Anchor.Centre;
|
||||
|
@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
private GameplayState gameplayState { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ISkinSource skin, OsuColour colours)
|
||||
private void load(ISkinSource skin)
|
||||
{
|
||||
var texture = skin.GetTexture("star2");
|
||||
var starBreakAdditive = skin.GetConfig<OsuSkinColour, Color4>(OsuSkinColour.StarBreakAdditive)?.Value ?? new Color4(255, 182, 193, 255);
|
||||
|
@ -174,7 +174,7 @@ namespace osu.Game.Rulesets.Osu.Statistics
|
||||
|
||||
pointGrid.Content = points;
|
||||
|
||||
if (score.HitEvents == null || score.HitEvents.Count == 0)
|
||||
if (score.HitEvents.Count == 0)
|
||||
return;
|
||||
|
||||
// Todo: This should probably not be done like this.
|
||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
private OsuConfigManager config { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuConfigManager config, OsuRulesetConfigManager rulesetConfig)
|
||||
private void load(OsuRulesetConfigManager rulesetConfig)
|
||||
{
|
||||
rulesetConfig?.BindWith(OsuRulesetSetting.ShowCursorTrail, showTrail);
|
||||
}
|
||||
|
@ -32,12 +32,12 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
HitObjects = new List<HitObject> { new Hit { Type = HitType.Centre } },
|
||||
BeatmapInfo = new BeatmapInfo
|
||||
{
|
||||
BaseDifficulty = new BeatmapDifficulty(),
|
||||
Difficulty = new BeatmapDifficulty(),
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
Artist = @"Unknown",
|
||||
Title = @"Sample Beatmap",
|
||||
AuthorString = @"peppy",
|
||||
Author = { Username = @"peppy" },
|
||||
},
|
||||
Ruleset = new TaikoRuleset().RulesetInfo
|
||||
},
|
||||
|
@ -40,10 +40,10 @@ namespace osu.Game.Rulesets.Taiko.Tests.Editor
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
EditorBeatmap = new EditorBeatmap(new TaikoBeatmap())
|
||||
EditorBeatmap = new EditorBeatmap(new TaikoBeatmap
|
||||
{
|
||||
BeatmapInfo = { Ruleset = new TaikoRuleset().RulesetInfo }
|
||||
},
|
||||
}),
|
||||
new TaikoHitObjectComposer(new TaikoRuleset())
|
||||
};
|
||||
|
||||
|
@ -158,12 +158,12 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
||||
HitObjects = new List<HitObject> { new Hit { Type = HitType.Centre } },
|
||||
BeatmapInfo = new BeatmapInfo
|
||||
{
|
||||
BaseDifficulty = new BeatmapDifficulty(),
|
||||
Difficulty = new BeatmapDifficulty(),
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
Artist = "Unknown",
|
||||
Title = "Sample Beatmap",
|
||||
AuthorString = "Craftplacer",
|
||||
Author = { Username = "Craftplacer" },
|
||||
},
|
||||
Ruleset = new TaikoRuleset().RulesetInfo
|
||||
},
|
||||
|
36
osu.Game.Rulesets.Taiko.Tests/TestSceneDrumRollJudgements.cs
Normal file
36
osu.Game.Rulesets.Taiko.Tests/TestSceneDrumRollJudgements.cs
Normal file
@ -0,0 +1,36 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Tests
|
||||
{
|
||||
public class TestSceneDrumRollJudgements : TestSceneTaikoPlayer
|
||||
{
|
||||
[Test]
|
||||
public void TestStrongDrumRollFullyJudgedOnKilled()
|
||||
{
|
||||
AddUntilStep("gameplay finished", () => Player.ScoreProcessor.HasCompleted.Value);
|
||||
AddAssert("all judgements are misses", () => Player.Results.All(r => r.Type == r.Judgement.MinResult));
|
||||
}
|
||||
|
||||
protected override bool Autoplay => false;
|
||||
|
||||
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new Beatmap<TaikoHitObject>
|
||||
{
|
||||
BeatmapInfo = { Ruleset = new TaikoRuleset().RulesetInfo },
|
||||
HitObjects =
|
||||
{
|
||||
new DrumRoll
|
||||
{
|
||||
StartTime = 1000,
|
||||
Duration = 1000,
|
||||
IsStrong = true
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -191,6 +191,9 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
|
||||
|
||||
protected override Beatmap<TaikoHitObject> CreateBeatmap() => new TaikoBeatmap();
|
||||
|
||||
// Important to note that this is subclassing a realm object.
|
||||
// Realm doesn't allow this, but for now this can work since we aren't (in theory?) persisting this to the database.
|
||||
// It is only used during beatmap conversion and processing.
|
||||
internal class TaikoMultiplierAppliedDifficulty : BeatmapDifficulty
|
||||
{
|
||||
public TaikoMultiplierAppliedDifficulty(IBeatmapDifficultyInfo difficulty)
|
||||
@ -205,6 +208,8 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
|
||||
|
||||
#region Overrides of BeatmapDifficulty
|
||||
|
||||
public override BeatmapDifficulty Clone() => new TaikoMultiplierAppliedDifficulty(this);
|
||||
|
||||
public override void CopyTo(BeatmapDifficulty other)
|
||||
{
|
||||
base.CopyTo(other);
|
||||
|
@ -197,6 +197,14 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
ApplyResult(r => r.Type = ParentHitObject.IsHit ? r.Judgement.MaxResult : r.Judgement.MinResult);
|
||||
}
|
||||
|
||||
public override void OnKilled()
|
||||
{
|
||||
base.OnKilled();
|
||||
|
||||
if (Time.Current > ParentHitObject.HitObject.GetEndTime() && !Judged)
|
||||
ApplyResult(r => r.Type = r.Judgement.MinResult);
|
||||
}
|
||||
|
||||
public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) => false;
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ using System;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Taiko.Skinning.Default;
|
||||
using osu.Game.Skinning;
|
||||
@ -52,6 +53,14 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
ApplyResult(r => r.Type = r.Judgement.MaxResult);
|
||||
}
|
||||
|
||||
public override void OnKilled()
|
||||
{
|
||||
base.OnKilled();
|
||||
|
||||
if (Time.Current > HitObject.GetEndTime() && !Judged)
|
||||
ApplyResult(r => r.Type = r.Judgement.MinResult);
|
||||
}
|
||||
|
||||
protected override void UpdateHitStateTransforms(ArmedState state)
|
||||
{
|
||||
switch (state)
|
||||
@ -92,6 +101,14 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
ApplyResult(r => r.Type = ParentHitObject.IsHit ? r.Judgement.MaxResult : r.Judgement.MinResult);
|
||||
}
|
||||
|
||||
public override void OnKilled()
|
||||
{
|
||||
base.OnKilled();
|
||||
|
||||
if (Time.Current > ParentHitObject.HitObject.GetEndTime() && !Judged)
|
||||
ApplyResult(r => r.Type = r.Judgement.MinResult);
|
||||
}
|
||||
|
||||
public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) => false;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
using osuTK;
|
||||
|
||||
@ -19,7 +18,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Default
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load()
|
||||
{
|
||||
AccentColour = Hit.COLOUR_CENTRE;
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
@ -20,7 +19,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Default
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load()
|
||||
{
|
||||
AccentColour = Hit.COLOUR_RIM;
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
@ -39,7 +38,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(TextureStore textures, GameplayState gameplayState)
|
||||
private void load(GameplayState gameplayState)
|
||||
{
|
||||
InternalChildren = new[]
|
||||
{
|
||||
|
@ -117,7 +117,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
Assert.AreEqual(string.Empty, metadata.Source);
|
||||
Assert.AreEqual("MBC7 Unisphere 地球ヤバイEP Chikyu Yabai", metadata.Tags);
|
||||
Assert.AreEqual(557821, beatmapInfo.OnlineID);
|
||||
Assert.AreEqual(241526, beatmapInfo.BeatmapSet.OnlineID);
|
||||
Assert.AreEqual(241526, beatmapInfo.BeatmapSet?.OnlineID);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
{
|
||||
MD5Hash = md5Hash,
|
||||
Ruleset = new OsuRuleset().RulesetInfo,
|
||||
BaseDifficulty = new BeatmapDifficulty()
|
||||
Difficulty = new BeatmapDifficulty()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
{
|
||||
var beatmap = decodeAsJson(normal);
|
||||
var meta = beatmap.BeatmapInfo.Metadata;
|
||||
Assert.AreEqual(241526, beatmap.BeatmapInfo.BeatmapSet.OnlineID);
|
||||
Assert.AreEqual(241526, beatmap.BeatmapInfo.BeatmapSet?.OnlineID);
|
||||
Assert.AreEqual("Soleily", meta.Artist);
|
||||
Assert.AreEqual("Soleily", meta.ArtistUnicode);
|
||||
Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile);
|
||||
|
86
osu.Game.Tests/Beatmaps/IO/BeatmapImportHelper.cs
Normal file
86
osu.Game.Tests/Beatmaps/IO/BeatmapImportHelper.cs
Normal file
@ -0,0 +1,86 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Tests.Database;
|
||||
using osu.Game.Tests.Resources;
|
||||
|
||||
namespace osu.Game.Tests.Beatmaps.IO
|
||||
{
|
||||
public static class BeatmapImportHelper
|
||||
{
|
||||
public static async Task<BeatmapSetInfo> LoadQuickOszIntoOsu(OsuGameBase osu)
|
||||
{
|
||||
string temp = TestResources.GetQuickTestBeatmapForImport();
|
||||
|
||||
var manager = osu.Dependencies.Get<BeatmapManager>();
|
||||
|
||||
var importedSet = await manager.Import(new ImportTask(temp)).ConfigureAwait(false);
|
||||
|
||||
Debug.Assert(importedSet != null);
|
||||
|
||||
ensureLoaded(osu);
|
||||
|
||||
waitForOrAssert(() => !File.Exists(temp), "Temporary file still exists after standard import", 5000);
|
||||
|
||||
return manager.GetAllUsableBeatmapSets().Find(beatmapSet => beatmapSet.ID == importedSet.ID);
|
||||
}
|
||||
|
||||
public static async Task<BeatmapSetInfo> LoadOszIntoOsu(OsuGameBase osu, string path = null, bool virtualTrack = false)
|
||||
{
|
||||
string temp = path ?? TestResources.GetTestBeatmapForImport(virtualTrack);
|
||||
|
||||
var manager = osu.Dependencies.Get<BeatmapManager>();
|
||||
|
||||
var importedSet = await manager.Import(new ImportTask(temp)).ConfigureAwait(false);
|
||||
|
||||
Debug.Assert(importedSet != null);
|
||||
|
||||
ensureLoaded(osu);
|
||||
|
||||
waitForOrAssert(() => !File.Exists(temp), "Temporary file still exists after standard import", 5000);
|
||||
|
||||
return manager.GetAllUsableBeatmapSets().Find(beatmapSet => beatmapSet.ID == importedSet.ID);
|
||||
}
|
||||
|
||||
private static void ensureLoaded(OsuGameBase osu, int timeout = 60000)
|
||||
{
|
||||
var realmContextFactory = osu.Dependencies.Get<RealmContextFactory>();
|
||||
|
||||
using (var realm = realmContextFactory.CreateContext())
|
||||
BeatmapImporterTests.EnsureLoaded(realm, timeout);
|
||||
|
||||
// TODO: add back some extra checks outside of the realm ones?
|
||||
// var set = queryBeatmapSets().First();
|
||||
// foreach (BeatmapInfo b in set.Beatmaps)
|
||||
// Assert.IsTrue(set.Beatmaps.Any(c => c.OnlineID == b.OnlineID));
|
||||
// Assert.IsTrue(set.Beatmaps.Count > 0);
|
||||
// var beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 0))?.Beatmap;
|
||||
// Assert.IsTrue(beatmap?.HitObjects.Any() == true);
|
||||
// beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 1))?.Beatmap;
|
||||
// Assert.IsTrue(beatmap?.HitObjects.Any() == true);
|
||||
// beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 2))?.Beatmap;
|
||||
// Assert.IsTrue(beatmap?.HitObjects.Any() == true);
|
||||
// beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 3))?.Beatmap;
|
||||
// Assert.IsTrue(beatmap?.HitObjects.Any() == true);
|
||||
}
|
||||
|
||||
private static void waitForOrAssert(Func<bool> result, string failureMessage, int timeout = 60000)
|
||||
{
|
||||
Task task = Task.Run(() =>
|
||||
{
|
||||
while (!result()) Thread.Sleep(200);
|
||||
});
|
||||
|
||||
Assert.IsTrue(task.Wait(timeout), failureMessage);
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -56,7 +56,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
|
||||
var meta = beatmap.Metadata;
|
||||
|
||||
Assert.AreEqual(241526, beatmap.BeatmapInfo.BeatmapSet.OnlineID);
|
||||
Assert.AreEqual(241526, beatmap.BeatmapInfo.BeatmapSet?.OnlineID);
|
||||
Assert.AreEqual("Soleily", meta.Artist);
|
||||
Assert.AreEqual("Soleily", meta.ArtistUnicode);
|
||||
Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile);
|
||||
|
@ -24,6 +24,8 @@ namespace osu.Game.Tests.Beatmaps
|
||||
{
|
||||
public const double BASE_STARS = 5.55;
|
||||
|
||||
private static readonly Guid guid = Guid.NewGuid();
|
||||
|
||||
private BeatmapSetInfo importedSet;
|
||||
|
||||
private TestBeatmapDifficultyCache difficultyCache;
|
||||
@ -33,7 +35,7 @@ namespace osu.Game.Tests.Beatmaps
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGameBase osu)
|
||||
{
|
||||
importedSet = ImportBeatmapTest.LoadQuickOszIntoOsu(osu).GetResultSafely();
|
||||
importedSet = BeatmapImportHelper.LoadQuickOszIntoOsu(osu).GetResultSafely();
|
||||
}
|
||||
|
||||
[SetUpSteps]
|
||||
@ -98,8 +100,8 @@ namespace osu.Game.Tests.Beatmaps
|
||||
[Test]
|
||||
public void TestKeyEqualsWithDifferentModInstances()
|
||||
{
|
||||
var key1 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
||||
var key2 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
||||
var key1 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = guid }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
||||
var key2 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = guid }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
||||
|
||||
Assert.That(key1, Is.EqualTo(key2));
|
||||
Assert.That(key1.GetHashCode(), Is.EqualTo(key2.GetHashCode()));
|
||||
@ -108,8 +110,8 @@ namespace osu.Game.Tests.Beatmaps
|
||||
[Test]
|
||||
public void TestKeyEqualsWithDifferentModOrder()
|
||||
{
|
||||
var key1 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
||||
var key2 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModHidden(), new OsuModHardRock() });
|
||||
var key1 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = guid }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
||||
var key2 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = guid }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModHidden(), new OsuModHardRock() });
|
||||
|
||||
Assert.That(key1, Is.EqualTo(key2));
|
||||
Assert.That(key1.GetHashCode(), Is.EqualTo(key2.GetHashCode()));
|
||||
@ -118,8 +120,8 @@ namespace osu.Game.Tests.Beatmaps
|
||||
[Test]
|
||||
public void TestKeyDoesntEqualWithDifferentModSettings()
|
||||
{
|
||||
var key1 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModDoubleTime { SpeedChange = { Value = 1.1 } } });
|
||||
var key2 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModDoubleTime { SpeedChange = { Value = 1.9 } } });
|
||||
var key1 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = guid }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModDoubleTime { SpeedChange = { Value = 1.1 } } });
|
||||
var key2 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = guid }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModDoubleTime { SpeedChange = { Value = 1.9 } } });
|
||||
|
||||
Assert.That(key1, Is.Not.EqualTo(key2));
|
||||
Assert.That(key1.GetHashCode(), Is.Not.EqualTo(key2.GetHashCode()));
|
||||
@ -128,8 +130,8 @@ namespace osu.Game.Tests.Beatmaps
|
||||
[Test]
|
||||
public void TestKeyEqualWithMatchingModSettings()
|
||||
{
|
||||
var key1 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModDoubleTime { SpeedChange = { Value = 1.25 } } });
|
||||
var key2 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModDoubleTime { SpeedChange = { Value = 1.25 } } });
|
||||
var key1 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = guid }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModDoubleTime { SpeedChange = { Value = 1.25 } } });
|
||||
var key2 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = guid }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModDoubleTime { SpeedChange = { Value = 1.25 } } });
|
||||
|
||||
Assert.That(key1, Is.EqualTo(key2));
|
||||
Assert.That(key1.GetHashCode(), Is.EqualTo(key2.GetHashCode()));
|
||||
|
@ -7,6 +7,7 @@ using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Screens.Edit;
|
||||
@ -30,7 +31,13 @@ namespace osu.Game.Tests.Beatmaps
|
||||
|
||||
AddStep("add beatmap", () =>
|
||||
{
|
||||
Child = editorBeatmap = new EditorBeatmap(new OsuBeatmap());
|
||||
Child = editorBeatmap = new EditorBeatmap(new OsuBeatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = new OsuRuleset().RulesetInfo,
|
||||
},
|
||||
});
|
||||
editorBeatmap.HitObjectAdded += h => addedObject = h;
|
||||
});
|
||||
|
||||
@ -49,7 +56,14 @@ namespace osu.Game.Tests.Beatmaps
|
||||
EditorBeatmap editorBeatmap = null;
|
||||
AddStep("add beatmap", () =>
|
||||
{
|
||||
Child = editorBeatmap = new EditorBeatmap(new OsuBeatmap { HitObjects = { hitCircle } });
|
||||
Child = editorBeatmap = new EditorBeatmap(new OsuBeatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = new OsuRuleset().RulesetInfo,
|
||||
},
|
||||
HitObjects = { hitCircle }
|
||||
});
|
||||
editorBeatmap.HitObjectRemoved += h => removedObject = h;
|
||||
});
|
||||
AddStep("remove hitobject", () => editorBeatmap.Remove(editorBeatmap.HitObjects.First()));
|
||||
@ -71,7 +85,14 @@ namespace osu.Game.Tests.Beatmaps
|
||||
{
|
||||
EditorBeatmap editorBeatmap;
|
||||
|
||||
Child = editorBeatmap = new EditorBeatmap(new OsuBeatmap { HitObjects = { hitCircle } });
|
||||
Child = editorBeatmap = new EditorBeatmap(new OsuBeatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = new OsuRuleset().RulesetInfo,
|
||||
},
|
||||
HitObjects = { hitCircle }
|
||||
});
|
||||
editorBeatmap.HitObjectUpdated += h => changedObject = h;
|
||||
});
|
||||
|
||||
@ -91,7 +112,13 @@ namespace osu.Game.Tests.Beatmaps
|
||||
|
||||
AddStep("add beatmap", () =>
|
||||
{
|
||||
Child = editorBeatmap = new EditorBeatmap(new OsuBeatmap());
|
||||
Child = editorBeatmap = new EditorBeatmap(new OsuBeatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = new OsuRuleset().RulesetInfo,
|
||||
},
|
||||
});
|
||||
editorBeatmap.HitObjectUpdated += h => changedObject = h;
|
||||
});
|
||||
|
||||
@ -111,7 +138,14 @@ namespace osu.Game.Tests.Beatmaps
|
||||
public void TestRemovedHitObjectStartTimeChangeEvent()
|
||||
{
|
||||
var hitCircle = new HitCircle();
|
||||
var editorBeatmap = new EditorBeatmap(new OsuBeatmap { HitObjects = { hitCircle } });
|
||||
var editorBeatmap = new EditorBeatmap(new OsuBeatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = new OsuRuleset().RulesetInfo,
|
||||
},
|
||||
HitObjects = { hitCircle }
|
||||
});
|
||||
|
||||
HitObject changedObject = null;
|
||||
editorBeatmap.HitObjectUpdated += h => changedObject = h;
|
||||
@ -131,6 +165,10 @@ namespace osu.Game.Tests.Beatmaps
|
||||
{
|
||||
var editorBeatmap = new EditorBeatmap(new OsuBeatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = new OsuRuleset().RulesetInfo,
|
||||
},
|
||||
HitObjects =
|
||||
{
|
||||
new HitCircle(),
|
||||
@ -156,6 +194,10 @@ namespace osu.Game.Tests.Beatmaps
|
||||
|
||||
var editorBeatmap = new EditorBeatmap(new OsuBeatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = new OsuRuleset().RulesetInfo,
|
||||
},
|
||||
HitObjects =
|
||||
{
|
||||
new HitCircle(),
|
||||
@ -185,7 +227,13 @@ namespace osu.Game.Tests.Beatmaps
|
||||
{
|
||||
updatedObjects.Clear();
|
||||
|
||||
Child = editorBeatmap = new EditorBeatmap(new OsuBeatmap());
|
||||
Child = editorBeatmap = new EditorBeatmap(new OsuBeatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = new OsuRuleset().RulesetInfo,
|
||||
},
|
||||
});
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
@ -220,7 +268,13 @@ namespace osu.Game.Tests.Beatmaps
|
||||
{
|
||||
updatedObjects.Clear();
|
||||
|
||||
Child = editorBeatmap = new EditorBeatmap(new OsuBeatmap());
|
||||
Child = editorBeatmap = new EditorBeatmap(new OsuBeatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = new OsuRuleset().RulesetInfo,
|
||||
},
|
||||
});
|
||||
editorBeatmap.Add(new HitCircle());
|
||||
});
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Models;
|
||||
|
||||
namespace osu.Game.Tests.Beatmaps
|
||||
{
|
||||
@ -34,7 +34,7 @@ namespace osu.Game.Tests.Beatmaps
|
||||
{
|
||||
Artist = "artist",
|
||||
Title = "title",
|
||||
Author = new APIUser { Username = "creator" }
|
||||
Author = new RealmUser { Username = "creator" }
|
||||
}
|
||||
};
|
||||
|
||||
@ -50,7 +50,7 @@ namespace osu.Game.Tests.Beatmaps
|
||||
{
|
||||
Artist = "artist",
|
||||
Title = "title",
|
||||
Author = new APIUser { Username = "creator" }
|
||||
Author = new RealmUser { Username = "creator" }
|
||||
},
|
||||
DifficultyName = "difficulty"
|
||||
};
|
||||
|
@ -19,6 +19,7 @@ using osu.Game.Extensions;
|
||||
using osu.Game.IO.Archives;
|
||||
using osu.Game.Models;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Stores;
|
||||
using osu.Game.Tests.Resources;
|
||||
using Realms;
|
||||
@ -34,33 +35,134 @@ namespace osu.Game.Tests.Database
|
||||
[TestFixture]
|
||||
public class BeatmapImporterTests : RealmTest
|
||||
{
|
||||
[Test]
|
||||
public void TestDetachBeatmapSet()
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using (var importer = new BeatmapModelManager(realmFactory, storage))
|
||||
using (new RulesetStore(realmFactory, storage))
|
||||
{
|
||||
ILive<BeatmapSetInfo>? beatmapSet;
|
||||
|
||||
using (var reader = new ZipArchiveReader(TestResources.GetTestBeatmapStream()))
|
||||
beatmapSet = await importer.Import(reader);
|
||||
|
||||
Assert.NotNull(beatmapSet);
|
||||
Debug.Assert(beatmapSet != null);
|
||||
|
||||
BeatmapSetInfo? detachedBeatmapSet = null;
|
||||
|
||||
beatmapSet.PerformRead(live =>
|
||||
{
|
||||
detachedBeatmapSet = live.Detach();
|
||||
|
||||
// files are omitted
|
||||
Assert.AreEqual(0, detachedBeatmapSet.Files.Count);
|
||||
|
||||
Assert.AreEqual(live.Beatmaps.Count, detachedBeatmapSet.Beatmaps.Count);
|
||||
Assert.AreEqual(live.Beatmaps.Select(f => f.Difficulty).Count(), detachedBeatmapSet.Beatmaps.Select(f => f.Difficulty).Count());
|
||||
Assert.AreEqual(live.Metadata, detachedBeatmapSet.Metadata);
|
||||
});
|
||||
|
||||
Debug.Assert(detachedBeatmapSet != null);
|
||||
|
||||
// Check detached instances can all be accessed without throwing.
|
||||
Assert.AreEqual(0, detachedBeatmapSet.Files.Count);
|
||||
Assert.NotNull(detachedBeatmapSet.Beatmaps.Count);
|
||||
Assert.NotZero(detachedBeatmapSet.Beatmaps.Select(f => f.Difficulty).Count());
|
||||
Assert.NotNull(detachedBeatmapSet.Metadata);
|
||||
|
||||
// Check cyclic reference to beatmap set
|
||||
Assert.AreEqual(detachedBeatmapSet, detachedBeatmapSet.Beatmaps.First().BeatmapSet);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUpdateDetachedBeatmapSet()
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using (var importer = new BeatmapModelManager(realmFactory, storage))
|
||||
using (new RulesetStore(realmFactory, storage))
|
||||
{
|
||||
ILive<BeatmapSetInfo>? beatmapSet;
|
||||
|
||||
using (var reader = new ZipArchiveReader(TestResources.GetTestBeatmapStream()))
|
||||
beatmapSet = await importer.Import(reader);
|
||||
|
||||
Assert.NotNull(beatmapSet);
|
||||
Debug.Assert(beatmapSet != null);
|
||||
|
||||
// Detach at the BeatmapInfo point, similar to what GetWorkingBeatmap does.
|
||||
BeatmapInfo? detachedBeatmap = null;
|
||||
|
||||
beatmapSet.PerformRead(s => detachedBeatmap = s.Beatmaps.First().Detach());
|
||||
|
||||
BeatmapSetInfo? detachedBeatmapSet = detachedBeatmap?.BeatmapSet;
|
||||
|
||||
Debug.Assert(detachedBeatmapSet != null);
|
||||
|
||||
var newUser = new RealmUser { Username = "peppy", OnlineID = 2 };
|
||||
|
||||
detachedBeatmapSet.Beatmaps.First().Metadata.Artist = "New Artist";
|
||||
detachedBeatmapSet.Beatmaps.First().Metadata.Author = newUser;
|
||||
|
||||
Assert.AreNotEqual(detachedBeatmapSet.Status, BeatmapOnlineStatus.Ranked);
|
||||
detachedBeatmapSet.Status = BeatmapOnlineStatus.Ranked;
|
||||
|
||||
beatmapSet.PerformWrite(s =>
|
||||
{
|
||||
detachedBeatmapSet.CopyChangesToRealm(s);
|
||||
});
|
||||
|
||||
beatmapSet.PerformRead(s =>
|
||||
{
|
||||
// Check above changes explicitly.
|
||||
Assert.AreEqual(BeatmapOnlineStatus.Ranked, s.Status);
|
||||
Assert.AreEqual("New Artist", s.Beatmaps.First().Metadata.Artist);
|
||||
Assert.AreEqual(newUser, s.Beatmaps.First().Metadata.Author);
|
||||
Assert.NotZero(s.Files.Count);
|
||||
|
||||
// Check nothing was lost in the copy operation.
|
||||
Assert.AreEqual(s.Files.Count, detachedBeatmapSet.Files.Count);
|
||||
Assert.AreEqual(s.Files.Select(f => f.File).Count(), detachedBeatmapSet.Files.Select(f => f.File).Count());
|
||||
Assert.AreEqual(s.Beatmaps.Count, detachedBeatmapSet.Beatmaps.Count);
|
||||
Assert.AreEqual(s.Beatmaps.Select(f => f.Difficulty).Count(), detachedBeatmapSet.Beatmaps.Select(f => f.Difficulty).Count());
|
||||
Assert.AreEqual(s.Metadata, detachedBeatmapSet.Metadata);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestImportBeatmapThenCleanup()
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using (var importer = new BeatmapImporter(realmFactory, storage))
|
||||
using (new RealmRulesetStore(realmFactory, storage))
|
||||
using (var importer = new BeatmapModelManager(realmFactory, storage))
|
||||
using (new RulesetStore(realmFactory, storage))
|
||||
{
|
||||
ILive<RealmBeatmapSet>? imported;
|
||||
ILive<BeatmapSetInfo>? imported;
|
||||
|
||||
using (var reader = new ZipArchiveReader(TestResources.GetTestBeatmapStream()))
|
||||
imported = await importer.Import(reader);
|
||||
|
||||
Assert.AreEqual(1, realmFactory.Context.All<RealmBeatmapSet>().Count());
|
||||
Assert.AreEqual(1, realmFactory.Context.All<BeatmapSetInfo>().Count());
|
||||
|
||||
Assert.NotNull(imported);
|
||||
Debug.Assert(imported != null);
|
||||
|
||||
imported.PerformWrite(s => s.DeletePending = true);
|
||||
|
||||
Assert.AreEqual(1, realmFactory.Context.All<RealmBeatmapSet>().Count(s => s.DeletePending));
|
||||
Assert.AreEqual(1, realmFactory.Context.All<BeatmapSetInfo>().Count(s => s.DeletePending));
|
||||
}
|
||||
});
|
||||
|
||||
Logger.Log("Running with no work to purge pending deletions");
|
||||
|
||||
RunTestWithRealm((realmFactory, _) => { Assert.AreEqual(0, realmFactory.Context.All<RealmBeatmapSet>().Count()); });
|
||||
RunTestWithRealm((realmFactory, _) => { Assert.AreEqual(0, realmFactory.Context.All<BeatmapSetInfo>().Count()); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -68,8 +170,8 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var importer = new BeatmapModelManager(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
await LoadOszIntoStore(importer, realmFactory.Context);
|
||||
});
|
||||
@ -80,8 +182,8 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var importer = new BeatmapModelManager(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
var imported = await LoadOszIntoStore(importer, realmFactory.Context);
|
||||
|
||||
@ -98,8 +200,8 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var importer = new BeatmapModelManager(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
var imported = await LoadOszIntoStore(importer, realmFactory.Context);
|
||||
|
||||
@ -112,17 +214,17 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var importer = new BeatmapModelManager(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
string? tempPath = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
ILive<RealmBeatmapSet>? importedSet;
|
||||
ILive<BeatmapSetInfo>? importedSet;
|
||||
|
||||
using (var stream = File.OpenRead(tempPath))
|
||||
{
|
||||
importedSet = await importer.Import(new ImportTask(stream, Path.GetFileName(tempPath)));
|
||||
ensureLoaded(realmFactory.Context);
|
||||
EnsureLoaded(realmFactory.Context);
|
||||
}
|
||||
|
||||
Assert.NotNull(importedSet);
|
||||
@ -131,7 +233,7 @@ namespace osu.Game.Tests.Database
|
||||
Assert.IsTrue(File.Exists(tempPath), "Stream source file somehow went missing");
|
||||
File.Delete(tempPath);
|
||||
|
||||
var imported = realmFactory.Context.All<RealmBeatmapSet>().First(beatmapSet => beatmapSet.ID == importedSet.ID);
|
||||
var imported = realmFactory.Context.All<BeatmapSetInfo>().First(beatmapSet => beatmapSet.ID == importedSet.ID);
|
||||
|
||||
deleteBeatmapSet(imported, realmFactory.Context);
|
||||
});
|
||||
@ -142,8 +244,8 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var importer = new BeatmapModelManager(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
var imported = await LoadOszIntoStore(importer, realmFactory.Context);
|
||||
var importedSecondTime = await LoadOszIntoStore(importer, realmFactory.Context);
|
||||
@ -162,8 +264,8 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var importer = new BeatmapModelManager(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
string? temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
@ -190,7 +292,7 @@ namespace osu.Game.Tests.Database
|
||||
|
||||
var importedSecondTime = await importer.Import(new ImportTask(temp));
|
||||
|
||||
ensureLoaded(realmFactory.Context);
|
||||
EnsureLoaded(realmFactory.Context);
|
||||
|
||||
Assert.NotNull(importedSecondTime);
|
||||
Debug.Assert(importedSecondTime != null);
|
||||
@ -211,8 +313,8 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var importer = new BeatmapModelManager(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
string? temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
@ -241,7 +343,7 @@ namespace osu.Game.Tests.Database
|
||||
|
||||
var importedSecondTime = await importer.Import(new ImportTask(temp));
|
||||
|
||||
ensureLoaded(realmFactory.Context);
|
||||
EnsureLoaded(realmFactory.Context);
|
||||
|
||||
// check the newly "imported" beatmap is not the original.
|
||||
Assert.NotNull(importedSecondTime);
|
||||
@ -263,8 +365,8 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var importer = new BeatmapModelManager(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
string? temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
@ -290,7 +392,7 @@ namespace osu.Game.Tests.Database
|
||||
|
||||
var importedSecondTime = await importer.Import(new ImportTask(temp));
|
||||
|
||||
ensureLoaded(realmFactory.Context);
|
||||
EnsureLoaded(realmFactory.Context);
|
||||
|
||||
Assert.NotNull(importedSecondTime);
|
||||
Debug.Assert(importedSecondTime != null);
|
||||
@ -311,8 +413,8 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var importer = new BeatmapModelManager(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
string? temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
@ -338,7 +440,7 @@ namespace osu.Game.Tests.Database
|
||||
|
||||
var importedSecondTime = await importer.Import(new ImportTask(temp));
|
||||
|
||||
ensureLoaded(realmFactory.Context);
|
||||
EnsureLoaded(realmFactory.Context);
|
||||
|
||||
Assert.NotNull(importedSecondTime);
|
||||
Debug.Assert(importedSecondTime != null);
|
||||
@ -360,8 +462,8 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var importer = new BeatmapModelManager(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
var imported = await LoadOszIntoStore(importer, realmFactory.Context);
|
||||
|
||||
@ -393,8 +495,8 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var importer = new BeatmapModelManager(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
var progressNotification = new ImportProgressNotification();
|
||||
|
||||
@ -429,8 +531,8 @@ namespace osu.Game.Tests.Database
|
||||
Interlocked.Increment(ref loggedExceptionCount);
|
||||
};
|
||||
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var importer = new BeatmapModelManager(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
var imported = await LoadOszIntoStore(importer, realmFactory.Context);
|
||||
|
||||
@ -479,8 +581,8 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var importer = new BeatmapModelManager(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
var imported = await LoadOszIntoStore(importer, realmFactory.Context);
|
||||
|
||||
@ -504,7 +606,7 @@ namespace osu.Game.Tests.Database
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using var importer = new NonOptimisedBeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
var imported = await LoadOszIntoStore(importer, realmFactory.Context);
|
||||
|
||||
@ -527,8 +629,8 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var importer = new BeatmapModelManager(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
var imported = await LoadOszIntoStore(importer, realmFactory.Context);
|
||||
|
||||
@ -553,10 +655,10 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var importer = new BeatmapModelManager(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
var metadata = new RealmBeatmapMetadata
|
||||
var metadata = new BeatmapMetadata
|
||||
{
|
||||
Artist = "SomeArtist",
|
||||
Author =
|
||||
@ -565,18 +667,18 @@ namespace osu.Game.Tests.Database
|
||||
}
|
||||
};
|
||||
|
||||
var ruleset = realmFactory.Context.All<RealmRuleset>().First();
|
||||
var ruleset = realmFactory.Context.All<RulesetInfo>().First();
|
||||
|
||||
var toImport = new RealmBeatmapSet
|
||||
var toImport = new BeatmapSetInfo
|
||||
{
|
||||
OnlineID = 1,
|
||||
Beatmaps =
|
||||
{
|
||||
new RealmBeatmap(ruleset, new RealmBeatmapDifficulty(), metadata)
|
||||
new BeatmapInfo(ruleset, new BeatmapDifficulty(), metadata)
|
||||
{
|
||||
OnlineID = 2,
|
||||
},
|
||||
new RealmBeatmap(ruleset, new RealmBeatmapDifficulty(), metadata)
|
||||
new BeatmapInfo(ruleset, new BeatmapDifficulty(), metadata)
|
||||
{
|
||||
OnlineID = 2,
|
||||
Status = BeatmapOnlineStatus.Loved,
|
||||
@ -599,13 +701,13 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var importer = new BeatmapModelManager(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
string? temp = TestResources.GetTestBeatmapForImport();
|
||||
using (File.OpenRead(temp))
|
||||
await importer.Import(temp);
|
||||
ensureLoaded(realmFactory.Context);
|
||||
EnsureLoaded(realmFactory.Context);
|
||||
File.Delete(temp);
|
||||
Assert.IsFalse(File.Exists(temp), "We likely held a read lock on the file when we shouldn't");
|
||||
});
|
||||
@ -616,8 +718,8 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var importer = new BeatmapModelManager(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
string? temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
@ -638,7 +740,7 @@ namespace osu.Game.Tests.Database
|
||||
|
||||
await importer.Import(temp);
|
||||
|
||||
ensureLoaded(realmFactory.Context);
|
||||
EnsureLoaded(realmFactory.Context);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -652,8 +754,8 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var importer = new BeatmapModelManager(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
string? temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
@ -678,7 +780,7 @@ namespace osu.Game.Tests.Database
|
||||
Assert.NotNull(imported);
|
||||
Debug.Assert(imported != null);
|
||||
|
||||
ensureLoaded(realmFactory.Context);
|
||||
EnsureLoaded(realmFactory.Context);
|
||||
|
||||
Assert.IsFalse(imported.PerformRead(s => s.Files.Any(f => f.Filename.Contains("subfolder"))), "Files contain common subfolder");
|
||||
}
|
||||
@ -694,8 +796,8 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var importer = new BeatmapModelManager(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
string? temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
@ -728,7 +830,7 @@ namespace osu.Game.Tests.Database
|
||||
Assert.NotNull(imported);
|
||||
Debug.Assert(imported != null);
|
||||
|
||||
ensureLoaded(realmFactory.Context);
|
||||
EnsureLoaded(realmFactory.Context);
|
||||
|
||||
Assert.IsFalse(imported.PerformRead(s => s.Files.Any(f => f.Filename.Contains("__MACOSX"))), "Files contain resource fork folder, which should be ignored");
|
||||
Assert.IsFalse(imported.PerformRead(s => s.Files.Any(f => f.Filename.Contains("actual_data"))), "Files contain common subfolder");
|
||||
@ -745,25 +847,25 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealmAsync(async (realmFactory, storage) =>
|
||||
{
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
using var importer = new BeatmapModelManager(realmFactory, storage);
|
||||
using var store = new RulesetStore(realmFactory, storage);
|
||||
|
||||
string? temp = TestResources.GetTestBeatmapForImport();
|
||||
await importer.Import(temp);
|
||||
|
||||
// Update via the beatmap, not the beatmap info, to ensure correct linking
|
||||
RealmBeatmapSet setToUpdate = realmFactory.Context.All<RealmBeatmapSet>().First();
|
||||
BeatmapSetInfo setToUpdate = realmFactory.Context.All<BeatmapSetInfo>().First();
|
||||
|
||||
var beatmapToUpdate = setToUpdate.Beatmaps.First();
|
||||
|
||||
realmFactory.Context.Write(() => beatmapToUpdate.DifficultyName = "updated");
|
||||
|
||||
RealmBeatmap updatedInfo = realmFactory.Context.All<RealmBeatmap>().First(b => b.ID == beatmapToUpdate.ID);
|
||||
BeatmapInfo updatedInfo = realmFactory.Context.All<BeatmapInfo>().First(b => b.ID == beatmapToUpdate.ID);
|
||||
Assert.That(updatedInfo.DifficultyName, Is.EqualTo("updated"));
|
||||
});
|
||||
}
|
||||
|
||||
public static async Task<RealmBeatmapSet?> LoadQuickOszIntoOsu(BeatmapImporter importer, Realm realm)
|
||||
public static async Task<BeatmapSetInfo?> LoadQuickOszIntoOsu(BeatmapImporter importer, Realm realm)
|
||||
{
|
||||
string? temp = TestResources.GetQuickTestBeatmapForImport();
|
||||
|
||||
@ -771,14 +873,14 @@ namespace osu.Game.Tests.Database
|
||||
|
||||
Assert.NotNull(importedSet);
|
||||
|
||||
ensureLoaded(realm);
|
||||
EnsureLoaded(realm);
|
||||
|
||||
waitForOrAssert(() => !File.Exists(temp), "Temporary file still exists after standard import", 5000);
|
||||
|
||||
return realm.All<RealmBeatmapSet>().FirstOrDefault(beatmapSet => beatmapSet.ID == importedSet!.ID);
|
||||
return realm.All<BeatmapSetInfo>().FirstOrDefault(beatmapSet => beatmapSet.ID == importedSet!.ID);
|
||||
}
|
||||
|
||||
public static async Task<RealmBeatmapSet> LoadOszIntoStore(BeatmapImporter importer, Realm realm, string? path = null, bool virtualTrack = false)
|
||||
public static async Task<BeatmapSetInfo> LoadOszIntoStore(BeatmapImporter importer, Realm realm, string? path = null, bool virtualTrack = false)
|
||||
{
|
||||
string? temp = path ?? TestResources.GetTestBeatmapForImport(virtualTrack);
|
||||
|
||||
@ -787,24 +889,24 @@ namespace osu.Game.Tests.Database
|
||||
Assert.NotNull(importedSet);
|
||||
Debug.Assert(importedSet != null);
|
||||
|
||||
ensureLoaded(realm);
|
||||
EnsureLoaded(realm);
|
||||
|
||||
waitForOrAssert(() => !File.Exists(temp), "Temporary file still exists after standard import", 5000);
|
||||
|
||||
return realm.All<RealmBeatmapSet>().First(beatmapSet => beatmapSet.ID == importedSet.ID);
|
||||
return realm.All<BeatmapSetInfo>().First(beatmapSet => beatmapSet.ID == importedSet.ID);
|
||||
}
|
||||
|
||||
private void deleteBeatmapSet(RealmBeatmapSet imported, Realm realm)
|
||||
private void deleteBeatmapSet(BeatmapSetInfo imported, Realm realm)
|
||||
{
|
||||
realm.Write(() => imported.DeletePending = true);
|
||||
|
||||
checkBeatmapSetCount(realm, 0);
|
||||
checkBeatmapSetCount(realm, 1, true);
|
||||
|
||||
Assert.IsTrue(realm.All<RealmBeatmapSet>().First(_ => true).DeletePending);
|
||||
Assert.IsTrue(realm.All<BeatmapSetInfo>().First(_ => true).DeletePending);
|
||||
}
|
||||
|
||||
private static Task createScoreForBeatmap(Realm realm, RealmBeatmap beatmap)
|
||||
private static Task createScoreForBeatmap(Realm realm, BeatmapInfo beatmap)
|
||||
{
|
||||
// TODO: reimplement when we have score support in realm.
|
||||
// return ImportScoreTest.LoadScoreIntoOsu(osu, new ScoreInfo
|
||||
@ -820,8 +922,8 @@ namespace osu.Game.Tests.Database
|
||||
private static void checkBeatmapSetCount(Realm realm, int expected, bool includeDeletePending = false)
|
||||
{
|
||||
Assert.AreEqual(expected, includeDeletePending
|
||||
? realm.All<RealmBeatmapSet>().Count()
|
||||
: realm.All<RealmBeatmapSet>().Count(s => !s.DeletePending));
|
||||
? realm.All<BeatmapSetInfo>().Count()
|
||||
: realm.All<BeatmapSetInfo>().Count(s => !s.DeletePending));
|
||||
}
|
||||
|
||||
private static string hashFile(string filename)
|
||||
@ -832,7 +934,7 @@ namespace osu.Game.Tests.Database
|
||||
|
||||
private static void checkBeatmapCount(Realm realm, int expected)
|
||||
{
|
||||
Assert.AreEqual(expected, realm.All<RealmBeatmap>().Where(_ => true).ToList().Count);
|
||||
Assert.AreEqual(expected, realm.All<BeatmapInfo>().Where(_ => true).ToList().Count);
|
||||
}
|
||||
|
||||
private static void checkSingleReferencedFileCount(Realm realm, int expected)
|
||||
@ -848,26 +950,25 @@ namespace osu.Game.Tests.Database
|
||||
Assert.AreEqual(expected, singleReferencedCount);
|
||||
}
|
||||
|
||||
private static void ensureLoaded(Realm realm, int timeout = 60000)
|
||||
internal static void EnsureLoaded(Realm realm, int timeout = 60000)
|
||||
{
|
||||
IQueryable<RealmBeatmapSet>? resultSets = null;
|
||||
IQueryable<BeatmapSetInfo>? resultSets = null;
|
||||
|
||||
waitForOrAssert(() =>
|
||||
{
|
||||
realm.Refresh();
|
||||
return (resultSets = realm.All<RealmBeatmapSet>().Where(s => !s.DeletePending && s.OnlineID == 241526)).Any();
|
||||
},
|
||||
@"BeatmapSet did not import to the database in allocated time.", timeout);
|
||||
{
|
||||
realm.Refresh();
|
||||
return (resultSets = realm.All<BeatmapSetInfo>().Where(s => !s.DeletePending && s.OnlineID == 241526)).Any();
|
||||
}, @"BeatmapSet did not import to the database in allocated time.", timeout);
|
||||
|
||||
// ensure we were stored to beatmap database backing...
|
||||
Assert.IsTrue(resultSets?.Count() == 1, $@"Incorrect result count found ({resultSets?.Count()} but should be 1).");
|
||||
|
||||
IEnumerable<RealmBeatmapSet> queryBeatmapSets() => realm.All<RealmBeatmapSet>().Where(s => !s.DeletePending && s.OnlineID == 241526);
|
||||
IEnumerable<BeatmapSetInfo> queryBeatmapSets() => realm.All<BeatmapSetInfo>().Where(s => !s.DeletePending && s.OnlineID == 241526);
|
||||
|
||||
var set = queryBeatmapSets().First();
|
||||
|
||||
// ReSharper disable once PossibleUnintendedReferenceComparison
|
||||
IEnumerable<RealmBeatmap> queryBeatmaps() => realm.All<RealmBeatmap>().Where(s => s.BeatmapSet != null && s.BeatmapSet == set);
|
||||
IEnumerable<BeatmapInfo> queryBeatmaps() => realm.All<BeatmapInfo>().Where(s => s.BeatmapSet != null && s.BeatmapSet == set);
|
||||
|
||||
Assert.AreEqual(12, queryBeatmaps().Count(), @"Beatmap count was not correct");
|
||||
Assert.AreEqual(1, queryBeatmapSets().Count(), @"Beatmapset count was not correct");
|
||||
@ -880,7 +981,7 @@ namespace osu.Game.Tests.Database
|
||||
countBeatmaps = queryBeatmaps().Count(),
|
||||
$@"Incorrect database beatmap count post-import ({countBeatmaps} but should be {countBeatmapSetBeatmaps}).");
|
||||
|
||||
foreach (RealmBeatmap b in set.Beatmaps)
|
||||
foreach (BeatmapInfo b in set.Beatmaps)
|
||||
Assert.IsTrue(set.Beatmaps.Any(c => c.OnlineID == b.OnlineID));
|
||||
Assert.IsTrue(set.Beatmaps.Count > 0);
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Models;
|
||||
|
||||
#nullable enable
|
||||
|
||||
@ -48,7 +48,7 @@ namespace osu.Game.Tests.Database
|
||||
|
||||
using (var context = realmFactory.CreateContext())
|
||||
{
|
||||
var subscription = context.All<RealmBeatmap>().QueryAsyncWithNotifications((sender, changes, error) =>
|
||||
var subscription = context.All<BeatmapInfo>().QueryAsyncWithNotifications((sender, changes, error) =>
|
||||
{
|
||||
using (realmFactory.CreateContext())
|
||||
{
|
||||
|
@ -8,8 +8,8 @@ using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Models;
|
||||
using Realms;
|
||||
|
||||
#nullable enable
|
||||
@ -23,9 +23,9 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealm((realmFactory, _) =>
|
||||
{
|
||||
ILive<RealmBeatmap> beatmap = realmFactory.CreateContext().Write(r => r.Add(new RealmBeatmap(CreateRuleset(), new RealmBeatmapDifficulty(), new RealmBeatmapMetadata()))).ToLive(realmFactory);
|
||||
ILive<BeatmapInfo> beatmap = realmFactory.CreateContext().Write(r => r.Add(new BeatmapInfo(CreateRuleset(), new BeatmapDifficulty(), new BeatmapMetadata()))).ToLive(realmFactory);
|
||||
|
||||
ILive<RealmBeatmap> beatmap2 = realmFactory.CreateContext().All<RealmBeatmap>().First().ToLive(realmFactory);
|
||||
ILive<BeatmapInfo> beatmap2 = realmFactory.CreateContext().All<BeatmapInfo>().First().ToLive(realmFactory);
|
||||
|
||||
Assert.AreEqual(beatmap, beatmap2);
|
||||
});
|
||||
@ -36,9 +36,9 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealm((realmFactory, storage) =>
|
||||
{
|
||||
var beatmap = new RealmBeatmap(CreateRuleset(), new RealmBeatmapDifficulty(), new RealmBeatmapMetadata());
|
||||
var beatmap = new BeatmapInfo(CreateRuleset(), new BeatmapDifficulty(), new BeatmapMetadata());
|
||||
|
||||
ILive<RealmBeatmap> liveBeatmap;
|
||||
ILive<BeatmapInfo> liveBeatmap;
|
||||
|
||||
using (var context = realmFactory.CreateContext())
|
||||
{
|
||||
@ -63,7 +63,7 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealm((realmFactory, _) =>
|
||||
{
|
||||
var beatmap = new RealmBeatmap(CreateRuleset(), new RealmBeatmapDifficulty(), new RealmBeatmapMetadata());
|
||||
var beatmap = new BeatmapInfo(CreateRuleset(), new BeatmapDifficulty(), new BeatmapMetadata());
|
||||
|
||||
var liveBeatmap = beatmap.ToLive(realmFactory);
|
||||
|
||||
@ -77,7 +77,7 @@ namespace osu.Game.Tests.Database
|
||||
[Test]
|
||||
public void TestAccessNonManaged()
|
||||
{
|
||||
var beatmap = new RealmBeatmap(CreateRuleset(), new RealmBeatmapDifficulty(), new RealmBeatmapMetadata());
|
||||
var beatmap = new BeatmapInfo(CreateRuleset(), new BeatmapDifficulty(), new BeatmapMetadata());
|
||||
var liveBeatmap = beatmap.ToLiveUnmanaged();
|
||||
|
||||
Assert.IsFalse(beatmap.Hidden);
|
||||
@ -96,12 +96,12 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealm((realmFactory, _) =>
|
||||
{
|
||||
ILive<RealmBeatmap>? liveBeatmap = null;
|
||||
ILive<BeatmapInfo>? liveBeatmap = null;
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
using (var threadContext = realmFactory.CreateContext())
|
||||
{
|
||||
var beatmap = threadContext.Write(r => r.Add(new RealmBeatmap(CreateRuleset(), new RealmBeatmapDifficulty(), new RealmBeatmapMetadata())));
|
||||
var beatmap = threadContext.Write(r => r.Add(new BeatmapInfo(CreateRuleset(), new BeatmapDifficulty(), new BeatmapMetadata())));
|
||||
|
||||
liveBeatmap = beatmap.ToLive(realmFactory);
|
||||
}
|
||||
@ -125,12 +125,12 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealm((realmFactory, _) =>
|
||||
{
|
||||
ILive<RealmBeatmap>? liveBeatmap = null;
|
||||
ILive<BeatmapInfo>? liveBeatmap = null;
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
using (var threadContext = realmFactory.CreateContext())
|
||||
{
|
||||
var beatmap = threadContext.Write(r => r.Add(new RealmBeatmap(CreateRuleset(), new RealmBeatmapDifficulty(), new RealmBeatmapMetadata())));
|
||||
var beatmap = threadContext.Write(r => r.Add(new BeatmapInfo(CreateRuleset(), new BeatmapDifficulty(), new BeatmapMetadata())));
|
||||
|
||||
liveBeatmap = beatmap.ToLive(realmFactory);
|
||||
}
|
||||
@ -151,7 +151,7 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealm((realmFactory, _) =>
|
||||
{
|
||||
var beatmap = new RealmBeatmap(CreateRuleset(), new RealmBeatmapDifficulty(), new RealmBeatmapMetadata());
|
||||
var beatmap = new BeatmapInfo(CreateRuleset(), new BeatmapDifficulty(), new BeatmapMetadata());
|
||||
var liveBeatmap = beatmap.ToLive(realmFactory);
|
||||
|
||||
Assert.DoesNotThrow(() =>
|
||||
@ -166,13 +166,13 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealm((realmFactory, _) =>
|
||||
{
|
||||
ILive<RealmBeatmap>? liveBeatmap = null;
|
||||
ILive<BeatmapInfo>? liveBeatmap = null;
|
||||
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
using (var threadContext = realmFactory.CreateContext())
|
||||
{
|
||||
var beatmap = threadContext.Write(r => r.Add(new RealmBeatmap(CreateRuleset(), new RealmBeatmapDifficulty(), new RealmBeatmapMetadata())));
|
||||
var beatmap = threadContext.Write(r => r.Add(new BeatmapInfo(CreateRuleset(), new BeatmapDifficulty(), new BeatmapMetadata())));
|
||||
|
||||
liveBeatmap = beatmap.ToLive(realmFactory);
|
||||
}
|
||||
@ -205,12 +205,12 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealm((realmFactory, _) =>
|
||||
{
|
||||
ILive<RealmBeatmap>? liveBeatmap = null;
|
||||
ILive<BeatmapInfo>? liveBeatmap = null;
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
using (var threadContext = realmFactory.CreateContext())
|
||||
{
|
||||
var beatmap = threadContext.Write(r => r.Add(new RealmBeatmap(CreateRuleset(), new RealmBeatmapDifficulty(), new RealmBeatmapMetadata())));
|
||||
var beatmap = threadContext.Write(r => r.Add(new BeatmapInfo(CreateRuleset(), new BeatmapDifficulty(), new BeatmapMetadata())));
|
||||
|
||||
liveBeatmap = beatmap.ToLive(realmFactory);
|
||||
}
|
||||
@ -237,19 +237,19 @@ namespace osu.Game.Tests.Database
|
||||
|
||||
using (var updateThreadContext = realmFactory.CreateContext())
|
||||
{
|
||||
updateThreadContext.All<RealmBeatmap>().QueryAsyncWithNotifications(gotChange);
|
||||
ILive<RealmBeatmap>? liveBeatmap = null;
|
||||
updateThreadContext.All<BeatmapInfo>().QueryAsyncWithNotifications(gotChange);
|
||||
ILive<BeatmapInfo>? liveBeatmap = null;
|
||||
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
using (var threadContext = realmFactory.CreateContext())
|
||||
{
|
||||
var ruleset = CreateRuleset();
|
||||
var beatmap = threadContext.Write(r => r.Add(new RealmBeatmap(ruleset, new RealmBeatmapDifficulty(), new RealmBeatmapMetadata())));
|
||||
var beatmap = threadContext.Write(r => r.Add(new BeatmapInfo(ruleset, new BeatmapDifficulty(), new BeatmapMetadata())));
|
||||
|
||||
// add a second beatmap to ensure that a full refresh occurs below.
|
||||
// not just a refresh from the resolved Live.
|
||||
threadContext.Write(r => r.Add(new RealmBeatmap(ruleset, new RealmBeatmapDifficulty(), new RealmBeatmapMetadata())));
|
||||
threadContext.Write(r => r.Add(new BeatmapInfo(ruleset, new BeatmapDifficulty(), new BeatmapMetadata())));
|
||||
|
||||
liveBeatmap = beatmap.ToLive(realmFactory);
|
||||
}
|
||||
@ -258,14 +258,14 @@ namespace osu.Game.Tests.Database
|
||||
Debug.Assert(liveBeatmap != null);
|
||||
|
||||
// not yet seen by main context
|
||||
Assert.AreEqual(0, updateThreadContext.All<RealmBeatmap>().Count());
|
||||
Assert.AreEqual(0, updateThreadContext.All<BeatmapInfo>().Count());
|
||||
Assert.AreEqual(0, changesTriggered);
|
||||
|
||||
liveBeatmap.PerformRead(resolved =>
|
||||
{
|
||||
// retrieval causes an implicit refresh. even changes that aren't related to the retrieval are fired at this point.
|
||||
// ReSharper disable once AccessToDisposedClosure
|
||||
Assert.AreEqual(2, updateThreadContext.All<RealmBeatmap>().Count());
|
||||
Assert.AreEqual(2, updateThreadContext.All<BeatmapInfo>().Count());
|
||||
Assert.AreEqual(1, changesTriggered);
|
||||
|
||||
// can access properties without a crash.
|
||||
@ -280,7 +280,7 @@ namespace osu.Game.Tests.Database
|
||||
});
|
||||
}
|
||||
|
||||
void gotChange(IRealmCollection<RealmBeatmap> sender, ChangeSet changes, Exception error)
|
||||
void gotChange(IRealmCollection<BeatmapInfo> sender, ChangeSet changes, Exception error)
|
||||
{
|
||||
changesTriggered++;
|
||||
}
|
||||
|
@ -9,9 +9,11 @@ using osu.Framework.Extensions;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.IO;
|
||||
using osu.Game.Models;
|
||||
using osu.Game.Rulesets;
|
||||
|
||||
#nullable enable
|
||||
|
||||
@ -74,24 +76,24 @@ namespace osu.Game.Tests.Database
|
||||
}
|
||||
}
|
||||
|
||||
protected static RealmBeatmapSet CreateBeatmapSet(RealmRuleset ruleset)
|
||||
protected static BeatmapSetInfo CreateBeatmapSet(RulesetInfo ruleset)
|
||||
{
|
||||
RealmFile createRealmFile() => new RealmFile { Hash = Guid.NewGuid().ToString().ComputeSHA2Hash() };
|
||||
|
||||
var metadata = new RealmBeatmapMetadata
|
||||
var metadata = new BeatmapMetadata
|
||||
{
|
||||
Title = "My Love",
|
||||
Artist = "Kuba Oms"
|
||||
};
|
||||
|
||||
var beatmapSet = new RealmBeatmapSet
|
||||
var beatmapSet = new BeatmapSetInfo
|
||||
{
|
||||
Beatmaps =
|
||||
{
|
||||
new RealmBeatmap(ruleset, new RealmBeatmapDifficulty(), metadata) { DifficultyName = "Easy", },
|
||||
new RealmBeatmap(ruleset, new RealmBeatmapDifficulty(), metadata) { DifficultyName = "Normal", },
|
||||
new RealmBeatmap(ruleset, new RealmBeatmapDifficulty(), metadata) { DifficultyName = "Hard", },
|
||||
new RealmBeatmap(ruleset, new RealmBeatmapDifficulty(), metadata) { DifficultyName = "Insane", }
|
||||
new BeatmapInfo(ruleset, new BeatmapDifficulty(), metadata) { DifficultyName = "Easy", },
|
||||
new BeatmapInfo(ruleset, new BeatmapDifficulty(), metadata) { DifficultyName = "Normal", },
|
||||
new BeatmapInfo(ruleset, new BeatmapDifficulty(), metadata) { DifficultyName = "Hard", },
|
||||
new BeatmapInfo(ruleset, new BeatmapDifficulty(), metadata) { DifficultyName = "Insane", }
|
||||
},
|
||||
Files =
|
||||
{
|
||||
@ -111,8 +113,8 @@ namespace osu.Game.Tests.Database
|
||||
return beatmapSet;
|
||||
}
|
||||
|
||||
protected static RealmRuleset CreateRuleset() =>
|
||||
new RealmRuleset(0, "osu!", "osu", true);
|
||||
protected static RulesetInfo CreateRuleset() =>
|
||||
new RulesetInfo(0, "osu!", "osu", true);
|
||||
|
||||
private class RealmTestGame : Framework.Game
|
||||
{
|
||||
|
@ -3,8 +3,7 @@
|
||||
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Models;
|
||||
using osu.Game.Stores;
|
||||
using osu.Game.Rulesets;
|
||||
|
||||
namespace osu.Game.Tests.Database
|
||||
{
|
||||
@ -15,10 +14,10 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealm((realmFactory, storage) =>
|
||||
{
|
||||
var rulesets = new RealmRulesetStore(realmFactory, storage);
|
||||
var rulesets = new RulesetStore(realmFactory, storage);
|
||||
|
||||
Assert.AreEqual(4, rulesets.AvailableRulesets.Count());
|
||||
Assert.AreEqual(4, realmFactory.Context.All<RealmRuleset>().Count());
|
||||
Assert.AreEqual(4, realmFactory.Context.All<RulesetInfo>().Count());
|
||||
});
|
||||
}
|
||||
|
||||
@ -27,14 +26,14 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealm((realmFactory, storage) =>
|
||||
{
|
||||
var rulesets = new RealmRulesetStore(realmFactory, storage);
|
||||
var rulesets2 = new RealmRulesetStore(realmFactory, storage);
|
||||
var rulesets = new RulesetStore(realmFactory, storage);
|
||||
var rulesets2 = new RulesetStore(realmFactory, storage);
|
||||
|
||||
Assert.AreEqual(4, rulesets.AvailableRulesets.Count());
|
||||
Assert.AreEqual(4, rulesets2.AvailableRulesets.Count());
|
||||
|
||||
Assert.AreEqual(rulesets.AvailableRulesets.First(), rulesets2.AvailableRulesets.First());
|
||||
Assert.AreEqual(4, realmFactory.Context.All<RealmRuleset>().Count());
|
||||
Assert.AreEqual(4, realmFactory.Context.All<RulesetInfo>().Count());
|
||||
});
|
||||
}
|
||||
|
||||
@ -43,7 +42,7 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
RunTestWithRealm((realmFactory, storage) =>
|
||||
{
|
||||
var rulesets = new RealmRulesetStore(realmFactory, storage);
|
||||
var rulesets = new RulesetStore(realmFactory, storage);
|
||||
|
||||
Assert.IsFalse(rulesets.AvailableRulesets.First().IsManaged);
|
||||
Assert.IsFalse(rulesets.GetRuleset(0)?.IsManaged);
|
||||
|
@ -74,7 +74,7 @@ namespace osu.Game.Tests.Editing.Checks
|
||||
[Test]
|
||||
public void TestMissingFile()
|
||||
{
|
||||
beatmap.BeatmapInfo.BeatmapSet.Files.Clear();
|
||||
beatmap.BeatmapInfo.BeatmapSet?.Files.Clear();
|
||||
|
||||
var issues = check.Run(getContext(null)).ToList();
|
||||
|
||||
|
@ -46,7 +46,7 @@ namespace osu.Game.Tests.Editing.Checks
|
||||
[Test]
|
||||
public void TestBackgroundSetAndNotInFiles()
|
||||
{
|
||||
beatmap.BeatmapInfo.BeatmapSet.Files.Clear();
|
||||
beatmap.BeatmapInfo.BeatmapSet?.Files.Clear();
|
||||
|
||||
var context = new BeatmapVerifierContext(beatmap, new TestWorkingBeatmap(beatmap));
|
||||
var issues = check.Run(context).ToList();
|
||||
|
@ -1,18 +1,13 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.IO;
|
||||
using osu.Game.Models;
|
||||
|
||||
namespace osu.Game.Tests.Editing.Checks
|
||||
{
|
||||
public static class CheckTestHelpers
|
||||
{
|
||||
public static BeatmapSetFileInfo CreateMockFile(string extension) =>
|
||||
new BeatmapSetFileInfo
|
||||
{
|
||||
Filename = $"abc123.{extension}",
|
||||
FileInfo = new FileInfo { Hash = "abcdef" }
|
||||
};
|
||||
public static RealmNamedFileUsage CreateMockFile(string extension) =>
|
||||
new RealmNamedFileUsage(new RealmFile { Hash = "abcdef" }, $"abc123.{extension}");
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using ManagedBass;
|
||||
@ -45,6 +46,8 @@ namespace osu.Game.Tests.Editing.Checks
|
||||
[Test]
|
||||
public void TestDifferentExtension()
|
||||
{
|
||||
Debug.Assert(beatmap.BeatmapInfo.BeatmapSet != null);
|
||||
|
||||
beatmap.BeatmapInfo.BeatmapSet.Files.Clear();
|
||||
beatmap.BeatmapInfo.BeatmapSet.Files.Add(CheckTestHelpers.CreateMockFile("jpg"));
|
||||
|
||||
|
@ -2,7 +2,8 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Screens.Edit;
|
||||
|
||||
@ -158,7 +159,13 @@ namespace osu.Game.Tests.Editing
|
||||
|
||||
private (EditorChangeHandler, EditorBeatmap) createChangeHandler()
|
||||
{
|
||||
var beatmap = new EditorBeatmap(new Beatmap());
|
||||
var beatmap = new EditorBeatmap(new OsuBeatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = new OsuRuleset().RulesetInfo,
|
||||
},
|
||||
});
|
||||
|
||||
var changeHandler = new EditorChangeHandler(beatmap);
|
||||
|
||||
|
@ -35,7 +35,13 @@ namespace osu.Game.Tests.Editing
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
editorBeatmap = new EditorBeatmap(new OsuBeatmap()),
|
||||
editorBeatmap = new EditorBeatmap(new OsuBeatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = new OsuRuleset().RulesetInfo,
|
||||
},
|
||||
}),
|
||||
Content = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Extensions;
|
||||
@ -23,8 +24,10 @@ namespace osu.Game.Tests.NonVisual
|
||||
[Test]
|
||||
public void TestDatabasedWithDatabased()
|
||||
{
|
||||
var ourInfo = new BeatmapSetInfo { ID = 123 };
|
||||
var otherInfo = new BeatmapSetInfo { ID = 123 };
|
||||
var guid = Guid.NewGuid();
|
||||
|
||||
var ourInfo = new BeatmapSetInfo { ID = guid };
|
||||
var otherInfo = new BeatmapSetInfo { ID = guid };
|
||||
|
||||
Assert.AreEqual(ourInfo, otherInfo);
|
||||
}
|
||||
@ -32,7 +35,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
[Test]
|
||||
public void TestDatabasedWithOnline()
|
||||
{
|
||||
var ourInfo = new BeatmapSetInfo { ID = 123, OnlineID = 12 };
|
||||
var ourInfo = new BeatmapSetInfo { ID = Guid.NewGuid(), OnlineID = 12 };
|
||||
var otherInfo = new BeatmapSetInfo { OnlineID = 12 };
|
||||
|
||||
Assert.AreNotEqual(ourInfo, otherInfo);
|
||||
|
@ -179,7 +179,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
{
|
||||
var osu = LoadOsuIntoHost(host);
|
||||
|
||||
const string database_filename = "client.db";
|
||||
const string database_filename = "client.realm";
|
||||
|
||||
Assert.DoesNotThrow(() => osu.Migrate(customPath));
|
||||
Assert.That(File.Exists(Path.Combine(customPath, database_filename)));
|
||||
|
@ -17,9 +17,8 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
||||
private BeatmapInfo getExampleBeatmap() => new BeatmapInfo
|
||||
{
|
||||
Ruleset = new RulesetInfo { OnlineID = 0 },
|
||||
RulesetID = 0,
|
||||
StarRating = 4.0d,
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
Difficulty = new BeatmapDifficulty
|
||||
{
|
||||
ApproachRate = 5.0f,
|
||||
DrainRate = 3.0f,
|
||||
@ -31,7 +30,7 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
||||
ArtistUnicode = "check unicode too",
|
||||
Title = "Title goes here",
|
||||
TitleUnicode = "Title goes here",
|
||||
AuthorString = "The Author",
|
||||
Author = { Username = "The Author" },
|
||||
Source = "unit tests",
|
||||
Tags = "look for tags too",
|
||||
},
|
||||
|
@ -9,10 +9,12 @@ using osu.Framework.Bindables;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Online.Solo;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Scoring;
|
||||
@ -93,7 +95,11 @@ namespace osu.Game.Tests.Online
|
||||
[Test]
|
||||
public void TestDeserialiseSubmittableScoreWithEmptyMods()
|
||||
{
|
||||
var score = new SubmittableScore(new ScoreInfo());
|
||||
var score = new SubmittableScore(new ScoreInfo
|
||||
{
|
||||
User = new APIUser(),
|
||||
Ruleset = new OsuRuleset().RulesetInfo,
|
||||
});
|
||||
|
||||
var deserialised = JsonConvert.DeserializeObject<SubmittableScore>(JsonConvert.SerializeObject(score));
|
||||
|
||||
@ -105,7 +111,9 @@ namespace osu.Game.Tests.Online
|
||||
{
|
||||
var score = new SubmittableScore(new ScoreInfo
|
||||
{
|
||||
Mods = new Mod[] { new OsuModDoubleTime { SpeedChange = { Value = 2 } } }
|
||||
Mods = new Mod[] { new OsuModDoubleTime { SpeedChange = { Value = 2 } } },
|
||||
User = new APIUser(),
|
||||
Ruleset = new OsuRuleset().RulesetInfo,
|
||||
});
|
||||
|
||||
var deserialised = JsonConvert.DeserializeObject<SubmittableScore>(JsonConvert.SerializeObject(score));
|
||||
|
@ -5,6 +5,7 @@ using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Models;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Tests.Visual;
|
||||
@ -20,13 +21,19 @@ namespace osu.Game.Tests.Online
|
||||
private static readonly BeatmapSetInfo test_db_model = new BeatmapSetInfo
|
||||
{
|
||||
OnlineID = 1,
|
||||
Metadata = new BeatmapMetadata
|
||||
Beatmaps =
|
||||
{
|
||||
Artist = "test author",
|
||||
Title = "test title",
|
||||
Author = new APIUser
|
||||
new BeatmapInfo
|
||||
{
|
||||
Username = "mapper"
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
Artist = "test author",
|
||||
Title = "test title",
|
||||
Author = new RealmUser
|
||||
{
|
||||
Username = "mapper"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -60,9 +60,8 @@ namespace osu.Game.Tests.Online
|
||||
testBeatmapInfo = getTestBeatmapInfo(testBeatmapFile);
|
||||
testBeatmapSet = testBeatmapInfo.BeatmapSet;
|
||||
|
||||
var existing = beatmaps.QueryBeatmapSet(s => s.OnlineID == testBeatmapSet.OnlineID);
|
||||
if (existing != null)
|
||||
beatmaps.Delete(existing);
|
||||
ContextFactory.Context.Write(r => r.RemoveAll<BeatmapSetInfo>());
|
||||
ContextFactory.Context.Write(r => r.RemoveAll<BeatmapInfo>());
|
||||
|
||||
selectedItem.Value = new PlaylistItem
|
||||
{
|
||||
@ -103,10 +102,10 @@ namespace osu.Game.Tests.Online
|
||||
AddStep("import beatmap", () => beatmaps.Import(testBeatmapFile).WaitSafely());
|
||||
addAvailabilityCheckStep("state locally available", BeatmapAvailability.LocallyAvailable);
|
||||
|
||||
AddStep("delete beatmap", () => beatmaps.Delete(beatmaps.QueryBeatmapSet(b => b.OnlineID == testBeatmapSet.OnlineID)));
|
||||
AddStep("delete beatmap", () => beatmaps.Delete(beatmaps.QueryBeatmapSet(b => b.OnlineID == testBeatmapSet.OnlineID)!.Value));
|
||||
addAvailabilityCheckStep("state not downloaded", BeatmapAvailability.NotDownloaded);
|
||||
|
||||
AddStep("undelete beatmap", () => beatmaps.Undelete(beatmaps.QueryBeatmapSet(b => b.OnlineID == testBeatmapSet.OnlineID)));
|
||||
AddStep("undelete beatmap", () => beatmaps.Undelete(beatmaps.QueryBeatmapSet(b => b.OnlineID == testBeatmapSet.OnlineID)!.Value));
|
||||
addAvailabilityCheckStep("state locally available", BeatmapAvailability.LocallyAvailable);
|
||||
}
|
||||
|
||||
@ -154,7 +153,6 @@ namespace osu.Game.Tests.Online
|
||||
Debug.Assert(info.BeatmapSet != null);
|
||||
|
||||
info.BeatmapSet.Beatmaps.Add(info);
|
||||
info.BeatmapSet.Metadata = info.Metadata;
|
||||
info.MD5Hash = stream.ComputeMD5Hash();
|
||||
info.Hash = stream.ComputeSHA2Hash();
|
||||
}
|
||||
@ -168,22 +166,22 @@ namespace osu.Game.Tests.Online
|
||||
|
||||
public Task<ILive<BeatmapSetInfo>> CurrentImportTask { get; private set; }
|
||||
|
||||
public TestBeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, [NotNull] AudioManager audioManager, IResourceStore<byte[]> resources, GameHost host = null, WorkingBeatmap defaultBeatmap = null)
|
||||
public TestBeatmapManager(Storage storage, RealmContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, [NotNull] AudioManager audioManager, IResourceStore<byte[]> resources, GameHost host = null, WorkingBeatmap defaultBeatmap = null)
|
||||
: base(storage, contextFactory, rulesets, api, audioManager, resources, host, defaultBeatmap)
|
||||
{
|
||||
}
|
||||
|
||||
protected override BeatmapModelManager CreateBeatmapModelManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, GameHost host)
|
||||
protected override BeatmapModelManager CreateBeatmapModelManager(Storage storage, RealmContextFactory contextFactory, RulesetStore rulesets, BeatmapOnlineLookupQueue onlineLookupQueue)
|
||||
{
|
||||
return new TestBeatmapModelManager(this, storage, contextFactory, rulesets, api, host);
|
||||
return new TestBeatmapModelManager(this, storage, contextFactory, rulesets, onlineLookupQueue);
|
||||
}
|
||||
|
||||
internal class TestBeatmapModelManager : BeatmapModelManager
|
||||
{
|
||||
private readonly TestBeatmapManager testBeatmapManager;
|
||||
|
||||
public TestBeatmapModelManager(TestBeatmapManager testBeatmapManager, Storage storage, IDatabaseContextFactory databaseContextFactory, RulesetStore rulesetStore, IAPIProvider apiProvider, GameHost gameHost)
|
||||
: base(storage, databaseContextFactory, rulesetStore, gameHost)
|
||||
public TestBeatmapModelManager(TestBeatmapManager testBeatmapManager, Storage storage, RealmContextFactory databaseContextFactory, RulesetStore rulesetStore, BeatmapOnlineLookupQueue beatmapOnlineLookupQueue)
|
||||
: base(databaseContextFactory, storage, beatmapOnlineLookupQueue)
|
||||
{
|
||||
this.testBeatmapManager = testBeatmapManager;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ namespace osu.Game.Tests.Resources
|
||||
// Create random metadata, then we can check if sorting works based on these
|
||||
Artist = "Some Artist " + RNG.Next(0, 9),
|
||||
Title = $"Some Song (set id {setId}) {Guid.NewGuid()}",
|
||||
AuthorString = "Some Guy " + RNG.Next(0, 9),
|
||||
Author = { Username = "Some Guy " + RNG.Next(0, 9) },
|
||||
};
|
||||
|
||||
var beatmapSet = new BeatmapSetInfo
|
||||
@ -97,7 +97,6 @@ namespace osu.Game.Tests.Resources
|
||||
OnlineID = setId,
|
||||
Hash = new MemoryStream(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())).ComputeMD5Hash(),
|
||||
DateAdded = DateTimeOffset.UtcNow,
|
||||
Metadata = metadata
|
||||
};
|
||||
|
||||
foreach (var b in getBeatmaps(difficultyCount ?? RNG.Next(1, 20)))
|
||||
@ -131,10 +130,10 @@ namespace osu.Game.Tests.Resources
|
||||
StarRating = diff,
|
||||
Length = length,
|
||||
BPM = bpm,
|
||||
Hash = Guid.NewGuid().ToString().ComputeMD5Hash(),
|
||||
Ruleset = rulesetInfo,
|
||||
RulesetID = rulesetInfo.ID ?? -1,
|
||||
Metadata = metadata,
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
Difficulty = new BeatmapDifficulty
|
||||
{
|
||||
OverallDifficulty = diff,
|
||||
}
|
||||
@ -166,7 +165,6 @@ namespace osu.Game.Tests.Resources
|
||||
},
|
||||
BeatmapInfo = beatmap,
|
||||
Ruleset = beatmap.Ruleset,
|
||||
RulesetID = beatmap.Ruleset.ID ?? 0,
|
||||
Mods = new Mod[] { new TestModHardRock(), new TestModDoubleTime() },
|
||||
TotalScore = 2845370,
|
||||
Accuracy = 0.95,
|
||||
|
@ -8,8 +8,8 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.IO.Archives;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
@ -17,6 +17,8 @@ using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Tests.Beatmaps.IO;
|
||||
using osu.Game.Tests.Resources;
|
||||
|
||||
namespace osu.Game.Tests.Scores.IO
|
||||
{
|
||||
@ -31,6 +33,8 @@ namespace osu.Game.Tests.Scores.IO
|
||||
{
|
||||
var osu = LoadOsuIntoHost(host, true);
|
||||
|
||||
var beatmap = BeatmapImportHelper.LoadOszIntoOsu(osu, TestResources.GetQuickTestBeatmapForImport()).GetResultSafely();
|
||||
|
||||
var toImport = new ScoreInfo
|
||||
{
|
||||
Rank = ScoreRank.B,
|
||||
@ -41,6 +45,8 @@ namespace osu.Game.Tests.Scores.IO
|
||||
User = new APIUser { Username = "Test user" },
|
||||
Date = DateTimeOffset.Now,
|
||||
OnlineID = 12345,
|
||||
Ruleset = new OsuRuleset().RulesetInfo,
|
||||
BeatmapInfo = beatmap.Beatmaps.First()
|
||||
};
|
||||
|
||||
var imported = await LoadScoreIntoOsu(osu, toImport);
|
||||
@ -49,7 +55,6 @@ namespace osu.Game.Tests.Scores.IO
|
||||
Assert.AreEqual(toImport.TotalScore, imported.TotalScore);
|
||||
Assert.AreEqual(toImport.Accuracy, imported.Accuracy);
|
||||
Assert.AreEqual(toImport.MaxCombo, imported.MaxCombo);
|
||||
Assert.AreEqual(toImport.Combo, imported.Combo);
|
||||
Assert.AreEqual(toImport.User.Username, imported.User.Username);
|
||||
Assert.AreEqual(toImport.Date, imported.Date);
|
||||
Assert.AreEqual(toImport.OnlineID, imported.OnlineID);
|
||||
@ -70,8 +75,13 @@ namespace osu.Game.Tests.Scores.IO
|
||||
{
|
||||
var osu = LoadOsuIntoHost(host, true);
|
||||
|
||||
var beatmap = BeatmapImportHelper.LoadOszIntoOsu(osu, TestResources.GetQuickTestBeatmapForImport()).GetResultSafely();
|
||||
|
||||
var toImport = new ScoreInfo
|
||||
{
|
||||
User = new APIUser { Username = "Test user" },
|
||||
BeatmapInfo = beatmap.Beatmaps.First(),
|
||||
Ruleset = new OsuRuleset().RulesetInfo,
|
||||
Mods = new Mod[] { new OsuModHardRock(), new OsuModDoubleTime() },
|
||||
};
|
||||
|
||||
@ -96,8 +106,13 @@ namespace osu.Game.Tests.Scores.IO
|
||||
{
|
||||
var osu = LoadOsuIntoHost(host, true);
|
||||
|
||||
var beatmap = BeatmapImportHelper.LoadOszIntoOsu(osu, TestResources.GetQuickTestBeatmapForImport()).GetResultSafely();
|
||||
|
||||
var toImport = new ScoreInfo
|
||||
{
|
||||
User = new APIUser { Username = "Test user" },
|
||||
BeatmapInfo = beatmap.Beatmaps.First(),
|
||||
Ruleset = new OsuRuleset().RulesetInfo,
|
||||
Statistics = new Dictionary<HitResult, int>
|
||||
{
|
||||
{ HitResult.Perfect, 100 },
|
||||
@ -117,43 +132,6 @@ namespace osu.Game.Tests.Scores.IO
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TestImportWithDeletedBeatmapSet()
|
||||
{
|
||||
using (HeadlessGameHost host = new CleanRunHeadlessGameHost())
|
||||
{
|
||||
try
|
||||
{
|
||||
var osu = LoadOsuIntoHost(host, true);
|
||||
|
||||
var toImport = new ScoreInfo
|
||||
{
|
||||
Hash = Guid.NewGuid().ToString(),
|
||||
Statistics = new Dictionary<HitResult, int>
|
||||
{
|
||||
{ HitResult.Perfect, 100 },
|
||||
{ HitResult.Miss, 50 }
|
||||
}
|
||||
};
|
||||
|
||||
var imported = await LoadScoreIntoOsu(osu, toImport);
|
||||
|
||||
var beatmapManager = osu.Dependencies.Get<BeatmapManager>();
|
||||
var scoreManager = osu.Dependencies.Get<ScoreManager>();
|
||||
|
||||
beatmapManager.Delete(beatmapManager.QueryBeatmapSet(s => s.Beatmaps.Any(b => b.ID == imported.BeatmapInfo.ID)));
|
||||
Assert.That(scoreManager.Query(s => s.Equals(imported)).DeletePending, Is.EqualTo(true));
|
||||
|
||||
var secondImport = await LoadScoreIntoOsu(osu, imported);
|
||||
Assert.That(secondImport, Is.Null);
|
||||
}
|
||||
finally
|
||||
{
|
||||
host.Exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TestOnlineScoreIsAvailableLocally()
|
||||
{
|
||||
@ -163,12 +141,25 @@ namespace osu.Game.Tests.Scores.IO
|
||||
{
|
||||
var osu = LoadOsuIntoHost(host, true);
|
||||
|
||||
await LoadScoreIntoOsu(osu, new ScoreInfo { OnlineID = 2 }, new TestArchiveReader());
|
||||
var beatmap = BeatmapImportHelper.LoadOszIntoOsu(osu, TestResources.GetQuickTestBeatmapForImport()).GetResultSafely();
|
||||
|
||||
await LoadScoreIntoOsu(osu, new ScoreInfo
|
||||
{
|
||||
User = new APIUser { Username = "Test user" },
|
||||
BeatmapInfo = beatmap.Beatmaps.First(),
|
||||
Ruleset = new OsuRuleset().RulesetInfo,
|
||||
OnlineID = 2
|
||||
}, new TestArchiveReader());
|
||||
|
||||
var scoreManager = osu.Dependencies.Get<ScoreManager>();
|
||||
|
||||
// Note: A new score reference is used here since the import process mutates the original object to set an ID
|
||||
Assert.That(scoreManager.IsAvailableLocally(new ScoreInfo { OnlineID = 2 }));
|
||||
Assert.That(scoreManager.IsAvailableLocally(new ScoreInfo
|
||||
{
|
||||
User = new APIUser { Username = "Test user" },
|
||||
BeatmapInfo = beatmap.Beatmaps.First(),
|
||||
OnlineID = 2
|
||||
}));
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -179,15 +170,13 @@ namespace osu.Game.Tests.Scores.IO
|
||||
|
||||
public static async Task<ScoreInfo> LoadScoreIntoOsu(OsuGameBase osu, ScoreInfo score, ArchiveReader archive = null)
|
||||
{
|
||||
var beatmapManager = osu.Dependencies.Get<BeatmapManager>();
|
||||
|
||||
score.BeatmapInfo ??= beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps.First();
|
||||
score.Ruleset ??= new OsuRuleset().RulesetInfo;
|
||||
// clone to avoid attaching the input score to realm.
|
||||
score = score.DeepClone();
|
||||
|
||||
var scoreManager = osu.Dependencies.Get<ScoreManager>();
|
||||
await scoreManager.Import(score, archive);
|
||||
|
||||
return scoreManager.GetAllUsableScores().FirstOrDefault();
|
||||
return scoreManager.Query(_ => true);
|
||||
}
|
||||
|
||||
internal class TestArchiveReader : ArchiveReader
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Scoring;
|
||||
|
||||
@ -29,8 +30,8 @@ namespace osu.Game.Tests.Scores.IO
|
||||
[Test]
|
||||
public void TestNonMatchingByPrimaryKey()
|
||||
{
|
||||
ScoreInfo score1 = new ScoreInfo { ID = 1 };
|
||||
ScoreInfo score2 = new ScoreInfo { ID = 2 };
|
||||
ScoreInfo score1 = new ScoreInfo { ID = Guid.NewGuid() };
|
||||
ScoreInfo score2 = new ScoreInfo { ID = Guid.NewGuid() };
|
||||
|
||||
Assert.That(score1, Is.Not.EqualTo(score2));
|
||||
}
|
||||
@ -38,8 +39,10 @@ namespace osu.Game.Tests.Scores.IO
|
||||
[Test]
|
||||
public void TestMatchingByPrimaryKey()
|
||||
{
|
||||
ScoreInfo score1 = new ScoreInfo { ID = 1 };
|
||||
ScoreInfo score2 = new ScoreInfo { ID = 1 };
|
||||
Guid id = Guid.NewGuid();
|
||||
|
||||
ScoreInfo score1 = new ScoreInfo { ID = id };
|
||||
ScoreInfo score2 = new ScoreInfo { ID = id };
|
||||
|
||||
Assert.That(score1, Is.EqualTo(score2));
|
||||
}
|
||||
|
@ -26,8 +26,12 @@ namespace osu.Game.Tests.Skins
|
||||
private void load()
|
||||
{
|
||||
var imported = beatmaps.Import(new ZipArchiveReader(TestResources.OpenResource("Archives/ogg-beatmap.osz"))).GetResultSafely();
|
||||
beatmap = beatmaps.GetWorkingBeatmap(imported.Value.Beatmaps[0]);
|
||||
beatmap.LoadTrack();
|
||||
|
||||
imported?.PerformRead(s =>
|
||||
{
|
||||
beatmap = beatmaps.GetWorkingBeatmap(s.Beatmaps[0]);
|
||||
beatmap.LoadTrack();
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -50,6 +50,7 @@ namespace osu.Game.Tests.Visual.Background
|
||||
Dependencies.Cache(rulesets = new RulesetStore(ContextFactory));
|
||||
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, Resources, host, Beatmap.Default));
|
||||
Dependencies.Cache(new OsuConfigManager(LocalStorage));
|
||||
Dependencies.Cache(ContextFactory);
|
||||
|
||||
manager.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely();
|
||||
|
||||
@ -387,6 +388,9 @@ namespace osu.Game.Tests.Visual.Background
|
||||
while (BlockLoad && !token.IsCancellationRequested)
|
||||
Thread.Sleep(1);
|
||||
|
||||
if (!LoadedBeatmapSuccessfully)
|
||||
return;
|
||||
|
||||
StoryboardEnabled = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||
DrawableRuleset.IsPaused.BindTo(IsPaused);
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
||||
{
|
||||
var beatmap = beatmaps.QueryBeatmapSet(b => b.OnlineID == online_id);
|
||||
|
||||
if (beatmap != null) beatmaps.Delete(beatmap);
|
||||
if (beatmap != null) beatmaps.Delete(beatmap.Value);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Beatmaps.Drawables.Cards;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays;
|
||||
|
||||
@ -18,7 +17,7 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
||||
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load()
|
||||
{
|
||||
var beatmapSet = new APIBeatmapSet
|
||||
{
|
||||
|
@ -38,6 +38,7 @@ namespace osu.Game.Tests.Visual.Collections
|
||||
{
|
||||
Dependencies.Cache(rulesets = new RulesetStore(ContextFactory));
|
||||
Dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, Audio, Resources, host, Beatmap.Default));
|
||||
Dependencies.Cache(ContextFactory);
|
||||
|
||||
beatmapManager.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely();
|
||||
|
||||
|
@ -29,9 +29,10 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
[Cached]
|
||||
private EditorClipboard clipboard = new EditorClipboard();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap);
|
||||
|
||||
Child = new ComposeScreen
|
||||
|
@ -11,6 +11,7 @@ using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Edit.Setup;
|
||||
using osuTK.Input;
|
||||
@ -25,7 +26,13 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
[SetUpSteps]
|
||||
public void SetUp()
|
||||
{
|
||||
AddStep("create blank beatmap", () => editorBeatmap = new EditorBeatmap(new Beatmap()));
|
||||
AddStep("create blank beatmap", () => editorBeatmap = new EditorBeatmap(new Beatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = new OsuRuleset().RulesetInfo
|
||||
}
|
||||
}));
|
||||
AddStep("create section", () => Child = new DependencyProvidingContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
AddStep("import test beatmap", () => importedBeatmapSet = ImportBeatmapTest.LoadOszIntoOsu(game, virtualTrack: true).GetResultSafely());
|
||||
AddStep("import test beatmap", () => importedBeatmapSet = BeatmapImportHelper.LoadOszIntoOsu(game, virtualTrack: true).GetResultSafely());
|
||||
base.SetUpSteps();
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Edit.Compose.Components;
|
||||
@ -29,7 +30,13 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
|
||||
public TestSceneDistanceSnapGrid()
|
||||
{
|
||||
editorBeatmap = new EditorBeatmap(new OsuBeatmap());
|
||||
editorBeatmap = new EditorBeatmap(new OsuBeatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = new OsuRuleset().RulesetInfo
|
||||
}
|
||||
});
|
||||
editorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = beat_length });
|
||||
}
|
||||
|
||||
|
@ -49,8 +49,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
public void TestCreateNewBeatmap()
|
||||
{
|
||||
AddStep("save beatmap", () => Editor.Save());
|
||||
AddAssert("new beatmap persisted", () => EditorBeatmap.BeatmapInfo.IsManaged);
|
||||
AddAssert("new beatmap in database", () => beatmapManager.QueryBeatmapSet(s => s.ID == EditorBeatmap.BeatmapInfo.BeatmapSet.ID)?.DeletePending == false);
|
||||
AddAssert("new beatmap in database", () => beatmapManager.QueryBeatmapSet(s => s.ID == EditorBeatmap.BeatmapInfo.BeatmapSet.ID)?.Value.DeletePending == false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -66,7 +65,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
});
|
||||
|
||||
AddUntilStep("wait for exit", () => !Editor.IsCurrentScreen());
|
||||
AddAssert("new beatmap not persisted", () => beatmapManager.QueryBeatmapSet(s => s.ID == editorBeatmap.BeatmapInfo.BeatmapSet.ID)?.DeletePending == true);
|
||||
AddAssert("new beatmap not persisted", () => beatmapManager.QueryBeatmapSet(s => s.ID == editorBeatmap.BeatmapInfo.BeatmapSet.ID)?.Value.DeletePending == true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
@ -37,9 +36,10 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
||||
// ensure that music controller does not change this beatmap due to it
|
||||
// completing naturally as part of the test.
|
||||
|
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -23,9 +22,10 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
BeatDivisor.Value = 4;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
var testBeatmap = new Beatmap
|
||||
{
|
||||
ControlPointInfo = new ControlPointInfo(),
|
||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
AddStep("import test beatmap", () => importedBeatmapSet = ImportBeatmapTest.LoadOszIntoOsu(game).GetResultSafely());
|
||||
AddStep("import test beatmap", () => importedBeatmapSet = BeatmapImportHelper.LoadOszIntoOsu(game).GetResultSafely());
|
||||
base.SetUpSteps();
|
||||
}
|
||||
|
||||
|
@ -39,9 +39,16 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
Beatmap.Value = CreateWorkingBeatmap(new Beatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = new OsuRuleset().RulesetInfo
|
||||
},
|
||||
HitObjects = new List<HitObject>
|
||||
{
|
||||
new HitCircle { Position = new Vector2(256, 192), Scale = 0.5f },
|
||||
new HitCircle
|
||||
{
|
||||
Position = new Vector2(256, 192), Scale = 0.5f
|
||||
},
|
||||
new HitCircle { Position = new Vector2(344, 148), Scale = 0.5f },
|
||||
new Slider
|
||||
{
|
||||
|
@ -5,6 +5,7 @@ using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Edit.Setup;
|
||||
|
||||
@ -13,7 +14,13 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
public class TestSceneMetadataSection : OsuTestScene
|
||||
{
|
||||
[Cached]
|
||||
private EditorBeatmap editorBeatmap = new EditorBeatmap(new Beatmap());
|
||||
private EditorBeatmap editorBeatmap = new EditorBeatmap(new Beatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = new OsuRuleset().RulesetInfo
|
||||
},
|
||||
});
|
||||
|
||||
private TestMetadataSection metadataSection;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user