public void ExportSketchToSvg() { var path = Path.Combine(FileDialogAdaptor.GetTempPath(), "sketch.svg"); TestDataGenerator.GenerateSketch(MainWindow); // Do Export MainWindow.Ribbon.SelectGroup("Sketch"); MainWindow.Ribbon.ClickButton("SketchExchange"); var menu = new ContextMenuAdaptor(MainWindow); menu.ClickMenuItem("ExportAllToFile"); var fileDlg = new FileDialogAdaptor(MainWindow); fileDlg.SelectFileType("*.svg"); fileDlg.Save(path, checkFile: false); Assert.IsFalse(FileDialogAdaptor.IsDialogOpen(MainWindow)); var dlg = new WindowAdaptor(MainWindow, "ExchangerSettings"); Assert.IsNotNull(dlg); dlg.ClickButton("Ok"); Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExchangerSettings")); FileDialogAdaptor.CheckFileExists(path); }
public void ExportCancelSettings() { var path = Path.Combine(FileDialogAdaptor.GetTempPath(), "pipe.svg"); TestDataGenerator.GenerateSketch(MainWindow); MainWindow.Ribbon.ClickButton("CloseSketchEditor"); MainWindow.Ribbon.SelectTab("Model"); Assume.That(MainWindow.Ribbon.IsButtonEnabled("CreatePipe")); MainWindow.Ribbon.ClickButton("CreatePipe"); MainWindow.Ribbon.SelectTab("Toolbox"); Assert.IsTrue(MainWindow.Ribbon.IsButtonEnabled("ExportPipeDrawing")); MainWindow.Ribbon.ClickButton("ExportPipeDrawing"); var fileDlg = new FileDialogAdaptor(MainWindow); fileDlg.SelectFileType("*.svg"); fileDlg.Save(path, checkFile: false); Assert.IsFalse(FileDialogAdaptor.IsDialogOpen(MainWindow)); Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExportViewportHlr")); var dlg = new WindowAdaptor(MainWindow, "ExchangerSettings"); dlg.ClickButton("Cancel"); Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExchangerSettings")); Assert.IsFalse(System.IO.File.Exists(path)); }
public void ExportWithInvalidExtension() { var typoPath = Path.Combine(FileDialogAdaptor.GetTempPath(), "testexport.invalid"); var path = typoPath + ".stl"; File.Delete(path); TestDataGenerator.GenerateBox(MainWindow); MainWindow.Ribbon.ClickFileMenuItem("Exchange", "ExportSelectedBrep"); var fileDlg = new FileDialogAdaptor(MainWindow); fileDlg.SelectFileType(".stl"); fileDlg.Save(typoPath, checkFile: false); Assert.IsFalse(FileDialogAdaptor.IsDialogOpen(MainWindow)); var dlg = new WindowAdaptor(MainWindow, "ExchangerSettings"); Assert.IsNotNull(dlg); dlg.ClickButton("Ok"); Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExchangerSettings")); FileDialogAdaptor.CheckFileExists(path); // Validate this is a STL file using var reader = File.OpenText(path); Assert.That(reader.ReadLine()?.StartsWith("solid ") ?? false); }
public void ExportSolidIges() { var path = Path.Combine(FileDialogAdaptor.GetTempPath(), "testexport.iges"); TestDataGenerator.GenerateBox(MainWindow); MainWindow.Ribbon.ClickFileMenuItem("ExportSelectedBrep"); var fileDlg = new FileDialogAdaptor(MainWindow); fileDlg.SelectFileType(".iges"); fileDlg.Save(path, checkFile: false); Assert.IsFalse(FileDialogAdaptor.IsDialogOpen(MainWindow)); Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExchangerSettings")); FileDialogAdaptor.CheckFileExists(path); }
public void ExportSolidCancelExchangerSettings() { var path = Path.Combine(FileDialogAdaptor.GetTempPath(), "testexport.brep"); TestDataGenerator.GenerateBox(MainWindow); MainWindow.Ribbon.ClickFileMenuItem("ExportSelectedBrep"); var fileDlg = new FileDialogAdaptor(MainWindow); fileDlg.SelectFileType(".brep"); fileDlg.Save(path, checkFile: false); Assert.IsFalse(FileDialogAdaptor.IsDialogOpen(MainWindow)); var dlg = new WindowAdaptor(MainWindow, "ExchangerSettings"); Assert.IsNotNull(dlg); dlg.ClickButton("Cancel"); Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExchangerSettings")); Assert.IsFalse(System.IO.File.Exists(path)); }
public void Export() { var viewport = MainWindow.Viewport; // Create box GenerateBox(); // Click button to start tool MainWindow.Ribbon.SelectGroup("Toolbox"); MainWindow.Ribbon.ClickButton("CreateEtchingMask"); Assert.IsTrue(MainWindow.Ribbon.IsButtonChecked("CreateEtchingMask")); Assert.AreEqual("\"EtchingMaskEditTool\"", Pipe.GetValue("$Context.WorkspaceController.CurrentTool.Id")); var propPanel = MainWindow.PropertyView.FindPanelByClass("EtchingMaskPropertyPanel"); Assert.IsNotNull(propPanel); propPanel.ClickButton("ExportVectorFile"); var fileDlg = new FileDialogAdaptor(MainWindow); Assert.That(fileDlg.Title, Is.EqualTo("Export...")); fileDlg.Save("ExportedEtchingMask.svg"); }
public void ExportHlrCancelSettings() { var path = Path.Combine(FileDialogAdaptor.GetTempPath(), "hlr.svg"); // Cancel export settings MainWindow.Ribbon.SelectGroup("Toolbox"); MainWindow.Ribbon.ClickButton("ExportViewHlr"); var dlg = new WindowAdaptor(MainWindow, "ExportViewportHlr"); dlg.ClickButton("Ok"); var fileDlg = new FileDialogAdaptor(MainWindow); fileDlg.SelectFileType("*.svg"); fileDlg.Save(path, checkFile: false); Assert.IsFalse(FileDialogAdaptor.IsDialogOpen(MainWindow)); Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExportViewportHlr")); dlg = new WindowAdaptor(MainWindow, "ExchangerSettings"); dlg.ClickButton("Cancel"); Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExchangerSettings")); Assert.IsFalse(System.IO.File.Exists(path)); }
public void ExportHlrAsDxf() { var path = Path.Combine(FileDialogAdaptor.GetTempPath(), "hlr.dxf"); // Do Export MainWindow.Ribbon.SelectGroup("Toolbox"); MainWindow.Ribbon.ClickButton("ExportViewHlr"); var dlg = new WindowAdaptor(MainWindow, "ExportViewportHlr"); dlg.ClickButton("Ok"); var fileDlg = new FileDialogAdaptor(MainWindow); fileDlg.SelectFileType("*.dxf"); fileDlg.Save(path, checkFile: false); Assert.IsFalse(FileDialogAdaptor.IsDialogOpen(MainWindow)); Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExportViewportHlr")); dlg = new WindowAdaptor(MainWindow, "ExchangerSettings"); dlg.ClickButton("Ok"); Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExchangerSettings")); FileDialogAdaptor.CheckFileExists(path); }