Skip to content

Commit

Permalink
CI環境ではConvertFromWebp_SuccessTestの実行をスキップする
Browse files Browse the repository at this point in the history
  • Loading branch information
upsilon committed Jun 2, 2024
1 parent bd72b10 commit c45c0de
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ env:
jobs:
build:
uses: ./.github/workflows/build.yml
with:
msbuild_args: /p:ContinuousIntegrationBuild=true

test:
runs-on: windows-2022
Expand Down
5 changes: 5 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>
<PropertyGroup>
<DefineConstants Condition="'$(ContinuousIntegrationBuild)' == 'true'">$(DefineConstants);CI_BUILD</DefineConstants>
</PropertyGroup>
</Project>
27 changes: 26 additions & 1 deletion OpenTween.Tests/WebpDecoderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,14 @@ public async Task IsWebpImage_WebPTest()
Assert.True(WebpDecoder.IsWebpImage(buffer));
}

#if CI_BUILD
#pragma warning disable xUnit1004
[Fact(Skip = "WebP画像拡張機能がインストールされている環境でしか動作しない")]
#pragma warning restore xUnit1004
#else
[Fact]
public async Task ConvertFromWebp_Test()
#endif
public async Task ConvertFromWebp_SuccessTest()
{
using var imgStream = File.OpenRead("Resources/re1.webp");
using var memstream = new MemoryStream();
Expand All @@ -62,5 +68,24 @@ public async Task ConvertFromWebp_Test()
using var memoryImage = new MemoryImage(converted);
Assert.Equal(ImageFormat.Png, memoryImage.ImageFormat);
}

#if CI_BUILD
[Fact]
#else
#pragma warning disable xUnit1004
[Fact(Skip = "WebP画像拡張機能がインストールされていない環境に対するテスト")]
#pragma warning restore xUnit1004
#endif
public async Task ConvertFromWebp_FailTest()
{
using var imgStream = File.OpenRead("Resources/re1.webp");
using var memstream = new MemoryStream();
await imgStream.CopyToAsync(memstream);
memstream.TryGetBuffer(out var buffer);

await Assert.ThrowsAsync<InvalidImageException>(
() => WebpDecoder.ConvertFromWebp(buffer)
);
}
}
}
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ init:

before_build:
- nuget restore
- ps: Set-Content .\msbuild.rsp "/warnaserror /p:DebugType=None"
- ps: Set-Content .\msbuild.rsp "/warnaserror /p:DebugType=None /p:ContinuousIntegrationBuild=true"

test:
assemblies:
Expand Down

0 comments on commit c45c0de

Please sign in to comment.