Skip to content

Commit 664d91e

Browse files
committed
Add RequirePlatformSupportAttributeExample
1 parent 41b6226 commit 664d91e

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright (c) 2021-2025 Koji Hasegawa.
2+
// This software is released under the MIT License.
3+
4+
using APIExamples.UnityTestFramework;
5+
using NUnit.Framework;
6+
using UnityEditor;
7+
using UnityEditor.TestTools;
8+
9+
namespace APIExamples.Editor.UnityTestFramework
10+
{
11+
/// <summary>
12+
/// Unityエディターに指定したプラットフォームモジュール(Build Support)がインストールされているときのみ実行されるテストの例.
13+
/// </summary>
14+
/// <seealso cref="UnityPlatformAttributeExample"/>
15+
[TestFixture]
16+
public class RequirePlatformSupportAttributeExample
17+
{
18+
[Test]
19+
[RequirePlatformSupport(BuildTarget.StandaloneOSX)]
20+
public void macOSモジュールがインストールされているときのみ実行されるテスト()
21+
{
22+
}
23+
24+
[Test]
25+
[RequirePlatformSupport(BuildTarget.StandaloneWindows)]
26+
public void Windowsモジュールがインストールされているときのみ実行されるテスト()
27+
{
28+
}
29+
30+
[Test]
31+
[RequirePlatformSupport(BuildTarget.StandaloneLinux64)]
32+
public void Linuxモジュールがインストールされているときのみ実行されるテスト()
33+
{
34+
}
35+
36+
[Test]
37+
[RequirePlatformSupport(BuildTarget.StandaloneOSX, BuildTarget.StandaloneWindows,
38+
BuildTarget.StandaloneLinux64)] // Note: And条件
39+
public void スタンドアロンモジュールが3種ともインストールされているときのみ実行されるテスト()
40+
{
41+
}
42+
43+
[Test]
44+
[RequirePlatformSupport(BuildTarget.WSAPlayer)]
45+
public void WSAPlayerモジュールがインストールされているときのみ実行されるテスト()
46+
{
47+
}
48+
}
49+
}

Assets/APIExamples/Tests/Editor/UnityTestFramework/RequirePlatformSupportAttributeExample.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)