public IEnumerator ShowingContent_InInspector_SurvivesDomainReload() { var content = new Content(); content.m_Data.Value = 25; SelectionUtility.ShowInInspector(content); for (var i = 0; i < 10; ++i) { yield return(null); } Assert.That(Selection.activeObject, Is.TypeOf <InspectorContent>()); var proxy = (InspectorContent)Selection.activeObject; Assert.That(proxy, Is.Not.Null); UnityEditor.Compilation.CompilationPipeline.RequestScriptCompilation(); yield return(new WaitForDomainReload()); yield return(null); proxy = (InspectorContent)Selection.activeObject; Assert.That(proxy, Is.Not.Null); var element = proxy.Root.Q <Element <Content> >(); Assert.That(element.m_Content.m_Data.Value, Is.EqualTo(25)); Selection.activeObject = null; }
public IEnumerator ShowingContent_InInspectorWindow_CanControlLifecycle() { Selection.activeObject = null; yield return(null); var content = new LifecycleContent(); content.Status = ContentStatus.ContentNotReady; SelectionUtility.ShowInInspector(content); for (var i = 0; i < 10; ++i) { yield return(null); } var editor = Resources.FindObjectsOfTypeAll <InspectorContentEditor>().FirstOrDefault(); Assert.That(editor && null != editor, Is.EqualTo(true)); var element = editor.Target.Root.Q <Element <LifecycleContent> >(); Assert.That(element, Is.Null); yield return(null); element = editor.Target.Root.Q <Element <LifecycleContent> >(); Assert.That(element, Is.Null); content.Status = ContentStatus.ContentReady; for (var i = 0; i < 10; ++i) { yield return(null); } element = editor.Target.Root.Q <Element <LifecycleContent> >(); Assert.That(element, Is.Not.Null); content.Status = ContentStatus.ContentNotReady; for (var i = 0; i < 10; ++i) { yield return(null); } element = editor.Target.Root.Q <Element <LifecycleContent> >(); Assert.That(element, Is.Null); content.Status = ContentStatus.ContentUnavailable; for (var i = 0; i < 10; ++i) { yield return(null); } Assert.That(editor && null != editor, Is.EqualTo(false)); }