예제 #1
0
        public void CloseApplicationSaveChanges()
        {
            TestDataGenerator.GenerateBox(MainWindow);
            MainWindow.ClickCloseButton();

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

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

            FileDialogAdaptor.DoSaveModel(MainWindow);

            Assert.That(() => App.Application.HasExited, Is.True.After(10).Seconds.PollEvery(100));
        }
예제 #2
0
        public void ModelSaveAsWithDifferentExtension()
        {
            var path = Path.Combine(FileDialogAdaptor.GetTempPath(), "testexport.stl");

            TestDataGenerator.GenerateBox(MainWindow);

            MainWindow.Ribbon.ClickFileMenuItem("SaveModelAs");
            var pathname = FileDialogAdaptor.DoSaveModel(MainWindow, Path.GetFileName(path), false);

            FileDialogAdaptor.CheckFileExists(path + ".model");

            // Validate this is a model file
            using var reader = File.OpenText(path + ".model");
            Assert.That(reader.ReadLine()?.StartsWith("PK") ?? false);
        }
예제 #3
0
        public void ModelSaveAs()
        {
            TestDataGenerator.GenerateBox(MainWindow);

            // Save model
            MainWindow.Ribbon.ClickFileMenuItem("SaveModel");
            FileDialogAdaptor.DoSaveModel(MainWindow);

            // Save model as
            MainWindow.Ribbon.ClickFileMenuItem("SaveModelAs");
            var pathname = FileDialogAdaptor.DoSaveModel(MainWindow, "SavedAsModel.model");

            Assert.That(System.IO.File.Exists(pathname));
            Assert.That(MainWindow.Title.StartsWith("SavedAsModel "));
        }
예제 #4
0
        public void CreateNewModelSave()
        {
            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);

            FileDialogAdaptor.DoSaveModel(MainWindow);

            // Check that button box is away
            Assert.AreEqual(0, MainWindow.Document.GetBodyItems().Count());
        }