예제 #1
0
        public virtual void Setup()
        {
            if (EditorApplication.isPlaying)
            {
                BuilderWindow = EditorWindow.GetWindow <Builder>();
            }
            else
            {
                BuilderWindow = BuilderTestsHelper.MakeNewBuilderWindow();
            }

            Selection       = BuilderWindow.selection;
            Canvas          = BuilderWindow.rootVisualElement.Q <BuilderCanvas>();
            LibraryPane     = BuilderWindow.rootVisualElement.Q <BuilderLibrary>();
            HierarchyPane   = BuilderWindow.rootVisualElement.Q <BuilderHierarchy>();
            StyleSheetsPane = BuilderWindow.rootVisualElement.Q <BuilderStyleSheets>();
            ViewportPane    = BuilderWindow.rootVisualElement.Q <BuilderViewport>();
            InspectorPane   = BuilderWindow.rootVisualElement.Q <BuilderInspector>();

            if (EditorApplication.isPlaying)
            {
                return;
            }

            BuilderProjectSettings.Reset();
            ForceNewDocument();
            var createSelectorField = StyleSheetsPane.Q <TextField>();

            createSelectorField.visualInput.Blur();
            LibraryPane.SetViewMode(BuilderLibrary.LibraryViewMode.TreeView);
        }
        public virtual void Setup()
        {
            if (EditorApplication.isPlaying)
            {
                builder = EditorWindow.GetWindow <Builder>();
            }
            else
            {
                builder = BuilderTestsHelper.MakeNewBuilderWindow();
            }

            selection       = builder.selection;
            canvas          = builder.rootVisualElement.Q <BuilderCanvas>();
            library         = builder.rootVisualElement.Q <BuilderLibrary>();
            hierarchy       = builder.rootVisualElement.Q <BuilderHierarchy>();
            styleSheetsPane = builder.rootVisualElement.Q <BuilderStyleSheets>();
            viewport        = builder.rootVisualElement.Q <BuilderViewport>();
            toolbar         = viewport.Q <BuilderToolbar>();
            inspector       = builder.rootVisualElement.Q <BuilderInspector>();

            if (EditorApplication.isPlaying)
            {
                return;
            }

            BuilderProjectSettings.Reset();
            ForceNewDocument();
            var createSelectorField = styleSheetsPane.Q <TextField>();

            createSelectorField.visualInput.Blur();
            library.SetViewMode(BuilderLibrary.LibraryViewMode.TreeView);
        }
        public virtual void Setup()
        {
            BuilderWindow   = BuilderTestsHelper.MakeNewBuilderWindow();
            LibraryPane     = BuilderWindow.rootVisualElement.Q <BuilderLibrary>();
            HierarchyPane   = BuilderWindow.rootVisualElement.Q <BuilderHierarchy>();
            StyleSheetsPane = BuilderWindow.rootVisualElement.Q <BuilderStyleSheets>();
            ViewportPane    = BuilderWindow.rootVisualElement.Q <BuilderViewport>();
            InspectorPane   = BuilderWindow.rootVisualElement.Q <BuilderInspector>();

            ForceNewDocument();
            var createSelectorField = StyleSheetsPane.Q <TextField>();

            createSelectorField.visualInput.Blur();
        }
예제 #4
0
        public void CanvasSizeRestoredOnDomainOrWindowReloadAndResetsOnDocInit()
        {
            BuilderWindow.canvas.ResetSize();
            var newWidth = k_TestCanvasSizeValue;

            InspectorPane.Q <IntegerField>("canvas-width").value = newWidth;
            Assert.That(BuilderWindow.canvas.width, Is.EqualTo(newWidth));

            BuilderWindow.Close();
            m_NewBuilder = BuilderTestsHelper.MakeNewBuilderWindow();
            Assert.That(m_NewBuilder.canvas.width, Is.EqualTo(newWidth));

            m_NewBuilder.rootVisualElement.Q <BuilderToolbar>().NewDocument(false);
            Assert.That(m_NewBuilder.canvas.width, Is.Not.EqualTo(newWidth));
        }