summaryrefslogtreecommitdiff
path: root/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRenderer.cs
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2020-04-20 19:09:33 -0400
committerAndrew Lee <alee14498@protonmail.com>2020-04-20 19:09:33 -0400
commit7c1e566113d59699af1624186c64eca67f063fc6 (patch)
tree5a6850a695986872d5d0b09d7dab8421628fe33e /Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRenderer.cs
parentdd117b77aae1d8be7563b360d05b842a73b7dab2 (diff)
downloadProject-Sandbox-7c1e566113d59699af1624186c64eca67f063fc6.tar.gz
Project-Sandbox-7c1e566113d59699af1624186c64eca67f063fc6.tar.bz2
Project-Sandbox-7c1e566113d59699af1624186c64eca67f063fc6.zip
Upgraded Unity
Diffstat (limited to 'Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRenderer.cs')
-rw-r--r--Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRenderer.cs97
1 files changed, 0 insertions, 97 deletions
diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRenderer.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRenderer.cs
deleted file mode 100644
index 95316e7..0000000
--- a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRenderer.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using NUnit.Framework.Interfaces;
-using NUnit.Framework.Internal;
-
-namespace UnityEngine.TestTools.TestRunner.Callbacks
-{
- internal class TestResultRenderer
- {
- private static class Styles
- {
- public static readonly GUIStyle SucceedLabelStyle;
- public static readonly GUIStyle FailedLabelStyle;
- public static readonly GUIStyle FailedMessagesStyle;
-
- static Styles()
- {
- SucceedLabelStyle = new GUIStyle("label");
- SucceedLabelStyle.normal.textColor = Color.green;
- SucceedLabelStyle.fontSize = 48;
-
- FailedLabelStyle = new GUIStyle("label");
- FailedLabelStyle.normal.textColor = Color.red;
- FailedLabelStyle.fontSize = 32;
-
- FailedMessagesStyle = new GUIStyle("label");
- FailedMessagesStyle.wordWrap = false;
- FailedMessagesStyle.richText = true;
- }
- }
-
- private readonly List<ITestResult> m_FailedTestCollection;
-
- private bool m_ShowResults;
- private Vector2 m_ScrollPosition;
-
- public TestResultRenderer(ITestResult testResults)
- {
- m_FailedTestCollection = new List<ITestResult>();
- GetFailedTests(testResults);
- }
-
- private void GetFailedTests(ITestResult testResults)
- {
- if (testResults is TestCaseResult)
- {
- if (testResults.ResultState.Status == TestStatus.Failed)
- m_FailedTestCollection.Add(testResults);
- }
- else if (testResults.HasChildren)
- {
- foreach (var testResultsChild in testResults.Children)
- {
- GetFailedTests(testResultsChild);
- }
- }
- }
-
- private const int k_MaxStringLength = 15000;
-
- public void ShowResults()
- {
- m_ShowResults = true;
- Cursor.visible = true;
- }
-
- public void Draw()
- {
- if (!m_ShowResults) return;
- if (m_FailedTestCollection.Count == 0)
- {
- GUILayout.Label("All test(s) succeeded", Styles.SucceedLabelStyle, GUILayout.Width(600));
- }
- else
- {
- int count = m_FailedTestCollection.Count;
- GUILayout.Label(count + " tests failed!", Styles.FailedLabelStyle);
-
- m_ScrollPosition = GUILayout.BeginScrollView(m_ScrollPosition, GUILayout.ExpandWidth(true));
- var text = "";
-
- text += "<b><size=18>Code-based tests</size></b>\n";
- text += string.Join("\n", m_FailedTestCollection
- .Select(result => result.Name + " " + result.ResultState + "\n" + result.Message)
- .ToArray());
-
- if (text.Length > k_MaxStringLength)
- text = text.Substring(0, k_MaxStringLength);
-
- GUILayout.TextArea(text, Styles.FailedMessagesStyle);
- GUILayout.EndScrollView();
- }
- if (GUILayout.Button("Close"))
- Application.Quit();
- }
- }
-}