Пример #1
0
        public void ToggleableOptionTest()
        {
            using (var app = new PythonVisualStudioApp()) {
                app.PythonToolsService.SetFormattingOption("SpaceBeforeClassDeclarationParen", true);
                foreach (var expectedResult in new bool?[] { false, null, true })
                {
                    using (var dialog = ToolsOptionsDialog.FromDte(app)) {
                        dialog.SelectedView = "Text Editor/Python/Formatting/Spacing";
                        var spacingView = FormattingOptionsTreeView.FromDialog(dialog);

                        var value = spacingView.WaitForItem(
                            "Class Definitions",
                            "Insert space between a class declaration's name and bases list"
                            );
                        Assert.IsNotNull(value, "Did not find item");

                        value.SetFocus();
                        Mouse.MoveTo(value.GetClickablePoint());
                        Mouse.Click(System.Windows.Input.MouseButton.Left);

                        dialog.OK();

                        Assert.AreEqual(
                            expectedResult,
                            app.PythonToolsService.GetFormattingOption("SpaceBeforeClassDeclarationParen")
                            );
                    }
                }
            }
        }
Пример #2
0
        public static FormattingOptionsTreeView FromDialog(ToolsOptionsDialog dialog) {
            dialog.WaitForInputIdle();
            var spacingViewElement = dialog.FindByAutomationId("_optionsTree");
            for (int retries = 10; retries > 0 && spacingViewElement == null; retries -= 1) {
                Thread.Sleep(100);
                dialog.WaitForInputIdle();
                spacingViewElement = dialog.FindByAutomationId("_optionsTree");
            }

            return new FormattingOptionsTreeView(spacingViewElement);
        }
Пример #3
0
        public static FormattingOptionsTreeView FromDialog(ToolsOptionsDialog dialog)
        {
            dialog.WaitForInputIdle();
            var spacingViewElement = dialog.FindByAutomationId("_optionsTree");

            for (int retries = 10; retries > 0 && spacingViewElement == null; retries -= 1)
            {
                Thread.Sleep(100);
                dialog.WaitForInputIdle();
                spacingViewElement = dialog.FindByAutomationId("_optionsTree");
            }

            return(new FormattingOptionsTreeView(spacingViewElement));
        }