예제 #1
0
        public void EscapeClosesContextMenu()
        {
            MainWindow.Ribbon.SelectTab("Model");
            MainWindow.Ribbon.ClickButton("CreateSphere");
            Assume.That(MainWindow.Ribbon.IsButtonChecked("CreateSphere"));
            MainWindow.Viewport.ClickRelative(0.5, 0.5);

            MainWindow.Viewport.ClickRelative(0.4, 0.4, MouseButton.Right);
            Assert.IsTrue(ContextMenuAdaptor.IsContextMenuOpen(MainWindow, "ViewportContextMenu"));

            Pipe.TypeKey(VirtualKeyShort.ESCAPE);
            Thread.Sleep(1000); // Allow fadeout
            Assert.IsFalse(ContextMenuAdaptor.IsContextMenuOpen(MainWindow, "ViewportContextMenu"));
            Assert.That(MainWindow.Ribbon.IsButtonChecked("CreateSphere"));

            // Select button prior to ESC
            MainWindow.Viewport.ClickRelative(0.4, 0.4, MouseButton.Right);
            var menu = new ContextMenuAdaptor(MainWindow, "ViewportContextMenu");

            menu.ClickButton("SnappingEnabled");
            Pipe.TypeKey(VirtualKeyShort.ESCAPE);
            Thread.Sleep(1000); // Allow fadeout
            Assert.IsFalse(ContextMenuAdaptor.IsContextMenuOpen(MainWindow, "ViewportContextMenu"));
            Assert.That(MainWindow.Ribbon.IsButtonChecked("CreateSphere"));
        }
예제 #2
0
        public void DynamicContextMenuItems()
        {
            TestDataGenerator.GenerateBox(MainWindow);

            MainWindow.Viewport.ClickRelative(0.4, 0.4, MouseButton.Right);
            Assert.IsTrue(ContextMenuAdaptor.IsContextMenuOpen(MainWindow, "ViewportContextMenu"));
            var menu = new ContextMenuAdaptor(MainWindow, "ViewportContextMenu");

            menu.ClickMenuItem("Transform Entity");

            MainWindow.Ribbon.SelectTab("Edit");
            Assert.IsTrue(MainWindow.Ribbon.IsButtonChecked("TransformShape"));
        }
        public void ScriptAddToMru()
        {
            MainWindow.Ribbon.SelectGroup("Toolbox");
            MainWindow.Ribbon.ClickButton("RunScript");
            var fileDlg = new FileDialogAdaptor(MainWindow);

            Assert.That(fileDlg.Title, Is.EqualTo("Open Script..."));
            fileDlg.Load(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\Data\UnitTests\SourceData\Scripts\CreateBoxBody.csx"));
            Assert.AreEqual(1, Pipe.GetValue <int>("$Context.Document.ChildCount"));

            MainWindow.Ribbon.OpenSplitButtonMenu("RunScript");
            Assert.IsTrue(ContextMenuAdaptor.IsContextMenuOpen(MainWindow));
            var context = new ContextMenuAdaptor(MainWindow);

            context.ClickMenuItem("CreateBoxBody");
            Assert.AreEqual(2, Pipe.GetValue <int>("$Context.Document.ChildCount"));
        }
        public void SelectColorFromRibbon()
        {
            MainWindow.Ribbon.SelectGroup("Edit");
            MainWindow.Ribbon.ClickButton("ActiveLayerVisual");
            Assert.IsTrue(ContextMenuAdaptor.IsContextMenuOpen(MainWindow, "LayerVisualPanel"));
            var visualPanel = new ContextMenuAdaptor(MainWindow, "LayerVisualPanel");

            visualPanel.ExpandComboBox("ColorPicker");
            Assert.IsTrue(ContextMenuAdaptor.IsContextMenuOpen(MainWindow, "ColorPickerPopup"));
            var colorPicker = new ContextMenuAdaptor(MainWindow, "ColorPickerPopup");
            var colors      = colorPicker.GetListBoxItems("ColorList").ToList();

            Assert.Less(10, colors.Count());
            colorPicker.SelectListBoxItem("ColorList", 10);
            var color      = new Color(colors[10].Split(',')[2]);
            var layerValue = Pipe.GetValue("$Context.Layers.ActiveLayer.Color");

            Assert.AreEqual(color.ToString(), layerValue);
        }
예제 #5
0
        public void CreateSketchOnPlane()
        {
            // Start tool
            MainWindow.Ribbon.SelectTab("Model");
            MainWindow.Ribbon.ClickButton("CreateDatumPlane");

            // Select as WorkingPlane
            MainWindow.Viewport.ClickRelative(0.5, 0.5, MouseButton.Right, false);
            Assume.That(ContextMenuAdaptor.IsContextMenuOpen(MainWindow, "ViewportContextMenu"));
            var contextMenu = new ContextMenuAdaptor(MainWindow, "ViewportContextMenu");

            contextMenu.ClickMenuItem("Set as Working Plane");

            // Create sketch on new plane
            MainWindow.Ribbon.ClickButton("CreateSketch");
            Assert.AreEqual("SketchEditorTool", Pipe.GetValue <string>("$Context.EditorState.ActiveTool"));

            // Exit sketch editor
            Pipe.TypeKey(VirtualKeyShort.ESCAPE);
            Assert.AreEqual("", Pipe.GetValue <string>("$Context.EditorState.ActiveTool"));

            // Let it crash
            MainWindow.Viewport.ClickRelative(0.5, 0.5, MouseButton.Right, false);
        }