public virtual void SetUp() { Window = EditorWindow.GetWindowWithRect <GtfoWindowTest>(k_WindowRect); GraphView = Window.GraphView; Helpers = new TestEventHelpers(Window); if (CreateGraphOnStartup) { var graphAsset = GraphAssetCreationHelpers <TestGraphAssetModel> .CreateInMemoryGraphAsset(CreatedGraphType, "Test"); CommandDispatcher.Dispatch(new LoadGraphAssetCommand(graphAsset)); } }
public void LoadGraphCommandLoadsCorrectGraph() { GraphAssetCreationHelpers <TestGraphAssetModel> .CreateGraphAsset(typeof(ClassStencil), "test", k_GraphPath); AssumeIntegrity(); AssetDatabase.SaveAssets(); Resources.UnloadAsset(m_CommandDispatcher.State.WindowState.AssetModel as Object); m_CommandDispatcher.Dispatch(new LoadGraphAssetCommand(k_GraphPath, 0, null)); Assert.AreEqual(k_GraphPath, AssetDatabase.GetAssetPath((Object)GraphModel.AssetModel)); AssertIntegrity(); AssetDatabase.DeleteAsset(k_GraphPath); }
public void CreateTestGraphCanBeReloaded() { var graphTemplate = new TestGraph(); GraphAssetCreationHelpers <TestGraphAssetModel> .CreateGraphAsset(typeof(ClassStencil), graphTemplate.DefaultAssetName, k_GraphPath, graphTemplate); GraphModel graph = AssetDatabase.LoadAssetAtPath <GraphAssetModel>(k_GraphPath)?.GraphModel as GraphModel; Resources.UnloadAsset((Object)graph?.AssetModel); m_CommandDispatcher.Dispatch(new LoadGraphAssetCommand(k_GraphPath, 0, null)); AssertIntegrity(); AssetDatabase.DeleteAsset(k_GraphPath); }
public static void CreateGraph(MenuCommand menuCommand) { const string path = "Assets"; var template = new GraphTemplate<MathBookStencil>(MathBookStencil.GraphName); CommandDispatcher commandDispatcher = null; if (EditorWindow.HasOpenInstances<SimpleGraphViewWindow>()) { var window = EditorWindow.GetWindow<SimpleGraphViewWindow>(); if (window != null) { commandDispatcher = window.CommandDispatcher; } } GraphAssetCreationHelpers<MathBookAsset>.CreateInProjectWindow(template, commandDispatcher, path); }
public static void CreateGraph(MenuCommand menuCommand) { const string path = "Assets"; var template = new GraphTemplate <VerticalStencil>(VerticalStencil.k_GraphName); CommandDispatcher commandDispatcher = null; if (EditorWindow.HasOpenInstances <VerticalGraphWindow>()) { var window = EditorWindow.GetWindow <VerticalGraphWindow>(); if (window != null) { commandDispatcher = window.CommandDispatcher; } } GraphAssetCreationHelpers <VerticalGraphAssetModel> .CreateInProjectWindow(template, commandDispatcher, path); }
public override void SetUp() { base.SetUp(); GraphViewSettings.UserSettings.EnableSnapToBorders = false; GraphViewSettings.UserSettings.EnableSnapToPort = false; m_AssetModel = GraphAssetCreationHelpers <TestAssetModel> .CreateGraphAsset(typeof(TestStencil), "TestFile", k_FilePath); CommandDispatcher.Dispatch(new LoadGraphAssetCommand(m_AssetModel)); m_NodeModel = CreateNode("Movable element", k_NodePos, 0, 1); // Add the minimap. var miniMap = new MiniMap(); miniMap.style.left = k_MinimapRect.x; miniMap.style.top = k_MinimapRect.y; miniMap.style.width = k_MinimapRect.width; miniMap.style.height = k_MinimapRect.height; graphView.Add(miniMap); }
public void SetUp() { m_Asset1 = GraphAssetCreationHelpers <TestGraphAssetModel> .CreateInMemoryGraphAsset(typeof(ClassStencil), "Test1"); }
public void SetUp() { m_GraphAsset = GraphAssetCreationHelpers <TestGraphAssetModel> .CreateInMemoryGraphAsset(typeof(ClassStencil), "Test"); m_GraphAsset.CreateGraph("Graph"); }
public void CreateGraphAssetBuildsValidGraphModel() { GraphAssetCreationHelpers <TestGraphAssetModel> .CreateInMemoryGraphAsset(typeof(ClassStencil), "test"); AssumeIntegrity(); }