File size: 1,538 Bytes
18a519f | 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 | using NUnit.Framework;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.TestTools;
using UnityEditor;
using UnityEditorInternal;
public class ProfileAnalyzerCaptureTests : ProfileAnalyzerBaseTest
{
[UnityTest]
public IEnumerator PlayMode_Capture_ContainsNoDuplicates()
{
StartProfiler();
yield return null;
yield return null;
yield return null;
yield return null;
yield return null;
StopProfiler();
// Seem to need one more frame to get the data transfered over so the profile analyzer can pull it.
yield return null;
//analyze the data
m_SetupData.profileData = m_SetupData.profilerWindowInterface.PullFromProfiler(m_SetupData.firstFrame, m_SetupData.lastFrame);
var analysis = GetAnalysisFromFrameData(m_SetupData.profileData);
var analysisMarkers = analysis.GetMarkers();
var analysisMarkerDict = new Dictionary<string, int>();
for (int i = 0; i < analysisMarkers.Count; ++i)
{
int count = 0;
string curName = analysisMarkers[i].name;
analysisMarkerDict.TryGetValue(curName, out count);
analysisMarkerDict[curName] = count + 1;
}
Assert.IsTrue(0 != analysisMarkerDict.Count, "analysisMarkerSet count is zero!");
foreach (var entry in analysisMarkerDict)
{
Assert.IsTrue(1 == entry.Value, "Duplicates found in analysis marker list: " + entry.Key);
}
}
}
|