Пример #1
0
        public void ImportToNewModel()
        {
            string path = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\Data\UITests\SourceData\ImprintRingFace.brep"));

            Assume.That(MainWindow.SendFileDrop(path));

            var dlg = new TaskDialogAdaptor(MainWindow);

            Assert.That(dlg, Is.Not.Null);
            Assert.That(dlg.Title, Is.EqualTo("Import Data"));

            dlg.ClickButton(TaskDialogAdaptor.Button.Command1);

            // Save model?
            dlg = new TaskDialogAdaptor(MainWindow);
            Assert.That(dlg, Is.Not.Null);
            Assert.That(dlg.Title, Is.EqualTo("Unsaved Changes"));
            dlg.ClickButton(TaskDialogAdaptor.Button.No);

            // Check that button box is not there
            Assert.AreEqual(1, MainWindow.Document.GetBodyItems().Count());
            Assert.AreEqual("ImprintRingFace", MainWindow.Document.GetBodyItems().First().Name);

            // Undo action not available, box is not there
            MainWindow.Ribbon.SelectTab("Edit");
            MainWindow.Ribbon.ClickButton("Undo");
            Assert.AreEqual(0, MainWindow.Document.GetBodyItems().Count());
        }
Пример #2
0
        public void CloseApplicationSaveChangesNo()
        {
            TestDataGenerator.GenerateBox(MainWindow);
            MainWindow.ClickCloseButton();

            // Save model?
            var dlg = new TaskDialogAdaptor(MainWindow);

            Assert.That(dlg.Title, Is.EqualTo("Unsaved Changes"));
            dlg.ClickButton(TaskDialogAdaptor.Button.No);

            Assert.That(() => App.Application.HasExited, Is.True.After(10).Seconds.PollEvery(100));
        }
Пример #3
0
        public void CloseApplicationSaveChangesCancel()
        {
            TestDataGenerator.GenerateBox(MainWindow);
            MainWindow.ClickCloseButton();

            // Save model?
            var dlg = new TaskDialogAdaptor(MainWindow);

            Assert.That(dlg.Title, Is.EqualTo("Unsaved Changes"));
            dlg.ClickButton(TaskDialogAdaptor.Button.Cancel);

            // Check that box is still there
            Assert.AreEqual(1, MainWindow.Document.GetBodyItems().Count());
        }
Пример #4
0
        public void CreateNewModelNoSave()
        {
            TestDataGenerator.GenerateBox(MainWindow);
            MainWindow.Ribbon.ClickFileMenuItem("NewModel");

            // Save model?
            var dlg = new TaskDialogAdaptor(MainWindow);

            Assert.That(dlg.Title, Is.EqualTo("Unsaved Changes"));
            dlg.ClickButton(TaskDialogAdaptor.Button.No);

            // Check that button box is away
            Assert.AreEqual(0, MainWindow.Document.GetBodyItems().Count());
        }
Пример #5
0
        public void CancelTaskDialog()
        {
            string path = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\Data\UITests\SourceData\ImprintRingFace.brep"));

            Assume.That(MainWindow.SendFileDrop(path));

            var dlg = new TaskDialogAdaptor(MainWindow);

            Assert.That(dlg, Is.Not.Null);
            Assert.That(dlg.Title, Is.EqualTo("Import Data"));

            dlg.ClickButton(TaskDialogAdaptor.Button.Cancel);

            // Check that box is still there
            Assert.AreEqual(1, MainWindow.Document.GetBodyItems().Count());
            Assert.AreEqual("Box_1", MainWindow.Document.GetBodyItems().First().Name);
        }
Пример #6
0
        public void LoadModelCancelSave()
        {
            string path = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\Data\UITests\SourceData\Cylinder.model"));

            Assume.That(MainWindow.SendFileDrop(path));

            // Save model?
            var dlg = new TaskDialogAdaptor(MainWindow);

            Assert.That(dlg, Is.Not.Null);
            Assert.That(dlg.Title, Is.EqualTo("Unsaved Changes"));
            dlg.ClickButton(TaskDialogAdaptor.Button.Cancel);

            // Check that box is still here
            Assert.AreEqual(1, MainWindow.Document.GetBodyItems().Count());
            Assert.AreEqual("Box_1", MainWindow.Document.GetBodyItems().First().Name);
        }
Пример #7
0
        public void DuplicateCloneBodyReference()
        {
            TestDataGenerator.GenerateBodyReference(MainWindow);
            MainWindow.Ribbon.SelectGroup("Edit");
            Assert.IsTrue(MainWindow.Ribbon.IsButtonEnabled("Duplicate"));
            MainWindow.Ribbon.ClickButton("Duplicate");

            var dlg = new TaskDialogAdaptor(MainWindow);

            Assert.That(dlg, Is.Not.Null);
            Assert.That(dlg.Title, Is.EqualTo("Foreign Body References"));
            dlg.ClickButton(TaskDialogAdaptor.Button.Command2);

            // Check that box is duplicated
            Assert.AreEqual(4, MainWindow.Document.GetBodyItems().Count());
            Assert.AreEqual(1, MainWindow.Document.GetSelectedItems().Count());
        }
Пример #8
0
        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"));
        }
Пример #9
0
        public void CreateNewModelSaveCancel()
        {
            TestDataGenerator.GenerateBox(MainWindow);
            MainWindow.Ribbon.ClickFileMenuItem("NewModel");

            // Save model?
            var taskDlg = new TaskDialogAdaptor(MainWindow);

            Assert.That(taskDlg.Title, Is.EqualTo("Unsaved Changes"));
            taskDlg.ClickButton(TaskDialogAdaptor.Button.Yes);

            var fileDlg = new FileDialogAdaptor(MainWindow);

            Assert.That(fileDlg.Title, Is.EqualTo("Saving Model..."));
            fileDlg.ClickButton(FileDialogAdaptor.Button.Cancel);

            // Check that button box is still there
            Assert.AreEqual(1, MainWindow.Document.GetBodyItems().Count());
        }
Пример #10
0
        public void ImportMerged()
        {
            string path = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\Data\UITests\SourceData\ImprintRingFace.brep"));

            Assume.That(MainWindow.SendFileDrop(path));

            var dlg = new TaskDialogAdaptor(MainWindow);

            Assert.That(dlg, Is.Not.Null);
            Assert.That(dlg.Title, Is.EqualTo("Import Data"));

            dlg.ClickButton(TaskDialogAdaptor.Button.Command2);

            // Check that data was imported
            Assert.AreEqual(2, MainWindow.Document.GetBodyItems().Count());

            // Undo action
            MainWindow.Ribbon.SelectTab("Edit");
            MainWindow.Ribbon.ClickButton("Undo");
            Assert.AreEqual(1, MainWindow.Document.GetBodyItems().Count());
            Assert.AreEqual("Box_1", MainWindow.Document.GetBodyItems().First().Name);
        }