Skip to content

Merge master #5127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,31 +93,16 @@ public void CheckDataType()
Assert.IsInstanceOf<VFXDataParticle>(output.GetData());
}

string tempFilePath = "Assets/Temp_vfxTest_Ddata.vfx";

VFXGraph MakeTemporaryGraph()
{
if (System.IO.File.Exists(tempFilePath))
{
AssetDatabase.DeleteAsset(tempFilePath);
}
var asset = VisualEffectAssetEditorUtility.CreateNewAsset(tempFilePath);
VisualEffectResource resource = asset.GetResource(); // force resource creation
VFXGraph graph = ScriptableObject.CreateInstance<VFXGraph>();
graph.visualEffectResource = resource;
return graph;
}

[OneTimeTearDown]
public void CleanUp()
{
AssetDatabase.DeleteAsset(tempFilePath);
VFXTestCommon.DeleteAllTemporaryGraph();
}

[Test]
public void CheckName_Sharing_Between_Output_Event()
{
var graph = MakeTemporaryGraph();
var graph = VFXTestCommon.MakeTemporaryGraph();

var gameObj = new GameObject("CheckData_Sharing_Between_Output_Event");
var vfxComponent = gameObj.AddComponent<VisualEffect>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,38 @@ private VisualEffectAsset CreateAssetAtPath(string path)
return VisualEffectAssetEditorUtility.CreateNewAsset(path);
}

[Test]
public void Sanitize_GetSpawnCount()
{
string kSourceAsset = "Assets/AllTests/Editor/Tests/VFXSerializationTests_GetSpawnCount.vfx_";
var graph = VFXTestCommon.CopyTemporaryGraph(kSourceAsset);

Assert.AreEqual(5, graph.children.OfType<VFXAttributeParameter>().Count());
Assert.AreEqual(5, graph.children.OfType<VFXInlineOperator>().Where(o => o.type == typeof(uint)).Count());
Assert.AreEqual(1, graph.children.OfType<VFXInlineOperator>().Where(o => o.type == typeof(float)).Count());
Assert.AreEqual(1, graph.children.OfType<Operator.Add>().Count());
Assert.AreEqual(1, graph.children.OfType<VFXInlineOperator>().Where(o => o.type == typeof(Color)).Count());

foreach (var attribute in graph.children.OfType<VFXAttributeParameter>())
Assert.IsTrue(attribute.outputSlots[0].HasLink());

foreach (var inlineUInt in graph.children.OfType<VFXInlineOperator>().Where(o => o.type == typeof(uint)))
Assert.IsTrue(inlineUInt.inputSlots[0].HasLink());

foreach (var inlineFloat in graph.children.OfType<VFXInlineOperator>().Where(o => o.type == typeof(float)))
Assert.IsTrue(inlineFloat.inputSlots[0].HasLink());

foreach (var inlineColor in graph.children.OfType<VFXInlineOperator>().Where(o => o.type == typeof(Color)))
Assert.IsTrue(inlineColor.inputSlots[0].HasLink());

foreach (var add in graph.children.OfType<Operator.Add>())
{
Assert.AreEqual(2, add.operandCount);
Assert.IsTrue(add.inputSlots[0].HasLink());
Assert.IsTrue(add.inputSlots[1].HasLink());
}
}

[OneTimeSetUpAttribute]
public void OneTimeSetUpAttribute()
{
Expand Down
Loading