Make VisualTests/nUnit work again

This commit is contained in:
Dean Herbert 2018-03-28 12:33:01 +09:00
parent 306ff09792
commit 94b1d3e4af
6 changed files with 66 additions and 30 deletions

@ -1 +1 @@
Subproject commit b59149e1cebe28675dcd2ebd014e5793d9626c09
Subproject commit 71fe258bf26dd2b8407729fd09f837ca26060d62

View File

@ -44,9 +44,6 @@ namespace osu.Desktop
{
switch (args.FirstOrDefault() ?? string.Empty)
{
case "--tests":
host.Run(new OsuTestBrowser());
break;
default:
host.Run(new OsuGameDesktop(args));
break;

View File

@ -1,39 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\osu.Game.props" />
<PropertyGroup Label="Project">
<TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Library</OutputType>
<PlatformTarget>AnyCPU</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Company>ppy Pty Ltd</Company>
<Version>1.0.0.0</Version>
<Copyright>ppy Pty Ltd 2007-2017</Copyright>
<AssemblyTitle>osu.Game.Tests</AssemblyTitle>
<Product>osu.Game.Tests</Product>
<!-- DeepEqual is not netstandard-compatible. This is fine since we run tests with .NET Framework anyway. -->
<NoWarn>NU1701</NoWarn>
</PropertyGroup>
<Import Project="..\osu.TestProject.props" />
<ItemGroup Label="Service">
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<PropertyGroup Label="Project">
<TargetFrameworks>net461;netcoreapp2.0</TargetFrameworks>
<OutputType>WinExe</OutputType>
<PlatformTarget>AnyCPU</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Company>ppy Pty Ltd</Company>
<Description>click the circles. to the beat.</Description>
<Copyright>ppy Pty Ltd 2007-2017</Copyright>
<!-- DeepEqual is not netstandard-compatible. This is fine since we run tests with .NET Framework anyway.
(Not sure why this is needed here, since we don't directly reference DeepEquals in this project...) -->
<NoWarn>NU1701</NoWarn>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\osu-framework\osu.Framework\osu.Framework.csproj" />
<ProjectReference Include="..\osu.Game.Rulesets.Osu\osu.Game.Rulesets.Osu.csproj" />
<ProjectReference Include="..\osu.Game.Rulesets.Catch\osu.Game.Rulesets.Catch.csproj" />
<ProjectReference Include="..\osu.Game.Rulesets.Mania\osu.Game.Rulesets.Mania.csproj" />
<ProjectReference Include="..\osu.Game.Rulesets.Taiko\osu.Game.Rulesets.Taiko.csproj" />
<ProjectReference Include="..\osu.Game\osu.Game.csproj" />
<ProjectReference Include="..\osu-resources\osu.Game.Resources\osu.Game.Resources.csproj" />
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.0.1" />
<PackageReference Include="DeepEqual" Version="1.6.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.1" />
<PackageReference Include="NUnit" Version="3.8.1" />
</ItemGroup>
<ItemGroup Label="Resources">
<EmbeddedResource Include="Resources\Soleily - Renatus %28Gamu%29 [Insane].osu" />
<EmbeddedResource Include="Resources\Himeringo - Yotsuya-san ni Yoroshiku %28RLC%29 [Winber1%27s Extreme].osu" />
<EmbeddedResource Include="Resources\Within Temptation - The Unforgiving %28Armin%29 [Marathon].osu" />
<EmbeddedResource Include="Resources\Kozato snow - Rengetsu Ouka %28_Kiva%29 [Yuki YukI].osu" />
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
</ItemGroup>
</Project>

View File

@ -3,12 +3,11 @@
using osu.Framework.Platform;
using osu.Framework.Testing;
using osu.Game;
using osu.Game.Screens.Backgrounds;
namespace osu.Desktop
namespace osu.Game.Tests
{
internal class OsuTestBrowser : OsuGameBase
public class OsuTestBrowser : OsuGameBase
{
protected override void LoadComplete()
{

View File

@ -0,0 +1,22 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework;
using osu.Framework.Platform;
namespace osu.Game.Tests
{
public static class VisualTestRunner
{
[STAThread]
public static int Main(string[] args)
{
using (DesktopGameHost host = Host.GetSuitableHost(@"osu", true))
{
host.Run(new OsuTestBrowser());
return 0;
}
}
}
}

26
osu.TestProject.props Normal file
View File

@ -0,0 +1,26 @@
<Project>
<Import Project=".\osu.Game.props" />
<PropertyGroup Label="Defines">
<DefineConstants Condition="'$(TargetFramework)' == 'net461'">$(DefineConstants);NET_FRAMEWORK</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<StartupObject>osu.Game.Tests.VisualTestRunner</StartupObject>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\osu-framework\osu.Framework\osu.Framework.csproj" />
<ProjectReference Include="..\osu.Game\osu.Game.csproj" />
<ProjectReference Include="..\osu-resources\osu.Game.Resources\osu.Game.Resources.csproj" />
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="DeepEqual" Version="1.6.0" />
<PackageReference Include="NUnit" Version="3.8.1" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\osu.Game\Tests\VisualTestRunner.cs">
<Link>VisualTestRunner.cs</Link>
</Compile>
</ItemGroup>
<PropertyGroup>
<GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup>
</Project>