diff --git a/Assets/Tests/CustomElementTest.cs b/Assets/Tests/CustomElementTest.cs index 7c26124..167de29 100644 --- a/Assets/Tests/CustomElementTest.cs +++ b/Assets/Tests/CustomElementTest.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Threading.Tasks; using NUnit.Framework; @@ -30,7 +30,7 @@ public override async Task TearDown() await base.TearDown(); // Destroy the instance. In some cases, it might be better not to do this. - _debugViewCustomElementTest= null; + _debugViewCustomElementTest = null; } [Test] @@ -48,10 +48,10 @@ public async Task AddProfileInfoLabel_DisplaysCorrectProfileInfo() var expectedMemory = ProfileUtils.GetTotalMemoryGB(); var frameTiming = ProfileUtils.GetLatestFrameTiming(); var expectedMemoryString = expectedMemory.ToString("F2"); - var expectedCpuFpsString = (1000 / frameTiming.cpuFrameTime).ToString("F0"); + var expectedCpuFpsString = (1000 / frameTiming.cpuFrameTime).ToString("F0"); var expectedCpuFrameTimeString = frameTiming.cpuFrameTime.ToString("F1"); var expectedGpuFpsString = (1000 / frameTiming.gpuFrameTime).ToString("F0"); - var expectedGpuFrameTimeString = frameTiming.gpuFrameTime.ToString("F1"); + var expectedGpuFrameTimeString = frameTiming.gpuFrameTime.ToString("F1"); Assert.That(label.text, Does.Contain(expectedMemoryString), "memory value should be contained in label."); Assert.That(label.text, Does.Contain(expectedCpuFpsString), "cpu fps value should be contained in label."); @@ -61,7 +61,7 @@ public async Task AddProfileInfoLabel_DisplaysCorrectProfileInfo() } [Test] - [TestCase (220, 332, 441, LogType.Error)] + [TestCase(220, 332, 441, LogType.Error)] [TestCase(220, 441, 332, LogType.Warning)] [TestCase(332, 441, 220, LogType.Log)] [TestCase(332, 220, 441, LogType.Error)] @@ -111,5 +111,41 @@ public async Task ConsoleView_SearchAndCategorizeMessages_WorksCorrectly( Assert.That(filteredItems, Is.Not.Null, "3: The type of the filter result is incorrect."); Assert.That(filteredItems.Count, Is.EqualTo(0), "3: The search results are not filtered correctly."); } + + [Test] + public async Task ConsoleView_ClickLogEntry_CopiesPressedLogText() + { + ConsoleView.Initialize(); + GUIUtility.systemCopyBuffer = ""; + + var window = _debugViewCustomElementTest.Root.AddWindow("TestWindow"); + window.parent.style.display = DisplayStyle.Flex; + var consoleView = window.AddConsoleView(); + + Debug.Log("Pressed log message"); + Debug.LogWarning("Other warning message"); + + await Awaitable.NextFrameAsync(); + + var listView = consoleView.Q(); + Assert.That(listView, Is.Not.Null, "The ListView does not exist."); + Assert.That(listView.itemsSource.Count, Is.GreaterThanOrEqualTo(2), "The ListView should contain test logs."); + + var buttons = consoleView.Query