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 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));
        }
Exemple #4
0
        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);
        }
Exemple #5
0
        public void ExportHlrCancel()
        {
            // Cancel dialog
            MainWindow.Ribbon.SelectGroup("Toolbox");
            MainWindow.Ribbon.ClickButton("ExportViewHlr");
            var dlg = new WindowAdaptor(MainWindow, "ExportViewportHlr");

            dlg.ClickButton("Cancel");
            Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExportViewportHlr"));
        }
        public void CreateNewModelNoChange()
        {
            MainWindow.Ribbon.ClickFileMenuItem("ShowAboutDialog");

            var dlg = new WindowAdaptor(MainWindow, "AboutDialog");

            dlg.ClickButton("CloseBtn");

            Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "AboutDialog"));
        }
Exemple #7
0
        public void ExportHlrCancelFileDlg()
        {
            // Cancel FileDlg
            MainWindow.Ribbon.SelectGroup("Toolbox");
            MainWindow.Ribbon.ClickButton("ExportViewHlr");
            var dlg = new WindowAdaptor(MainWindow, "ExportViewportHlr");

            dlg.ClickButton("Ok");

            var fileDlg = new FileDialogAdaptor(MainWindow);

            fileDlg.ClickButton(FileDialogAdaptor.Button.Cancel);
            Assert.IsFalse(FileDialogAdaptor.IsDialogOpen(MainWindow));
            Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExportViewportHlr"));
        }
Exemple #8
0
        public void ImportToSketchCanceled()
        {
            string path = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\Data\UITests\SourceData\ImportSketch.dxf"));

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

            var dlg = new WindowAdaptor(MainWindow, "ExchangerSettings");

            Assert.IsNotNull(dlg);
            dlg.ClickButton("Cancel");
            Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExchangerSettings"));

            // Check that box is still alone
            Assert.AreEqual(1, MainWindow.Document.GetBodyItems().Count());
            Assert.AreEqual("Box_1", MainWindow.Document.GetBodyItems().First().Name);
        }
        public void ImportSolidObj()
        {
            string path = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\Data\UITests\SourceData\ImportMesh.obj"));

            MainWindow.Ribbon.ClickFileMenuItem("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("Ok");
            Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExchangerSettings"));
            Assert.That(Pipe.GetValue <int>("$Context.Document.ChildCount") > 0);
        }
Exemple #10
0
        public void OpenSolidStepByCommandLine()
        {
            string path = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, _BasePath, "ImportSolid.stp"));

            App = new ApplicationAdaptor();
            App.Init($"\"{path}\"");
            MainWindow = new MainWindowAdaptor(App);
            Wait.UntilResponsive(MainWindow.Window);

            var dlg = new WindowAdaptor(MainWindow, "ExchangerSettings");

            Assert.IsNotNull(dlg);
            dlg.ClickButton("Ok");
            Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExchangerSettings"));

            var pipe = new DebugPipeClient();

            Assert.That(pipe.GetValue <int>("$Context.Document.EntityCount") > 0);
        }
        public void ExportSolidBrep()
        {
            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("Ok");
            Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExchangerSettings"));

            FileDialogAdaptor.CheckFileExists(path);
        }
Exemple #12
0
        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));
        }
Exemple #13
0
        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);
        }