public void ImportSketchFromDxf() { string path = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\Data\UITests\SourceData\ImportSketch.dxf")); TestDataGenerator.GenerateSketch(MainWindow); MainWindow.Ribbon.SelectGroup("Sketch"); MainWindow.Ribbon.ClickButton("SketchExchange"); var menu = new ContextMenuAdaptor(MainWindow); menu.ClickMenuItem("ImportFromFile"); var fileDlg = new FileDialogAdaptor(MainWindow); fileDlg.SelectFileType("*.dxf"); fileDlg.Load(path); Assert.IsFalse(FileDialogAdaptor.IsDialogOpen(MainWindow)); var dlg = new WindowAdaptor(MainWindow, "ExchangerSettings"); Assert.IsNotNull(dlg); dlg.ClickButton("Ok"); Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExchangerSettings")); Assert.AreEqual(5, Pipe.GetValue <int>("$Sketch.Segments.Count")); }
public void ImportSolidStl() { string path = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\Data\UITests\SourceData\ImportMesh.stl")); MainWindow.Ribbon.ClickFileMenuItem("ImportFileToModel"); var fileDlg = new FileDialogAdaptor(MainWindow); fileDlg.SelectFileType(".stl"); fileDlg.Load(path); Assert.IsFalse(FileDialogAdaptor.IsDialogOpen(MainWindow)); Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExchangerSettings")); Assert.That(Pipe.GetValue <int>("$Context.Document.ChildCount") > 0); }
public void RunScriptError() { 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\CompilerError.csx")); Assert.IsTrue(TaskDialogAdaptor.IsTaskDialogOpen(MainWindow)); var errordlg = new TaskDialogAdaptor(MainWindow); Assert.AreEqual("Run script failed", errordlg.Title); errordlg.Close(); }
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 LoadImage() { string path = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\Data\UITests\SourceData\Image_300x150.png")); // Start tool MainWindow.Ribbon.SelectTab("Model"); MainWindow.Ribbon.ClickButton("CreateDatumPlane"); var panel = MainWindow.PropertyView.FindPanelByClass("DatumPlanePropertyPanel"); Assert.NotNull(panel); // Load without aspect correction Assert.IsTrue(panel.GetToggle("KeepAspectRatio")); panel.ClickButton("LoadImageFile"); Assert.IsTrue(FileDialogAdaptor.IsDialogOpen(MainWindow)); var fileDialog = new FileDialogAdaptor(MainWindow); fileDialog.Load(path); Assert.IsTrue(TaskDialogAdaptor.IsTaskDialogOpen(MainWindow)); var taskDialog = new TaskDialogAdaptor(MainWindow); taskDialog.ClickButton(TaskDialogAdaptor.Button.No); Assert.IsNotEmpty(Pipe.GetValue <string>("$Selected.ImageFilePath")); Assert.AreEqual(100.0, panel.GetValue <double>("DimensionX")); Assert.AreEqual(100.0, panel.GetValue <double>("DimensionY")); // Load with aspect correction Assert.IsTrue(panel.GetToggle("KeepAspectRatio")); panel.ClickButton("LoadImageFile"); Assert.IsTrue(FileDialogAdaptor.IsDialogOpen(MainWindow)); fileDialog = new FileDialogAdaptor(MainWindow); fileDialog.Load(path); Assert.IsTrue(TaskDialogAdaptor.IsTaskDialogOpen(MainWindow)); taskDialog = new TaskDialogAdaptor(MainWindow); taskDialog.ClickButton(TaskDialogAdaptor.Button.Yes); Assert.IsNotEmpty(Pipe.GetValue <string>("$Selected.ImageFilePath")); Assert.AreEqual(100.0, panel.GetValue <double>("DimensionX")); Assert.AreEqual(50.0, panel.GetValue <double>("DimensionY")); }
public void ImportSolidCancelExchangerSettings() { string path = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\Data\UITests\SourceData\ImportMesh.obj")); MainWindow.Ribbon.ClickFileMenuItem("Exchange", "ImportFileToModel"); var fileDlg = new FileDialogAdaptor(MainWindow); fileDlg.SelectFileType(".obj"); fileDlg.Load(path); Assert.IsFalse(FileDialogAdaptor.IsDialogOpen(MainWindow)); var dlg = new WindowAdaptor(MainWindow, "ExchangerSettings"); Assert.IsNotNull(dlg); dlg.ClickButton("Cancel"); Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExchangerSettings")); Assert.That(Pipe.GetValue <int>("$Context.Document.EntityCount") == 0); }
public void RunScript() { MainWindow.Ribbon.SelectGroup("Toolbox"); // Abort file window MainWindow.Ribbon.ClickButton("RunScript"); var fileDlg = new FileDialogAdaptor(MainWindow); Assert.That(fileDlg.Title, Is.EqualTo("Open Script...")); fileDlg.Close(); // Select MainWindow.Ribbon.ClickButton("RunScript"); 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")); // Check for body Assert.AreEqual(1, Pipe.GetValue <int>("$Context.Document.ChildCount")); }