WindowResultUpdater.cs
1.65 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
using System.Linq;
using TestRunner.Callbacks;
using UnityEditor.TestTools.TestRunner.Api;
namespace UnityEditor.TestTools.TestRunner.GUI
{
internal class WindowResultUpdater : ICallbacks, ITestTreeRebuildCallbacks
{
public WindowResultUpdater()
{
var cachedResults = WindowResultUpdaterDataHolder.instance.CachedResults;
var testList = TestRunnerWindow.s_Instance.m_SelectedTestTypes;
foreach (var result in cachedResults)
{
testList.UpdateResult(result);
}
cachedResults.Clear();
}
public void RunStarted(ITestAdaptor testsToRun)
{
}
public void RunFinished(ITestResultAdaptor testResults)
{
if (TestRunnerWindow.s_Instance != null)
{
TestRunnerWindow.s_Instance.RebuildUIFilter();
}
}
public void TestStarted(ITestAdaptor testName)
{
}
public void TestFinished(ITestResultAdaptor test)
{
var result = new TestRunnerResult(test);
if (TestRunnerWindow.s_Instance == null)
{
WindowResultUpdaterDataHolder.instance.CachedResults.Add(result);
return;
}
TestRunnerWindow.s_Instance.m_SelectedTestTypes.UpdateResult(result);
}
public void TestTreeRebuild(ITestAdaptor test)
{
if (TestRunnerWindow.s_Instance == null)
{
return;
}
TestRunnerWindow.s_Instance.m_SelectedTestTypes.UpdateTestTree(test);
}
}
}