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);
        }
Пример #2
0
        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 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"));
        }
Пример #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);
        }
        public void ImportSolidStl()
        {
            string path = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\Data\UITests\SourceData\ImportMesh.stl"));

            MainWindow.Ribbon.ClickFileMenuItem("ImportFileToModel");

            var fileDlg = new FileDialogAdaptor(MainWindow);

            fileDlg.SelectFileType(".stl");
            fileDlg.Load(path);
            Assert.IsFalse(FileDialogAdaptor.IsDialogOpen(MainWindow));

            Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExchangerSettings"));
            Assert.That(Pipe.GetValue <int>("$Context.Document.ChildCount") > 0);
        }
        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);
        }
Пример #7
0
        public void ImportSolidCancelExchangerSettings()
        {
            string path = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\Data\UITests\SourceData\ImportMesh.obj"));

            MainWindow.Ribbon.ClickFileMenuItem("Exchange", "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("Cancel");
            Assert.IsFalse(WindowAdaptor.IsWindowOpen(MainWindow, "ExchangerSettings"));
            Assert.That(Pipe.GetValue <int>("$Context.Document.EntityCount") == 0);
        }
        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));
        }
Пример #9
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));
        }
Пример #10
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);
        }