-
Notifications
You must be signed in to change notification settings - Fork 874
Expand file tree
/
Copy pathPostProcessingRuntimeTests.cs
More file actions
84 lines (64 loc) · 1.87 KB
/
Copy pathPostProcessingRuntimeTests.cs
File metadata and controls
84 lines (64 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
class PostProcessingTests
{
[Test]
public void Profile_AddSettings()
{
var profile = NewProfile();
var bloom = profile.AddSettings<Bloom>();
Assert.IsNotNull(bloom);
Destroy(profile);
}
[Test]
public void Profile_HasSettings()
{
var profile = NewProfile(typeof(Bloom));
Assert.IsTrue(profile.HasSettings<Bloom>());
Assert.IsFalse(profile.HasSettings<ChromaticAberration>());
Destroy(profile);
}
[Test]
public void Profile_GetSettings()
{
var profile = NewProfile(typeof(Bloom));
Assert.IsNotNull(profile.GetSetting<Bloom>());
Assert.IsNull(profile.GetSetting<ChromaticAberration>());
Destroy(profile);
}
[Test]
public void Profile_TryGetSettings()
{
var profile = NewProfile(typeof(Bloom));
Bloom outBloom;
var exists = profile.TryGetSettings(out outBloom);
Assert.IsTrue(exists);
Assert.IsNotNull(outBloom);
ChromaticAberration outChroma;
exists = profile.TryGetSettings(out outChroma);
Assert.IsFalse(exists);
Assert.IsNull(outChroma);
Destroy(profile);
}
[Test]
public void Profile_RemoveSettings()
{
var profile = NewProfile(typeof(Bloom));
profile.RemoveSettings<Bloom>();
Assert.IsFalse(profile.HasSettings<Bloom>());
Destroy(profile);
}
static PostProcessProfile NewProfile(params Type[] types)
{
var profile = ScriptableObject.CreateInstance<PostProcessProfile>();
foreach (var t in types)
profile.AddSettings(t);
return profile;
}
static void Destroy(PostProcessProfile profile)
{
UnityEngine.Object.DestroyImmediate(profile);
}
}