public void CreateNewModelNoChange() { MainWindow.Ribbon.ClickFileMenuItem("NewModel"); // Save model? Assert.That(TaskDialogAdaptor.IsTaskDialogOpen(MainWindow), Is.False); }
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 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 CopyWithBodyReferenceToNewModel() { TestDataGenerator.GenerateBodyReference(MainWindow); MainWindow.Ribbon.SelectGroup("Edit"); Assert.IsTrue(MainWindow.Ribbon.IsButtonEnabled("CutClipboard")); MainWindow.Ribbon.ClickButton("CutClipboard"); Reset(); // Creates new model Assert.IsTrue(MainWindow.Ribbon.IsButtonEnabled("PasteClipboard")); MainWindow.Ribbon.ClickButton("PasteClipboard"); Assert.IsFalse(TaskDialogAdaptor.IsTaskDialogOpen(MainWindow)); // Check that box is duplicated Assert.AreEqual(2, MainWindow.Document.GetBodyItems().Count()); Assert.AreEqual(1, MainWindow.Document.GetSelectedItems().Count()); }
public void CutPasteWithBodyReference() { TestDataGenerator.GenerateBodyReference(MainWindow); MainWindow.Ribbon.SelectTab("Edit"); Assert.IsTrue(MainWindow.Ribbon.IsButtonEnabled("CutClipboard")); MainWindow.Ribbon.ClickButton("CutClipboard"); MainWindow.Document.SelectItem("Box_1"); MainWindow.Ribbon.ClickButton("Delete"); Assert.IsTrue(MainWindow.Ribbon.IsButtonEnabled("PasteClipboard")); MainWindow.Ribbon.ClickButton("PasteClipboard"); Assert.IsFalse(TaskDialogAdaptor.IsTaskDialogOpen(MainWindow)); // Check that box is duplicated Assert.AreEqual(2, MainWindow.Document.GetBodyItems().Count()); Assert.AreEqual(1, MainWindow.Document.GetSelectedItems().Count()); }